20#ifndef STM32H7xx_HAL_MMC_H
21#define STM32H7xx_HAL_MMC_H
67typedef uint32_t HAL_MMC_CardStateTypeDef;
69#define HAL_MMC_CARD_IDLE 0x00000000U
70#define HAL_MMC_CARD_READY 0x00000001U
71#define HAL_MMC_CARD_IDENTIFICATION 0x00000002U
72#define HAL_MMC_CARD_STANDBY 0x00000003U
73#define HAL_MMC_CARD_TRANSFER 0x00000004U
74#define HAL_MMC_CARD_SENDING 0x00000005U
75#define HAL_MMC_CARD_RECEIVING 0x00000006U
76#define HAL_MMC_CARD_PROGRAMMING 0x00000007U
77#define HAL_MMC_CARD_DISCONNECTED 0x00000008U
78#define HAL_MMC_CARD_BUSTEST 0x00000009U
79#define HAL_MMC_CARD_SLEEP 0x0000000AU
80#define HAL_MMC_CARD_ERROR 0x000000FFU
89#define MMC_InitTypeDef SDMMC_InitTypeDef
90#define MMC_TypeDef SDMMC_TypeDef
116#if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
117typedef struct __MMC_HandleTypeDef
122 MMC_TypeDef *Instance;
124 MMC_InitTypeDef Init;
148 uint32_t Ext_CSD[128];
150#if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
151 void (* TxCpltCallback)(
struct __MMC_HandleTypeDef *hmmc);
152 void (* RxCpltCallback)(
struct __MMC_HandleTypeDef *hmmc);
153 void (* ErrorCallback)(
struct __MMC_HandleTypeDef *hmmc);
154 void (* AbortCpltCallback)(
struct __MMC_HandleTypeDef *hmmc);
155 void (* Read_DMADblBuf0CpltCallback)(
struct __MMC_HandleTypeDef *hmmc);
156 void (* Read_DMADblBuf1CpltCallback)(
struct __MMC_HandleTypeDef *hmmc);
157 void (* Write_DMADblBuf0CpltCallback)(
struct __MMC_HandleTypeDef *hmmc);
158 void (* Write_DMADblBuf1CpltCallback)(
struct __MMC_HandleTypeDef *hmmc);
160 void (* MspInitCallback)(
struct __MMC_HandleTypeDef *hmmc);
161 void (* MspDeInitCallback)(
struct __MMC_HandleTypeDef *hmmc);
241#if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
248 HAL_MMC_TX_CPLT_CB_ID = 0x00U,
249 HAL_MMC_RX_CPLT_CB_ID = 0x01U,
250 HAL_MMC_ERROR_CB_ID = 0x02U,
251 HAL_MMC_ABORT_CB_ID = 0x03U,
252 HAL_MMC_READ_DMA_DBL_BUF0_CPLT_CB_ID = 0x04U,
253 HAL_MMC_READ_DMA_DBL_BUF1_CPLT_CB_ID = 0x05U,
254 HAL_MMC_WRITE_DMA_DBL_BUF0_CPLT_CB_ID = 0x06U,
255 HAL_MMC_WRITE_DMA_DBL_BUF1_CPLT_CB_ID = 0x07U,
257 HAL_MMC_MSP_INIT_CB_ID = 0x10U,
258 HAL_MMC_MSP_DEINIT_CB_ID = 0x11U
259} HAL_MMC_CallbackIDTypeDef;
283#define MMC_BLOCKSIZE ((uint32_t)512U)
289#define HAL_MMC_ERROR_NONE SDMMC_ERROR_NONE
290#define HAL_MMC_ERROR_CMD_CRC_FAIL SDMMC_ERROR_CMD_CRC_FAIL
291#define HAL_MMC_ERROR_DATA_CRC_FAIL SDMMC_ERROR_DATA_CRC_FAIL
292#define HAL_MMC_ERROR_CMD_RSP_TIMEOUT SDMMC_ERROR_CMD_RSP_TIMEOUT
293#define HAL_MMC_ERROR_DATA_TIMEOUT SDMMC_ERROR_DATA_TIMEOUT
294#define HAL_MMC_ERROR_TX_UNDERRUN SDMMC_ERROR_TX_UNDERRUN
295#define HAL_MMC_ERROR_RX_OVERRUN SDMMC_ERROR_RX_OVERRUN
296#define HAL_MMC_ERROR_ADDR_MISALIGNED SDMMC_ERROR_ADDR_MISALIGNED
297#define HAL_MMC_ERROR_BLOCK_LEN_ERR SDMMC_ERROR_BLOCK_LEN_ERR
299#define HAL_MMC_ERROR_ERASE_SEQ_ERR SDMMC_ERROR_ERASE_SEQ_ERR
300#define HAL_MMC_ERROR_BAD_ERASE_PARAM SDMMC_ERROR_BAD_ERASE_PARAM
301#define HAL_MMC_ERROR_WRITE_PROT_VIOLATION SDMMC_ERROR_WRITE_PROT_VIOLATION
302#define HAL_MMC_ERROR_LOCK_UNLOCK_FAILED SDMMC_ERROR_LOCK_UNLOCK_FAILED
304#define HAL_MMC_ERROR_COM_CRC_FAILED SDMMC_ERROR_COM_CRC_FAILED
305#define HAL_MMC_ERROR_ILLEGAL_CMD SDMMC_ERROR_ILLEGAL_CMD
306#define HAL_MMC_ERROR_CARD_ECC_FAILED SDMMC_ERROR_CARD_ECC_FAILED
307#define HAL_MMC_ERROR_CC_ERR SDMMC_ERROR_CC_ERR
308#define HAL_MMC_ERROR_GENERAL_UNKNOWN_ERR SDMMC_ERROR_GENERAL_UNKNOWN_ERR
309#define HAL_MMC_ERROR_STREAM_READ_UNDERRUN SDMMC_ERROR_STREAM_READ_UNDERRUN
310#define HAL_MMC_ERROR_STREAM_WRITE_OVERRUN SDMMC_ERROR_STREAM_WRITE_OVERRUN
311#define HAL_MMC_ERROR_CID_CSD_OVERWRITE SDMMC_ERROR_CID_CSD_OVERWRITE
312#define HAL_MMC_ERROR_WP_ERASE_SKIP SDMMC_ERROR_WP_ERASE_SKIP
313#define HAL_MMC_ERROR_CARD_ECC_DISABLED SDMMC_ERROR_CARD_ECC_DISABLED
314#define HAL_MMC_ERROR_ERASE_RESET SDMMC_ERROR_ERASE_RESET
316#define HAL_MMC_ERROR_AKE_SEQ_ERR SDMMC_ERROR_AKE_SEQ_ERR
317#define HAL_MMC_ERROR_INVALID_VOLTRANGE SDMMC_ERROR_INVALID_VOLTRANGE
318#define HAL_MMC_ERROR_ADDR_OUT_OF_RANGE SDMMC_ERROR_ADDR_OUT_OF_RANGE
319#define HAL_MMC_ERROR_REQUEST_NOT_APPLICABLE SDMMC_ERROR_REQUEST_NOT_APPLICABLE
320#define HAL_MMC_ERROR_PARAM SDMMC_ERROR_INVALID_PARAMETER
321#define HAL_MMC_ERROR_UNSUPPORTED_FEATURE SDMMC_ERROR_UNSUPPORTED_FEATURE
322#define HAL_MMC_ERROR_BUSY SDMMC_ERROR_BUSY
323#define HAL_MMC_ERROR_DMA SDMMC_ERROR_DMA
324#define HAL_MMC_ERROR_TIMEOUT SDMMC_ERROR_TIMEOUT
326#if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
327#define HAL_MMC_ERROR_INVALID_CALLBACK SDMMC_ERROR_INVALID_PARAMETER
337#define MMC_CONTEXT_NONE ((uint32_t)0x00000000U)
338#define MMC_CONTEXT_READ_SINGLE_BLOCK ((uint32_t)0x00000001U)
339#define MMC_CONTEXT_READ_MULTIPLE_BLOCK ((uint32_t)0x00000002U)
340#define MMC_CONTEXT_WRITE_SINGLE_BLOCK ((uint32_t)0x00000010U)
341#define MMC_CONTEXT_WRITE_MULTIPLE_BLOCK ((uint32_t)0x00000020U)
342#define MMC_CONTEXT_IT ((uint32_t)0x00000008U)
343#define MMC_CONTEXT_DMA ((uint32_t)0x00000080U)
356#define MMC_HIGH_VOLTAGE_RANGE 0x80FF8000U
357#define MMC_DUAL_VOLTAGE_RANGE 0x80FF8080U
358#define MMC_LOW_VOLTAGE_RANGE 0x80000080U
359#define EMMC_HIGH_VOLTAGE_RANGE 0xC0FF8000U
360#define EMMC_DUAL_VOLTAGE_RANGE 0xC0FF8080U
361#define EMMC_LOW_VOLTAGE_RANGE 0xC0000080U
362#define MMC_INVALID_VOLTAGE_RANGE 0x0001FF01U
371#define MMC_LOW_CAPACITY_CARD ((uint32_t)0x00000000U)
372#define MMC_HIGH_CAPACITY_CARD ((uint32_t)0x00000001U)
382#define HAL_MMC_ERASE 0x00000000U
383#define HAL_MMC_TRIM 0x00000001U
384#define HAL_MMC_DISCARD 0x00000003U
385#define HAL_MMC_SECURE_ERASE 0x80000000U
386#define HAL_MMC_SECURE_TRIM_STEP1 0x80000001U
387#define HAL_MMC_SECURE_TRIM_STEP2 0x80008000U
389#define IS_MMC_ERASE_TYPE(TYPE) (((TYPE) == HAL_MMC_ERASE) || \
390 ((TYPE) == HAL_MMC_TRIM) || \
391 ((TYPE) == HAL_MMC_DISCARD) || \
392 ((TYPE) == HAL_MMC_SECURE_ERASE) || \
393 ((TYPE) == HAL_MMC_SECURE_TRIM_STEP1) || \
394 ((TYPE) == HAL_MMC_SECURE_TRIM_STEP2))
403#define HAL_MMC_SRT_ERASE 0x00000001U
404#define HAL_MMC_SRT_WRITE_CHAR_ERASE 0x00000002U
405#define HAL_MMC_SRT_WRITE_CHAR_COMPL_RANDOM 0x00000004U
406#define HAL_MMC_SRT_VENDOR_DEFINED 0x00000008U
409#define IS_MMC_SRT_TYPE(TYPE) (((TYPE) == HAL_MMC_SRT_ERASE) || \
410 ((TYPE) == HAL_MMC_SRT_WRITE_CHAR_ERASE) || \
411 ((TYPE) == HAL_MMC_SRT_WRITE_CHAR_COMPL_RANDOM) || \
412 ((TYPE) == HAL_MMC_SRT_VENDOR_DEFINED))
431#if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
432#define __HAL_MMC_RESET_HANDLE_STATE(__HANDLE__) do { \
433 (__HANDLE__)->State = HAL_MMC_STATE_RESET; \
434 (__HANDLE__)->MspInitCallback = NULL; \
435 (__HANDLE__)->MspDeInitCallback = NULL; \
438#define __HAL_MMC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_MMC_STATE_RESET)
471#define __HAL_MMC_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
503#define __HAL_MMC_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
541#define __HAL_MMC_GET_FLAG(__HANDLE__, __FLAG__) __SDMMC_GET_FLAG((__HANDLE__)->Instance, (__FLAG__))
570#define __HAL_MMC_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDMMC_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__))
602#define __HAL_MMC_GET_IT(__HANDLE__, __INTERRUPT__) __SDMMC_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__))
634#define __HAL_MMC_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDMMC_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__))
669 uint32_t NumberOfBlocks,
672 uint32_t NumberOfBlocks, uint32_t Timeout);
676 uint32_t NumberOfBlocks);
678 uint32_t NumberOfBlocks);
681 uint32_t NumberOfBlocks);
683 uint32_t NumberOfBlocks);
693#if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
696 pMMC_CallbackTypeDef pCallback);
751 uint32_t BlockEndAdd);
783#define MMC_EXT_CSD_DATA_SEC_SIZE_INDEX 61
784#define MMC_EXT_CSD_DATA_SEC_SIZE_POS 8
#define __IO
Definition: core_cm4.h:239
HAL_MMC_StateTypeDef
Definition: stm32h7xx_hal_mmc.h:49
@ HAL_MMC_STATE_RECEIVING
Definition: stm32h7xx_hal_mmc.h:55
@ HAL_MMC_STATE_TIMEOUT
Definition: stm32h7xx_hal_mmc.h:52
@ HAL_MMC_STATE_TRANSFER
Definition: stm32h7xx_hal_mmc.h:56
@ HAL_MMC_STATE_BUSY
Definition: stm32h7xx_hal_mmc.h:53
@ HAL_MMC_STATE_READY
Definition: stm32h7xx_hal_mmc.h:51
@ HAL_MMC_STATE_RESET
Definition: stm32h7xx_hal_mmc.h:50
@ HAL_MMC_STATE_ERROR
Definition: stm32h7xx_hal_mmc.h:57
@ HAL_MMC_STATE_PROGRAMMING
Definition: stm32h7xx_hal_mmc.h:54
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
Header file of SD HAL extended module.
Header file of SDMMC HAL module.
Definition: stm32h7xx_hal_mmc.h:224
__IO uint32_t ProdSN
Definition: stm32h7xx_hal_mmc.h:230
__IO uint8_t CID_CRC
Definition: stm32h7xx_hal_mmc.h:233
__IO uint8_t ProdName2
Definition: stm32h7xx_hal_mmc.h:228
__IO uint16_t OEM_AppliID
Definition: stm32h7xx_hal_mmc.h:226
__IO uint8_t ManufacturerID
Definition: stm32h7xx_hal_mmc.h:225
__IO uint8_t Reserved2
Definition: stm32h7xx_hal_mmc.h:234
__IO uint8_t Reserved1
Definition: stm32h7xx_hal_mmc.h:231
__IO uint8_t ProdRev
Definition: stm32h7xx_hal_mmc.h:229
__IO uint16_t ManufactDate
Definition: stm32h7xx_hal_mmc.h:232
__IO uint32_t ProdName1
Definition: stm32h7xx_hal_mmc.h:227
Definition: stm32h7xx_hal_mmc.h:175
__IO uint8_t ECC
Definition: stm32h7xx_hal_mmc.h:210
__IO uint8_t EraseGrSize
Definition: stm32h7xx_hal_mmc.h:195
__IO uint8_t CSD_CRC
Definition: stm32h7xx_hal_mmc.h:211
__IO uint8_t PermWrProtect
Definition: stm32h7xx_hal_mmc.h:207
__IO uint8_t WriteBlockPaPartial
Definition: stm32h7xx_hal_mmc.h:202
__IO uint8_t NSAC
Definition: stm32h7xx_hal_mmc.h:180
__IO uint8_t MaxBusClkFrec
Definition: stm32h7xx_hal_mmc.h:181
__IO uint8_t WrBlockMisalign
Definition: stm32h7xx_hal_mmc.h:185
__IO uint8_t WrProtectGrSize
Definition: stm32h7xx_hal_mmc.h:197
__IO uint8_t PartBlockRead
Definition: stm32h7xx_hal_mmc.h:184
__IO uint8_t FileFormatGroup
Definition: stm32h7xx_hal_mmc.h:205
__IO uint8_t RdBlockLen
Definition: stm32h7xx_hal_mmc.h:183
__IO uint8_t EraseGrMul
Definition: stm32h7xx_hal_mmc.h:196
__IO uint8_t SysSpecVersion
Definition: stm32h7xx_hal_mmc.h:177
__IO uint8_t Reserved4
Definition: stm32h7xx_hal_mmc.h:212
__IO uint8_t MaxWrCurrentVDDMax
Definition: stm32h7xx_hal_mmc.h:193
__IO uint8_t ContentProtectAppli
Definition: stm32h7xx_hal_mmc.h:204
__IO uint8_t DeviceSizeMul
Definition: stm32h7xx_hal_mmc.h:194
__IO uint8_t TempWrProtect
Definition: stm32h7xx_hal_mmc.h:208
__IO uint8_t RdBlockMisalign
Definition: stm32h7xx_hal_mmc.h:186
__IO uint8_t MaxWrCurrentVDDMin
Definition: stm32h7xx_hal_mmc.h:192
__IO uint32_t DeviceSize
Definition: stm32h7xx_hal_mmc.h:189
__IO uint8_t DSRImpl
Definition: stm32h7xx_hal_mmc.h:187
__IO uint8_t TAAC
Definition: stm32h7xx_hal_mmc.h:179
__IO uint8_t MaxRdCurrentVDDMin
Definition: stm32h7xx_hal_mmc.h:190
__IO uint8_t FileFormat
Definition: stm32h7xx_hal_mmc.h:209
__IO uint8_t WrSpeedFact
Definition: stm32h7xx_hal_mmc.h:200
__IO uint8_t MaxRdCurrentVDDMax
Definition: stm32h7xx_hal_mmc.h:191
__IO uint8_t Reserved2
Definition: stm32h7xx_hal_mmc.h:188
__IO uint8_t CSDStruct
Definition: stm32h7xx_hal_mmc.h:176
__IO uint8_t MaxWrBlockLen
Definition: stm32h7xx_hal_mmc.h:201
__IO uint16_t CardComdClasses
Definition: stm32h7xx_hal_mmc.h:182
__IO uint8_t CopyFlag
Definition: stm32h7xx_hal_mmc.h:206
__IO uint8_t WrProtectGrEnable
Definition: stm32h7xx_hal_mmc.h:198
__IO uint8_t Reserved3
Definition: stm32h7xx_hal_mmc.h:203
__IO uint8_t Reserved1
Definition: stm32h7xx_hal_mmc.h:178
__IO uint8_t ManDeflECC
Definition: stm32h7xx_hal_mmc.h:199
MMC Card Information Structure definition.
Definition: stm32h7xx_hal_mmc.h:96
uint32_t RelCardAdd
Definition: stm32h7xx_hal_mmc.h:101
uint32_t LogBlockNbr
Definition: stm32h7xx_hal_mmc.h:107
uint32_t LogBlockSize
Definition: stm32h7xx_hal_mmc.h:109
uint32_t CardType
Definition: stm32h7xx_hal_mmc.h:97
uint32_t BlockSize
Definition: stm32h7xx_hal_mmc.h:105
uint32_t Class
Definition: stm32h7xx_hal_mmc.h:99
uint32_t BlockNbr
Definition: stm32h7xx_hal_mmc.h:103
MMC handle Structure definition.
Definition: stm32h7xx_hal_mmc.h:121
uint8_t * pRxBuffPtr
Definition: stm32h7xx_hal_mmc.h:132
__IO uint32_t Context
Definition: stm32h7xx_hal_mmc.h:136
const uint8_t * pTxBuffPtr
Definition: stm32h7xx_hal_mmc.h:128
HAL_MMC_CardInfoTypeDef MmcCard
Definition: stm32h7xx_hal_mmc.h:142
HAL_LockTypeDef Lock
Definition: stm32h7xx_hal_mmc.h:126
__IO HAL_MMC_StateTypeDef State
Definition: stm32h7xx_hal_mmc.h:138
uint32_t RxXferSize
Definition: stm32h7xx_hal_mmc.h:134
__IO uint32_t ErrorCode
Definition: stm32h7xx_hal_mmc.h:140
uint32_t TxXferSize
Definition: stm32h7xx_hal_mmc.h:130