STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_sd.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32L4xx_HAL_SD_H
22 #define STM32L4xx_HAL_SD_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 #if defined(SDMMC1)
29 
30 /* Includes ------------------------------------------------------------------*/
31 #include "stm32l4xx_ll_sdmmc.h"
32 
42 /* Exported types ------------------------------------------------------------*/
50 typedef enum
51 {
52  HAL_SD_STATE_RESET = ((uint32_t)0x00000000U),
53  HAL_SD_STATE_READY = ((uint32_t)0x00000001U),
54  HAL_SD_STATE_TIMEOUT = ((uint32_t)0x00000002U),
55  HAL_SD_STATE_BUSY = ((uint32_t)0x00000003U),
56  HAL_SD_STATE_PROGRAMMING = ((uint32_t)0x00000004U),
57  HAL_SD_STATE_RECEIVING = ((uint32_t)0x00000005U),
58  HAL_SD_STATE_TRANSFER = ((uint32_t)0x00000006U),
59  HAL_SD_STATE_ERROR = ((uint32_t)0x0000000FU)
60 }HAL_SD_StateTypeDef;
68 typedef uint32_t HAL_SD_CardStateTypeDef;
69 
70 #define HAL_SD_CARD_READY 0x00000001U
71 #define HAL_SD_CARD_IDENTIFICATION 0x00000002U
72 #define HAL_SD_CARD_STANDBY 0x00000003U
73 #define HAL_SD_CARD_TRANSFER 0x00000004U
74 #define HAL_SD_CARD_SENDING 0x00000005U
75 #define HAL_SD_CARD_RECEIVING 0x00000006U
76 #define HAL_SD_CARD_PROGRAMMING 0x00000007U
77 #define HAL_SD_CARD_DISCONNECTED 0x00000008U
78 #define HAL_SD_CARD_ERROR 0x000000FFU
86 #define SD_InitTypeDef SDMMC_InitTypeDef
87 #define SD_TypeDef SDMMC_TypeDef
88 
92 typedef struct
93 {
94  uint32_t CardType;
96  uint32_t CardVersion;
98  uint32_t Class;
100  uint32_t RelCardAdd;
102  uint32_t BlockNbr;
104  uint32_t BlockSize;
106  uint32_t LogBlockNbr;
108  uint32_t LogBlockSize;
110 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
111 
112  uint32_t CardSpeed;
114 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
116 
120 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
121 typedef struct __SD_HandleTypeDef
122 #else
123 typedef struct
124 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
125 {
126  SD_TypeDef *Instance;
128  SD_InitTypeDef Init;
130  HAL_LockTypeDef Lock;
132  uint8_t *pTxBuffPtr;
134  uint32_t TxXferSize;
136  uint8_t *pRxBuffPtr;
138  uint32_t RxXferSize;
140  __IO uint32_t Context;
142  __IO HAL_SD_StateTypeDef State;
144  __IO uint32_t ErrorCode;
146 #if !defined(STM32L4R5xx) && !defined(STM32L4R7xx) && !defined(STM32L4R9xx) && !defined(STM32L4S5xx) && !defined(STM32L4S7xx) && !defined(STM32L4S9xx)
147 
148  DMA_HandleTypeDef *hdmatx;
150  DMA_HandleTypeDef *hdmarx;
152 #endif /* !STM32L4R5xx && !STM32L4R7xx && !STM32L4R9xx && !STM32L4S5xx && !STM32L4S7xx && !STM32L4S9xx */
155  uint32_t CSD[4];
157  uint32_t CID[4];
159 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
160  void (* TxCpltCallback) (struct __SD_HandleTypeDef *hsd);
161  void (* RxCpltCallback) (struct __SD_HandleTypeDef *hsd);
162  void (* ErrorCallback) (struct __SD_HandleTypeDef *hsd);
163  void (* AbortCpltCallback) (struct __SD_HandleTypeDef *hsd);
164 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
165  void (* Read_DMADblBuf0CpltCallback) (struct __SD_HandleTypeDef *hsd);
166  void (* Read_DMADblBuf1CpltCallback) (struct __SD_HandleTypeDef *hsd);
167  void (* Write_DMADblBuf0CpltCallback) (struct __SD_HandleTypeDef *hsd);
168  void (* Write_DMADblBuf1CpltCallback) (struct __SD_HandleTypeDef *hsd);
169 
170  void (* DriveTransceiver_1_8V_Callback) (FlagStatus status);
171 #endif
172 
173  void (* MspInitCallback) (struct __SD_HandleTypeDef *hsd);
174  void (* MspDeInitCallback) (struct __SD_HandleTypeDef *hsd);
175 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
177 
185 typedef struct
186 {
187  __IO uint8_t CSDStruct;
188  __IO uint8_t SysSpecVersion;
189  __IO uint8_t Reserved1;
190  __IO uint8_t TAAC;
191  __IO uint8_t NSAC;
192  __IO uint8_t MaxBusClkFrec;
193  __IO uint16_t CardComdClasses;
194  __IO uint8_t RdBlockLen;
195  __IO uint8_t PartBlockRead;
196  __IO uint8_t WrBlockMisalign;
197  __IO uint8_t RdBlockMisalign;
198  __IO uint8_t DSRImpl;
199  __IO uint8_t Reserved2;
200  __IO uint32_t DeviceSize;
201  __IO uint8_t MaxRdCurrentVDDMin;
202  __IO uint8_t MaxRdCurrentVDDMax;
203  __IO uint8_t MaxWrCurrentVDDMin;
204  __IO uint8_t MaxWrCurrentVDDMax;
205  __IO uint8_t DeviceSizeMul;
206  __IO uint8_t EraseGrSize;
207  __IO uint8_t EraseGrMul;
208  __IO uint8_t WrProtectGrSize;
209  __IO uint8_t WrProtectGrEnable;
210  __IO uint8_t ManDeflECC;
211  __IO uint8_t WrSpeedFact;
212  __IO uint8_t MaxWrBlockLen;
213  __IO uint8_t WriteBlockPaPartial;
214  __IO uint8_t Reserved3;
215  __IO uint8_t ContentProtectAppli;
216  __IO uint8_t FileFormatGroup;
217  __IO uint8_t CopyFlag;
218  __IO uint8_t PermWrProtect;
219  __IO uint8_t TempWrProtect;
220  __IO uint8_t FileFormat;
221  __IO uint8_t ECC;
222  __IO uint8_t CSD_CRC;
223  __IO uint8_t Reserved4;
232 typedef struct
233 {
234  __IO uint8_t ManufacturerID;
235  __IO uint16_t OEM_AppliID;
236  __IO uint32_t ProdName1;
237  __IO uint8_t ProdName2;
238  __IO uint8_t ProdRev;
239  __IO uint32_t ProdSN;
240  __IO uint8_t Reserved1;
241  __IO uint16_t ManufactDate;
242  __IO uint8_t CID_CRC;
243  __IO uint8_t Reserved2;
253 typedef struct
254 {
255  __IO uint8_t DataBusWidth;
256  __IO uint8_t SecuredMode;
257  __IO uint16_t CardType;
258  __IO uint32_t ProtectedAreaSize;
259  __IO uint8_t SpeedClass;
260  __IO uint8_t PerformanceMove;
261  __IO uint8_t AllocationUnitSize;
262  __IO uint16_t EraseSize;
263  __IO uint8_t EraseTimeout;
264  __IO uint8_t EraseOffset;
265 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
266  __IO uint8_t UhsSpeedGrade;
267  __IO uint8_t UhsAllocationUnitSize;
268  __IO uint8_t VideoSpeedClass;
269 #endif
275 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
276 
279 typedef enum
280 {
285 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
290 #endif
291 
302 typedef void (*pSD_CallbackTypeDef) (SD_HandleTypeDef *hsd);
303 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
304 typedef void (*pSD_TransceiverCallbackTypeDef)(FlagStatus status);
305 #endif
306 
309 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
310 
314 /* Exported constants --------------------------------------------------------*/
319 #define BLOCKSIZE ((uint32_t)512U)
324 #define HAL_SD_ERROR_NONE SDMMC_ERROR_NONE
325 #define HAL_SD_ERROR_CMD_CRC_FAIL SDMMC_ERROR_CMD_CRC_FAIL
326 #define HAL_SD_ERROR_DATA_CRC_FAIL SDMMC_ERROR_DATA_CRC_FAIL
327 #define HAL_SD_ERROR_CMD_RSP_TIMEOUT SDMMC_ERROR_CMD_RSP_TIMEOUT
328 #define HAL_SD_ERROR_DATA_TIMEOUT SDMMC_ERROR_DATA_TIMEOUT
329 #define HAL_SD_ERROR_TX_UNDERRUN SDMMC_ERROR_TX_UNDERRUN
330 #define HAL_SD_ERROR_RX_OVERRUN SDMMC_ERROR_RX_OVERRUN
331 #define HAL_SD_ERROR_ADDR_MISALIGNED SDMMC_ERROR_ADDR_MISALIGNED
332 #define HAL_SD_ERROR_BLOCK_LEN_ERR SDMMC_ERROR_BLOCK_LEN_ERR
334 #define HAL_SD_ERROR_ERASE_SEQ_ERR SDMMC_ERROR_ERASE_SEQ_ERR
335 #define HAL_SD_ERROR_BAD_ERASE_PARAM SDMMC_ERROR_BAD_ERASE_PARAM
336 #define HAL_SD_ERROR_WRITE_PROT_VIOLATION SDMMC_ERROR_WRITE_PROT_VIOLATION
337 #define HAL_SD_ERROR_LOCK_UNLOCK_FAILED SDMMC_ERROR_LOCK_UNLOCK_FAILED
339 #define HAL_SD_ERROR_COM_CRC_FAILED SDMMC_ERROR_COM_CRC_FAILED
340 #define HAL_SD_ERROR_ILLEGAL_CMD SDMMC_ERROR_ILLEGAL_CMD
341 #define HAL_SD_ERROR_CARD_ECC_FAILED SDMMC_ERROR_CARD_ECC_FAILED
342 #define HAL_SD_ERROR_CC_ERR SDMMC_ERROR_CC_ERR
343 #define HAL_SD_ERROR_GENERAL_UNKNOWN_ERR SDMMC_ERROR_GENERAL_UNKNOWN_ERR
344 #define HAL_SD_ERROR_STREAM_READ_UNDERRUN SDMMC_ERROR_STREAM_READ_UNDERRUN
345 #define HAL_SD_ERROR_STREAM_WRITE_OVERRUN SDMMC_ERROR_STREAM_WRITE_OVERRUN
346 #define HAL_SD_ERROR_CID_CSD_OVERWRITE SDMMC_ERROR_CID_CSD_OVERWRITE
347 #define HAL_SD_ERROR_WP_ERASE_SKIP SDMMC_ERROR_WP_ERASE_SKIP
348 #define HAL_SD_ERROR_CARD_ECC_DISABLED SDMMC_ERROR_CARD_ECC_DISABLED
349 #define HAL_SD_ERROR_ERASE_RESET SDMMC_ERROR_ERASE_RESET
351 #define HAL_SD_ERROR_AKE_SEQ_ERR SDMMC_ERROR_AKE_SEQ_ERR
352 #define HAL_SD_ERROR_INVALID_VOLTRANGE SDMMC_ERROR_INVALID_VOLTRANGE
353 #define HAL_SD_ERROR_ADDR_OUT_OF_RANGE SDMMC_ERROR_ADDR_OUT_OF_RANGE
354 #define HAL_SD_ERROR_REQUEST_NOT_APPLICABLE SDMMC_ERROR_REQUEST_NOT_APPLICABLE
355 #define HAL_SD_ERROR_PARAM SDMMC_ERROR_INVALID_PARAMETER
356 #define HAL_SD_ERROR_UNSUPPORTED_FEATURE SDMMC_ERROR_UNSUPPORTED_FEATURE
357 #define HAL_SD_ERROR_BUSY SDMMC_ERROR_BUSY
358 #define HAL_SD_ERROR_DMA SDMMC_ERROR_DMA
359 #define HAL_SD_ERROR_TIMEOUT SDMMC_ERROR_TIMEOUT
361 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
362 #define HAL_SD_ERROR_INVALID_CALLBACK SDMMC_ERROR_INVALID_PARAMETER
363 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
364 
371 #define SD_CONTEXT_NONE ((uint32_t)0x00000000U)
372 #define SD_CONTEXT_READ_SINGLE_BLOCK ((uint32_t)0x00000001U)
373 #define SD_CONTEXT_READ_MULTIPLE_BLOCK ((uint32_t)0x00000002U)
374 #define SD_CONTEXT_WRITE_SINGLE_BLOCK ((uint32_t)0x00000010U)
375 #define SD_CONTEXT_WRITE_MULTIPLE_BLOCK ((uint32_t)0x00000020U)
376 #define SD_CONTEXT_IT ((uint32_t)0x00000008U)
377 #define SD_CONTEXT_DMA ((uint32_t)0x00000080U)
386 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
387 #define CARD_NORMAL_SPEED ((uint32_t)0x00000000U)
388 #define CARD_HIGH_SPEED ((uint32_t)0x00000100U)
389 #define CARD_ULTRA_HIGH_SPEED ((uint32_t)0x00000200U)
391 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
392 
393 #define CARD_SDSC ((uint32_t)0x00000000U)
394 #define CARD_SDHC_SDXC ((uint32_t)0x00000001U)
395 #define CARD_SECURED ((uint32_t)0x00000003U)
396 
404 #define CARD_V1_X ((uint32_t)0x00000000U)
405 #define CARD_V2_X ((uint32_t)0x00000001U)
406 
414 /* Exported macro ------------------------------------------------------------*/
423 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
424 #define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__) do { \
425  (__HANDLE__)->State = HAL_SD_STATE_RESET; \
426  (__HANDLE__)->MspInitCallback = NULL; \
427  (__HANDLE__)->MspDeInitCallback = NULL; \
428  } while(0)
429 #else
430 #define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SD_STATE_RESET)
431 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
432 
433 #if !defined(STM32L4R5xx) && !defined(STM32L4R7xx) && !defined(STM32L4R9xx) && !defined(STM32L4S5xx) && !defined(STM32L4S7xx) && !defined(STM32L4S9xx)
434 
438 #define __HAL_SD_ENABLE(__HANDLE__) __SDMMC_ENABLE((__HANDLE__)->Instance)
439 
444 #define __HAL_SD_DISABLE(__HANDLE__) __SDMMC_DISABLE((__HANDLE__)->Instance)
445 
450 #define __HAL_SD_DMA_ENABLE(__HANDLE__) __SDMMC_DMA_ENABLE((__HANDLE__)->Instance)
451 
456 #define __HAL_SD_DMA_DISABLE(__HANDLE__) __SDMMC_DMA_DISABLE((__HANDLE__)->Instance)
457 #endif /* !STM32L4R5xx && !STM32L4R7xx && !STM32L4R9xx && !STM32L4S5xx && !STM32L4S7xx && !STM32L4S9xx */
458 
496 #define __HAL_SD_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
497 
535 #define __HAL_SD_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
536 
578 #define __HAL_SD_GET_FLAG(__HANDLE__, __FLAG__) __SDMMC_GET_FLAG((__HANDLE__)->Instance, (__FLAG__))
579 
607 #define __HAL_SD_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDMMC_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__))
608 
646 #define __HAL_SD_GET_IT(__HANDLE__, __INTERRUPT__) __SDMMC_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__))
647 
674 #define __HAL_SD_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDMMC_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__))
675 
680 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
681 /* Include SD HAL Extension module */
682 #include "stm32l4xx_hal_sd_ex.h"
683 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
684 
685 /* Exported functions --------------------------------------------------------*/
693 HAL_StatusTypeDef HAL_SD_Init (SD_HandleTypeDef *hsd);
694 HAL_StatusTypeDef HAL_SD_InitCard (SD_HandleTypeDef *hsd);
695 HAL_StatusTypeDef HAL_SD_DeInit (SD_HandleTypeDef *hsd);
696 void HAL_SD_MspInit (SD_HandleTypeDef *hsd);
705 /* Blocking mode: Polling */
706 HAL_StatusTypeDef HAL_SD_ReadBlocks (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout);
707 HAL_StatusTypeDef HAL_SD_WriteBlocks (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout);
708 HAL_StatusTypeDef HAL_SD_Erase (SD_HandleTypeDef *hsd, uint32_t BlockStartAdd, uint32_t BlockEndAdd);
709 /* Non-Blocking mode: IT */
710 HAL_StatusTypeDef HAL_SD_ReadBlocks_IT (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
711 HAL_StatusTypeDef HAL_SD_WriteBlocks_IT (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
712 /* Non-Blocking mode: DMA */
713 HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
714 HAL_StatusTypeDef HAL_SD_WriteBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
715 
717 
718 /* Callback in non blocking modes (DMA) */
723 
724 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
725 /* SD callback registering/unregistering */
726 HAL_StatusTypeDef HAL_SD_RegisterCallback (SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID, pSD_CallbackTypeDef pCallback);
727 HAL_StatusTypeDef HAL_SD_UnRegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID);
728 
729 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
732 #endif
733 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
734 
742 HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation(SD_HandleTypeDef *hsd, uint32_t WideMode);
743 HAL_StatusTypeDef HAL_SD_ConfigSpeedBusOperation(SD_HandleTypeDef *hsd, uint32_t SpeedMode);
751 HAL_StatusTypeDef HAL_SD_SendSDStatus (SD_HandleTypeDef *hsd, uint32_t *pSDstatus);
752 HAL_SD_CardStateTypeDef HAL_SD_GetCardState (SD_HandleTypeDef *hsd);
753 HAL_StatusTypeDef HAL_SD_GetCardCID (SD_HandleTypeDef *hsd, HAL_SD_CardCIDTypeDef *pCID);
754 HAL_StatusTypeDef HAL_SD_GetCardCSD (SD_HandleTypeDef *hsd, HAL_SD_CardCSDTypeDef *pCSD);
755 HAL_StatusTypeDef HAL_SD_GetCardStatus(SD_HandleTypeDef *hsd, HAL_SD_CardStatusTypeDef *pStatus);
756 HAL_StatusTypeDef HAL_SD_GetCardInfo (SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypeDef *pCardInfo);
764 HAL_SD_StateTypeDef HAL_SD_GetState(SD_HandleTypeDef *hsd);
765 uint32_t HAL_SD_GetError(SD_HandleTypeDef *hsd);
773 HAL_StatusTypeDef HAL_SD_Abort (SD_HandleTypeDef *hsd);
774 HAL_StatusTypeDef HAL_SD_Abort_IT(SD_HandleTypeDef *hsd);
779 /* Private types -------------------------------------------------------------*/
788 /* Private defines -----------------------------------------------------------*/
797 /* Private variables ---------------------------------------------------------*/
806 /* Private constants ---------------------------------------------------------*/
815 /* Private macros ------------------------------------------------------------*/
824 /* Private functions prototypes ----------------------------------------------*/
833 /* Private functions ---------------------------------------------------------*/
855 #endif /* SDMMC1 */
856 
857 #ifdef __cplusplus
858 }
859 #endif
860 
861 
862 #endif /* STM32L4xx_HAL_SD_H */
863 
864 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
__IO uint16_t CardComdClasses
HAL_SD_CallbackIDTypeDef
HAL_StatusTypeDef HAL_SD_GetCardStatus(SD_HandleTypeDef *hsd, HAL_SD_CardStatusTypeDef *pStatus)
Gets the SD status info.
void(* pSD_TransceiverCallbackTypeDef)(FlagStatus status)
HAL_SD_StateTypeDef HAL_SD_GetState(SD_HandleTypeDef *hsd)
return the SD state
HAL_StatusTypeDef HAL_SD_UnRegisterTransceiverCallback(SD_HandleTypeDef *hsd)
Unregister a User SD Transceiver Callback SD Callback is redirected to the weak (surcharged) predefin...
void HAL_SD_MspInit(SD_HandleTypeDef *hsd)
Initializes the SD MSP.
__IO uint8_t MaxRdCurrentVDDMax
DMA handle Structure definition.
HAL_StatusTypeDef HAL_SD_Erase(SD_HandleTypeDef *hsd, uint32_t BlockStartAdd, uint32_t BlockEndAdd)
Erases the specified memory area of the given SD card.
void HAL_SD_ErrorCallback(SD_HandleTypeDef *hsd)
SD error callbacks.
HAL_StatusTypeDef HAL_SD_Abort(SD_HandleTypeDef *hsd)
Abort the current transfer and disable the SD.
Header file of SD HAL extended module.
HAL_StatusTypeDef HAL_SD_DeInit(SD_HandleTypeDef *hsd)
De-Initializes the SD card.
Header file of SDMMC HAL module.
SD_InitTypeDef Init
uint32_t HAL_SD_GetError(SD_HandleTypeDef *hsd)
Return the SD error code.
__IO uint8_t ContentProtectAppli
__IO uint8_t MaxWrCurrentVDDMax
struct __SD_HandleTypeDef else typedef struct endif SD_HandleTypeDef
SD handle Structure definition.
__IO uint8_t WriteBlockPaPartial
HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation(SD_HandleTypeDef *hsd, uint32_t WideMode)
Enables wide bus operation for the requested card if supported by card.
HAL_SD_CardStateTypeDef HAL_SD_GetCardState(SD_HandleTypeDef *hsd)
Gets the current sd card data state.
HAL_StatusTypeDef HAL_SD_ConfigSpeedBusOperation(SD_HandleTypeDef *hsd, uint32_t SpeedMode)
Configure the speed bus mode.
HAL_StatusTypeDef HAL_SD_InitCard(SD_HandleTypeDef *hsd)
Initializes the SD Card.
HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
Reads block(s) from a specified address in a card. The Data transfer is managed by DMA mode...
void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
Rx Transfer completed callbacks.
SD_TypeDef * Instance
HAL_StatusTypeDef HAL_SD_Init(SD_HandleTypeDef *hsd)
Initializes the SD according to the specified parameters in the SD_HandleTypeDef and create the assoc...
__IO uint8_t UhsAllocationUnitSize
HAL_StatusTypeDef HAL_SD_WriteBlocks_IT(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
Writes block(s) to a specified address in a card. The Data transfer is managed in interrupt mode...
void(* pSD_CallbackTypeDef)(SD_HandleTypeDef *hsd)
__IO uint8_t WrProtectGrSize
SD Card Information Structure definition.
__IO uint8_t MaxRdCurrentVDDMin
__IO uint16_t ManufactDate
__IO uint8_t MaxWrCurrentVDDMin
HAL_StatusTypeDef HAL_SD_ReadBlocks_IT(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
Reads block(s) from a specified address in a card. The Data transfer is managed in interrupt mode...
HAL_StatusTypeDef HAL_SD_Abort_IT(SD_HandleTypeDef *hsd)
Abort the current transfer and disable the SD (IT mode).
HAL_StatusTypeDef HAL_SD_WriteBlocks(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout)
Allows to write block(s) to a specified address in a card. The Data transfer is managed by polling mo...
HAL_SD_CardInfoTypeDef SdCard
HAL_StatusTypeDef HAL_SD_UnRegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID)
Unregister a User SD Callback SD Callback is redirected to the weak (surcharged) predefined callback...
HAL_StatusTypeDef HAL_SD_RegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID, pSD_CallbackTypeDef pCallback)
Register a User SD Callback To be used instead of the weak (surcharged) predefined callback...
__IO uint8_t FileFormatGroup
uint32_t HAL_SD_CardStateTypeDef
HAL_LockTypeDef
HAL Lock structures definition.
__IO uint8_t RdBlockMisalign
void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd)
SD Abort callbacks.
HAL_StatusTypeDef HAL_SD_GetCardCID(SD_HandleTypeDef *hsd, HAL_SD_CardCIDTypeDef *pCID)
Returns information the information of the card which are stored on the CID register.
HAL_StatusTypeDef HAL_SD_GetCardCSD(SD_HandleTypeDef *hsd, HAL_SD_CardCSDTypeDef *pCSD)
Returns information the information of the card which are stored on the CSD register.
void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
Tx Transfer completed callbacks.
ADC handle Structure definition.
HAL_StatusTypeDef HAL_SD_GetCardInfo(SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypeDef *pCardInfo)
Gets the SD card info.
HAL_StatusTypeDef HAL_SD_WriteBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
Writes block(s) to a specified address in a card. The Data transfer is managed by DMA mode...
__IO HAL_SD_StateTypeDef State
__IO uint8_t WrBlockMisalign
HAL_StatusTypeDef HAL_SD_ReadBlocks(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout)
Reads block(s) from a specified address in a card. The Data transfer is managed by polling mode...
HAL_StatusTypeDef HAL_SD_RegisterTransceiverCallback(SD_HandleTypeDef *hsd, pSD_TransceiverCallbackTypeDef pCallback)
Register a User SD Transceiver Callback To be used instead of the weak (surcharged) predefined callba...
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
De-Initialize SD MSP.
HAL_StatusTypeDef HAL_SD_SendSDStatus(SD_HandleTypeDef *hsd, uint32_t *pSDstatus)
void HAL_SD_IRQHandler(SD_HandleTypeDef *hsd)
This function handles SD card interrupt request.
__IO uint8_t WrProtectGrEnable