Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
TARGET_NUCLEO_F746ZG/stm32f7xx_hal_sd.h@121:672067c3ada4, 2016-04-14 (annotated)
- Committer:
- elijahorr
- Date:
- Thu Apr 14 07:28:54 2016 +0000
- Revision:
- 121:672067c3ada4
- Parent:
- 116:c0f6e94411f5
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 115:87f2f5183dfb | 1 | /** |
Kojto | 115:87f2f5183dfb | 2 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 3 | * @file stm32f7xx_hal_sd.h |
Kojto | 115:87f2f5183dfb | 4 | * @author MCD Application Team |
Kojto | 116:c0f6e94411f5 | 5 | * @version V1.0.4 |
Kojto | 116:c0f6e94411f5 | 6 | * @date 09-December-2015 |
Kojto | 115:87f2f5183dfb | 7 | * @brief Header file of SD HAL module. |
Kojto | 115:87f2f5183dfb | 8 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 9 | * @attention |
Kojto | 115:87f2f5183dfb | 10 | * |
Kojto | 115:87f2f5183dfb | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Kojto | 115:87f2f5183dfb | 12 | * |
Kojto | 115:87f2f5183dfb | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 115:87f2f5183dfb | 14 | * are permitted provided that the following conditions are met: |
Kojto | 115:87f2f5183dfb | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 115:87f2f5183dfb | 16 | * this list of conditions and the following disclaimer. |
Kojto | 115:87f2f5183dfb | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 115:87f2f5183dfb | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 115:87f2f5183dfb | 19 | * and/or other materials provided with the distribution. |
Kojto | 115:87f2f5183dfb | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 115:87f2f5183dfb | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 115:87f2f5183dfb | 22 | * without specific prior written permission. |
Kojto | 115:87f2f5183dfb | 23 | * |
Kojto | 115:87f2f5183dfb | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 115:87f2f5183dfb | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 115:87f2f5183dfb | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 115:87f2f5183dfb | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 115:87f2f5183dfb | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 115:87f2f5183dfb | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 115:87f2f5183dfb | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 115:87f2f5183dfb | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 115:87f2f5183dfb | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 115:87f2f5183dfb | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 115:87f2f5183dfb | 34 | * |
Kojto | 115:87f2f5183dfb | 35 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 36 | */ |
Kojto | 115:87f2f5183dfb | 37 | |
Kojto | 115:87f2f5183dfb | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 39 | #ifndef __STM32F7xx_HAL_SD_H |
Kojto | 115:87f2f5183dfb | 40 | #define __STM32F7xx_HAL_SD_H |
Kojto | 115:87f2f5183dfb | 41 | |
Kojto | 115:87f2f5183dfb | 42 | #ifdef __cplusplus |
Kojto | 115:87f2f5183dfb | 43 | extern "C" { |
Kojto | 115:87f2f5183dfb | 44 | #endif |
Kojto | 115:87f2f5183dfb | 45 | |
Kojto | 115:87f2f5183dfb | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 47 | #include "stm32f7xx_ll_sdmmc.h" |
Kojto | 115:87f2f5183dfb | 48 | |
Kojto | 115:87f2f5183dfb | 49 | /** @addtogroup STM32F7xx_HAL_Driver |
Kojto | 115:87f2f5183dfb | 50 | * @{ |
Kojto | 115:87f2f5183dfb | 51 | */ |
Kojto | 115:87f2f5183dfb | 52 | |
Kojto | 115:87f2f5183dfb | 53 | /** @defgroup SD SD |
Kojto | 115:87f2f5183dfb | 54 | * @brief SD HAL module driver |
Kojto | 115:87f2f5183dfb | 55 | * @{ |
Kojto | 115:87f2f5183dfb | 56 | */ |
Kojto | 115:87f2f5183dfb | 57 | |
Kojto | 115:87f2f5183dfb | 58 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 59 | /** @defgroup SD_Exported_Types SD Exported Types |
Kojto | 115:87f2f5183dfb | 60 | * @{ |
Kojto | 115:87f2f5183dfb | 61 | */ |
Kojto | 115:87f2f5183dfb | 62 | |
Kojto | 115:87f2f5183dfb | 63 | /** @defgroup SD_Exported_Types_Group1 SD Handle Structure definition |
Kojto | 115:87f2f5183dfb | 64 | * @{ |
Kojto | 115:87f2f5183dfb | 65 | */ |
Kojto | 115:87f2f5183dfb | 66 | #define SD_InitTypeDef SDMMC_InitTypeDef |
Kojto | 115:87f2f5183dfb | 67 | #define SD_TypeDef SDMMC_TypeDef |
Kojto | 115:87f2f5183dfb | 68 | |
Kojto | 115:87f2f5183dfb | 69 | typedef struct |
Kojto | 115:87f2f5183dfb | 70 | { |
Kojto | 115:87f2f5183dfb | 71 | SD_TypeDef *Instance; /*!< SDMMC register base address */ |
Kojto | 115:87f2f5183dfb | 72 | |
Kojto | 115:87f2f5183dfb | 73 | SD_InitTypeDef Init; /*!< SD required parameters */ |
Kojto | 115:87f2f5183dfb | 74 | |
Kojto | 115:87f2f5183dfb | 75 | HAL_LockTypeDef Lock; /*!< SD locking object */ |
Kojto | 115:87f2f5183dfb | 76 | |
Kojto | 115:87f2f5183dfb | 77 | uint32_t CardType; /*!< SD card type */ |
Kojto | 115:87f2f5183dfb | 78 | |
Kojto | 115:87f2f5183dfb | 79 | uint32_t RCA; /*!< SD relative card address */ |
Kojto | 115:87f2f5183dfb | 80 | |
Kojto | 115:87f2f5183dfb | 81 | uint32_t CSD[4]; /*!< SD card specific data table */ |
Kojto | 115:87f2f5183dfb | 82 | |
Kojto | 115:87f2f5183dfb | 83 | uint32_t CID[4]; /*!< SD card identification number table */ |
Kojto | 115:87f2f5183dfb | 84 | |
Kojto | 115:87f2f5183dfb | 85 | __IO uint32_t SdTransferCplt; /*!< SD transfer complete flag in non blocking mode */ |
Kojto | 115:87f2f5183dfb | 86 | |
Kojto | 115:87f2f5183dfb | 87 | __IO uint32_t SdTransferErr; /*!< SD transfer error flag in non blocking mode */ |
Kojto | 115:87f2f5183dfb | 88 | |
Kojto | 115:87f2f5183dfb | 89 | __IO uint32_t DmaTransferCplt; /*!< SD DMA transfer complete flag */ |
Kojto | 115:87f2f5183dfb | 90 | |
Kojto | 115:87f2f5183dfb | 91 | __IO uint32_t SdOperation; /*!< SD transfer operation (read/write) */ |
Kojto | 115:87f2f5183dfb | 92 | |
Kojto | 115:87f2f5183dfb | 93 | DMA_HandleTypeDef *hdmarx; /*!< SD Rx DMA handle parameters */ |
Kojto | 115:87f2f5183dfb | 94 | |
Kojto | 115:87f2f5183dfb | 95 | DMA_HandleTypeDef *hdmatx; /*!< SD Tx DMA handle parameters */ |
Kojto | 115:87f2f5183dfb | 96 | |
Kojto | 115:87f2f5183dfb | 97 | }SD_HandleTypeDef; |
Kojto | 115:87f2f5183dfb | 98 | /** |
Kojto | 115:87f2f5183dfb | 99 | * @} |
Kojto | 115:87f2f5183dfb | 100 | */ |
Kojto | 115:87f2f5183dfb | 101 | |
Kojto | 115:87f2f5183dfb | 102 | /** @defgroup SD_Exported_Types_Group2 Card Specific Data: CSD Register |
Kojto | 115:87f2f5183dfb | 103 | * @{ |
Kojto | 115:87f2f5183dfb | 104 | */ |
Kojto | 115:87f2f5183dfb | 105 | typedef struct |
Kojto | 115:87f2f5183dfb | 106 | { |
Kojto | 115:87f2f5183dfb | 107 | __IO uint8_t CSDStruct; /*!< CSD structure */ |
Kojto | 115:87f2f5183dfb | 108 | __IO uint8_t SysSpecVersion; /*!< System specification version */ |
Kojto | 115:87f2f5183dfb | 109 | __IO uint8_t Reserved1; /*!< Reserved */ |
Kojto | 115:87f2f5183dfb | 110 | __IO uint8_t TAAC; /*!< Data read access time 1 */ |
Kojto | 115:87f2f5183dfb | 111 | __IO uint8_t NSAC; /*!< Data read access time 2 in CLK cycles */ |
Kojto | 115:87f2f5183dfb | 112 | __IO uint8_t MaxBusClkFrec; /*!< Max. bus clock frequency */ |
Kojto | 115:87f2f5183dfb | 113 | __IO uint16_t CardComdClasses; /*!< Card command classes */ |
Kojto | 115:87f2f5183dfb | 114 | __IO uint8_t RdBlockLen; /*!< Max. read data block length */ |
Kojto | 115:87f2f5183dfb | 115 | __IO uint8_t PartBlockRead; /*!< Partial blocks for read allowed */ |
Kojto | 115:87f2f5183dfb | 116 | __IO uint8_t WrBlockMisalign; /*!< Write block misalignment */ |
Kojto | 115:87f2f5183dfb | 117 | __IO uint8_t RdBlockMisalign; /*!< Read block misalignment */ |
Kojto | 115:87f2f5183dfb | 118 | __IO uint8_t DSRImpl; /*!< DSR implemented */ |
Kojto | 115:87f2f5183dfb | 119 | __IO uint8_t Reserved2; /*!< Reserved */ |
Kojto | 115:87f2f5183dfb | 120 | __IO uint32_t DeviceSize; /*!< Device Size */ |
Kojto | 115:87f2f5183dfb | 121 | __IO uint8_t MaxRdCurrentVDDMin; /*!< Max. read current @ VDD min */ |
Kojto | 115:87f2f5183dfb | 122 | __IO uint8_t MaxRdCurrentVDDMax; /*!< Max. read current @ VDD max */ |
Kojto | 115:87f2f5183dfb | 123 | __IO uint8_t MaxWrCurrentVDDMin; /*!< Max. write current @ VDD min */ |
Kojto | 115:87f2f5183dfb | 124 | __IO uint8_t MaxWrCurrentVDDMax; /*!< Max. write current @ VDD max */ |
Kojto | 115:87f2f5183dfb | 125 | __IO uint8_t DeviceSizeMul; /*!< Device size multiplier */ |
Kojto | 115:87f2f5183dfb | 126 | __IO uint8_t EraseGrSize; /*!< Erase group size */ |
Kojto | 115:87f2f5183dfb | 127 | __IO uint8_t EraseGrMul; /*!< Erase group size multiplier */ |
Kojto | 115:87f2f5183dfb | 128 | __IO uint8_t WrProtectGrSize; /*!< Write protect group size */ |
Kojto | 115:87f2f5183dfb | 129 | __IO uint8_t WrProtectGrEnable; /*!< Write protect group enable */ |
Kojto | 115:87f2f5183dfb | 130 | __IO uint8_t ManDeflECC; /*!< Manufacturer default ECC */ |
Kojto | 115:87f2f5183dfb | 131 | __IO uint8_t WrSpeedFact; /*!< Write speed factor */ |
Kojto | 115:87f2f5183dfb | 132 | __IO uint8_t MaxWrBlockLen; /*!< Max. write data block length */ |
Kojto | 115:87f2f5183dfb | 133 | __IO uint8_t WriteBlockPaPartial; /*!< Partial blocks for write allowed */ |
Kojto | 115:87f2f5183dfb | 134 | __IO uint8_t Reserved3; /*!< Reserved */ |
Kojto | 115:87f2f5183dfb | 135 | __IO uint8_t ContentProtectAppli; /*!< Content protection application */ |
Kojto | 115:87f2f5183dfb | 136 | __IO uint8_t FileFormatGrouop; /*!< File format group */ |
Kojto | 115:87f2f5183dfb | 137 | __IO uint8_t CopyFlag; /*!< Copy flag (OTP) */ |
Kojto | 115:87f2f5183dfb | 138 | __IO uint8_t PermWrProtect; /*!< Permanent write protection */ |
Kojto | 115:87f2f5183dfb | 139 | __IO uint8_t TempWrProtect; /*!< Temporary write protection */ |
Kojto | 115:87f2f5183dfb | 140 | __IO uint8_t FileFormat; /*!< File format */ |
Kojto | 115:87f2f5183dfb | 141 | __IO uint8_t ECC; /*!< ECC code */ |
Kojto | 115:87f2f5183dfb | 142 | __IO uint8_t CSD_CRC; /*!< CSD CRC */ |
Kojto | 115:87f2f5183dfb | 143 | __IO uint8_t Reserved4; /*!< Always 1 */ |
Kojto | 115:87f2f5183dfb | 144 | |
Kojto | 115:87f2f5183dfb | 145 | }HAL_SD_CSDTypedef; |
Kojto | 115:87f2f5183dfb | 146 | /** |
Kojto | 115:87f2f5183dfb | 147 | * @} |
Kojto | 115:87f2f5183dfb | 148 | */ |
Kojto | 115:87f2f5183dfb | 149 | |
Kojto | 115:87f2f5183dfb | 150 | /** @defgroup SD_Exported_Types_Group3 Card Identification Data: CID Register |
Kojto | 115:87f2f5183dfb | 151 | * @{ |
Kojto | 115:87f2f5183dfb | 152 | */ |
Kojto | 115:87f2f5183dfb | 153 | typedef struct |
Kojto | 115:87f2f5183dfb | 154 | { |
Kojto | 115:87f2f5183dfb | 155 | __IO uint8_t ManufacturerID; /*!< Manufacturer ID */ |
Kojto | 115:87f2f5183dfb | 156 | __IO uint16_t OEM_AppliID; /*!< OEM/Application ID */ |
Kojto | 115:87f2f5183dfb | 157 | __IO uint32_t ProdName1; /*!< Product Name part1 */ |
Kojto | 115:87f2f5183dfb | 158 | __IO uint8_t ProdName2; /*!< Product Name part2 */ |
Kojto | 115:87f2f5183dfb | 159 | __IO uint8_t ProdRev; /*!< Product Revision */ |
Kojto | 115:87f2f5183dfb | 160 | __IO uint32_t ProdSN; /*!< Product Serial Number */ |
Kojto | 115:87f2f5183dfb | 161 | __IO uint8_t Reserved1; /*!< Reserved1 */ |
Kojto | 115:87f2f5183dfb | 162 | __IO uint16_t ManufactDate; /*!< Manufacturing Date */ |
Kojto | 115:87f2f5183dfb | 163 | __IO uint8_t CID_CRC; /*!< CID CRC */ |
Kojto | 115:87f2f5183dfb | 164 | __IO uint8_t Reserved2; /*!< Always 1 */ |
Kojto | 115:87f2f5183dfb | 165 | |
Kojto | 115:87f2f5183dfb | 166 | }HAL_SD_CIDTypedef; |
Kojto | 115:87f2f5183dfb | 167 | /** |
Kojto | 115:87f2f5183dfb | 168 | * @} |
Kojto | 115:87f2f5183dfb | 169 | */ |
Kojto | 115:87f2f5183dfb | 170 | |
Kojto | 115:87f2f5183dfb | 171 | /** @defgroup SD_Exported_Types_Group4 SD Card Status returned by ACMD13 |
Kojto | 115:87f2f5183dfb | 172 | * @{ |
Kojto | 115:87f2f5183dfb | 173 | */ |
Kojto | 115:87f2f5183dfb | 174 | typedef struct |
Kojto | 115:87f2f5183dfb | 175 | { |
Kojto | 115:87f2f5183dfb | 176 | __IO uint8_t DAT_BUS_WIDTH; /*!< Shows the currently defined data bus width */ |
Kojto | 115:87f2f5183dfb | 177 | __IO uint8_t SECURED_MODE; /*!< Card is in secured mode of operation */ |
Kojto | 115:87f2f5183dfb | 178 | __IO uint16_t SD_CARD_TYPE; /*!< Carries information about card type */ |
Kojto | 115:87f2f5183dfb | 179 | __IO uint32_t SIZE_OF_PROTECTED_AREA; /*!< Carries information about the capacity of protected area */ |
Kojto | 115:87f2f5183dfb | 180 | __IO uint8_t SPEED_CLASS; /*!< Carries information about the speed class of the card */ |
Kojto | 115:87f2f5183dfb | 181 | __IO uint8_t PERFORMANCE_MOVE; /*!< Carries information about the card's performance move */ |
Kojto | 115:87f2f5183dfb | 182 | __IO uint8_t AU_SIZE; /*!< Carries information about the card's allocation unit size */ |
Kojto | 115:87f2f5183dfb | 183 | __IO uint16_t ERASE_SIZE; /*!< Determines the number of AUs to be erased in one operation */ |
Kojto | 115:87f2f5183dfb | 184 | __IO uint8_t ERASE_TIMEOUT; /*!< Determines the timeout for any number of AU erase */ |
Kojto | 115:87f2f5183dfb | 185 | __IO uint8_t ERASE_OFFSET; /*!< Carries information about the erase offset */ |
Kojto | 115:87f2f5183dfb | 186 | |
Kojto | 115:87f2f5183dfb | 187 | }HAL_SD_CardStatusTypedef; |
Kojto | 115:87f2f5183dfb | 188 | /** |
Kojto | 115:87f2f5183dfb | 189 | * @} |
Kojto | 115:87f2f5183dfb | 190 | */ |
Kojto | 115:87f2f5183dfb | 191 | |
Kojto | 115:87f2f5183dfb | 192 | /** @defgroup SD_Exported_Types_Group5 SD Card information structure |
Kojto | 115:87f2f5183dfb | 193 | * @{ |
Kojto | 115:87f2f5183dfb | 194 | */ |
Kojto | 115:87f2f5183dfb | 195 | typedef struct |
Kojto | 115:87f2f5183dfb | 196 | { |
Kojto | 115:87f2f5183dfb | 197 | HAL_SD_CSDTypedef SD_csd; /*!< SD card specific data register */ |
Kojto | 115:87f2f5183dfb | 198 | HAL_SD_CIDTypedef SD_cid; /*!< SD card identification number register */ |
Kojto | 115:87f2f5183dfb | 199 | uint64_t CardCapacity; /*!< Card capacity */ |
Kojto | 115:87f2f5183dfb | 200 | uint32_t CardBlockSize; /*!< Card block size */ |
Kojto | 115:87f2f5183dfb | 201 | uint16_t RCA; /*!< SD relative card address */ |
Kojto | 115:87f2f5183dfb | 202 | uint8_t CardType; /*!< SD card type */ |
Kojto | 115:87f2f5183dfb | 203 | |
Kojto | 115:87f2f5183dfb | 204 | }HAL_SD_CardInfoTypedef; |
Kojto | 115:87f2f5183dfb | 205 | /** |
Kojto | 115:87f2f5183dfb | 206 | * @} |
Kojto | 115:87f2f5183dfb | 207 | */ |
Kojto | 115:87f2f5183dfb | 208 | |
Kojto | 115:87f2f5183dfb | 209 | /** @defgroup SD_Exported_Types_Group6 SD Error status enumeration Structure definition |
Kojto | 115:87f2f5183dfb | 210 | * @{ |
Kojto | 115:87f2f5183dfb | 211 | */ |
Kojto | 115:87f2f5183dfb | 212 | typedef enum |
Kojto | 115:87f2f5183dfb | 213 | { |
Kojto | 115:87f2f5183dfb | 214 | /** |
Kojto | 115:87f2f5183dfb | 215 | * @brief SD specific error defines |
Kojto | 115:87f2f5183dfb | 216 | */ |
Kojto | 115:87f2f5183dfb | 217 | SD_CMD_CRC_FAIL = (1), /*!< Command response received (but CRC check failed) */ |
Kojto | 115:87f2f5183dfb | 218 | SD_DATA_CRC_FAIL = (2), /*!< Data block sent/received (CRC check failed) */ |
Kojto | 115:87f2f5183dfb | 219 | SD_CMD_RSP_TIMEOUT = (3), /*!< Command response timeout */ |
Kojto | 115:87f2f5183dfb | 220 | SD_DATA_TIMEOUT = (4), /*!< Data timeout */ |
Kojto | 115:87f2f5183dfb | 221 | SD_TX_UNDERRUN = (5), /*!< Transmit FIFO underrun */ |
Kojto | 115:87f2f5183dfb | 222 | SD_RX_OVERRUN = (6), /*!< Receive FIFO overrun */ |
Kojto | 115:87f2f5183dfb | 223 | SD_START_BIT_ERR = (7), /*!< Start bit not detected on all data signals in wide bus mode */ |
Kojto | 115:87f2f5183dfb | 224 | SD_CMD_OUT_OF_RANGE = (8), /*!< Command's argument was out of range. */ |
Kojto | 115:87f2f5183dfb | 225 | SD_ADDR_MISALIGNED = (9), /*!< Misaligned address */ |
Kojto | 115:87f2f5183dfb | 226 | SD_BLOCK_LEN_ERR = (10), /*!< Transferred block length is not allowed for the card or the number of transferred bytes does not match the block length */ |
Kojto | 115:87f2f5183dfb | 227 | SD_ERASE_SEQ_ERR = (11), /*!< An error in the sequence of erase command occurs. */ |
Kojto | 115:87f2f5183dfb | 228 | SD_BAD_ERASE_PARAM = (12), /*!< An invalid selection for erase groups */ |
Kojto | 115:87f2f5183dfb | 229 | SD_WRITE_PROT_VIOLATION = (13), /*!< Attempt to program a write protect block */ |
Kojto | 115:87f2f5183dfb | 230 | SD_LOCK_UNLOCK_FAILED = (14), /*!< Sequence or password error has been detected in unlock command or if there was an attempt to access a locked card */ |
Kojto | 115:87f2f5183dfb | 231 | SD_COM_CRC_FAILED = (15), /*!< CRC check of the previous command failed */ |
Kojto | 115:87f2f5183dfb | 232 | SD_ILLEGAL_CMD = (16), /*!< Command is not legal for the card state */ |
Kojto | 115:87f2f5183dfb | 233 | SD_CARD_ECC_FAILED = (17), /*!< Card internal ECC was applied but failed to correct the data */ |
Kojto | 115:87f2f5183dfb | 234 | SD_CC_ERROR = (18), /*!< Internal card controller error */ |
Kojto | 115:87f2f5183dfb | 235 | SD_GENERAL_UNKNOWN_ERROR = (19), /*!< General or unknown error */ |
Kojto | 115:87f2f5183dfb | 236 | SD_STREAM_READ_UNDERRUN = (20), /*!< The card could not sustain data transfer in stream read operation. */ |
Kojto | 115:87f2f5183dfb | 237 | SD_STREAM_WRITE_OVERRUN = (21), /*!< The card could not sustain data programming in stream mode */ |
Kojto | 115:87f2f5183dfb | 238 | SD_CID_CSD_OVERWRITE = (22), /*!< CID/CSD overwrite error */ |
Kojto | 115:87f2f5183dfb | 239 | SD_WP_ERASE_SKIP = (23), /*!< Only partial address space was erased */ |
Kojto | 115:87f2f5183dfb | 240 | SD_CARD_ECC_DISABLED = (24), /*!< Command has been executed without using internal ECC */ |
Kojto | 115:87f2f5183dfb | 241 | SD_ERASE_RESET = (25), /*!< Erase sequence was cleared before executing because an out of erase sequence command was received */ |
Kojto | 115:87f2f5183dfb | 242 | SD_AKE_SEQ_ERROR = (26), /*!< Error in sequence of authentication. */ |
Kojto | 115:87f2f5183dfb | 243 | SD_INVALID_VOLTRANGE = (27), |
Kojto | 115:87f2f5183dfb | 244 | SD_ADDR_OUT_OF_RANGE = (28), |
Kojto | 115:87f2f5183dfb | 245 | SD_SWITCH_ERROR = (29), |
Kojto | 115:87f2f5183dfb | 246 | SD_SDMMC_DISABLED = (30), |
Kojto | 115:87f2f5183dfb | 247 | SD_SDMMC_FUNCTION_BUSY = (31), |
Kojto | 115:87f2f5183dfb | 248 | SD_SDMMC_FUNCTION_FAILED = (32), |
Kojto | 115:87f2f5183dfb | 249 | SD_SDMMC_UNKNOWN_FUNCTION = (33), |
Kojto | 115:87f2f5183dfb | 250 | |
Kojto | 115:87f2f5183dfb | 251 | /** |
Kojto | 115:87f2f5183dfb | 252 | * @brief Standard error defines |
Kojto | 115:87f2f5183dfb | 253 | */ |
Kojto | 115:87f2f5183dfb | 254 | SD_INTERNAL_ERROR = (34), |
Kojto | 115:87f2f5183dfb | 255 | SD_NOT_CONFIGURED = (35), |
Kojto | 115:87f2f5183dfb | 256 | SD_REQUEST_PENDING = (36), |
Kojto | 115:87f2f5183dfb | 257 | SD_REQUEST_NOT_APPLICABLE = (37), |
Kojto | 115:87f2f5183dfb | 258 | SD_INVALID_PARAMETER = (38), |
Kojto | 115:87f2f5183dfb | 259 | SD_UNSUPPORTED_FEATURE = (39), |
Kojto | 115:87f2f5183dfb | 260 | SD_UNSUPPORTED_HW = (40), |
Kojto | 115:87f2f5183dfb | 261 | SD_ERROR = (41), |
Kojto | 115:87f2f5183dfb | 262 | SD_OK = (0) |
Kojto | 115:87f2f5183dfb | 263 | |
Kojto | 115:87f2f5183dfb | 264 | }HAL_SD_ErrorTypedef; |
Kojto | 115:87f2f5183dfb | 265 | /** |
Kojto | 115:87f2f5183dfb | 266 | * @} |
Kojto | 115:87f2f5183dfb | 267 | */ |
Kojto | 115:87f2f5183dfb | 268 | |
Kojto | 115:87f2f5183dfb | 269 | /** @defgroup SD_Exported_Types_Group7 SD Transfer state enumeration structure |
Kojto | 115:87f2f5183dfb | 270 | * @{ |
Kojto | 115:87f2f5183dfb | 271 | */ |
Kojto | 115:87f2f5183dfb | 272 | typedef enum |
Kojto | 115:87f2f5183dfb | 273 | { |
Kojto | 115:87f2f5183dfb | 274 | SD_TRANSFER_OK = 0, /*!< Transfer success */ |
Kojto | 115:87f2f5183dfb | 275 | SD_TRANSFER_BUSY = 1, /*!< Transfer is occurring */ |
Kojto | 115:87f2f5183dfb | 276 | SD_TRANSFER_ERROR = 2 /*!< Transfer failed */ |
Kojto | 115:87f2f5183dfb | 277 | |
Kojto | 115:87f2f5183dfb | 278 | }HAL_SD_TransferStateTypedef; |
Kojto | 115:87f2f5183dfb | 279 | /** |
Kojto | 115:87f2f5183dfb | 280 | * @} |
Kojto | 115:87f2f5183dfb | 281 | */ |
Kojto | 115:87f2f5183dfb | 282 | |
Kojto | 115:87f2f5183dfb | 283 | /** @defgroup SD_Exported_Types_Group8 SD Card State enumeration structure |
Kojto | 115:87f2f5183dfb | 284 | * @{ |
Kojto | 115:87f2f5183dfb | 285 | */ |
Kojto | 115:87f2f5183dfb | 286 | typedef enum |
Kojto | 115:87f2f5183dfb | 287 | { |
Kojto | 115:87f2f5183dfb | 288 | SD_CARD_READY = ((uint32_t)0x00000001), /*!< Card state is ready */ |
Kojto | 115:87f2f5183dfb | 289 | SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002), /*!< Card is in identification state */ |
Kojto | 115:87f2f5183dfb | 290 | SD_CARD_STANDBY = ((uint32_t)0x00000003), /*!< Card is in standby state */ |
Kojto | 115:87f2f5183dfb | 291 | SD_CARD_TRANSFER = ((uint32_t)0x00000004), /*!< Card is in transfer state */ |
Kojto | 115:87f2f5183dfb | 292 | SD_CARD_SENDING = ((uint32_t)0x00000005), /*!< Card is sending an operation */ |
Kojto | 115:87f2f5183dfb | 293 | SD_CARD_RECEIVING = ((uint32_t)0x00000006), /*!< Card is receiving operation information */ |
Kojto | 115:87f2f5183dfb | 294 | SD_CARD_PROGRAMMING = ((uint32_t)0x00000007), /*!< Card is in programming state */ |
Kojto | 115:87f2f5183dfb | 295 | SD_CARD_DISCONNECTED = ((uint32_t)0x00000008), /*!< Card is disconnected */ |
Kojto | 115:87f2f5183dfb | 296 | SD_CARD_ERROR = ((uint32_t)0x000000FF) /*!< Card is in error state */ |
Kojto | 115:87f2f5183dfb | 297 | |
Kojto | 115:87f2f5183dfb | 298 | }HAL_SD_CardStateTypedef; |
Kojto | 115:87f2f5183dfb | 299 | /** |
Kojto | 115:87f2f5183dfb | 300 | * @} |
Kojto | 115:87f2f5183dfb | 301 | */ |
Kojto | 115:87f2f5183dfb | 302 | |
Kojto | 115:87f2f5183dfb | 303 | /** @defgroup SD_Exported_Types_Group9 SD Operation enumeration structure |
Kojto | 115:87f2f5183dfb | 304 | * @{ |
Kojto | 115:87f2f5183dfb | 305 | */ |
Kojto | 115:87f2f5183dfb | 306 | typedef enum |
Kojto | 115:87f2f5183dfb | 307 | { |
Kojto | 115:87f2f5183dfb | 308 | SD_READ_SINGLE_BLOCK = 0, /*!< Read single block operation */ |
Kojto | 115:87f2f5183dfb | 309 | SD_READ_MULTIPLE_BLOCK = 1, /*!< Read multiple blocks operation */ |
Kojto | 115:87f2f5183dfb | 310 | SD_WRITE_SINGLE_BLOCK = 2, /*!< Write single block operation */ |
Kojto | 115:87f2f5183dfb | 311 | SD_WRITE_MULTIPLE_BLOCK = 3 /*!< Write multiple blocks operation */ |
Kojto | 115:87f2f5183dfb | 312 | |
Kojto | 115:87f2f5183dfb | 313 | }HAL_SD_OperationTypedef; |
Kojto | 115:87f2f5183dfb | 314 | /** |
Kojto | 115:87f2f5183dfb | 315 | * @} |
Kojto | 115:87f2f5183dfb | 316 | */ |
Kojto | 115:87f2f5183dfb | 317 | |
Kojto | 115:87f2f5183dfb | 318 | /** |
Kojto | 115:87f2f5183dfb | 319 | * @} |
Kojto | 115:87f2f5183dfb | 320 | */ |
Kojto | 115:87f2f5183dfb | 321 | |
Kojto | 115:87f2f5183dfb | 322 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 323 | /** @defgroup SD_Exported_Constants SD Exported Constants |
Kojto | 115:87f2f5183dfb | 324 | * @{ |
Kojto | 115:87f2f5183dfb | 325 | */ |
Kojto | 115:87f2f5183dfb | 326 | |
Kojto | 115:87f2f5183dfb | 327 | /** |
Kojto | 115:87f2f5183dfb | 328 | * @brief SD Commands Index |
Kojto | 115:87f2f5183dfb | 329 | */ |
Kojto | 115:87f2f5183dfb | 330 | #define SD_CMD_GO_IDLE_STATE ((uint8_t)0) /*!< Resets the SD memory card. */ |
Kojto | 115:87f2f5183dfb | 331 | #define SD_CMD_SEND_OP_COND ((uint8_t)1) /*!< Sends host capacity support information and activates the card's initialization process. */ |
Kojto | 115:87f2f5183dfb | 332 | #define SD_CMD_ALL_SEND_CID ((uint8_t)2) /*!< Asks any card connected to the host to send the CID numbers on the CMD line. */ |
Kojto | 115:87f2f5183dfb | 333 | #define SD_CMD_SET_REL_ADDR ((uint8_t)3) /*!< Asks the card to publish a new relative address (RCA). */ |
Kojto | 115:87f2f5183dfb | 334 | #define SD_CMD_SET_DSR ((uint8_t)4) /*!< Programs the DSR of all cards. */ |
Kojto | 115:87f2f5183dfb | 335 | #define SD_CMD_SDMMC_SEN_OP_COND ((uint8_t)5) /*!< Sends host capacity support information (HCS) and asks the accessed card to send its |
Kojto | 115:87f2f5183dfb | 336 | operating condition register (OCR) content in the response on the CMD line. */ |
Kojto | 115:87f2f5183dfb | 337 | #define SD_CMD_HS_SWITCH ((uint8_t)6) /*!< Checks switchable function (mode 0) and switch card function (mode 1). */ |
Kojto | 115:87f2f5183dfb | 338 | #define SD_CMD_SEL_DESEL_CARD ((uint8_t)7) /*!< Selects the card by its own relative address and gets deselected by any other address */ |
Kojto | 115:87f2f5183dfb | 339 | #define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8) /*!< Sends SD Memory Card interface condition, which includes host supply voltage information |
Kojto | 115:87f2f5183dfb | 340 | and asks the card whether card supports voltage. */ |
Kojto | 115:87f2f5183dfb | 341 | #define SD_CMD_SEND_CSD ((uint8_t)9) /*!< Addressed card sends its card specific data (CSD) on the CMD line. */ |
Kojto | 115:87f2f5183dfb | 342 | #define SD_CMD_SEND_CID ((uint8_t)10) /*!< Addressed card sends its card identification (CID) on the CMD line. */ |
Kojto | 115:87f2f5183dfb | 343 | #define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11) /*!< SD card doesn't support it. */ |
Kojto | 115:87f2f5183dfb | 344 | #define SD_CMD_STOP_TRANSMISSION ((uint8_t)12) /*!< Forces the card to stop transmission. */ |
Kojto | 115:87f2f5183dfb | 345 | #define SD_CMD_SEND_STATUS ((uint8_t)13) /*!< Addressed card sends its status register. */ |
Kojto | 115:87f2f5183dfb | 346 | #define SD_CMD_HS_BUSTEST_READ ((uint8_t)14) |
Kojto | 115:87f2f5183dfb | 347 | #define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15) /*!< Sends an addressed card into the inactive state. */ |
Kojto | 115:87f2f5183dfb | 348 | #define SD_CMD_SET_BLOCKLEN ((uint8_t)16) /*!< Sets the block length (in bytes for SDSC) for all following block commands |
Kojto | 115:87f2f5183dfb | 349 | (read, write, lock). Default block length is fixed to 512 Bytes. Not effective |
Kojto | 115:87f2f5183dfb | 350 | for SDHS and SDXC. */ |
Kojto | 115:87f2f5183dfb | 351 | #define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17) /*!< Reads single block of size selected by SET_BLOCKLEN in case of SDSC, and a block of |
Kojto | 115:87f2f5183dfb | 352 | fixed 512 bytes in case of SDHC and SDXC. */ |
Kojto | 115:87f2f5183dfb | 353 | #define SD_CMD_READ_MULT_BLOCK ((uint8_t)18) /*!< Continuously transfers data blocks from card to host until interrupted by |
Kojto | 115:87f2f5183dfb | 354 | STOP_TRANSMISSION command. */ |
Kojto | 115:87f2f5183dfb | 355 | #define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19) /*!< 64 bytes tuning pattern is sent for SDR50 and SDR104. */ |
Kojto | 115:87f2f5183dfb | 356 | #define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20) /*!< Speed class control command. */ |
Kojto | 115:87f2f5183dfb | 357 | #define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23) /*!< Specify block count for CMD18 and CMD25. */ |
Kojto | 115:87f2f5183dfb | 358 | #define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24) /*!< Writes single block of size selected by SET_BLOCKLEN in case of SDSC, and a block of |
Kojto | 115:87f2f5183dfb | 359 | fixed 512 bytes in case of SDHC and SDXC. */ |
Kojto | 115:87f2f5183dfb | 360 | #define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25) /*!< Continuously writes blocks of data until a STOP_TRANSMISSION follows. */ |
Kojto | 115:87f2f5183dfb | 361 | #define SD_CMD_PROG_CID ((uint8_t)26) /*!< Reserved for manufacturers. */ |
Kojto | 115:87f2f5183dfb | 362 | #define SD_CMD_PROG_CSD ((uint8_t)27) /*!< Programming of the programmable bits of the CSD. */ |
Kojto | 115:87f2f5183dfb | 363 | #define SD_CMD_SET_WRITE_PROT ((uint8_t)28) /*!< Sets the write protection bit of the addressed group. */ |
Kojto | 115:87f2f5183dfb | 364 | #define SD_CMD_CLR_WRITE_PROT ((uint8_t)29) /*!< Clears the write protection bit of the addressed group. */ |
Kojto | 115:87f2f5183dfb | 365 | #define SD_CMD_SEND_WRITE_PROT ((uint8_t)30) /*!< Asks the card to send the status of the write protection bits. */ |
Kojto | 115:87f2f5183dfb | 366 | #define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32) /*!< Sets the address of the first write block to be erased. (For SD card only). */ |
Kojto | 115:87f2f5183dfb | 367 | #define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33) /*!< Sets the address of the last write block of the continuous range to be erased. */ |
Kojto | 115:87f2f5183dfb | 368 | #define SD_CMD_ERASE_GRP_START ((uint8_t)35) /*!< Sets the address of the first write block to be erased. Reserved for each command |
Kojto | 115:87f2f5183dfb | 369 | system set by switch function command (CMD6). */ |
Kojto | 115:87f2f5183dfb | 370 | #define SD_CMD_ERASE_GRP_END ((uint8_t)36) /*!< Sets the address of the last write block of the continuous range to be erased. |
Kojto | 115:87f2f5183dfb | 371 | Reserved for each command system set by switch function command (CMD6). */ |
Kojto | 115:87f2f5183dfb | 372 | #define SD_CMD_ERASE ((uint8_t)38) /*!< Reserved for SD security applications. */ |
Kojto | 115:87f2f5183dfb | 373 | #define SD_CMD_FAST_IO ((uint8_t)39) /*!< SD card doesn't support it (Reserved). */ |
Kojto | 115:87f2f5183dfb | 374 | #define SD_CMD_GO_IRQ_STATE ((uint8_t)40) /*!< SD card doesn't support it (Reserved). */ |
Kojto | 115:87f2f5183dfb | 375 | #define SD_CMD_LOCK_UNLOCK ((uint8_t)42) /*!< Sets/resets the password or lock/unlock the card. The size of the data block is set by |
Kojto | 115:87f2f5183dfb | 376 | the SET_BLOCK_LEN command. */ |
Kojto | 115:87f2f5183dfb | 377 | #define SD_CMD_APP_CMD ((uint8_t)55) /*!< Indicates to the card that the next command is an application specific command rather |
Kojto | 115:87f2f5183dfb | 378 | than a standard command. */ |
Kojto | 115:87f2f5183dfb | 379 | #define SD_CMD_GEN_CMD ((uint8_t)56) /*!< Used either to transfer a data block to the card or to get a data block from the card |
Kojto | 115:87f2f5183dfb | 380 | for general purpose/application specific commands. */ |
Kojto | 115:87f2f5183dfb | 381 | #define SD_CMD_NO_CMD ((uint8_t)64) |
Kojto | 115:87f2f5183dfb | 382 | |
Kojto | 115:87f2f5183dfb | 383 | /** |
Kojto | 115:87f2f5183dfb | 384 | * @brief Following commands are SD Card Specific commands. |
Kojto | 115:87f2f5183dfb | 385 | * SDMMC_APP_CMD should be sent before sending these commands. |
Kojto | 115:87f2f5183dfb | 386 | */ |
Kojto | 115:87f2f5183dfb | 387 | #define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6) /*!< (ACMD6) Defines the data bus width to be used for data transfer. The allowed data bus |
Kojto | 115:87f2f5183dfb | 388 | widths are given in SCR register. */ |
Kojto | 115:87f2f5183dfb | 389 | #define SD_CMD_SD_APP_STATUS ((uint8_t)13) /*!< (ACMD13) Sends the SD status. */ |
Kojto | 115:87f2f5183dfb | 390 | #define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22) /*!< (ACMD22) Sends the number of the written (without errors) write blocks. Responds with |
Kojto | 115:87f2f5183dfb | 391 | 32bit+CRC data block. */ |
Kojto | 115:87f2f5183dfb | 392 | #define SD_CMD_SD_APP_OP_COND ((uint8_t)41) /*!< (ACMD41) Sends host capacity support information (HCS) and asks the accessed card to |
Kojto | 115:87f2f5183dfb | 393 | send its operating condition register (OCR) content in the response on the CMD line. */ |
Kojto | 115:87f2f5183dfb | 394 | #define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42) /*!< (ACMD42) Connects/Disconnects the 50 KOhm pull-up resistor on CD/DAT3 (pin 1) of the card. */ |
Kojto | 115:87f2f5183dfb | 395 | #define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51) /*!< Reads the SD Configuration Register (SCR). */ |
Kojto | 115:87f2f5183dfb | 396 | #define SD_CMD_SDMMC_RW_DIRECT ((uint8_t)52) /*!< For SD I/O card only, reserved for security specification. */ |
Kojto | 115:87f2f5183dfb | 397 | #define SD_CMD_SDMMC_RW_EXTENDED ((uint8_t)53) /*!< For SD I/O card only, reserved for security specification. */ |
Kojto | 115:87f2f5183dfb | 398 | |
Kojto | 115:87f2f5183dfb | 399 | /** |
Kojto | 115:87f2f5183dfb | 400 | * @brief Following commands are SD Card Specific security commands. |
Kojto | 115:87f2f5183dfb | 401 | * SD_CMD_APP_CMD should be sent before sending these commands. |
Kojto | 115:87f2f5183dfb | 402 | */ |
Kojto | 115:87f2f5183dfb | 403 | #define SD_CMD_SD_APP_GET_MKB ((uint8_t)43) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 404 | #define SD_CMD_SD_APP_GET_MID ((uint8_t)44) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 405 | #define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 406 | #define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 407 | #define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 408 | #define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 409 | #define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 410 | #define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 411 | #define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 412 | #define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 413 | #define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48) /*!< For SD card only */ |
Kojto | 115:87f2f5183dfb | 414 | |
Kojto | 115:87f2f5183dfb | 415 | /** |
Kojto | 115:87f2f5183dfb | 416 | * @brief Supported SD Memory Cards |
Kojto | 115:87f2f5183dfb | 417 | */ |
Kojto | 115:87f2f5183dfb | 418 | #define STD_CAPACITY_SD_CARD_V1_1 ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 419 | #define STD_CAPACITY_SD_CARD_V2_0 ((uint32_t)0x00000001) |
Kojto | 115:87f2f5183dfb | 420 | #define HIGH_CAPACITY_SD_CARD ((uint32_t)0x00000002) |
Kojto | 115:87f2f5183dfb | 421 | #define MULTIMEDIA_CARD ((uint32_t)0x00000003) |
Kojto | 115:87f2f5183dfb | 422 | #define SECURE_DIGITAL_IO_CARD ((uint32_t)0x00000004) |
Kojto | 115:87f2f5183dfb | 423 | #define HIGH_SPEED_MULTIMEDIA_CARD ((uint32_t)0x00000005) |
Kojto | 115:87f2f5183dfb | 424 | #define SECURE_DIGITAL_IO_COMBO_CARD ((uint32_t)0x00000006) |
Kojto | 115:87f2f5183dfb | 425 | #define HIGH_CAPACITY_MMC_CARD ((uint32_t)0x00000007) |
Kojto | 115:87f2f5183dfb | 426 | /** |
Kojto | 115:87f2f5183dfb | 427 | * @} |
Kojto | 115:87f2f5183dfb | 428 | */ |
Kojto | 115:87f2f5183dfb | 429 | |
Kojto | 115:87f2f5183dfb | 430 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 431 | /** @defgroup SD_Exported_macros SD Exported Macros |
Kojto | 115:87f2f5183dfb | 432 | * @brief macros to handle interrupts and specific clock configurations |
Kojto | 115:87f2f5183dfb | 433 | * @{ |
Kojto | 115:87f2f5183dfb | 434 | */ |
Kojto | 115:87f2f5183dfb | 435 | |
Kojto | 115:87f2f5183dfb | 436 | /** |
Kojto | 115:87f2f5183dfb | 437 | * @brief Enable the SD device. |
Kojto | 115:87f2f5183dfb | 438 | * @retval None |
Kojto | 115:87f2f5183dfb | 439 | */ |
Kojto | 115:87f2f5183dfb | 440 | #define __HAL_SD_SDMMC_ENABLE(__HANDLE__) __SDMMC_ENABLE((__HANDLE__)->Instance) |
Kojto | 115:87f2f5183dfb | 441 | |
Kojto | 115:87f2f5183dfb | 442 | /** |
Kojto | 115:87f2f5183dfb | 443 | * @brief Disable the SD device. |
Kojto | 115:87f2f5183dfb | 444 | * @retval None |
Kojto | 115:87f2f5183dfb | 445 | */ |
Kojto | 115:87f2f5183dfb | 446 | #define __HAL_SD_SDMMC_DISABLE(__HANDLE__) __SDMMC_DISABLE((__HANDLE__)->Instance) |
Kojto | 115:87f2f5183dfb | 447 | |
Kojto | 115:87f2f5183dfb | 448 | /** |
Kojto | 115:87f2f5183dfb | 449 | * @brief Enable the SDMMC DMA transfer. |
Kojto | 115:87f2f5183dfb | 450 | * @retval None |
Kojto | 115:87f2f5183dfb | 451 | */ |
Kojto | 115:87f2f5183dfb | 452 | #define __HAL_SD_SDMMC_DMA_ENABLE(__HANDLE__) __SDMMC_DMA_ENABLE((__HANDLE__)->Instance) |
Kojto | 115:87f2f5183dfb | 453 | |
Kojto | 115:87f2f5183dfb | 454 | /** |
Kojto | 115:87f2f5183dfb | 455 | * @brief Disable the SDMMC DMA transfer. |
Kojto | 115:87f2f5183dfb | 456 | * @retval None |
Kojto | 115:87f2f5183dfb | 457 | */ |
Kojto | 115:87f2f5183dfb | 458 | #define __HAL_SD_SDMMC_DMA_DISABLE(__HANDLE__) __SDMMC_DMA_DISABLE((__HANDLE__)->Instance) |
Kojto | 115:87f2f5183dfb | 459 | |
Kojto | 115:87f2f5183dfb | 460 | /** |
Kojto | 115:87f2f5183dfb | 461 | * @brief Enable the SD device interrupt. |
Kojto | 115:87f2f5183dfb | 462 | * @param __HANDLE__: SD Handle |
Kojto | 115:87f2f5183dfb | 463 | * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be enabled. |
Kojto | 115:87f2f5183dfb | 464 | * This parameter can be one or a combination of the following values: |
Kojto | 115:87f2f5183dfb | 465 | * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
Kojto | 115:87f2f5183dfb | 466 | * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
Kojto | 115:87f2f5183dfb | 467 | * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt |
Kojto | 115:87f2f5183dfb | 468 | * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt |
Kojto | 115:87f2f5183dfb | 469 | * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
Kojto | 115:87f2f5183dfb | 470 | * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt |
Kojto | 115:87f2f5183dfb | 471 | * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt |
Kojto | 115:87f2f5183dfb | 472 | * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt |
Kojto | 115:87f2f5183dfb | 473 | * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
Kojto | 115:87f2f5183dfb | 474 | * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
Kojto | 115:87f2f5183dfb | 475 | * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt |
Kojto | 115:87f2f5183dfb | 476 | * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt |
Kojto | 115:87f2f5183dfb | 477 | * @arg SDMMC_IT_RXACT: Data receive in progress interrupt |
Kojto | 115:87f2f5183dfb | 478 | * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
Kojto | 115:87f2f5183dfb | 479 | * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
Kojto | 115:87f2f5183dfb | 480 | * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt |
Kojto | 115:87f2f5183dfb | 481 | * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt |
Kojto | 115:87f2f5183dfb | 482 | * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt |
Kojto | 115:87f2f5183dfb | 483 | * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt |
Kojto | 115:87f2f5183dfb | 484 | * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt |
Kojto | 115:87f2f5183dfb | 485 | * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt |
Kojto | 115:87f2f5183dfb | 486 | * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt |
Kojto | 115:87f2f5183dfb | 487 | * @retval None |
Kojto | 115:87f2f5183dfb | 488 | */ |
Kojto | 115:87f2f5183dfb | 489 | #define __HAL_SD_SDMMC_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__)) |
Kojto | 115:87f2f5183dfb | 490 | |
Kojto | 115:87f2f5183dfb | 491 | /** |
Kojto | 115:87f2f5183dfb | 492 | * @brief Disable the SD device interrupt. |
Kojto | 115:87f2f5183dfb | 493 | * @param __HANDLE__: SD Handle |
Kojto | 115:87f2f5183dfb | 494 | * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be disabled. |
Kojto | 115:87f2f5183dfb | 495 | * This parameter can be one or a combination of the following values: |
Kojto | 115:87f2f5183dfb | 496 | * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
Kojto | 115:87f2f5183dfb | 497 | * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
Kojto | 115:87f2f5183dfb | 498 | * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt |
Kojto | 115:87f2f5183dfb | 499 | * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt |
Kojto | 115:87f2f5183dfb | 500 | * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
Kojto | 115:87f2f5183dfb | 501 | * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt |
Kojto | 115:87f2f5183dfb | 502 | * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt |
Kojto | 115:87f2f5183dfb | 503 | * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt |
Kojto | 115:87f2f5183dfb | 504 | * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
Kojto | 115:87f2f5183dfb | 505 | * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
Kojto | 115:87f2f5183dfb | 506 | * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt |
Kojto | 115:87f2f5183dfb | 507 | * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt |
Kojto | 115:87f2f5183dfb | 508 | * @arg SDMMC_IT_RXACT: Data receive in progress interrupt |
Kojto | 115:87f2f5183dfb | 509 | * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
Kojto | 115:87f2f5183dfb | 510 | * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
Kojto | 115:87f2f5183dfb | 511 | * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt |
Kojto | 115:87f2f5183dfb | 512 | * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt |
Kojto | 115:87f2f5183dfb | 513 | * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt |
Kojto | 115:87f2f5183dfb | 514 | * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt |
Kojto | 115:87f2f5183dfb | 515 | * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt |
Kojto | 115:87f2f5183dfb | 516 | * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt |
Kojto | 115:87f2f5183dfb | 517 | * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt |
Kojto | 115:87f2f5183dfb | 518 | * @retval None |
Kojto | 115:87f2f5183dfb | 519 | */ |
Kojto | 115:87f2f5183dfb | 520 | #define __HAL_SD_SDMMC_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__)) |
Kojto | 115:87f2f5183dfb | 521 | |
Kojto | 115:87f2f5183dfb | 522 | /** |
Kojto | 115:87f2f5183dfb | 523 | * @brief Check whether the specified SD flag is set or not. |
Kojto | 115:87f2f5183dfb | 524 | * @param __HANDLE__: SD Handle |
Kojto | 115:87f2f5183dfb | 525 | * @param __FLAG__: specifies the flag to check. |
Kojto | 115:87f2f5183dfb | 526 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 527 | * @arg SDMMC_FLAG_CCRCFAIL: Command response received (CRC check failed) |
Kojto | 115:87f2f5183dfb | 528 | * @arg SDMMC_FLAG_DCRCFAIL: Data block sent/received (CRC check failed) |
Kojto | 115:87f2f5183dfb | 529 | * @arg SDMMC_FLAG_CTIMEOUT: Command response timeout |
Kojto | 115:87f2f5183dfb | 530 | * @arg SDMMC_FLAG_DTIMEOUT: Data timeout |
Kojto | 115:87f2f5183dfb | 531 | * @arg SDMMC_FLAG_TXUNDERR: Transmit FIFO underrun error |
Kojto | 115:87f2f5183dfb | 532 | * @arg SDMMC_FLAG_RXOVERR: Received FIFO overrun error |
Kojto | 115:87f2f5183dfb | 533 | * @arg SDMMC_FLAG_CMDREND: Command response received (CRC check passed) |
Kojto | 115:87f2f5183dfb | 534 | * @arg SDMMC_FLAG_CMDSENT: Command sent (no response required) |
Kojto | 115:87f2f5183dfb | 535 | * @arg SDMMC_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) |
Kojto | 115:87f2f5183dfb | 536 | * @arg SDMMC_FLAG_DBCKEND: Data block sent/received (CRC check passed) |
Kojto | 115:87f2f5183dfb | 537 | * @arg SDMMC_FLAG_CMDACT: Command transfer in progress |
Kojto | 115:87f2f5183dfb | 538 | * @arg SDMMC_FLAG_TXACT: Data transmit in progress |
Kojto | 115:87f2f5183dfb | 539 | * @arg SDMMC_FLAG_RXACT: Data receive in progress |
Kojto | 115:87f2f5183dfb | 540 | * @arg SDMMC_FLAG_TXFIFOHE: Transmit FIFO Half Empty |
Kojto | 115:87f2f5183dfb | 541 | * @arg SDMMC_FLAG_RXFIFOHF: Receive FIFO Half Full |
Kojto | 115:87f2f5183dfb | 542 | * @arg SDMMC_FLAG_TXFIFOF: Transmit FIFO full |
Kojto | 115:87f2f5183dfb | 543 | * @arg SDMMC_FLAG_RXFIFOF: Receive FIFO full |
Kojto | 115:87f2f5183dfb | 544 | * @arg SDMMC_FLAG_TXFIFOE: Transmit FIFO empty |
Kojto | 115:87f2f5183dfb | 545 | * @arg SDMMC_FLAG_RXFIFOE: Receive FIFO empty |
Kojto | 115:87f2f5183dfb | 546 | * @arg SDMMC_FLAG_TXDAVL: Data available in transmit FIFO |
Kojto | 115:87f2f5183dfb | 547 | * @arg SDMMC_FLAG_RXDAVL: Data available in receive FIFO |
Kojto | 115:87f2f5183dfb | 548 | * @arg SDMMC_FLAG_SDIOIT: SD I/O interrupt received |
Kojto | 115:87f2f5183dfb | 549 | * @retval The new state of SD FLAG (SET or RESET). |
Kojto | 115:87f2f5183dfb | 550 | */ |
Kojto | 115:87f2f5183dfb | 551 | #define __HAL_SD_SDMMC_GET_FLAG(__HANDLE__, __FLAG__) __SDMMC_GET_FLAG((__HANDLE__)->Instance, (__FLAG__)) |
Kojto | 115:87f2f5183dfb | 552 | |
Kojto | 115:87f2f5183dfb | 553 | /** |
Kojto | 115:87f2f5183dfb | 554 | * @brief Clear the SD's pending flags. |
Kojto | 115:87f2f5183dfb | 555 | * @param __HANDLE__: SD Handle |
Kojto | 115:87f2f5183dfb | 556 | * @param __FLAG__: specifies the flag to clear. |
Kojto | 115:87f2f5183dfb | 557 | * This parameter can be one or a combination of the following values: |
Kojto | 115:87f2f5183dfb | 558 | * @arg SDMMC_FLAG_CCRCFAIL: Command response received (CRC check failed) |
Kojto | 115:87f2f5183dfb | 559 | * @arg SDMMC_FLAG_DCRCFAIL: Data block sent/received (CRC check failed) |
Kojto | 115:87f2f5183dfb | 560 | * @arg SDMMC_FLAG_CTIMEOUT: Command response timeout |
Kojto | 115:87f2f5183dfb | 561 | * @arg SDMMC_FLAG_DTIMEOUT: Data timeout |
Kojto | 115:87f2f5183dfb | 562 | * @arg SDMMC_FLAG_TXUNDERR: Transmit FIFO underrun error |
Kojto | 115:87f2f5183dfb | 563 | * @arg SDMMC_FLAG_RXOVERR: Received FIFO overrun error |
Kojto | 115:87f2f5183dfb | 564 | * @arg SDMMC_FLAG_CMDREND: Command response received (CRC check passed) |
Kojto | 115:87f2f5183dfb | 565 | * @arg SDMMC_FLAG_CMDSENT: Command sent (no response required) |
Kojto | 115:87f2f5183dfb | 566 | * @arg SDMMC_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) |
Kojto | 115:87f2f5183dfb | 567 | * @arg SDMMC_FLAG_DBCKEND: Data block sent/received (CRC check passed) |
Kojto | 115:87f2f5183dfb | 568 | * @arg SDMMC_FLAG_SDIOIT: SD I/O interrupt received |
Kojto | 115:87f2f5183dfb | 569 | * @retval None |
Kojto | 115:87f2f5183dfb | 570 | */ |
Kojto | 115:87f2f5183dfb | 571 | #define __HAL_SD_SDMMC_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDMMC_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__)) |
Kojto | 115:87f2f5183dfb | 572 | |
Kojto | 115:87f2f5183dfb | 573 | /** |
Kojto | 115:87f2f5183dfb | 574 | * @brief Check whether the specified SD interrupt has occurred or not. |
Kojto | 115:87f2f5183dfb | 575 | * @param __HANDLE__: SD Handle |
Kojto | 115:87f2f5183dfb | 576 | * @param __INTERRUPT__: specifies the SDMMC interrupt source to check. |
Kojto | 115:87f2f5183dfb | 577 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 578 | * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
Kojto | 115:87f2f5183dfb | 579 | * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
Kojto | 115:87f2f5183dfb | 580 | * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt |
Kojto | 115:87f2f5183dfb | 581 | * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt |
Kojto | 115:87f2f5183dfb | 582 | * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
Kojto | 115:87f2f5183dfb | 583 | * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt |
Kojto | 115:87f2f5183dfb | 584 | * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt |
Kojto | 115:87f2f5183dfb | 585 | * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt |
Kojto | 115:87f2f5183dfb | 586 | * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
Kojto | 115:87f2f5183dfb | 587 | * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
Kojto | 115:87f2f5183dfb | 588 | * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt |
Kojto | 115:87f2f5183dfb | 589 | * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt |
Kojto | 115:87f2f5183dfb | 590 | * @arg SDMMC_IT_RXACT: Data receive in progress interrupt |
Kojto | 115:87f2f5183dfb | 591 | * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
Kojto | 115:87f2f5183dfb | 592 | * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
Kojto | 115:87f2f5183dfb | 593 | * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt |
Kojto | 115:87f2f5183dfb | 594 | * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt |
Kojto | 115:87f2f5183dfb | 595 | * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt |
Kojto | 115:87f2f5183dfb | 596 | * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt |
Kojto | 115:87f2f5183dfb | 597 | * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt |
Kojto | 115:87f2f5183dfb | 598 | * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt |
Kojto | 115:87f2f5183dfb | 599 | * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt |
Kojto | 115:87f2f5183dfb | 600 | * @retval The new state of SD IT (SET or RESET). |
Kojto | 115:87f2f5183dfb | 601 | */ |
Kojto | 115:87f2f5183dfb | 602 | #define __HAL_SD_SDMMC_GET_IT(__HANDLE__, __INTERRUPT__) __SDMMC_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__)) |
Kojto | 115:87f2f5183dfb | 603 | |
Kojto | 115:87f2f5183dfb | 604 | /** |
Kojto | 115:87f2f5183dfb | 605 | * @brief Clear the SD's interrupt pending bits. |
Kojto | 115:87f2f5183dfb | 606 | * @param __HANDLE__: SD Handle |
Kojto | 115:87f2f5183dfb | 607 | * @param __INTERRUPT__: specifies the interrupt pending bit to clear. |
Kojto | 115:87f2f5183dfb | 608 | * This parameter can be one or a combination of the following values: |
Kojto | 115:87f2f5183dfb | 609 | * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
Kojto | 115:87f2f5183dfb | 610 | * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
Kojto | 115:87f2f5183dfb | 611 | * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt |
Kojto | 115:87f2f5183dfb | 612 | * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt |
Kojto | 115:87f2f5183dfb | 613 | * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
Kojto | 115:87f2f5183dfb | 614 | * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt |
Kojto | 115:87f2f5183dfb | 615 | * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt |
Kojto | 115:87f2f5183dfb | 616 | * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt |
Kojto | 115:87f2f5183dfb | 617 | * @arg SDMMC_IT_DATAEND: Data end (data counter, SDMMC_DCOUNT, is zero) interrupt |
Kojto | 115:87f2f5183dfb | 618 | * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt |
Kojto | 115:87f2f5183dfb | 619 | * @retval None |
Kojto | 115:87f2f5183dfb | 620 | */ |
Kojto | 115:87f2f5183dfb | 621 | #define __HAL_SD_SDMMC_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDMMC_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__)) |
Kojto | 115:87f2f5183dfb | 622 | /** |
Kojto | 115:87f2f5183dfb | 623 | * @} |
Kojto | 115:87f2f5183dfb | 624 | */ |
Kojto | 115:87f2f5183dfb | 625 | |
Kojto | 115:87f2f5183dfb | 626 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 627 | /** @defgroup SD_Exported_Functions SD Exported Functions |
Kojto | 115:87f2f5183dfb | 628 | * @{ |
Kojto | 115:87f2f5183dfb | 629 | */ |
Kojto | 115:87f2f5183dfb | 630 | |
Kojto | 115:87f2f5183dfb | 631 | /** @defgroup SD_Exported_Functions_Group1 Initialization and de-initialization functions |
Kojto | 115:87f2f5183dfb | 632 | * @{ |
Kojto | 115:87f2f5183dfb | 633 | */ |
Kojto | 115:87f2f5183dfb | 634 | HAL_SD_ErrorTypedef HAL_SD_Init(SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypedef *SDCardInfo); |
Kojto | 115:87f2f5183dfb | 635 | HAL_StatusTypeDef HAL_SD_DeInit (SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 636 | void HAL_SD_MspInit(SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 637 | void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 638 | /** |
Kojto | 115:87f2f5183dfb | 639 | * @} |
Kojto | 115:87f2f5183dfb | 640 | */ |
Kojto | 115:87f2f5183dfb | 641 | |
Kojto | 115:87f2f5183dfb | 642 | /** @defgroup SD_Exported_Functions_Group2 Input and Output operation functions |
Kojto | 115:87f2f5183dfb | 643 | * @{ |
Kojto | 115:87f2f5183dfb | 644 | */ |
Kojto | 115:87f2f5183dfb | 645 | /* Blocking mode: Polling */ |
Kojto | 115:87f2f5183dfb | 646 | HAL_SD_ErrorTypedef HAL_SD_ReadBlocks(SD_HandleTypeDef *hsd, uint32_t *pReadBuffer, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumberOfBlocks); |
Kojto | 115:87f2f5183dfb | 647 | HAL_SD_ErrorTypedef HAL_SD_WriteBlocks(SD_HandleTypeDef *hsd, uint32_t *pWriteBuffer, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumberOfBlocks); |
Kojto | 115:87f2f5183dfb | 648 | HAL_SD_ErrorTypedef HAL_SD_Erase(SD_HandleTypeDef *hsd, uint64_t startaddr, uint64_t endaddr); |
Kojto | 115:87f2f5183dfb | 649 | |
Kojto | 115:87f2f5183dfb | 650 | /* Non-Blocking mode: Interrupt */ |
Kojto | 115:87f2f5183dfb | 651 | void HAL_SD_IRQHandler(SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 652 | |
Kojto | 115:87f2f5183dfb | 653 | /* Callback in non blocking modes (DMA) */ |
Kojto | 115:87f2f5183dfb | 654 | void HAL_SD_DMA_RxCpltCallback(DMA_HandleTypeDef *hdma); |
Kojto | 115:87f2f5183dfb | 655 | void HAL_SD_DMA_RxErrorCallback(DMA_HandleTypeDef *hdma); |
Kojto | 115:87f2f5183dfb | 656 | void HAL_SD_DMA_TxCpltCallback(DMA_HandleTypeDef *hdma); |
Kojto | 115:87f2f5183dfb | 657 | void HAL_SD_DMA_TxErrorCallback(DMA_HandleTypeDef *hdma); |
Kojto | 115:87f2f5183dfb | 658 | void HAL_SD_XferCpltCallback(SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 659 | void HAL_SD_XferErrorCallback(SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 660 | |
Kojto | 115:87f2f5183dfb | 661 | /* Non-Blocking mode: DMA */ |
Kojto | 115:87f2f5183dfb | 662 | HAL_SD_ErrorTypedef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint32_t *pReadBuffer, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumberOfBlocks); |
Kojto | 115:87f2f5183dfb | 663 | HAL_SD_ErrorTypedef HAL_SD_WriteBlocks_DMA(SD_HandleTypeDef *hsd, uint32_t *pWriteBuffer, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumberOfBlocks); |
Kojto | 115:87f2f5183dfb | 664 | HAL_SD_ErrorTypedef HAL_SD_CheckWriteOperation(SD_HandleTypeDef *hsd, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 665 | HAL_SD_ErrorTypedef HAL_SD_CheckReadOperation(SD_HandleTypeDef *hsd, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 666 | /** |
Kojto | 115:87f2f5183dfb | 667 | * @} |
Kojto | 115:87f2f5183dfb | 668 | */ |
Kojto | 115:87f2f5183dfb | 669 | |
Kojto | 115:87f2f5183dfb | 670 | /** @defgroup SD_Exported_Functions_Group3 Peripheral Control functions |
Kojto | 115:87f2f5183dfb | 671 | * @{ |
Kojto | 115:87f2f5183dfb | 672 | */ |
Kojto | 115:87f2f5183dfb | 673 | HAL_SD_ErrorTypedef HAL_SD_Get_CardInfo(SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypedef *pCardInfo); |
Kojto | 115:87f2f5183dfb | 674 | HAL_SD_ErrorTypedef HAL_SD_WideBusOperation_Config(SD_HandleTypeDef *hsd, uint32_t WideMode); |
Kojto | 115:87f2f5183dfb | 675 | HAL_SD_ErrorTypedef HAL_SD_StopTransfer(SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 676 | HAL_SD_ErrorTypedef HAL_SD_HighSpeed (SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 677 | /** |
Kojto | 115:87f2f5183dfb | 678 | * @} |
Kojto | 115:87f2f5183dfb | 679 | */ |
Kojto | 115:87f2f5183dfb | 680 | |
Kojto | 115:87f2f5183dfb | 681 | /* Peripheral State functions ************************************************/ |
Kojto | 115:87f2f5183dfb | 682 | /** @defgroup SD_Exported_Functions_Group4 Peripheral State functions |
Kojto | 115:87f2f5183dfb | 683 | * @{ |
Kojto | 115:87f2f5183dfb | 684 | */ |
Kojto | 115:87f2f5183dfb | 685 | HAL_SD_ErrorTypedef HAL_SD_SendSDStatus(SD_HandleTypeDef *hsd, uint32_t *pSDstatus); |
Kojto | 115:87f2f5183dfb | 686 | HAL_SD_ErrorTypedef HAL_SD_GetCardStatus(SD_HandleTypeDef *hsd, HAL_SD_CardStatusTypedef *pCardStatus); |
Kojto | 115:87f2f5183dfb | 687 | HAL_SD_TransferStateTypedef HAL_SD_GetStatus(SD_HandleTypeDef *hsd); |
Kojto | 115:87f2f5183dfb | 688 | /** |
Kojto | 115:87f2f5183dfb | 689 | * @} |
Kojto | 115:87f2f5183dfb | 690 | */ |
Kojto | 115:87f2f5183dfb | 691 | |
Kojto | 115:87f2f5183dfb | 692 | /** |
Kojto | 115:87f2f5183dfb | 693 | * @} |
Kojto | 115:87f2f5183dfb | 694 | */ |
Kojto | 115:87f2f5183dfb | 695 | |
Kojto | 115:87f2f5183dfb | 696 | /* Private types -------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 697 | /** @defgroup SD_Private_Types SD Private Types |
Kojto | 115:87f2f5183dfb | 698 | * @{ |
Kojto | 115:87f2f5183dfb | 699 | */ |
Kojto | 115:87f2f5183dfb | 700 | |
Kojto | 115:87f2f5183dfb | 701 | /** |
Kojto | 115:87f2f5183dfb | 702 | * @} |
Kojto | 115:87f2f5183dfb | 703 | */ |
Kojto | 115:87f2f5183dfb | 704 | |
Kojto | 115:87f2f5183dfb | 705 | /* Private defines -----------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 706 | /** @defgroup SD_Private_Defines SD Private Defines |
Kojto | 115:87f2f5183dfb | 707 | * @{ |
Kojto | 115:87f2f5183dfb | 708 | */ |
Kojto | 115:87f2f5183dfb | 709 | |
Kojto | 115:87f2f5183dfb | 710 | /** |
Kojto | 115:87f2f5183dfb | 711 | * @} |
Kojto | 115:87f2f5183dfb | 712 | */ |
Kojto | 115:87f2f5183dfb | 713 | |
Kojto | 115:87f2f5183dfb | 714 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 715 | /** @defgroup SD_Private_Variables SD Private Variables |
Kojto | 115:87f2f5183dfb | 716 | * @{ |
Kojto | 115:87f2f5183dfb | 717 | */ |
Kojto | 115:87f2f5183dfb | 718 | |
Kojto | 115:87f2f5183dfb | 719 | /** |
Kojto | 115:87f2f5183dfb | 720 | * @} |
Kojto | 115:87f2f5183dfb | 721 | */ |
Kojto | 115:87f2f5183dfb | 722 | |
Kojto | 115:87f2f5183dfb | 723 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 724 | /** @defgroup SD_Private_Constants SD Private Constants |
Kojto | 115:87f2f5183dfb | 725 | * @{ |
Kojto | 115:87f2f5183dfb | 726 | */ |
Kojto | 115:87f2f5183dfb | 727 | |
Kojto | 115:87f2f5183dfb | 728 | /** |
Kojto | 115:87f2f5183dfb | 729 | * @} |
Kojto | 115:87f2f5183dfb | 730 | */ |
Kojto | 115:87f2f5183dfb | 731 | |
Kojto | 115:87f2f5183dfb | 732 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 733 | /** @defgroup SD_Private_Macros SD Private Macros |
Kojto | 115:87f2f5183dfb | 734 | * @{ |
Kojto | 115:87f2f5183dfb | 735 | */ |
Kojto | 115:87f2f5183dfb | 736 | |
Kojto | 115:87f2f5183dfb | 737 | /** |
Kojto | 115:87f2f5183dfb | 738 | * @} |
Kojto | 115:87f2f5183dfb | 739 | */ |
Kojto | 115:87f2f5183dfb | 740 | |
Kojto | 115:87f2f5183dfb | 741 | /* Private functions prototypes ----------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 742 | /** @defgroup SD_Private_Functions_Prototypes SD Private Functions Prototypes |
Kojto | 115:87f2f5183dfb | 743 | * @{ |
Kojto | 115:87f2f5183dfb | 744 | */ |
Kojto | 115:87f2f5183dfb | 745 | |
Kojto | 115:87f2f5183dfb | 746 | /** |
Kojto | 115:87f2f5183dfb | 747 | * @} |
Kojto | 115:87f2f5183dfb | 748 | */ |
Kojto | 115:87f2f5183dfb | 749 | |
Kojto | 115:87f2f5183dfb | 750 | /* Private functions ---------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 751 | /** @defgroup SD_Private_Functions SD Private Functions |
Kojto | 115:87f2f5183dfb | 752 | * @{ |
Kojto | 115:87f2f5183dfb | 753 | */ |
Kojto | 115:87f2f5183dfb | 754 | |
Kojto | 115:87f2f5183dfb | 755 | /** |
Kojto | 115:87f2f5183dfb | 756 | * @} |
Kojto | 115:87f2f5183dfb | 757 | */ |
Kojto | 115:87f2f5183dfb | 758 | |
Kojto | 115:87f2f5183dfb | 759 | /** |
Kojto | 115:87f2f5183dfb | 760 | * @} |
Kojto | 115:87f2f5183dfb | 761 | */ |
Kojto | 115:87f2f5183dfb | 762 | |
Kojto | 115:87f2f5183dfb | 763 | /** |
Kojto | 115:87f2f5183dfb | 764 | * @} |
Kojto | 115:87f2f5183dfb | 765 | */ |
Kojto | 115:87f2f5183dfb | 766 | |
Kojto | 115:87f2f5183dfb | 767 | #ifdef __cplusplus |
Kojto | 115:87f2f5183dfb | 768 | } |
Kojto | 115:87f2f5183dfb | 769 | #endif |
Kojto | 115:87f2f5183dfb | 770 | |
Kojto | 115:87f2f5183dfb | 771 | |
Kojto | 115:87f2f5183dfb | 772 | #endif /* __STM32F7xx_HAL_SD_H */ |
Kojto | 115:87f2f5183dfb | 773 | |
Kojto | 115:87f2f5183dfb | 774 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |