STM32H735xx HAL User Manual
stm32h7xx_hal_sd.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h7xx_hal_sd.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of SD HAL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2017 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32H7xx_HAL_SD_H
00021 #define STM32H7xx_HAL_SD_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32h7xx_ll_sdmmc.h"
00029 #if defined (DLYB_SDMMC1) || defined (DLYB_SDMMC2) || defined (DLYB_SDMMC3)
00030 #include "stm32h7xx_ll_delayblock.h"
00031 #endif /* (DLYB_SDMMC1) || (DLYB_SDMMC2) */
00032 
00033 /** @addtogroup STM32H7xx_HAL_Driver
00034   * @{
00035   */
00036 
00037 /** @defgroup SD SD
00038   * @brief SD HAL module driver
00039   * @{
00040   */
00041 
00042 /* Exported types ------------------------------------------------------------*/
00043 /** @defgroup SD_Exported_Types SD Exported Types
00044   * @{
00045   */
00046 
00047 /** @defgroup SD_Exported_Types_Group1 SD State enumeration structure
00048   * @{
00049   */
00050 typedef enum
00051 {
00052   HAL_SD_STATE_RESET                  = ((uint32_t)0x00000000U),  /*!< SD not yet initialized or disabled  */
00053   HAL_SD_STATE_READY                  = ((uint32_t)0x00000001U),  /*!< SD initialized and ready for use    */
00054   HAL_SD_STATE_TIMEOUT                = ((uint32_t)0x00000002U),  /*!< SD Timeout state                    */
00055   HAL_SD_STATE_BUSY                   = ((uint32_t)0x00000003U),  /*!< SD process ongoing                  */
00056   HAL_SD_STATE_PROGRAMMING            = ((uint32_t)0x00000004U),  /*!< SD Programming State                */
00057   HAL_SD_STATE_RECEIVING              = ((uint32_t)0x00000005U),  /*!< SD Receiving State                  */
00058   HAL_SD_STATE_TRANSFER               = ((uint32_t)0x00000006U),  /*!< SD Transfer State                   */
00059   HAL_SD_STATE_ERROR                  = ((uint32_t)0x0000000FU)   /*!< SD is in error state                */
00060 } HAL_SD_StateTypeDef;
00061 /**
00062   * @}
00063   */
00064 
00065 /** @defgroup SD_Exported_Types_Group2 SD Card State enumeration structure
00066   * @{
00067   */
00068 typedef uint32_t HAL_SD_CardStateTypeDef;
00069 
00070 #define HAL_SD_CARD_READY          0x00000001U  /*!< Card state is ready                     */
00071 #define HAL_SD_CARD_IDENTIFICATION 0x00000002U  /*!< Card is in identification state         */
00072 #define HAL_SD_CARD_STANDBY        0x00000003U  /*!< Card is in standby state                */
00073 #define HAL_SD_CARD_TRANSFER       0x00000004U  /*!< Card is in transfer state               */
00074 #define HAL_SD_CARD_SENDING        0x00000005U  /*!< Card is sending an operation            */
00075 #define HAL_SD_CARD_RECEIVING      0x00000006U  /*!< Card is receiving operation information */
00076 #define HAL_SD_CARD_PROGRAMMING    0x00000007U  /*!< Card is in programming state            */
00077 #define HAL_SD_CARD_DISCONNECTED   0x00000008U  /*!< Card is disconnected                    */
00078 #define HAL_SD_CARD_ERROR          0x000000FFU  /*!< Card response Error                     */
00079 /**
00080   * @}
00081   */
00082 
00083 /** @defgroup SD_Exported_Types_Group3 SD Handle Structure definition
00084   * @{
00085   */
00086 #define SD_InitTypeDef      SDMMC_InitTypeDef
00087 #define SD_TypeDef          SDMMC_TypeDef
00088 
00089 /**
00090   * @brief  SD Card Information Structure definition
00091   */
00092 typedef struct
00093 {
00094   uint32_t CardType;                     /*!< Specifies the card Type                         */
00095 
00096   uint32_t CardVersion;                  /*!< Specifies the card version                      */
00097 
00098   uint32_t Class;                        /*!< Specifies the class of the card class           */
00099 
00100   uint32_t RelCardAdd;                   /*!< Specifies the Relative Card Address             */
00101 
00102   uint32_t BlockNbr;                     /*!< Specifies the Card Capacity in blocks           */
00103 
00104   uint32_t BlockSize;                    /*!< Specifies one block size in bytes               */
00105 
00106   uint32_t LogBlockNbr;                  /*!< Specifies the Card logical Capacity in blocks   */
00107 
00108   uint32_t LogBlockSize;                 /*!< Specifies logical block size in bytes           */
00109 
00110   uint32_t CardSpeed;                    /*!< Specifies the card Speed                        */
00111 
00112 } HAL_SD_CardInfoTypeDef;
00113 
00114 /**
00115   * @brief  SD handle Structure definition
00116   */
00117 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
00118 typedef struct __SD_HandleTypeDef
00119 #else
00120 typedef struct
00121 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
00122 {
00123   SD_TypeDef                   *Instance;        /*!< SD registers base address           */
00124 
00125   SD_InitTypeDef               Init;             /*!< SD required parameters              */
00126 
00127   HAL_LockTypeDef              Lock;             /*!< SD locking object                   */
00128 
00129   uint8_t                      *pTxBuffPtr;      /*!< Pointer to SD Tx transfer Buffer    */
00130 
00131   uint32_t                     TxXferSize;       /*!< SD Tx Transfer size                 */
00132 
00133   uint8_t                      *pRxBuffPtr;      /*!< Pointer to SD Rx transfer Buffer    */
00134 
00135   uint32_t                     RxXferSize;       /*!< SD Rx Transfer size                 */
00136 
00137   __IO uint32_t                Context;          /*!< SD transfer context                 */
00138 
00139   __IO HAL_SD_StateTypeDef     State;            /*!< SD card State                       */
00140 
00141   __IO uint32_t                ErrorCode;        /*!< SD Card Error codes                 */
00142 
00143   HAL_SD_CardInfoTypeDef       SdCard;           /*!< SD Card information                 */
00144 
00145   uint32_t                     CSD[4];           /*!< SD card specific data table         */
00146 
00147   uint32_t                     CID[4];           /*!< SD card identification number table */
00148 
00149 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
00150   void (* TxCpltCallback)(struct __SD_HandleTypeDef *hsd);
00151   void (* RxCpltCallback)(struct __SD_HandleTypeDef *hsd);
00152   void (* ErrorCallback)(struct __SD_HandleTypeDef *hsd);
00153   void (* AbortCpltCallback)(struct __SD_HandleTypeDef *hsd);
00154   void (* Read_DMADblBuf0CpltCallback)(struct __SD_HandleTypeDef *hsd);
00155   void (* Read_DMADblBuf1CpltCallback)(struct __SD_HandleTypeDef *hsd);
00156   void (* Write_DMADblBuf0CpltCallback)(struct __SD_HandleTypeDef *hsd);
00157   void (* Write_DMADblBuf1CpltCallback)(struct __SD_HandleTypeDef *hsd);
00158 #if (USE_SD_TRANSCEIVER != 0U)
00159   void (* DriveTransceiver_1_8V_Callback)(FlagStatus status);
00160 #endif /* USE_SD_TRANSCEIVER */
00161 
00162   void (* MspInitCallback)(struct __SD_HandleTypeDef *hsd);
00163   void (* MspDeInitCallback)(struct __SD_HandleTypeDef *hsd);
00164 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
00165 } SD_HandleTypeDef;
00166 
00167 /**
00168   * @}
00169   */
00170 
00171 /** @defgroup SD_Exported_Types_Group4 Card Specific Data: CSD Register
00172   * @{
00173   */
00174 typedef struct
00175 {
00176   __IO uint8_t  CSDStruct;            /*!< CSD structure                         */
00177   __IO uint8_t  SysSpecVersion;       /*!< System specification version          */
00178   __IO uint8_t  Reserved1;            /*!< Reserved                              */
00179   __IO uint8_t  TAAC;                 /*!< Data read access time 1               */
00180   __IO uint8_t  NSAC;                 /*!< Data read access time 2 in CLK cycles */
00181   __IO uint8_t  MaxBusClkFrec;        /*!< Max. bus clock frequency              */
00182   __IO uint16_t CardComdClasses;      /*!< Card command classes                  */
00183   __IO uint8_t  RdBlockLen;           /*!< Max. read data block length           */
00184   __IO uint8_t  PartBlockRead;        /*!< Partial blocks for read allowed       */
00185   __IO uint8_t  WrBlockMisalign;      /*!< Write block misalignment              */
00186   __IO uint8_t  RdBlockMisalign;      /*!< Read block misalignment               */
00187   __IO uint8_t  DSRImpl;              /*!< DSR implemented                       */
00188   __IO uint8_t  Reserved2;            /*!< Reserved                              */
00189   __IO uint32_t DeviceSize;           /*!< Device Size                           */
00190   __IO uint8_t  MaxRdCurrentVDDMin;   /*!< Max. read current @ VDD min           */
00191   __IO uint8_t  MaxRdCurrentVDDMax;   /*!< Max. read current @ VDD max           */
00192   __IO uint8_t  MaxWrCurrentVDDMin;   /*!< Max. write current @ VDD min          */
00193   __IO uint8_t  MaxWrCurrentVDDMax;   /*!< Max. write current @ VDD max          */
00194   __IO uint8_t  DeviceSizeMul;        /*!< Device size multiplier                */
00195   __IO uint8_t  EraseGrSize;          /*!< Erase group size                      */
00196   __IO uint8_t  EraseGrMul;           /*!< Erase group size multiplier           */
00197   __IO uint8_t  WrProtectGrSize;      /*!< Write protect group size              */
00198   __IO uint8_t  WrProtectGrEnable;    /*!< Write protect group enable            */
00199   __IO uint8_t  ManDeflECC;           /*!< Manufacturer default ECC              */
00200   __IO uint8_t  WrSpeedFact;          /*!< Write speed factor                    */
00201   __IO uint8_t  MaxWrBlockLen;        /*!< Max. write data block length          */
00202   __IO uint8_t  WriteBlockPaPartial;  /*!< Partial blocks for write allowed      */
00203   __IO uint8_t  Reserved3;            /*!< Reserved                              */
00204   __IO uint8_t  ContentProtectAppli;  /*!< Content protection application        */
00205   __IO uint8_t  FileFormatGroup;      /*!< File format group                     */
00206   __IO uint8_t  CopyFlag;             /*!< Copy flag (OTP)                       */
00207   __IO uint8_t  PermWrProtect;        /*!< Permanent write protection            */
00208   __IO uint8_t  TempWrProtect;        /*!< Temporary write protection            */
00209   __IO uint8_t  FileFormat;           /*!< File format                           */
00210   __IO uint8_t  ECC;                  /*!< ECC code                              */
00211   __IO uint8_t  CSD_CRC;              /*!< CSD CRC                               */
00212   __IO uint8_t  Reserved4;            /*!< Always 1                              */
00213 } HAL_SD_CardCSDTypeDef;
00214 /**
00215   * @}
00216   */
00217 
00218 /** @defgroup SD_Exported_Types_Group5 Card Identification Data: CID Register
00219   * @{
00220   */
00221 typedef struct
00222 {
00223   __IO uint8_t  ManufacturerID;  /*!< Manufacturer ID       */
00224   __IO uint16_t OEM_AppliID;     /*!< OEM/Application ID    */
00225   __IO uint32_t ProdName1;       /*!< Product Name part1    */
00226   __IO uint8_t  ProdName2;       /*!< Product Name part2    */
00227   __IO uint8_t  ProdRev;         /*!< Product Revision      */
00228   __IO uint32_t ProdSN;          /*!< Product Serial Number */
00229   __IO uint8_t  Reserved1;       /*!< Reserved1             */
00230   __IO uint16_t ManufactDate;    /*!< Manufacturing Date    */
00231   __IO uint8_t  CID_CRC;         /*!< CID CRC               */
00232   __IO uint8_t  Reserved2;       /*!< Always 1              */
00233 
00234 } HAL_SD_CardCIDTypeDef;
00235 /**
00236   * @}
00237   */
00238 
00239 /** @defgroup SD_Exported_Types_Group6 SD Card Status returned by ACMD13
00240   * @{
00241   */
00242 typedef struct
00243 {
00244   __IO uint8_t  DataBusWidth;           /*!< Shows the currently defined data bus width                 */
00245   __IO uint8_t  SecuredMode;            /*!< Card is in secured mode of operation                       */
00246   __IO uint16_t CardType;               /*!< Carries information about card type                        */
00247   __IO uint32_t ProtectedAreaSize;      /*!< Carries information about the capacity of protected area   */
00248   __IO uint8_t  SpeedClass;             /*!< Carries information about the speed class of the card      */
00249   __IO uint8_t  PerformanceMove;        /*!< Carries information about the card's performance move      */
00250   __IO uint8_t  AllocationUnitSize;     /*!< Carries information about the card's allocation unit size  */
00251   __IO uint16_t EraseSize;              /*!< Determines the number of AUs to be erased in one operation */
00252   __IO uint8_t  EraseTimeout;           /*!< Determines the timeout for any number of AU erase          */
00253   __IO uint8_t  EraseOffset;            /*!< Carries information about the erase offset                 */
00254   __IO uint8_t  UhsSpeedGrade;          /*!< Carries information about the speed grade of UHS card      */
00255   __IO uint8_t  UhsAllocationUnitSize;  /*!< Carries information about the UHS card's allocation unit size  */
00256   __IO uint8_t  VideoSpeedClass;        /*!< Carries information about the Video Speed Class of UHS card    */
00257 } HAL_SD_CardStatusTypeDef;
00258 /**
00259   * @}
00260   */
00261 
00262 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
00263 /** @defgroup SD_Exported_Types_Group7 SD Callback ID enumeration definition
00264   * @{
00265   */
00266 typedef enum
00267 {
00268   HAL_SD_TX_CPLT_CB_ID                 = 0x00U,  /*!< SD Tx Complete Callback ID                     */
00269   HAL_SD_RX_CPLT_CB_ID                 = 0x01U,  /*!< SD Rx Complete Callback ID                     */
00270   HAL_SD_ERROR_CB_ID                   = 0x02U,  /*!< SD Error Callback ID                           */
00271   HAL_SD_ABORT_CB_ID                   = 0x03U,  /*!< SD Abort Callback ID                           */
00272   HAL_SD_READ_DMA_DBL_BUF0_CPLT_CB_ID  = 0x04U,  /*!< SD Rx DMA Double Buffer 0 Complete Callback ID */
00273   HAL_SD_READ_DMA_DBL_BUF1_CPLT_CB_ID  = 0x05U,  /*!< SD Rx DMA Double Buffer 1 Complete Callback ID */
00274   HAL_SD_WRITE_DMA_DBL_BUF0_CPLT_CB_ID = 0x06U,  /*!< SD Tx DMA Double Buffer 0 Complete Callback ID */
00275   HAL_SD_WRITE_DMA_DBL_BUF1_CPLT_CB_ID = 0x07U,  /*!< SD Tx DMA Double Buffer 1 Complete Callback ID */
00276 
00277   HAL_SD_MSP_INIT_CB_ID                = 0x10U,  /*!< SD MspInit Callback ID                         */
00278   HAL_SD_MSP_DEINIT_CB_ID              = 0x11U   /*!< SD MspDeInit Callback ID                       */
00279 } HAL_SD_CallbackIDTypeDef;
00280 /**
00281   * @}
00282   */
00283 
00284 /** @defgroup SD_Exported_Types_Group8 SD Callback pointer definition
00285   * @{
00286   */
00287 typedef void (*pSD_CallbackTypeDef)(SD_HandleTypeDef *hsd);
00288 #if (USE_SD_TRANSCEIVER != 0U)
00289 typedef void (*pSD_TransceiverCallbackTypeDef)(FlagStatus status);
00290 #endif /* USE_SD_TRANSCEIVER */
00291 /**
00292   * @}
00293   */
00294 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
00295 /**
00296   * @}
00297   */
00298 
00299 /* Exported constants --------------------------------------------------------*/
00300 /** @defgroup SD_Exported_Constants SD Exported Constants
00301   * @{
00302   */
00303 
00304 #define BLOCKSIZE   ((uint32_t)512U) /*!< Block size is 512 bytes */
00305 
00306 /** @defgroup SD_Exported_Constansts_Group1 SD Error status enumeration Structure definition
00307   * @{
00308   */
00309 #define HAL_SD_ERROR_NONE                     SDMMC_ERROR_NONE                        /*!< No error                                                     */
00310 #define HAL_SD_ERROR_CMD_CRC_FAIL             SDMMC_ERROR_CMD_CRC_FAIL                /*!< Command response received (but CRC check failed)             */
00311 #define HAL_SD_ERROR_DATA_CRC_FAIL            SDMMC_ERROR_DATA_CRC_FAIL               /*!< Data block sent/received (CRC check failed)                  */
00312 #define HAL_SD_ERROR_CMD_RSP_TIMEOUT          SDMMC_ERROR_CMD_RSP_TIMEOUT             /*!< Command response timeout                                     */
00313 #define HAL_SD_ERROR_DATA_TIMEOUT             SDMMC_ERROR_DATA_TIMEOUT                /*!< Data timeout                                                 */
00314 #define HAL_SD_ERROR_TX_UNDERRUN              SDMMC_ERROR_TX_UNDERRUN                 /*!< Transmit FIFO underrun                                       */
00315 #define HAL_SD_ERROR_RX_OVERRUN               SDMMC_ERROR_RX_OVERRUN                  /*!< Receive FIFO overrun                                         */
00316 #define HAL_SD_ERROR_ADDR_MISALIGNED          SDMMC_ERROR_ADDR_MISALIGNED             /*!< Misaligned address                                           */
00317 #define HAL_SD_ERROR_BLOCK_LEN_ERR            SDMMC_ERROR_BLOCK_LEN_ERR               /*!< Transferred block length is not allowed for the card or the  */
00318                                                                                       /*!< number of transferred bytes does not match the block length  */
00319 #define HAL_SD_ERROR_ERASE_SEQ_ERR            SDMMC_ERROR_ERASE_SEQ_ERR               /*!< An error in the sequence of erase command occurs             */
00320 #define HAL_SD_ERROR_BAD_ERASE_PARAM          SDMMC_ERROR_BAD_ERASE_PARAM             /*!< An invalid selection for erase groups                        */
00321 #define HAL_SD_ERROR_WRITE_PROT_VIOLATION     SDMMC_ERROR_WRITE_PROT_VIOLATION        /*!< Attempt to program a write protect block                     */
00322 #define HAL_SD_ERROR_LOCK_UNLOCK_FAILED       SDMMC_ERROR_LOCK_UNLOCK_FAILED          /*!< Sequence or password error has been detected in unlock       */
00323                                                                                       /*!< command or if there was an attempt to access a locked card   */
00324 #define HAL_SD_ERROR_COM_CRC_FAILED           SDMMC_ERROR_COM_CRC_FAILED              /*!< CRC check of the previous command failed                     */
00325 #define HAL_SD_ERROR_ILLEGAL_CMD              SDMMC_ERROR_ILLEGAL_CMD                 /*!< Command is not legal for the card state                      */
00326 #define HAL_SD_ERROR_CARD_ECC_FAILED          SDMMC_ERROR_CARD_ECC_FAILED             /*!< Card internal ECC was applied but failed to correct the data */
00327 #define HAL_SD_ERROR_CC_ERR                   SDMMC_ERROR_CC_ERR                      /*!< Internal card controller error                               */
00328 #define HAL_SD_ERROR_GENERAL_UNKNOWN_ERR      SDMMC_ERROR_GENERAL_UNKNOWN_ERR         /*!< General or unknown error                                     */
00329 #define HAL_SD_ERROR_STREAM_READ_UNDERRUN     SDMMC_ERROR_STREAM_READ_UNDERRUN        /*!< The card could not sustain data reading in stream rmode      */
00330 #define HAL_SD_ERROR_STREAM_WRITE_OVERRUN     SDMMC_ERROR_STREAM_WRITE_OVERRUN        /*!< The card could not sustain data programming in stream mode   */
00331 #define HAL_SD_ERROR_CID_CSD_OVERWRITE        SDMMC_ERROR_CID_CSD_OVERWRITE           /*!< CID/CSD overwrite error                                      */
00332 #define HAL_SD_ERROR_WP_ERASE_SKIP            SDMMC_ERROR_WP_ERASE_SKIP               /*!< Only partial address space was erased                        */
00333 #define HAL_SD_ERROR_CARD_ECC_DISABLED        SDMMC_ERROR_CARD_ECC_DISABLED           /*!< Command has been executed without using internal ECC         */
00334 #define HAL_SD_ERROR_ERASE_RESET              SDMMC_ERROR_ERASE_RESET                 /*!< Erase sequence was cleared before executing because an out   */
00335                                                                                       /*!< of erase sequence command was received                       */
00336 #define HAL_SD_ERROR_AKE_SEQ_ERR              SDMMC_ERROR_AKE_SEQ_ERR                 /*!< Error in sequence of authentication                          */
00337 #define HAL_SD_ERROR_INVALID_VOLTRANGE        SDMMC_ERROR_INVALID_VOLTRANGE           /*!< Error in case of invalid voltage range                       */
00338 #define HAL_SD_ERROR_ADDR_OUT_OF_RANGE        SDMMC_ERROR_ADDR_OUT_OF_RANGE           /*!< Error when addressed block is out of range                   */
00339 #define HAL_SD_ERROR_REQUEST_NOT_APPLICABLE   SDMMC_ERROR_REQUEST_NOT_APPLICABLE      /*!< Error when command request is not applicable                 */
00340 #define HAL_SD_ERROR_PARAM                    SDMMC_ERROR_INVALID_PARAMETER           /*!< the used parameter is not valid                              */
00341 #define HAL_SD_ERROR_UNSUPPORTED_FEATURE      SDMMC_ERROR_UNSUPPORTED_FEATURE         /*!< Error when feature is not insupported                        */
00342 #define HAL_SD_ERROR_BUSY                     SDMMC_ERROR_BUSY                        /*!< Error when transfer process is busy                          */
00343 #define HAL_SD_ERROR_DMA                      SDMMC_ERROR_DMA                         /*!< Error while DMA transfer                                     */
00344 #define HAL_SD_ERROR_TIMEOUT                  SDMMC_ERROR_TIMEOUT                     /*!< Timeout error                                                */
00345 
00346 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
00347 #define HAL_SD_ERROR_INVALID_CALLBACK         SDMMC_ERROR_INVALID_PARAMETER       /*!< Invalid callback error                                        */
00348 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
00349 /**
00350   * @}
00351   */
00352 
00353 /** @defgroup SD_Exported_Constansts_Group2 SD context enumeration
00354   * @{
00355   */
00356 #define   SD_CONTEXT_NONE                 ((uint32_t)0x00000000U)  /*!< None                             */
00357 #define   SD_CONTEXT_READ_SINGLE_BLOCK    ((uint32_t)0x00000001U)  /*!< Read single block operation      */
00358 #define   SD_CONTEXT_READ_MULTIPLE_BLOCK  ((uint32_t)0x00000002U)  /*!< Read multiple blocks operation   */
00359 #define   SD_CONTEXT_WRITE_SINGLE_BLOCK   ((uint32_t)0x00000010U)  /*!< Write single block operation     */
00360 #define   SD_CONTEXT_WRITE_MULTIPLE_BLOCK ((uint32_t)0x00000020U)  /*!< Write multiple blocks operation  */
00361 #define   SD_CONTEXT_IT                   ((uint32_t)0x00000008U)  /*!< Process in Interrupt mode        */
00362 #define   SD_CONTEXT_DMA                  ((uint32_t)0x00000080U)  /*!< Process in DMA mode              */
00363 
00364 /**
00365   * @}
00366   */
00367 
00368 /** @defgroup SD_Exported_Constansts_Group3 SD Supported Memory Cards
00369   * @{
00370   */
00371 #define CARD_NORMAL_SPEED        ((uint32_t)0x00000000U)    /*!< Normal Speed Card <12.5Mo/s , Spec Version 1.01    */
00372 #define CARD_HIGH_SPEED          ((uint32_t)0x00000100U)    /*!< High Speed Card <25Mo/s , Spec version 2.00        */
00373 #define CARD_ULTRA_HIGH_SPEED    ((uint32_t)0x00000200U)    /*!< UHS-I SD Card <50Mo/s for SDR50, DDR5 Cards
00374                                                                  and <104Mo/s for SDR104, Spec version 3.01          */
00375 
00376 #define CARD_SDSC                  ((uint32_t)0x00000000U)  /*!< SD Standard Capacity <2Go                          */
00377 #define CARD_SDHC_SDXC             ((uint32_t)0x00000001U)  /*!< SD High Capacity <32Go, SD Extended Capacity <2To  */
00378 #define CARD_SECURED               ((uint32_t)0x00000003U)
00379 
00380 /**
00381   * @}
00382   */
00383 
00384 /** @defgroup SD_Exported_Constansts_Group4 SD Supported Version
00385   * @{
00386   */
00387 #define CARD_V1_X                  ((uint32_t)0x00000000U)
00388 #define CARD_V2_X                  ((uint32_t)0x00000001U)
00389 /**
00390   * @}
00391   */
00392 
00393 /**
00394   * @}
00395   */
00396 
00397 /* Exported macro ------------------------------------------------------------*/
00398 /** @defgroup SD_Exported_macros SD Exported Macros
00399   *  @brief macros to handle interrupts and specific clock configurations
00400   * @{
00401   */
00402 /** @brief Reset SD handle state.
00403   * @param  __HANDLE__ SD Handle.
00404   * @retval None
00405   */
00406 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
00407 #define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__)           do {                                              \
00408                                                                (__HANDLE__)->State = HAL_SD_STATE_RESET; \
00409                                                                (__HANDLE__)->MspInitCallback = NULL;       \
00410                                                                (__HANDLE__)->MspDeInitCallback = NULL;     \
00411                                                              } while(0)
00412 #else
00413 #define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__)           ((__HANDLE__)->State = HAL_SD_STATE_RESET)
00414 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
00415 
00416 /**
00417   * @brief  Enable the SD device interrupt.
00418   * @param  __HANDLE__ SD Handle.
00419   * @param  __INTERRUPT__ specifies the SDMMC interrupt sources to be enabled.
00420   *         This parameter can be one or a combination of the following values:
00421   *            @arg SDMMC_IT_CCRCFAIL:   Command response received (CRC check failed) interrupt
00422   *            @arg SDMMC_IT_DCRCFAIL:   Data block sent/received (CRC check failed) interrupt
00423   *            @arg SDMMC_IT_CTIMEOUT:   Command response timeout interrupt
00424   *            @arg SDMMC_IT_DTIMEOUT:   Data timeout interrupt
00425   *            @arg SDMMC_IT_TXUNDERR:   Transmit FIFO underrun error interrupt
00426   *            @arg SDMMC_IT_RXOVERR:    Received FIFO overrun error interrupt
00427   *            @arg SDMMC_IT_CMDREND:    Command response received (CRC check passed) interrupt
00428   *            @arg SDMMC_IT_CMDSENT:    Command sent (no response required) interrupt
00429   *            @arg SDMMC_IT_DATAEND:    Data end (data counter, DATACOUNT, is zero) interrupt
00430   *            @arg SDMMC_IT_DHOLD:      Data transfer Hold interrupt
00431   *            @arg SDMMC_IT_DBCKEND:    Data block sent/received (CRC check passed) interrupt
00432   *            @arg SDMMC_IT_DABORT:     Data transfer aborted by CMD12 interrupt
00433   *            @arg SDMMC_IT_TXFIFOHE:   Transmit FIFO Half Empty interrupt
00434   *            @arg SDMMC_IT_RXFIFOHF:   Receive FIFO Half Full interrupt
00435   *            @arg SDMMC_IT_RXFIFOF:    Receive FIFO full interrupt
00436   *            @arg SDMMC_IT_TXFIFOE:    Transmit FIFO empty interrupt
00437   *            @arg SDMMC_IT_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected interrupt
00438   *            @arg SDMMC_IT_SDIOIT:     SDIO interrupt received interrupt
00439   *            @arg SDMMC_IT_ACKFAIL:    Boot Acknowledgment received interrupt
00440   *            @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
00441   *            @arg SDMMC_IT_VSWEND:     Voltage switch critical timing section completion interrupt
00442   *            @arg SDMMC_IT_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure interrupt
00443   *            @arg SDMMC_IT_IDMABTC:    IDMA buffer transfer complete interrupt
00444   * @retval None
00445   */
00446 #define __HAL_SD_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
00447 
00448 /**
00449   * @brief  Disable the SD device interrupt.
00450   * @param  __HANDLE__ SD Handle.
00451   * @param  __INTERRUPT__ specifies the SDMMC interrupt sources to be disabled.
00452   *          This parameter can be one or a combination of the following values:
00453   *            @arg SDMMC_IT_CCRCFAIL:   Command response received (CRC check failed) interrupt
00454   *            @arg SDMMC_IT_DCRCFAIL:   Data block sent/received (CRC check failed) interrupt
00455   *            @arg SDMMC_IT_CTIMEOUT:   Command response timeout interrupt
00456   *            @arg SDMMC_IT_DTIMEOUT:   Data timeout interrupt
00457   *            @arg SDMMC_IT_TXUNDERR:   Transmit FIFO underrun error interrupt
00458   *            @arg SDMMC_IT_RXOVERR:    Received FIFO overrun error interrupt
00459   *            @arg SDMMC_IT_CMDREND:    Command response received (CRC check passed) interrupt
00460   *            @arg SDMMC_IT_CMDSENT:    Command sent (no response required) interrupt
00461   *            @arg SDMMC_IT_DATAEND:    Data end (data counter, DATACOUNT, is zero) interrupt
00462   *            @arg SDMMC_IT_DHOLD:      Data transfer Hold interrupt
00463   *            @arg SDMMC_IT_DBCKEND:    Data block sent/received (CRC check passed) interrupt
00464   *            @arg SDMMC_IT_DABORT:     Data transfer aborted by CMD12 interrupt
00465   *            @arg SDMMC_IT_TXFIFOHE:   Transmit FIFO Half Empty interrupt
00466   *            @arg SDMMC_IT_RXFIFOHF:   Receive FIFO Half Full interrupt
00467   *            @arg SDMMC_IT_RXFIFOF:    Receive FIFO full interrupt
00468   *            @arg SDMMC_IT_TXFIFOE:    Transmit FIFO empty interrupt
00469   *            @arg SDMMC_IT_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected interrupt
00470   *            @arg SDMMC_IT_SDIOIT:     SDIO interrupt received interrupt
00471   *            @arg SDMMC_IT_ACKFAIL:    Boot Acknowledgment received interrupt
00472   *            @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
00473   *            @arg SDMMC_IT_VSWEND:     Voltage switch critical timing section completion interrupt
00474   *            @arg SDMMC_IT_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure interrupt
00475   *            @arg SDMMC_IT_IDMABTC:    IDMA buffer transfer complete interrupt
00476   * @retval None
00477   */
00478 #define __HAL_SD_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
00479 
00480 /**
00481   * @brief  Check whether the specified SD flag is set or not.
00482   * @param  __HANDLE__ SD Handle.
00483   * @param  __FLAG__ specifies the flag to check.
00484   *          This parameter can be one of the following values:
00485   *            @arg SDMMC_FLAG_CCRCFAIL:   Command response received (CRC check failed)
00486   *            @arg SDMMC_FLAG_DCRCFAIL:   Data block sent/received (CRC check failed)
00487   *            @arg SDMMC_FLAG_CTIMEOUT:   Command response timeout
00488   *            @arg SDMMC_FLAG_DTIMEOUT:   Data timeout
00489   *            @arg SDMMC_FLAG_TXUNDERR:   Transmit FIFO underrun error
00490   *            @arg SDMMC_FLAG_RXOVERR:    Received FIFO overrun error
00491   *            @arg SDMMC_FLAG_CMDREND:    Command response received (CRC check passed)
00492   *            @arg SDMMC_FLAG_CMDSENT:    Command sent (no response required)
00493   *            @arg SDMMC_FLAG_DATAEND:    Data end (data counter, DATACOUNT, is zero)
00494   *            @arg SDMMC_FLAG_DHOLD:      Data transfer Hold
00495   *            @arg SDMMC_FLAG_DBCKEND:    Data block sent/received (CRC check passed)
00496   *            @arg SDMMC_FLAG_DABORT:     Data transfer aborted by CMD12
00497   *            @arg SDMMC_FLAG_DPSMACT:    Data path state machine active
00498   *            @arg SDMMC_FLAG_CPSMACT:    Command path state machine active
00499   *            @arg SDMMC_FLAG_TXFIFOHE:   Transmit FIFO Half Empty
00500   *            @arg SDMMC_FLAG_RXFIFOHF:   Receive FIFO Half Full
00501   *            @arg SDMMC_FLAG_TXFIFOF:    Transmit FIFO full
00502   *            @arg SDMMC_FLAG_RXFIFOF:    Receive FIFO full
00503   *            @arg SDMMC_FLAG_TXFIFOE:    Transmit FIFO empty
00504   *            @arg SDMMC_FLAG_RXFIFOE:    Receive FIFO empty
00505   *            @arg SDMMC_FLAG_BUSYD0:     Inverted value of SDMMC_D0 line (Busy)
00506   *            @arg SDMMC_FLAG_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected
00507   *            @arg SDMMC_FLAG_SDIOIT:     SDIO interrupt received
00508   *            @arg SDMMC_FLAG_ACKFAIL:    Boot Acknowledgment received
00509   *            @arg SDMMC_FLAG_ACKTIMEOUT: Boot Acknowledgment timeout
00510   *            @arg SDMMC_FLAG_VSWEND:     Voltage switch critical timing section completion
00511   *            @arg SDMMC_FLAG_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure
00512   *            @arg SDMMC_FLAG_IDMATE:     IDMA transfer error
00513   *            @arg SDMMC_FLAG_IDMABTC:    IDMA buffer transfer complete
00514   * @retval The new state of SD FLAG (SET or RESET).
00515   */
00516 #define __HAL_SD_GET_FLAG(__HANDLE__, __FLAG__) __SDMMC_GET_FLAG((__HANDLE__)->Instance, (__FLAG__))
00517 
00518 /**
00519   * @brief  Clear the SD's pending flags.
00520   * @param  __HANDLE__ SD Handle.
00521   * @param  __FLAG__ specifies the flag to clear.
00522   *          This parameter can be one or a combination of the following values:
00523   *            @arg SDMMC_FLAG_CCRCFAIL:   Command response received (CRC check failed)
00524   *            @arg SDMMC_FLAG_DCRCFAIL:   Data block sent/received (CRC check failed)
00525   *            @arg SDMMC_FLAG_CTIMEOUT:   Command response timeout
00526   *            @arg SDMMC_FLAG_DTIMEOUT:   Data timeout
00527   *            @arg SDMMC_FLAG_TXUNDERR:   Transmit FIFO underrun error
00528   *            @arg SDMMC_FLAG_RXOVERR:    Received FIFO overrun error
00529   *            @arg SDMMC_FLAG_CMDREND:    Command response received (CRC check passed)
00530   *            @arg SDMMC_FLAG_CMDSENT:    Command sent (no response required)
00531   *            @arg SDMMC_FLAG_DATAEND:    Data end (data counter, DATACOUNT, is zero)
00532   *            @arg SDMMC_FLAG_DHOLD:      Data transfer Hold
00533   *            @arg SDMMC_FLAG_DBCKEND:    Data block sent/received (CRC check passed)
00534   *            @arg SDMMC_FLAG_DABORT:     Data transfer aborted by CMD12
00535   *            @arg SDMMC_FLAG_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected
00536   *            @arg SDMMC_FLAG_SDIOIT:     SDIO interrupt received
00537   *            @arg SDMMC_FLAG_ACKFAIL:    Boot Acknowledgment received
00538   *            @arg SDMMC_FLAG_ACKTIMEOUT: Boot Acknowledgment timeout
00539   *            @arg SDMMC_FLAG_VSWEND:     Voltage switch critical timing section completion
00540   *            @arg SDMMC_FLAG_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure
00541   *            @arg SDMMC_FLAG_IDMATE:     IDMA transfer error
00542   *            @arg SDMMC_FLAG_IDMABTC:    IDMA buffer transfer complete
00543   * @retval None
00544   */
00545 #define __HAL_SD_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDMMC_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__))
00546 
00547 /**
00548   * @brief  Check whether the specified SD interrupt has occurred or not.
00549   * @param  __HANDLE__ SD Handle.
00550   * @param  __INTERRUPT__ specifies the SDMMC interrupt source to check.
00551   *          This parameter can be one of the following values:
00552   *            @arg SDMMC_IT_CCRCFAIL:   Command response received (CRC check failed) interrupt
00553   *            @arg SDMMC_IT_DCRCFAIL:   Data block sent/received (CRC check failed) interrupt
00554   *            @arg SDMMC_IT_CTIMEOUT:   Command response timeout interrupt
00555   *            @arg SDMMC_IT_DTIMEOUT:   Data timeout interrupt
00556   *            @arg SDMMC_IT_TXUNDERR:   Transmit FIFO underrun error interrupt
00557   *            @arg SDMMC_IT_RXOVERR:    Received FIFO overrun error interrupt
00558   *            @arg SDMMC_IT_CMDREND:    Command response received (CRC check passed) interrupt
00559   *            @arg SDMMC_IT_CMDSENT:    Command sent (no response required) interrupt
00560   *            @arg SDMMC_IT_DATAEND:    Data end (data counter, DATACOUNT, is zero) interrupt
00561   *            @arg SDMMC_IT_DHOLD:      Data transfer Hold interrupt
00562   *            @arg SDMMC_IT_DBCKEND:    Data block sent/received (CRC check passed) interrupt
00563   *            @arg SDMMC_IT_DABORT:     Data transfer aborted by CMD12 interrupt
00564   *            @arg SDMMC_IT_TXFIFOHE:   Transmit FIFO Half Empty interrupt
00565   *            @arg SDMMC_IT_RXFIFOHF:   Receive FIFO Half Full interrupt
00566   *            @arg SDMMC_IT_RXFIFOF:    Receive FIFO full interrupt
00567   *            @arg SDMMC_IT_TXFIFOE:    Transmit FIFO empty interrupt
00568   *            @arg SDMMC_IT_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected interrupt
00569   *            @arg SDMMC_IT_SDIOIT:     SDIO interrupt received interrupt
00570   *            @arg SDMMC_IT_ACKFAIL:    Boot Acknowledgment received interrupt
00571   *            @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
00572   *            @arg SDMMC_IT_VSWEND:     Voltage switch critical timing section completion interrupt
00573   *            @arg SDMMC_IT_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure interrupt
00574   *            @arg SDMMC_IT_IDMABTC:    IDMA buffer transfer complete interrupt
00575   * @retval The new state of SD IT (SET or RESET).
00576   */
00577 #define __HAL_SD_GET_IT(__HANDLE__, __INTERRUPT__) __SDMMC_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__))
00578 
00579 /**
00580   * @brief  Clear the SD's interrupt pending bits.
00581   * @param  __HANDLE__ SD Handle.
00582   * @param  __INTERRUPT__ specifies the interrupt pending bit to clear.
00583   *          This parameter can be one or a combination of the following values:
00584   *            @arg SDMMC_IT_CCRCFAIL:   Command response received (CRC check failed) interrupt
00585   *            @arg SDMMC_IT_DCRCFAIL:   Data block sent/received (CRC check failed) interrupt
00586   *            @arg SDMMC_IT_CTIMEOUT:   Command response timeout interrupt
00587   *            @arg SDMMC_IT_DTIMEOUT:   Data timeout interrupt
00588   *            @arg SDMMC_IT_TXUNDERR:   Transmit FIFO underrun error interrupt
00589   *            @arg SDMMC_IT_RXOVERR:    Received FIFO overrun error interrupt
00590   *            @arg SDMMC_IT_CMDREND:    Command response received (CRC check passed) interrupt
00591   *            @arg SDMMC_IT_CMDSENT:    Command sent (no response required) interrupt
00592   *            @arg SDMMC_IT_DATAEND:    Data end (data counter, DATACOUNT, is zero) interrupt
00593   *            @arg SDMMC_IT_DHOLD:      Data transfer Hold interrupt
00594   *            @arg SDMMC_IT_DBCKEND:    Data block sent/received (CRC check passed) interrupt
00595   *            @arg SDMMC_IT_DABORT:     Data transfer aborted by CMD12 interrupt
00596   *            @arg SDMMC_IT_BUSYD0END:  End of SDMMC_D0 Busy following a CMD response detected interrupt
00597   *            @arg SDMMC_IT_SDIOIT:     SDIO interrupt received interrupt
00598   *            @arg SDMMC_IT_ACKFAIL:    Boot Acknowledgment received interrupt
00599   *            @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
00600   *            @arg SDMMC_IT_VSWEND:     Voltage switch critical timing section completion interrupt
00601   *            @arg SDMMC_IT_CKSTOP:     SDMMC_CK stopped in Voltage switch procedure interrupt
00602   *            @arg SDMMC_IT_IDMABTC:    IDMA buffer transfer complete interrupt
00603   * @retval None
00604   */
00605 #define __HAL_SD_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDMMC_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__))
00606 
00607 /**
00608   * @}
00609   */
00610 
00611 /* Include SD HAL Extension module */
00612 #include "stm32h7xx_hal_sd_ex.h"
00613 
00614 /* Exported functions --------------------------------------------------------*/
00615 /** @defgroup SD_Exported_Functions SD Exported Functions
00616   * @{
00617   */
00618 
00619 /** @defgroup SD_Exported_Functions_Group1 Initialization and de-initialization functions
00620   * @{
00621   */
00622 HAL_StatusTypeDef HAL_SD_Init(SD_HandleTypeDef *hsd);
00623 HAL_StatusTypeDef HAL_SD_InitCard(SD_HandleTypeDef *hsd);
00624 HAL_StatusTypeDef HAL_SD_DeInit(SD_HandleTypeDef *hsd);
00625 void              HAL_SD_MspInit(SD_HandleTypeDef *hsd);
00626 void              HAL_SD_MspDeInit(SD_HandleTypeDef *hsd);
00627 /**
00628   * @}
00629   */
00630 
00631 /** @defgroup SD_Exported_Functions_Group2 Input and Output operation functions
00632   * @{
00633   */
00634 /* Blocking mode: Polling */
00635 HAL_StatusTypeDef HAL_SD_ReadBlocks(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks,
00636                                     uint32_t Timeout);
00637 HAL_StatusTypeDef HAL_SD_WriteBlocks(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks,
00638                                      uint32_t Timeout);
00639 HAL_StatusTypeDef HAL_SD_Erase(SD_HandleTypeDef *hsd, uint32_t BlockStartAdd, uint32_t BlockEndAdd);
00640 /* Non-Blocking mode: IT */
00641 HAL_StatusTypeDef HAL_SD_ReadBlocks_IT(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd,
00642                                        uint32_t NumberOfBlocks);
00643 HAL_StatusTypeDef HAL_SD_WriteBlocks_IT(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd,
00644                                         uint32_t NumberOfBlocks);
00645 /* Non-Blocking mode: DMA */
00646 HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd,
00647                                         uint32_t NumberOfBlocks);
00648 HAL_StatusTypeDef HAL_SD_WriteBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd,
00649                                          uint32_t NumberOfBlocks);
00650 
00651 void              HAL_SD_IRQHandler(SD_HandleTypeDef *hsd);
00652 
00653 /* Callback in non blocking modes (DMA) */
00654 void              HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd);
00655 void              HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd);
00656 void              HAL_SD_ErrorCallback(SD_HandleTypeDef *hsd);
00657 void              HAL_SD_AbortCallback(SD_HandleTypeDef *hsd);
00658 
00659 #if (USE_SD_TRANSCEIVER != 0U)
00660 /* Callback to switch in 1.8V mode */
00661 void              HAL_SD_DriveTransceiver_1_8V_Callback(FlagStatus status);
00662 #endif /* USE_SD_TRANSCEIVER */
00663 
00664 #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U)
00665 /* SD callback registering/unregistering */
00666 HAL_StatusTypeDef HAL_SD_RegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID,
00667                                           pSD_CallbackTypeDef pCallback);
00668 HAL_StatusTypeDef HAL_SD_UnRegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID);
00669 
00670 #if (USE_SD_TRANSCEIVER != 0U)
00671 HAL_StatusTypeDef HAL_SD_RegisterTransceiverCallback(SD_HandleTypeDef *hsd, pSD_TransceiverCallbackTypeDef pCallback);
00672 HAL_StatusTypeDef HAL_SD_UnRegisterTransceiverCallback(SD_HandleTypeDef *hsd);
00673 #endif /* USE_SD_TRANSCEIVER */
00674 #endif /* USE_HAL_SD_REGISTER_CALLBACKS */
00675 
00676 /**
00677   * @}
00678   */
00679 
00680 /** @defgroup SD_Exported_Functions_Group3 Peripheral Control functions
00681   * @{
00682   */
00683 HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation(SD_HandleTypeDef *hsd, uint32_t WideMode);
00684 HAL_StatusTypeDef HAL_SD_ConfigSpeedBusOperation(SD_HandleTypeDef *hsd, uint32_t SpeedMode);
00685 /**
00686   * @}
00687   */
00688 
00689 /** @defgroup SD_Exported_Functions_Group4 SD card related functions
00690   * @{
00691   */
00692 HAL_SD_CardStateTypeDef HAL_SD_GetCardState(SD_HandleTypeDef *hsd);
00693 HAL_StatusTypeDef       HAL_SD_GetCardCID(SD_HandleTypeDef *hsd, HAL_SD_CardCIDTypeDef *pCID);
00694 HAL_StatusTypeDef       HAL_SD_GetCardCSD(SD_HandleTypeDef *hsd, HAL_SD_CardCSDTypeDef *pCSD);
00695 HAL_StatusTypeDef       HAL_SD_GetCardStatus(SD_HandleTypeDef *hsd, HAL_SD_CardStatusTypeDef *pStatus);
00696 HAL_StatusTypeDef       HAL_SD_GetCardInfo(SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypeDef *pCardInfo);
00697 /**
00698   * @}
00699   */
00700 
00701 /** @defgroup SD_Exported_Functions_Group5 Peripheral State and Errors functions
00702   * @{
00703   */
00704 HAL_SD_StateTypeDef HAL_SD_GetState(SD_HandleTypeDef *hsd);
00705 uint32_t            HAL_SD_GetError(SD_HandleTypeDef *hsd);
00706 /**
00707   * @}
00708   */
00709 
00710 /** @defgroup SD_Exported_Functions_Group6 Perioheral Abort management
00711   * @{
00712   */
00713 HAL_StatusTypeDef HAL_SD_Abort(SD_HandleTypeDef *hsd);
00714 HAL_StatusTypeDef HAL_SD_Abort_IT(SD_HandleTypeDef *hsd);
00715 /**
00716   * @}
00717   */
00718 
00719 /* Private types -------------------------------------------------------------*/
00720 /** @defgroup SD_Private_Types SD Private Types
00721   * @{
00722   */
00723 
00724 /**
00725   * @}
00726   */
00727 
00728 /* Private defines -----------------------------------------------------------*/
00729 /** @defgroup SD_Private_Defines SD Private Defines
00730   * @{
00731   */
00732 
00733 /**
00734   * @}
00735   */
00736 
00737 /* Private variables ---------------------------------------------------------*/
00738 /** @defgroup SD_Private_Variables SD Private Variables
00739   * @{
00740   */
00741 
00742 /**
00743   * @}
00744   */
00745 
00746 /* Private constants ---------------------------------------------------------*/
00747 /** @defgroup SD_Private_Constants SD Private Constants
00748   * @{
00749   */
00750 
00751 /**
00752   * @}
00753   */
00754 
00755 /* Private macros ------------------------------------------------------------*/
00756 /** @defgroup SD_Private_Macros SD Private Macros
00757   * @{
00758   */
00759 
00760 /**
00761   * @}
00762   */
00763 
00764 /* Private functions prototypes ----------------------------------------------*/
00765 /** @defgroup SD_Private_Functions_Prototypes SD Private Functions Prototypes
00766   * @{
00767   */
00768 
00769 /**
00770   * @}
00771   */
00772 
00773 /* Private functions ---------------------------------------------------------*/
00774 /** @defgroup SD_Private_Functions SD Private Functions
00775   * @{
00776   */
00777 
00778 /**
00779   * @}
00780   */
00781 
00782 
00783 /**
00784   * @}
00785   */
00786 
00787 /**
00788   * @}
00789   */
00790 
00791 /**
00792   * @}
00793   */
00794 
00795 #ifdef __cplusplus
00796 }
00797 #endif
00798 
00799 
00800 #endif /* STM32H7xx_HAL_SD_H */