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


