1 /**
2   ******************************************************************************
3   * @file    stm32h5xx_hal_sd.h
4   * @author  MCD Application Team
5   * @brief   Header file of SD HAL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2022 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32H5xx_HAL_SD_H
21 #define STM32H5xx_HAL_SD_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h5xx_ll_sdmmc.h"
29 #if defined (DLYB_SDMMC1) || defined (DLYB_SDMMC2) || defined (DLYB_SDMMC3)
30 #include "stm32h5xx_ll_dlyb.h"
31 #endif /* (DLYB_SDMMC1) || (DLYB_SDMMC2) */
32 
33 /** @addtogroup STM32H5xx_HAL_Driver
34   * @{
35   */
36 #if defined (SDMMC1) || defined (SDMMC2)
37 
38 /** @defgroup SD SD
39   * @brief SD HAL module driver
40   * @{
41   */
42 
43 /* Exported types ------------------------------------------------------------*/
44 /** @defgroup SD_Exported_Types SD Exported Types
45   * @{
46   */
47 
48 /** @defgroup SD_Exported_Types_Group1 SD State enumeration structure
49   * @{
50   */
51 typedef enum
52 {
53   HAL_SD_STATE_RESET                  = ((uint32_t)0x00000000U),  /*!< SD not yet initialized or disabled  */
54   HAL_SD_STATE_READY                  = ((uint32_t)0x00000001U),  /*!< SD initialized and ready for use    */
55   HAL_SD_STATE_TIMEOUT                = ((uint32_t)0x00000002U),  /*!< SD Timeout state                    */
56   HAL_SD_STATE_BUSY                   = ((uint32_t)0x00000003U),  /*!< SD process ongoing                  */
57   HAL_SD_STATE_PROGRAMMING            = ((uint32_t)0x00000004U),  /*!< SD Programming State                */
58   HAL_SD_STATE_RECEIVING              = ((uint32_t)0x00000005U),  /*!< SD Receiving State                  */
59   HAL_SD_STATE_TRANSFER               = ((uint32_t)0x00000006U),  /*!< SD Transfer State                   */
60   HAL_SD_STATE_ERROR                  = ((uint32_t)0x0000000FU)   /*!< SD is in error state                */
61 } HAL_SD_StateTypeDef;
62 /**
63   * @}
64   */
65 
66 /** @defgroup SD_Exported_Types_Group2 SD Card State enumeration structure
67   * @{
68   */
69 typedef uint32_t HAL_SD_CardStateTypeDef;
70 
71 #define HAL_SD_CARD_READY          0x00000001U  /*!< Card state is ready                     */
72 #define HAL_SD_CARD_IDENTIFICATION 0x00000002U  /*!< Card is in identification state         */
73 #define HAL_SD_CARD_STANDBY        0x00000003U  /*!< Card is in standby state                */
74 #define HAL_SD_CARD_TRANSFER       0x00000004U  /*!< Card is in transfer state               */
75 #define HAL_SD_CARD_SENDING        0x00000005U  /*!< Card is sending an operation            */
76 #define HAL_SD_CARD_RECEIVING      0x00000006U  /*!< Card is receiving operation information */
77 #define HAL_SD_CARD_PROGRAMMING    0x00000007U  /*!< Card is in programming state            */
78 #define HAL_SD_CARD_DISCONNECTED   0x00000008U  /*!< Card is disconnected                    */
79 #define HAL_SD_CARD_ERROR          0x000000FFU  /*!< Card response Error                     */
80 /**
81   * @}
82   */
83 
84 /** @defgroup SD_Exported_Types_Group3 SD Handle Structure definition
85   * @{
86   */
87 #define SD_InitTypeDef      SDMMC_InitTypeDef
88 #define SD_TypeDef          SDMMC_TypeDef
89 
90 /**
91   * @brief  SD Card Information Structure definition
92   */
93 typedef struct
94 {
95   uint32_t CardType;                     /*!< Specifies the card Type                         */
96 
97   uint32_t CardVersion;                  /*!< Specifies the card version                      */
98 
99   uint32_t Class;                        /*!< Specifies the class of the card class           */
100 
101   uint32_t RelCardAdd;                   /*!< Specifies the Relative Card Address             */
102 
103   uint32_t BlockNbr;                     /*!< Specifies the Card Capacity in blocks           */
104 
105   uint32_t BlockSize;                    /*!< Specifies one block size in bytes               */
106 
107   uint32_t LogBlockNbr;                  /*!< Specifies the Card logical Capacity in blocks   */
108 
109   uint32_t LogBlockSize;                 /*!< Specifies logical block size in bytes           */
110 
111   uint32_t CardSpeed;                    /*!< Specifies the card Speed                        */
112 
113 } HAL_SD_CardInfoTypeDef;
114 
115 /**
116   * @brief  SD handle Structure definition
117   */
118 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
119 typedef struct __SD_HandleTypeDef
120 #else
121 typedef struct
122 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
123 {
124   SD_TypeDef                   *Instance;        /*!< SD registers base address           */
125 
126   SD_InitTypeDef               Init;             /*!< SD required parameters              */
127 
128   HAL_LockTypeDef              Lock;             /*!< SD locking object                   */
129 
130   const uint8_t                *pTxBuffPtr;      /*!< Pointer to SD Tx transfer Buffer    */
131 
132   uint32_t                     TxXferSize;       /*!< SD Tx Transfer size                 */
133 
134   uint8_t                      *pRxBuffPtr;      /*!< Pointer to SD Rx transfer Buffer    */
135 
136   uint32_t                     RxXferSize;       /*!< SD Rx Transfer size                 */
137 
138   __IO uint32_t                Context;          /*!< SD transfer context                 */
139 
140   __IO HAL_SD_StateTypeDef     State;            /*!< SD card State                       */
141 
142   __IO uint32_t                ErrorCode;        /*!< SD Card Error codes                 */
143 
144   HAL_SD_CardInfoTypeDef       SdCard;           /*!< SD Card information                 */
145 
146   uint32_t                     CSD[4];           /*!< SD card specific data table         */
147 
148   uint32_t                     CID[4];           /*!< SD card identification number table */
149 
150 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
151   void (* TxCpltCallback)(struct __SD_HandleTypeDef *hsd);
152   void (* RxCpltCallback)(struct __SD_HandleTypeDef *hsd);
153   void (* ErrorCallback)(struct __SD_HandleTypeDef *hsd);
154   void (* AbortCpltCallback)(struct __SD_HandleTypeDef *hsd);
155   void (* Read_DMALnkLstBufCpltCallback)(struct __SD_HandleTypeDef *hsd);
156   void (* Write_DMALnkLstBufCpltCallback)(struct __SD_HandleTypeDef *hsd);
157 #if (USE_SD_TRANSCEIVER != 0U)
158   void (* DriveTransceiver_1_8V_Callback)(FlagStatus status);
159 #endif /* USE_SD_TRANSCEIVER */
160 
161   void (* MspInitCallback)(struct __SD_HandleTypeDef *hsd);
162   void (* MspDeInitCallback)(struct __SD_HandleTypeDef *hsd);
163 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
164 } SD_HandleTypeDef;
165 
166 /**
167   * @}
168   */
169 
170 /** @defgroup SD_Exported_Types_Group4 Card Specific Data: CSD Register
171   * @{
172   */
173 typedef struct
174 {
175   __IO uint8_t  CSDStruct;            /*!< CSD structure                         */
176   __IO uint8_t  SysSpecVersion;       /*!< System specification version          */
177   __IO uint8_t  Reserved1;            /*!< Reserved                              */
178   __IO uint8_t  TAAC;                 /*!< Data read access time 1               */
179   __IO uint8_t  NSAC;                 /*!< Data read access time 2 in CLK cycles */
180   __IO uint8_t  MaxBusClkFrec;        /*!< Max. bus clock frequency              */
181   __IO uint16_t CardComdClasses;      /*!< Card command classes                  */
182   __IO uint8_t  RdBlockLen;           /*!< Max. read data block length           */
183   __IO uint8_t  PartBlockRead;        /*!< Partial blocks for read allowed       */
184   __IO uint8_t  WrBlockMisalign;      /*!< Write block misalignment              */
185   __IO uint8_t  RdBlockMisalign;      /*!< Read block misalignment               */
186   __IO uint8_t  DSRImpl;              /*!< DSR implemented                       */
187   __IO uint8_t  Reserved2;            /*!< Reserved                              */
188   __IO uint32_t DeviceSize;           /*!< Device Size                           */
189   __IO uint8_t  MaxRdCurrentVDDMin;   /*!< Max. read current @ VDD min           */
190   __IO uint8_t  MaxRdCurrentVDDMax;   /*!< Max. read current @ VDD max           */
191   __IO uint8_t  MaxWrCurrentVDDMin;   /*!< Max. write current @ VDD min          */
192   __IO uint8_t  MaxWrCurrentVDDMax;   /*!< Max. write current @ VDD max          */
193   __IO uint8_t  DeviceSizeMul;        /*!< Device size multiplier                */
194   __IO uint8_t  EraseGrSize;          /*!< Erase group size                      */
195   __IO uint8_t  EraseGrMul;           /*!< Erase group size multiplier           */
196   __IO uint8_t  WrProtectGrSize;      /*!< Write protect group size              */
197   __IO uint8_t  WrProtectGrEnable;    /*!< Write protect group enable            */
198   __IO uint8_t  ManDeflECC;           /*!< Manufacturer default ECC              */
199   __IO uint8_t  WrSpeedFact;          /*!< Write speed factor                    */
200   __IO uint8_t  MaxWrBlockLen;        /*!< Max. write data block length          */
201   __IO uint8_t  WriteBlockPaPartial;  /*!< Partial blocks for write allowed      */
202   __IO uint8_t  Reserved3;            /*!< Reserved                              */
203   __IO uint8_t  ContentProtectAppli;  /*!< Content protection application        */
204   __IO uint8_t  FileFormatGroup;      /*!< File format group                     */
205   __IO uint8_t  CopyFlag;             /*!< Copy flag (OTP)                       */
206   __IO uint8_t  PermWrProtect;        /*!< Permanent write protection            */
207   __IO uint8_t  TempWrProtect;        /*!< Temporary write protection            */
208   __IO uint8_t  FileFormat;           /*!< File format                           */
209   __IO uint8_t  ECC;                  /*!< ECC code                              */
210   __IO uint8_t  CSD_CRC;              /*!< CSD CRC                               */
211   __IO uint8_t  Reserved4;            /*!< Always 1                              */
212 } HAL_SD_CardCSDTypeDef;
213 /**
214   * @}
215   */
216 
217 /** @defgroup SD_Exported_Types_Group5 Card Identification Data: CID Register
218   * @{
219   */
220 typedef struct
221 {
222   __IO uint8_t  ManufacturerID;  /*!< Manufacturer ID       */
223   __IO uint16_t OEM_AppliID;     /*!< OEM/Application ID    */
224   __IO uint32_t ProdName1;       /*!< Product Name part1    */
225   __IO uint8_t  ProdName2;       /*!< Product Name part2    */
226   __IO uint8_t  ProdRev;         /*!< Product Revision      */
227   __IO uint32_t ProdSN;          /*!< Product Serial Number */
228   __IO uint8_t  Reserved1;       /*!< Reserved1             */
229   __IO uint16_t ManufactDate;    /*!< Manufacturing Date    */
230   __IO uint8_t  CID_CRC;         /*!< CID CRC               */
231   __IO uint8_t  Reserved2;       /*!< Always 1              */
232 
233 } HAL_SD_CardCIDTypeDef;
234 /**
235   * @}
236   */
237 
238 /** @defgroup SD_Exported_Types_Group6 SD Card Status returned by ACMD13
239   * @{
240   */
241 typedef struct
242 {
243   __IO uint8_t  DataBusWidth;           /*!< Shows the currently defined data bus width                 */
244   __IO uint8_t  SecuredMode;            /*!< Card is in secured mode of operation                       */
245   __IO uint16_t CardType;               /*!< Carries information about card type                        */
246   __IO uint32_t ProtectedAreaSize;      /*!< Carries information about the capacity of protected area   */
247   __IO uint8_t  SpeedClass;             /*!< Carries information about the speed class of the card      */
248   __IO uint8_t  PerformanceMove;        /*!< Carries information about the card's performance move      */
249   __IO uint8_t  AllocationUnitSize;     /*!< Carries information about the card's allocation unit size  */
250   __IO uint16_t EraseSize;              /*!< Determines the number of AUs to be erased in one operation */
251   __IO uint8_t  EraseTimeout;           /*!< Determines the timeout for any number of AU erase          */
252   __IO uint8_t  EraseOffset;            /*!< Carries information about the erase offset                 */
253   __IO uint8_t  UhsSpeedGrade;          /*!< Carries information about the speed grade of UHS card      */
254   __IO uint8_t  UhsAllocationUnitSize;  /*!< Carries information about the UHS card's allocation unit size  */
255   __IO uint8_t  VideoSpeedClass;        /*!< Carries information about the Video Speed Class of UHS card    */
256 } HAL_SD_CardStatusTypeDef;
257 /**
258   * @}
259   */
260 
261 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
262 /** @defgroup SD_Exported_Types_Group7 SD Callback ID enumeration definition
263   * @{
264   */
265 typedef enum
266 {
267   HAL_SD_TX_CPLT_CB_ID                 = 0x00U,  /*!< SD Tx Complete Callback ID                     */
268   HAL_SD_RX_CPLT_CB_ID                 = 0x01U,  /*!< SD Rx Complete Callback ID                     */
269   HAL_SD_ERROR_CB_ID                   = 0x02U,  /*!< SD Error Callback ID                           */
270   HAL_SD_ABORT_CB_ID                   = 0x03U,  /*!< SD Abort Callback ID                           */
271   HAL_SD_READ_DMA_LNKLST_BUF_CPLT_CB_ID  = 0x04U,  /*!< SD DMA Rx Linked List Node buffer Callback ID */
272   HAL_SD_WRITE_DMA_LNKLST_BUF_CPLT_CB_ID = 0x05U,  /*!< SD DMA Tx Linked List Node buffer Callback ID */
273 
274   HAL_SD_MSP_INIT_CB_ID                = 0x10U,  /*!< SD MspInit Callback ID                         */
275   HAL_SD_MSP_DEINIT_CB_ID              = 0x11U   /*!< SD MspDeInit Callback ID                       */
276 } HAL_SD_CallbackIDTypeDef;
277 /**
278   * @}
279   */
280 
281 /** @defgroup SD_Exported_Types_Group8 SD Callback pointer definition
282   * @{
283   */
284 typedef void (*pSD_CallbackTypeDef)(SD_HandleTypeDef *hsd);
285 #if (USE_SD_TRANSCEIVER != 0U)
286 typedef void (*pSD_TransceiverCallbackTypeDef)(FlagStatus status);
287 #endif /* USE_SD_TRANSCEIVER */
288 /**
289   * @}
290   */
291 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
292 /**
293   * @}
294   */
295 
296 /* Exported constants --------------------------------------------------------*/
297 /** @defgroup SD_Exported_Constants SD Exported Constants
298   * @{
299   */
300 
301 #define BLOCKSIZE   ((uint32_t)512U) /*!< Block size is 512 bytes */
302 
303 /** @defgroup SD_Exported_Constansts_Group1 SD Error status enumeration Structure definition
304   * @{
305   */
306 #define HAL_SD_ERROR_NONE                     SDMMC_ERROR_NONE                        /*!< No error                                                     */
307 #define HAL_SD_ERROR_CMD_CRC_FAIL             SDMMC_ERROR_CMD_CRC_FAIL                /*!< Command response received (but CRC check failed)             */
308 #define HAL_SD_ERROR_DATA_CRC_FAIL            SDMMC_ERROR_DATA_CRC_FAIL               /*!< Data block sent/received (CRC check failed)                  */
309 #define HAL_SD_ERROR_CMD_RSP_TIMEOUT          SDMMC_ERROR_CMD_RSP_TIMEOUT             /*!< Command response timeout                                     */
310 #define HAL_SD_ERROR_DATA_TIMEOUT             SDMMC_ERROR_DATA_TIMEOUT                /*!< Data timeout                                                 */
311 #define HAL_SD_ERROR_TX_UNDERRUN              SDMMC_ERROR_TX_UNDERRUN                 /*!< Transmit FIFO underrun                                       */
312 #define HAL_SD_ERROR_RX_OVERRUN               SDMMC_ERROR_RX_OVERRUN                  /*!< Receive FIFO overrun                                         */
313 #define HAL_SD_ERROR_ADDR_MISALIGNED          SDMMC_ERROR_ADDR_MISALIGNED             /*!< Misaligned address                                           */
314 #define HAL_SD_ERROR_BLOCK_LEN_ERR            SDMMC_ERROR_BLOCK_LEN_ERR               /*!< Transferred block length is not allowed for the card or the  */
315                                                                                       /*!< number of transferred bytes does not match the block length  */
316 #define HAL_SD_ERROR_ERASE_SEQ_ERR            SDMMC_ERROR_ERASE_SEQ_ERR               /*!< An error in the sequence of erase command occurs             */
317 #define HAL_SD_ERROR_BAD_ERASE_PARAM          SDMMC_ERROR_BAD_ERASE_PARAM             /*!< An invalid selection for erase groups                        */
318 #define HAL_SD_ERROR_WRITE_PROT_VIOLATION     SDMMC_ERROR_WRITE_PROT_VIOLATION        /*!< Attempt to program a write protect block                     */
319 #define HAL_SD_ERROR_LOCK_UNLOCK_FAILED       SDMMC_ERROR_LOCK_UNLOCK_FAILED          /*!< Sequence or password error has been detected in unlock       */
320                                                                                       /*!< command or if there was an attempt to access a locked card   */
321 #define HAL_SD_ERROR_COM_CRC_FAILED           SDMMC_ERROR_COM_CRC_FAILED              /*!< CRC check of the previous command failed                     */
322 #define HAL_SD_ERROR_ILLEGAL_CMD              SDMMC_ERROR_ILLEGAL_CMD                 /*!< Command is not legal for the card state                      */
323 #define HAL_SD_ERROR_CARD_ECC_FAILED          SDMMC_ERROR_CARD_ECC_FAILED             /*!< Card internal ECC was applied but failed to correct the data */
324 #define HAL_SD_ERROR_CC_ERR                   SDMMC_ERROR_CC_ERR                      /*!< Internal card controller error                               */
325 #define HAL_SD_ERROR_GENERAL_UNKNOWN_ERR      SDMMC_ERROR_GENERAL_UNKNOWN_ERR         /*!< General or unknown error                                     */
326 #define HAL_SD_ERROR_STREAM_READ_UNDERRUN     SDMMC_ERROR_STREAM_READ_UNDERRUN        /*!< The card could not sustain data reading in stream rmode      */
327 #define HAL_SD_ERROR_STREAM_WRITE_OVERRUN     SDMMC_ERROR_STREAM_WRITE_OVERRUN        /*!< The card could not sustain data programming in stream mode   */
328 #define HAL_SD_ERROR_CID_CSD_OVERWRITE        SDMMC_ERROR_CID_CSD_OVERWRITE           /*!< CID/CSD overwrite error                                      */
329 #define HAL_SD_ERROR_WP_ERASE_SKIP            SDMMC_ERROR_WP_ERASE_SKIP               /*!< Only partial address space was erased                        */
330 #define HAL_SD_ERROR_CARD_ECC_DISABLED        SDMMC_ERROR_CARD_ECC_DISABLED           /*!< Command has been executed without using internal ECC         */
331 #define HAL_SD_ERROR_ERASE_RESET              SDMMC_ERROR_ERASE_RESET                 /*!< Erase sequence was cleared before executing because an out   */
332                                                                                       /*!< of erase sequence command was received                       */
333 #define HAL_SD_ERROR_AKE_SEQ_ERR              SDMMC_ERROR_AKE_SEQ_ERR                 /*!< Error in sequence of authentication                          */
334 #define HAL_SD_ERROR_INVALID_VOLTRANGE        SDMMC_ERROR_INVALID_VOLTRANGE           /*!< Error in case of invalid voltage range                       */
335 #define HAL_SD_ERROR_ADDR_OUT_OF_RANGE        SDMMC_ERROR_ADDR_OUT_OF_RANGE           /*!< Error when addressed block is out of range                   */
336 #define HAL_SD_ERROR_REQUEST_NOT_APPLICABLE   SDMMC_ERROR_REQUEST_NOT_APPLICABLE      /*!< Error when command request is not applicable                 */
337 #define HAL_SD_ERROR_PARAM                    SDMMC_ERROR_INVALID_PARAMETER           /*!< the used parameter is not valid                              */
338 #define HAL_SD_ERROR_UNSUPPORTED_FEATURE      SDMMC_ERROR_UNSUPPORTED_FEATURE         /*!< Error when feature is not insupported                        */
339 #define HAL_SD_ERROR_BUSY                     SDMMC_ERROR_BUSY                        /*!< Error when transfer process is busy                          */
340 #define HAL_SD_ERROR_DMA                      SDMMC_ERROR_DMA                         /*!< Error while DMA transfer                                     */
341 #define HAL_SD_ERROR_TIMEOUT                  SDMMC_ERROR_TIMEOUT                     /*!< Timeout error                                                */
342 
343 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
344 #define HAL_SD_ERROR_INVALID_CALLBACK         SDMMC_ERROR_INVALID_PARAMETER       /*!< Invalid callback error                                        */
345 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
346 /**
347   * @}
348   */
349 
350 /** @defgroup SD_Exported_Constansts_Group2 SD context enumeration
351   * @{
352   */
353 #define   SD_CONTEXT_NONE                 ((uint32_t)0x00000000U)  /*!< None                             */
354 #define   SD_CONTEXT_READ_SINGLE_BLOCK    ((uint32_t)0x00000001U)  /*!< Read single block operation      */
355 #define   SD_CONTEXT_READ_MULTIPLE_BLOCK  ((uint32_t)0x00000002U)  /*!< Read multiple blocks operation   */
356 #define   SD_CONTEXT_WRITE_SINGLE_BLOCK   ((uint32_t)0x00000010U)  /*!< Write single block operation     */
357 #define   SD_CONTEXT_WRITE_MULTIPLE_BLOCK ((uint32_t)0x00000020U)  /*!< Write multiple blocks operation  */
358 #define   SD_CONTEXT_IT                   ((uint32_t)0x00000008U)  /*!< Process in Interrupt mode        */
359 #define   SD_CONTEXT_DMA                  ((uint32_t)0x00000080U)  /*!< Process in DMA mode              */
360 
361 /**
362   * @}
363   */
364 
365 /** @defgroup SD_Exported_Constansts_Group3 SD Supported Memory Cards
366   * @{
367   */
368 #define CARD_NORMAL_SPEED        ((uint32_t)0x00000000U)    /*!< Normal Speed Card <12.5Mo/s , Spec Version 1.01    */
369 #define CARD_HIGH_SPEED          ((uint32_t)0x00000100U)    /*!< High Speed Card <25Mo/s , Spec version 2.00        */
370 #define CARD_ULTRA_HIGH_SPEED    ((uint32_t)0x00000200U)    /*!< UHS-I SD Card <50Mo/s for SDR50, DDR5 Cards
371                                                                  and <104Mo/s for SDR104, Spec version 3.01          */
372 
373 #define CARD_SDSC                  ((uint32_t)0x00000000U)  /*!< SD Standard Capacity <2Go                          */
374 #define CARD_SDHC_SDXC             ((uint32_t)0x00000001U)  /*!< SD High Capacity <32Go, SD Extended Capacity <2To  */
375 #define CARD_SECURED               ((uint32_t)0x00000003U)
376 
377 /**
378   * @}
379   */
380 
381 /** @defgroup SD_Exported_Constansts_Group4 SD Supported Version
382   * @{
383   */
384 #define CARD_V1_X                  ((uint32_t)0x00000000U)
385 #define CARD_V2_X                  ((uint32_t)0x00000001U)
386 /**
387   * @}
388   */
389 
390 /**
391   * @}
392   */
393 
394 /* Exported macro ------------------------------------------------------------*/
395 /** @defgroup SD_Exported_macros SD Exported Macros
396   *  @brief macros to handle interrupts and specific clock configurations
397   * @{
398   */
399 /** @brief Reset SD handle state.
400   * @param  __HANDLE__ SD Handle.
401   * @retval None
402   */
403 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
404 #define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__)           do {                                              \
405                                                                (__HANDLE__)->State = HAL_SD_STATE_RESET; \
406                                                                (__HANDLE__)->MspInitCallback = NULL;       \
407                                                                (__HANDLE__)->MspDeInitCallback = NULL;     \
408                                                              } while(0)
409 #else
410 #define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__)           ((__HANDLE__)->State = HAL_SD_STATE_RESET)
411 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
412 
413 /**
414   * @brief  Enable the SD device interrupt.
415   * @param  __HANDLE__ SD Handle.
416   * @param  __INTERRUPT__ specifies the SDMMC interrupt sources to be enabled.
417   *         This parameter can be one or a combination of the following values:
418   *            @arg SDMMC_IT_CCRCFAIL:   Command response received (CRC check failed) interrupt
419   *            @arg SDMMC_IT_DCRCFAIL:   Data block sent/received (CRC check failed) interrupt
420   *            @arg SDMMC_IT_CTIMEOUT:   Command response timeout interrupt
421   *            @arg SDMMC_IT_DTIMEOUT:   Data timeout interrupt
422   *            @arg SDMMC_IT_TXUNDERR:   Transmit FIFO underrun error interrupt
423   *            @arg SDMMC_IT_RXOVERR:    Received FIFO overrun error interrupt
424   *            @arg SDMMC_IT_CMDREND:    Command response received (CRC check passed) interrupt
425   *            @arg SDMMC_IT_CMDSENT:    Command sent (no response required) interrupt
426   *            @arg SDMMC_IT_DATAEND:    Data end (data counter, DATACOUNT, is zero) interrupt
427   *            @arg SDMMC_IT_DHOLD:      Data transfer Hold interrupt
428   *            @arg SDMMC_IT_DBCKEND:    Data block sent/received (CRC check passed) interrupt
429   *            @arg SDMMC_IT_DABORT:     Data transfer aborted by CMD12 interrupt
430   *            @arg SDMMC_IT_TXFIFOHE:   Transmit FIFO Half Empty interrupt
431   *            @arg SDMMC_IT_RXFIFOHF:   Receive FIFO Half Full interrupt
432   *            @arg SDMMC_IT_RXFIFOF:    Receive FIFO full interrupt
433   *            @arg SDMMC_IT_TXFIFOE:    Transmit FIFO empty interrupt
434   *            @arg SDMMC_IT_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected interrupt
435   *            @arg SDMMC_IT_SDIOIT:     SDIO interrupt received interrupt
436   *            @arg SDMMC_IT_ACKFAIL:    Boot Acknowledgment received interrupt
437   *            @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
438   *            @arg SDMMC_IT_VSWEND:     Voltage switch critical timing section completion interrupt
439   *            @arg SDMMC_IT_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure interrupt
440   *            @arg SDMMC_IT_IDMABTC:    IDMA buffer transfer complete interrupt
441   * @retval None
442   */
443 #define __HAL_SD_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
444 
445 /**
446   * @brief  Disable the SD device interrupt.
447   * @param  __HANDLE__ SD Handle.
448   * @param  __INTERRUPT__ specifies the SDMMC interrupt sources to be disabled.
449   *          This parameter can be one or a combination of the following values:
450   *            @arg SDMMC_IT_CCRCFAIL:   Command response received (CRC check failed) interrupt
451   *            @arg SDMMC_IT_DCRCFAIL:   Data block sent/received (CRC check failed) interrupt
452   *            @arg SDMMC_IT_CTIMEOUT:   Command response timeout interrupt
453   *            @arg SDMMC_IT_DTIMEOUT:   Data timeout interrupt
454   *            @arg SDMMC_IT_TXUNDERR:   Transmit FIFO underrun error interrupt
455   *            @arg SDMMC_IT_RXOVERR:    Received FIFO overrun error interrupt
456   *            @arg SDMMC_IT_CMDREND:    Command response received (CRC check passed) interrupt
457   *            @arg SDMMC_IT_CMDSENT:    Command sent (no response required) interrupt
458   *            @arg SDMMC_IT_DATAEND:    Data end (data counter, DATACOUNT, is zero) interrupt
459   *            @arg SDMMC_IT_DHOLD:      Data transfer Hold interrupt
460   *            @arg SDMMC_IT_DBCKEND:    Data block sent/received (CRC check passed) interrupt
461   *            @arg SDMMC_IT_DABORT:     Data transfer aborted by CMD12 interrupt
462   *            @arg SDMMC_IT_TXFIFOHE:   Transmit FIFO Half Empty interrupt
463   *            @arg SDMMC_IT_RXFIFOHF:   Receive FIFO Half Full interrupt
464   *            @arg SDMMC_IT_RXFIFOF:    Receive FIFO full interrupt
465   *            @arg SDMMC_IT_TXFIFOE:    Transmit FIFO empty interrupt
466   *            @arg SDMMC_IT_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected interrupt
467   *            @arg SDMMC_IT_SDIOIT:     SDIO interrupt received interrupt
468   *            @arg SDMMC_IT_ACKFAIL:    Boot Acknowledgment received interrupt
469   *            @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
470   *            @arg SDMMC_IT_VSWEND:     Voltage switch critical timing section completion interrupt
471   *            @arg SDMMC_IT_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure interrupt
472   *            @arg SDMMC_IT_IDMABTC:    IDMA buffer transfer complete interrupt
473   * @retval None
474   */
475 #define __HAL_SD_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
476 
477 /**
478   * @brief  Check whether the specified SD flag is set or not.
479   * @param  __HANDLE__ SD Handle.
480   * @param  __FLAG__ specifies the flag to check.
481   *          This parameter can be one of the following values:
482   *            @arg SDMMC_FLAG_CCRCFAIL:   Command response received (CRC check failed)
483   *            @arg SDMMC_FLAG_DCRCFAIL:   Data block sent/received (CRC check failed)
484   *            @arg SDMMC_FLAG_CTIMEOUT:   Command response timeout
485   *            @arg SDMMC_FLAG_DTIMEOUT:   Data timeout
486   *            @arg SDMMC_FLAG_TXUNDERR:   Transmit FIFO underrun error
487   *            @arg SDMMC_FLAG_RXOVERR:    Received FIFO overrun error
488   *            @arg SDMMC_FLAG_CMDREND:    Command response received (CRC check passed)
489   *            @arg SDMMC_FLAG_CMDSENT:    Command sent (no response required)
490   *            @arg SDMMC_FLAG_DATAEND:    Data end (data counter, DATACOUNT, is zero)
491   *            @arg SDMMC_FLAG_DHOLD:      Data transfer Hold
492   *            @arg SDMMC_FLAG_DBCKEND:    Data block sent/received (CRC check passed)
493   *            @arg SDMMC_FLAG_DABORT:     Data transfer aborted by CMD12
494   *            @arg SDMMC_FLAG_DPSMACT:    Data path state machine active
495   *            @arg SDMMC_FLAG_CPSMACT:    Command path state machine active
496   *            @arg SDMMC_FLAG_TXFIFOHE:   Transmit FIFO Half Empty
497   *            @arg SDMMC_FLAG_RXFIFOHF:   Receive FIFO Half Full
498   *            @arg SDMMC_FLAG_TXFIFOF:    Transmit FIFO full
499   *            @arg SDMMC_FLAG_RXFIFOF:    Receive FIFO full
500   *            @arg SDMMC_FLAG_TXFIFOE:    Transmit FIFO empty
501   *            @arg SDMMC_FLAG_RXFIFOE:    Receive FIFO empty
502   *            @arg SDMMC_FLAG_BUSYD0:     Inverted value of SDMMC_D0 line (Busy)
503   *            @arg SDMMC_FLAG_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected
504   *            @arg SDMMC_FLAG_SDIOIT:     SDIO interrupt received
505   *            @arg SDMMC_FLAG_ACKFAIL:    Boot Acknowledgment received
506   *            @arg SDMMC_FLAG_ACKTIMEOUT: Boot Acknowledgment timeout
507   *            @arg SDMMC_FLAG_VSWEND:     Voltage switch critical timing section completion
508   *            @arg SDMMC_FLAG_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure
509   *            @arg SDMMC_FLAG_IDMATE:     IDMA transfer error
510   *            @arg SDMMC_FLAG_IDMABTC:    IDMA buffer transfer complete
511   * @retval The new state of SD FLAG (SET or RESET).
512   */
513 #define __HAL_SD_GET_FLAG(__HANDLE__, __FLAG__) __SDMMC_GET_FLAG((__HANDLE__)->Instance, (__FLAG__))
514 
515 /**
516   * @brief  Clear the SD's pending flags.
517   * @param  __HANDLE__ SD Handle.
518   * @param  __FLAG__ specifies the flag to clear.
519   *          This parameter can be one or a combination of the following values:
520   *            @arg SDMMC_FLAG_CCRCFAIL:   Command response received (CRC check failed)
521   *            @arg SDMMC_FLAG_DCRCFAIL:   Data block sent/received (CRC check failed)
522   *            @arg SDMMC_FLAG_CTIMEOUT:   Command response timeout
523   *            @arg SDMMC_FLAG_DTIMEOUT:   Data timeout
524   *            @arg SDMMC_FLAG_TXUNDERR:   Transmit FIFO underrun error
525   *            @arg SDMMC_FLAG_RXOVERR:    Received FIFO overrun error
526   *            @arg SDMMC_FLAG_CMDREND:    Command response received (CRC check passed)
527   *            @arg SDMMC_FLAG_CMDSENT:    Command sent (no response required)
528   *            @arg SDMMC_FLAG_DATAEND:    Data end (data counter, DATACOUNT, is zero)
529   *            @arg SDMMC_FLAG_DHOLD:      Data transfer Hold
530   *            @arg SDMMC_FLAG_DBCKEND:    Data block sent/received (CRC check passed)
531   *            @arg SDMMC_FLAG_DABORT:     Data transfer aborted by CMD12
532   *            @arg SDMMC_FLAG_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected
533   *            @arg SDMMC_FLAG_SDIOIT:     SDIO interrupt received
534   *            @arg SDMMC_FLAG_ACKFAIL:    Boot Acknowledgment received
535   *            @arg SDMMC_FLAG_ACKTIMEOUT: Boot Acknowledgment timeout
536   *            @arg SDMMC_FLAG_VSWEND:     Voltage switch critical timing section completion
537   *            @arg SDMMC_FLAG_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure
538   *            @arg SDMMC_FLAG_IDMATE:     IDMA transfer error
539   *            @arg SDMMC_FLAG_IDMABTC:    IDMA buffer transfer complete
540   * @retval None
541   */
542 #define __HAL_SD_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDMMC_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__))
543 
544 /**
545   * @brief  Check whether the specified SD interrupt has occurred or not.
546   * @param  __HANDLE__ SD Handle.
547   * @param  __INTERRUPT__ specifies the SDMMC interrupt source to check.
548   *          This parameter can be one of the following values:
549   *            @arg SDMMC_IT_CCRCFAIL:   Command response received (CRC check failed) interrupt
550   *            @arg SDMMC_IT_DCRCFAIL:   Data block sent/received (CRC check failed) interrupt
551   *            @arg SDMMC_IT_CTIMEOUT:   Command response timeout interrupt
552   *            @arg SDMMC_IT_DTIMEOUT:   Data timeout interrupt
553   *            @arg SDMMC_IT_TXUNDERR:   Transmit FIFO underrun error interrupt
554   *            @arg SDMMC_IT_RXOVERR:    Received FIFO overrun error interrupt
555   *            @arg SDMMC_IT_CMDREND:    Command response received (CRC check passed) interrupt
556   *            @arg SDMMC_IT_CMDSENT:    Command sent (no response required) interrupt
557   *            @arg SDMMC_IT_DATAEND:    Data end (data counter, DATACOUNT, is zero) interrupt
558   *            @arg SDMMC_IT_DHOLD:      Data transfer Hold interrupt
559   *            @arg SDMMC_IT_DBCKEND:    Data block sent/received (CRC check passed) interrupt
560   *            @arg SDMMC_IT_DABORT:     Data transfer aborted by CMD12 interrupt
561   *            @arg SDMMC_IT_TXFIFOHE:   Transmit FIFO Half Empty interrupt
562   *            @arg SDMMC_IT_RXFIFOHF:   Receive FIFO Half Full interrupt
563   *            @arg SDMMC_IT_RXFIFOF:    Receive FIFO full interrupt
564   *            @arg SDMMC_IT_TXFIFOE:    Transmit FIFO empty interrupt
565   *            @arg SDMMC_IT_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected interrupt
566   *            @arg SDMMC_IT_SDIOIT:     SDIO interrupt received interrupt
567   *            @arg SDMMC_IT_ACKFAIL:    Boot Acknowledgment received interrupt
568   *            @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
569   *            @arg SDMMC_IT_VSWEND:     Voltage switch critical timing section completion interrupt
570   *            @arg SDMMC_IT_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure interrupt
571   *            @arg SDMMC_IT_IDMABTC:    IDMA buffer transfer complete interrupt
572   * @retval The new state of SD IT (SET or RESET).
573   */
574 #define __HAL_SD_GET_IT(__HANDLE__, __INTERRUPT__) __SDMMC_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__))
575 
576 /**
577   * @brief  Clear the SD's interrupt pending bits.
578   * @param  __HANDLE__ SD Handle.
579   * @param  __INTERRUPT__ specifies the interrupt pending bit to clear.
580   *          This parameter can be one or a combination of the following values:
581   *            @arg SDMMC_IT_CCRCFAIL:   Command response received (CRC check failed) interrupt
582   *            @arg SDMMC_IT_DCRCFAIL:   Data block sent/received (CRC check failed) interrupt
583   *            @arg SDMMC_IT_CTIMEOUT:   Command response timeout interrupt
584   *            @arg SDMMC_IT_DTIMEOUT:   Data timeout interrupt
585   *            @arg SDMMC_IT_TXUNDERR:   Transmit FIFO underrun error interrupt
586   *            @arg SDMMC_IT_RXOVERR:    Received FIFO overrun error interrupt
587   *            @arg SDMMC_IT_CMDREND:    Command response received (CRC check passed) interrupt
588   *            @arg SDMMC_IT_CMDSENT:    Command sent (no response required) interrupt
589   *            @arg SDMMC_IT_DATAEND:    Data end (data counter, DATACOUNT, is zero) interrupt
590   *            @arg SDMMC_IT_DHOLD:      Data transfer Hold interrupt
591   *            @arg SDMMC_IT_DBCKEND:    Data block sent/received (CRC check passed) interrupt
592   *            @arg SDMMC_IT_DABORT:     Data transfer aborted by CMD12 interrupt
593   *            @arg SDMMC_IT_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected interrupt
594   *            @arg SDMMC_IT_SDIOIT:     SDIO interrupt received interrupt
595   *            @arg SDMMC_IT_ACKFAIL:    Boot Acknowledgment received interrupt
596   *            @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
597   *            @arg SDMMC_IT_VSWEND:     Voltage switch critical timing section completion interrupt
598   *            @arg SDMMC_IT_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure interrupt
599   *            @arg SDMMC_IT_IDMABTC:    IDMA buffer transfer complete interrupt
600   * @retval None
601   */
602 #define __HAL_SD_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDMMC_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__))
603 
604 /**
605   * @}
606   */
607 
608 /* Include SD HAL Extension module */
609 #include "stm32h5xx_hal_sd_ex.h"
610 
611 /* Exported functions --------------------------------------------------------*/
612 /** @defgroup SD_Exported_Functions SD Exported Functions
613   * @{
614   */
615 
616 /** @defgroup SD_Exported_Functions_Group1 Initialization and de-initialization functions
617   * @{
618   */
619 HAL_StatusTypeDef HAL_SD_Init(SD_HandleTypeDef *hsd);
620 HAL_StatusTypeDef HAL_SD_InitCard(SD_HandleTypeDef *hsd);
621 HAL_StatusTypeDef HAL_SD_DeInit(SD_HandleTypeDef *hsd);
622 void              HAL_SD_MspInit(SD_HandleTypeDef *hsd);
623 void              HAL_SD_MspDeInit(SD_HandleTypeDef *hsd);
624 /**
625   * @}
626   */
627 
628 /** @defgroup SD_Exported_Functions_Group2 Input and Output operation functions
629   * @{
630   */
631 /* Blocking mode: Polling */
632 HAL_StatusTypeDef HAL_SD_ReadBlocks(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks,
633                                     uint32_t Timeout);
634 HAL_StatusTypeDef HAL_SD_WriteBlocks(SD_HandleTypeDef *hsd, const uint8_t *pData, uint32_t BlockAdd,
635                                      uint32_t NumberOfBlocks, uint32_t Timeout);
636 HAL_StatusTypeDef HAL_SD_Erase(SD_HandleTypeDef *hsd, uint32_t BlockStartAdd, uint32_t BlockEndAdd);
637 /* Non-Blocking mode: IT */
638 HAL_StatusTypeDef HAL_SD_ReadBlocks_IT(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd,
639                                        uint32_t NumberOfBlocks);
640 HAL_StatusTypeDef HAL_SD_WriteBlocks_IT(SD_HandleTypeDef *hsd, const uint8_t *pData, uint32_t BlockAdd,
641                                         uint32_t NumberOfBlocks);
642 /* Non-Blocking mode: DMA */
643 HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd,
644                                         uint32_t NumberOfBlocks);
645 HAL_StatusTypeDef HAL_SD_WriteBlocks_DMA(SD_HandleTypeDef *hsd, const uint8_t *pData, uint32_t BlockAdd,
646                                          uint32_t NumberOfBlocks);
647 
648 void              HAL_SD_IRQHandler(SD_HandleTypeDef *hsd);
649 
650 /* Callback in non blocking modes (DMA) */
651 void              HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd);
652 void              HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd);
653 void              HAL_SD_ErrorCallback(SD_HandleTypeDef *hsd);
654 void              HAL_SD_AbortCallback(SD_HandleTypeDef *hsd);
655 
656 #if (USE_SD_TRANSCEIVER != 0U)
657 /* Callback to switch in 1.8V mode */
658 void              HAL_SD_DriveTransceiver_1_8V_Callback(FlagStatus status);
659 #endif /* USE_SD_TRANSCEIVER */
660 
661 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
662 /* SD callback registering/unregistering */
663 HAL_StatusTypeDef HAL_SD_RegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID,
664                                           pSD_CallbackTypeDef pCallback);
665 HAL_StatusTypeDef HAL_SD_UnRegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID);
666 
667 #if (USE_SD_TRANSCEIVER != 0U)
668 HAL_StatusTypeDef HAL_SD_RegisterTransceiverCallback(SD_HandleTypeDef *hsd, pSD_TransceiverCallbackTypeDef pCallback);
669 HAL_StatusTypeDef HAL_SD_UnRegisterTransceiverCallback(SD_HandleTypeDef *hsd);
670 #endif /* USE_SD_TRANSCEIVER */
671 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
672 
673 /**
674   * @}
675   */
676 
677 /** @defgroup SD_Exported_Functions_Group3 Peripheral Control functions
678   * @{
679   */
680 HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation(SD_HandleTypeDef *hsd, uint32_t WideMode);
681 HAL_StatusTypeDef HAL_SD_ConfigSpeedBusOperation(SD_HandleTypeDef *hsd, uint32_t SpeedMode);
682 /**
683   * @}
684   */
685 
686 /** @defgroup SD_Exported_Functions_Group4 SD card related functions
687   * @{
688   */
689 HAL_SD_CardStateTypeDef HAL_SD_GetCardState(SD_HandleTypeDef *hsd);
690 HAL_StatusTypeDef       HAL_SD_GetCardCID(SD_HandleTypeDef *hsd, HAL_SD_CardCIDTypeDef *pCID);
691 HAL_StatusTypeDef       HAL_SD_GetCardCSD(SD_HandleTypeDef *hsd, HAL_SD_CardCSDTypeDef *pCSD);
692 HAL_StatusTypeDef       HAL_SD_GetCardStatus(SD_HandleTypeDef *hsd, HAL_SD_CardStatusTypeDef *pStatus);
693 HAL_StatusTypeDef       HAL_SD_GetCardInfo(SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypeDef *pCardInfo);
694 /**
695   * @}
696   */
697 
698 /** @defgroup SD_Exported_Functions_Group5 Peripheral State and Errors functions
699   * @{
700   */
701 HAL_SD_StateTypeDef HAL_SD_GetState(SD_HandleTypeDef *hsd);
702 uint32_t            HAL_SD_GetError(SD_HandleTypeDef *hsd);
703 /**
704   * @}
705   */
706 
707 /** @defgroup SD_Exported_Functions_Group6 Perioheral Abort management
708   * @{
709   */
710 HAL_StatusTypeDef HAL_SD_Abort(SD_HandleTypeDef *hsd);
711 HAL_StatusTypeDef HAL_SD_Abort_IT(SD_HandleTypeDef *hsd);
712 /**
713   * @}
714   */
715 
716 /* Private types -------------------------------------------------------------*/
717 /** @defgroup SD_Private_Types SD Private Types
718   * @{
719   */
720 
721 /**
722   * @}
723   */
724 
725 /* Private defines -----------------------------------------------------------*/
726 /** @defgroup SD_Private_Defines SD Private Defines
727   * @{
728   */
729 
730 /**
731   * @}
732   */
733 
734 /* Private variables ---------------------------------------------------------*/
735 /** @defgroup SD_Private_Variables SD Private Variables
736   * @{
737   */
738 
739 /**
740   * @}
741   */
742 
743 /* Private constants ---------------------------------------------------------*/
744 /** @defgroup SD_Private_Constants SD Private Constants
745   * @{
746   */
747 
748 /**
749   * @}
750   */
751 
752 /* Private macros ------------------------------------------------------------*/
753 /** @defgroup SD_Private_Macros SD Private Macros
754   * @{
755   */
756 
757 /**
758   * @}
759   */
760 
761 /* Private functions prototypes ----------------------------------------------*/
762 /** @defgroup SD_Private_Functions_Prototypes SD Private Functions Prototypes
763   * @{
764   */
765 
766 /**
767   * @}
768   */
769 
770 /* Private functions ---------------------------------------------------------*/
771 /** @defgroup SD_Private_Functions SD Private Functions
772   * @{
773   */
774 
775 /**
776   * @}
777   */
778 
779 
780 /**
781   * @}
782   */
783 
784 /**
785   * @}
786   */
787 #endif /* SDMMC1 || SDMMC2 */
788 
789 /**
790   * @}
791   */
792 
793 #ifdef __cplusplus
794 }
795 #endif
796 
797 
798 #endif /* STM32H5xx_HAL_SD_H */
799