21 #ifndef STM32F7xx_HAL_MMC_H
22 #define STM32F7xx_HAL_MMC_H
69 #define HAL_MMC_CARD_READY 0x00000001U
70 #define HAL_MMC_CARD_IDENTIFICATION 0x00000002U
71 #define HAL_MMC_CARD_STANDBY 0x00000003U
72 #define HAL_MMC_CARD_TRANSFER 0x00000004U
73 #define HAL_MMC_CARD_SENDING 0x00000005U
74 #define HAL_MMC_CARD_RECEIVING 0x00000006U
75 #define HAL_MMC_CARD_PROGRAMMING 0x00000007U
76 #define HAL_MMC_CARD_DISCONNECTED 0x00000008U
77 #define HAL_MMC_CARD_ERROR 0x000000FFU
85 #define MMC_InitTypeDef SDMMC_InitTypeDef
86 #define MMC_TypeDef SDMMC_TypeDef
103 uint32_t LogBlockNbr;
105 uint32_t LogBlockSize;
112 #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
113 typedef struct __MMC_HandleTypeDef
132 __IO uint32_t Context;
136 __IO uint32_t ErrorCode;
148 #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
149 void (* TxCpltCallback) (
struct __MMC_HandleTypeDef *hmmc);
150 void (* RxCpltCallback) (
struct __MMC_HandleTypeDef *hmmc);
151 void (* ErrorCallback) (
struct __MMC_HandleTypeDef *hmmc);
152 void (* AbortCpltCallback) (
struct __MMC_HandleTypeDef *hmmc);
154 void (* MspInitCallback) (
struct __MMC_HandleTypeDef *hmmc);
155 void (* MspDeInitCallback) (
struct __MMC_HandleTypeDef *hmmc);
168 __IO uint8_t CSDStruct;
169 __IO uint8_t SysSpecVersion;
170 __IO uint8_t Reserved1;
173 __IO uint8_t MaxBusClkFrec;
174 __IO uint16_t CardComdClasses;
175 __IO uint8_t RdBlockLen;
176 __IO uint8_t PartBlockRead;
177 __IO uint8_t WrBlockMisalign;
178 __IO uint8_t RdBlockMisalign;
179 __IO uint8_t DSRImpl;
180 __IO uint8_t Reserved2;
181 __IO uint32_t DeviceSize;
182 __IO uint8_t MaxRdCurrentVDDMin;
183 __IO uint8_t MaxRdCurrentVDDMax;
184 __IO uint8_t MaxWrCurrentVDDMin;
185 __IO uint8_t MaxWrCurrentVDDMax;
186 __IO uint8_t DeviceSizeMul;
187 __IO uint8_t EraseGrSize;
188 __IO uint8_t EraseGrMul;
189 __IO uint8_t WrProtectGrSize;
190 __IO uint8_t WrProtectGrEnable;
191 __IO uint8_t ManDeflECC;
192 __IO uint8_t WrSpeedFact;
193 __IO uint8_t MaxWrBlockLen;
194 __IO uint8_t WriteBlockPaPartial;
195 __IO uint8_t Reserved3;
196 __IO uint8_t ContentProtectAppli;
197 __IO uint8_t FileFormatGroup;
198 __IO uint8_t CopyFlag;
199 __IO uint8_t PermWrProtect;
200 __IO uint8_t TempWrProtect;
201 __IO uint8_t FileFormat;
203 __IO uint8_t CSD_CRC;
204 __IO uint8_t Reserved4;
216 __IO uint8_t ManufacturerID;
217 __IO uint16_t OEM_AppliID;
218 __IO uint32_t ProdName1;
219 __IO uint8_t ProdName2;
220 __IO uint8_t ProdRev;
221 __IO uint32_t ProdSN;
222 __IO uint8_t Reserved1;
223 __IO uint16_t ManufactDate;
224 __IO uint8_t CID_CRC;
225 __IO uint8_t Reserved2;
232 #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
238 HAL_MMC_TX_CPLT_CB_ID = 0x00U,
239 HAL_MMC_RX_CPLT_CB_ID = 0x01U,
240 HAL_MMC_ERROR_CB_ID = 0x02U,
241 HAL_MMC_ABORT_CB_ID = 0x03U,
243 HAL_MMC_MSP_INIT_CB_ID = 0x10U,
244 HAL_MMC_MSP_DEINIT_CB_ID = 0x11U
245 }HAL_MMC_CallbackIDTypeDef;
267 #define MMC_BLOCKSIZE 512U
272 #define HAL_MMC_ERROR_NONE SDMMC_ERROR_NONE
273 #define HAL_MMC_ERROR_CMD_CRC_FAIL SDMMC_ERROR_CMD_CRC_FAIL
274 #define HAL_MMC_ERROR_DATA_CRC_FAIL SDMMC_ERROR_DATA_CRC_FAIL
275 #define HAL_MMC_ERROR_CMD_RSP_TIMEOUT SDMMC_ERROR_CMD_RSP_TIMEOUT
276 #define HAL_MMC_ERROR_DATA_TIMEOUT SDMMC_ERROR_DATA_TIMEOUT
277 #define HAL_MMC_ERROR_TX_UNDERRUN SDMMC_ERROR_TX_UNDERRUN
278 #define HAL_MMC_ERROR_RX_OVERRUN SDMMC_ERROR_RX_OVERRUN
279 #define HAL_MMC_ERROR_ADDR_MISALIGNED SDMMC_ERROR_ADDR_MISALIGNED
280 #define HAL_MMC_ERROR_BLOCK_LEN_ERR SDMMC_ERROR_BLOCK_LEN_ERR
282 #define HAL_MMC_ERROR_ERASE_SEQ_ERR SDMMC_ERROR_ERASE_SEQ_ERR
283 #define HAL_MMC_ERROR_BAD_ERASE_PARAM SDMMC_ERROR_BAD_ERASE_PARAM
284 #define HAL_MMC_ERROR_WRITE_PROT_VIOLATION SDMMC_ERROR_WRITE_PROT_VIOLATION
285 #define HAL_MMC_ERROR_LOCK_UNLOCK_FAILED SDMMC_ERROR_LOCK_UNLOCK_FAILED
287 #define HAL_MMC_ERROR_COM_CRC_FAILED SDMMC_ERROR_COM_CRC_FAILED
288 #define HAL_MMC_ERROR_ILLEGAL_CMD SDMMC_ERROR_ILLEGAL_CMD
289 #define HAL_MMC_ERROR_CARD_ECC_FAILED SDMMC_ERROR_CARD_ECC_FAILED
290 #define HAL_MMC_ERROR_CC_ERR SDMMC_ERROR_CC_ERR
291 #define HAL_MMC_ERROR_GENERAL_UNKNOWN_ERR SDMMC_ERROR_GENERAL_UNKNOWN_ERR
292 #define HAL_MMC_ERROR_STREAM_READ_UNDERRUN SDMMC_ERROR_STREAM_READ_UNDERRUN
293 #define HAL_MMC_ERROR_STREAM_WRITE_OVERRUN SDMMC_ERROR_STREAM_WRITE_OVERRUN
294 #define HAL_MMC_ERROR_CID_CSD_OVERWRITE SDMMC_ERROR_CID_CSD_OVERWRITE
295 #define HAL_MMC_ERROR_WP_ERASE_SKIP SDMMC_ERROR_WP_ERASE_SKIP
296 #define HAL_MMC_ERROR_CARD_ECC_DISABLED SDMMC_ERROR_CARD_ECC_DISABLED
297 #define HAL_MMC_ERROR_ERASE_RESET SDMMC_ERROR_ERASE_RESET
299 #define HAL_MMC_ERROR_AKE_SEQ_ERR SDMMC_ERROR_AKE_SEQ_ERR
300 #define HAL_MMC_ERROR_INVALID_VOLTRANGE SDMMC_ERROR_INVALID_VOLTRANGE
301 #define HAL_MMC_ERROR_ADDR_OUT_OF_RANGE SDMMC_ERROR_ADDR_OUT_OF_RANGE
302 #define HAL_MMC_ERROR_REQUEST_NOT_APPLICABLE SDMMC_ERROR_REQUEST_NOT_APPLICABLE
303 #define HAL_MMC_ERROR_PARAM SDMMC_ERROR_INVALID_PARAMETER
304 #define HAL_MMC_ERROR_UNSUPPORTED_FEATURE SDMMC_ERROR_UNSUPPORTED_FEATURE
305 #define HAL_MMC_ERROR_BUSY SDMMC_ERROR_BUSY
306 #define HAL_MMC_ERROR_DMA SDMMC_ERROR_DMA
307 #define HAL_MMC_ERROR_TIMEOUT SDMMC_ERROR_TIMEOUT
309 #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
310 #define HAL_MMC_ERROR_INVALID_CALLBACK SDMMC_ERROR_INVALID_PARAMETER
319 #define MMC_CONTEXT_NONE 0x00000000U
320 #define MMC_CONTEXT_READ_SINGLE_BLOCK 0x00000001U
321 #define MMC_CONTEXT_READ_MULTIPLE_BLOCK 0x00000002U
322 #define MMC_CONTEXT_WRITE_SINGLE_BLOCK 0x00000010U
323 #define MMC_CONTEXT_WRITE_MULTIPLE_BLOCK 0x00000020U
324 #define MMC_CONTEXT_IT 0x00000008U
325 #define MMC_CONTEXT_DMA 0x00000080U
337 #define MMC_HIGH_VOLTAGE_RANGE 0x80FF8000U
338 #define MMC_DUAL_VOLTAGE_RANGE 0x80FF8080U
339 #define eMMC_HIGH_VOLTAGE_RANGE 0xC0FF8000U
340 #define eMMC_DUAL_VOLTAGE_RANGE 0xC0FF8080U
341 #define MMC_INVALID_VOLTAGE_RANGE 0x0001FF01U
349 #define MMC_LOW_CAPACITY_CARD 0x00000000U
350 #define MMC_HIGH_CAPACITY_CARD 0x00000001U
369 #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
370 #define __HAL_MMC_RESET_HANDLE_STATE(__HANDLE__) do { \
371 (__HANDLE__)->State = HAL_MMC_STATE_RESET; \
372 (__HANDLE__)->MspInitCallback = NULL; \
373 (__HANDLE__)->MspDeInitCallback = NULL; \
376 #define __HAL_MMC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_MMC_STATE_RESET)
383 #define __HAL_MMC_ENABLE(__HANDLE__) __SDMMC_ENABLE((__HANDLE__)->Instance)
389 #define __HAL_MMC_DISABLE(__HANDLE__) __SDMMC_DISABLE((__HANDLE__)->Instance)
395 #define __HAL_MMC_DMA_ENABLE(__HANDLE__) __SDMMC_DMA_ENABLE((__HANDLE__)->Instance)
401 #define __HAL_MMC_DMA_DISABLE(__HANDLE__) __SDMMC_DMA_DISABLE((__HANDLE__)->Instance)
432 #define __HAL_MMC_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
463 #define __HAL_MMC_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
494 #define __HAL_MMC_GET_FLAG(__HANDLE__, __FLAG__) __SDMMC_GET_FLAG((__HANDLE__)->Instance, (__FLAG__))
514 #define __HAL_MMC_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDMMC_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__))
545 #define __HAL_MMC_GET_IT(__HANDLE__, __INTERRUPT__) __SDMMC_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__))
569 #define __HAL_MMC_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDMMC_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__))
615 #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)