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