inport from local

Dependents:   Hobbyking_Cheetah_0511

Committer:
NYX
Date:
Mon Mar 16 06:35:48 2020 +0000
Revision:
0:85b3fd62ea1a
reinport to mbed;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
NYX 0:85b3fd62ea1a 1 /**
NYX 0:85b3fd62ea1a 2 ******************************************************************************
NYX 0:85b3fd62ea1a 3 * @file stm32f4xx_hal_mmc.h
NYX 0:85b3fd62ea1a 4 * @author MCD Application Team
NYX 0:85b3fd62ea1a 5 * @version V1.7.1
NYX 0:85b3fd62ea1a 6 * @date 14-April-2017
NYX 0:85b3fd62ea1a 7 * @brief Header file of MMC HAL module.
NYX 0:85b3fd62ea1a 8 ******************************************************************************
NYX 0:85b3fd62ea1a 9 * @attention
NYX 0:85b3fd62ea1a 10 *
NYX 0:85b3fd62ea1a 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
NYX 0:85b3fd62ea1a 12 *
NYX 0:85b3fd62ea1a 13 * Redistribution and use in source and binary forms, with or without modification,
NYX 0:85b3fd62ea1a 14 * are permitted provided that the following conditions are met:
NYX 0:85b3fd62ea1a 15 * 1. Redistributions of source code must retain the above copyright notice,
NYX 0:85b3fd62ea1a 16 * this list of conditions and the following disclaimer.
NYX 0:85b3fd62ea1a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
NYX 0:85b3fd62ea1a 18 * this list of conditions and the following disclaimer in the documentation
NYX 0:85b3fd62ea1a 19 * and/or other materials provided with the distribution.
NYX 0:85b3fd62ea1a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
NYX 0:85b3fd62ea1a 21 * may be used to endorse or promote products derived from this software
NYX 0:85b3fd62ea1a 22 * without specific prior written permission.
NYX 0:85b3fd62ea1a 23 *
NYX 0:85b3fd62ea1a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
NYX 0:85b3fd62ea1a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
NYX 0:85b3fd62ea1a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
NYX 0:85b3fd62ea1a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
NYX 0:85b3fd62ea1a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
NYX 0:85b3fd62ea1a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
NYX 0:85b3fd62ea1a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
NYX 0:85b3fd62ea1a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
NYX 0:85b3fd62ea1a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
NYX 0:85b3fd62ea1a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NYX 0:85b3fd62ea1a 34 *
NYX 0:85b3fd62ea1a 35 ******************************************************************************
NYX 0:85b3fd62ea1a 36 */
NYX 0:85b3fd62ea1a 37
NYX 0:85b3fd62ea1a 38 /* Define to prevent recursive inclusion -------------------------------------*/
NYX 0:85b3fd62ea1a 39 #ifndef __STM32F4xx_HAL_MMC_H
NYX 0:85b3fd62ea1a 40 #define __STM32F4xx_HAL_MMC_H
NYX 0:85b3fd62ea1a 41
NYX 0:85b3fd62ea1a 42 #ifdef __cplusplus
NYX 0:85b3fd62ea1a 43 extern "C" {
NYX 0:85b3fd62ea1a 44 #endif
NYX 0:85b3fd62ea1a 45
NYX 0:85b3fd62ea1a 46 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
NYX 0:85b3fd62ea1a 47 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
NYX 0:85b3fd62ea1a 48 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
NYX 0:85b3fd62ea1a 49 defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
NYX 0:85b3fd62ea1a 50 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
NYX 0:85b3fd62ea1a 51
NYX 0:85b3fd62ea1a 52 /* Includes ------------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 53 #include "stm32f4xx_ll_sdmmc.h"
NYX 0:85b3fd62ea1a 54
NYX 0:85b3fd62ea1a 55 /** @addtogroup STM32F4xx_HAL_Driver
NYX 0:85b3fd62ea1a 56 * @{
NYX 0:85b3fd62ea1a 57 */
NYX 0:85b3fd62ea1a 58
NYX 0:85b3fd62ea1a 59 /** @defgroup MMC MMC
NYX 0:85b3fd62ea1a 60 * @brief MMC HAL module driver
NYX 0:85b3fd62ea1a 61 * @{
NYX 0:85b3fd62ea1a 62 */
NYX 0:85b3fd62ea1a 63
NYX 0:85b3fd62ea1a 64 /* Exported types ------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 65 /** @defgroup MMC_Exported_Types MMC Exported Types
NYX 0:85b3fd62ea1a 66 * @{
NYX 0:85b3fd62ea1a 67 */
NYX 0:85b3fd62ea1a 68
NYX 0:85b3fd62ea1a 69 /** @defgroup MMC_Exported_Types_Group1 MMC State enumeration structure
NYX 0:85b3fd62ea1a 70 * @{
NYX 0:85b3fd62ea1a 71 */
NYX 0:85b3fd62ea1a 72 typedef enum
NYX 0:85b3fd62ea1a 73 {
NYX 0:85b3fd62ea1a 74 HAL_MMC_STATE_RESET = 0x00000000U, /*!< MMC not yet initialized or disabled */
NYX 0:85b3fd62ea1a 75 HAL_MMC_STATE_READY = 0x00000001U, /*!< MMC initialized and ready for use */
NYX 0:85b3fd62ea1a 76 HAL_MMC_STATE_TIMEOUT = 0x00000002U, /*!< MMC Timeout state */
NYX 0:85b3fd62ea1a 77 HAL_MMC_STATE_BUSY = 0x00000003U, /*!< MMC process ongoing */
NYX 0:85b3fd62ea1a 78 HAL_MMC_STATE_PROGRAMMING = 0x00000004U, /*!< MMC Programming State */
NYX 0:85b3fd62ea1a 79 HAL_MMC_STATE_RECEIVING = 0x00000005U, /*!< MMC Receinving State */
NYX 0:85b3fd62ea1a 80 HAL_MMC_STATE_TRANSFER = 0x00000006U, /*!< MMC Transfert State */
NYX 0:85b3fd62ea1a 81 HAL_MMC_STATE_ERROR = 0x0000000FU /*!< MMC is in error state */
NYX 0:85b3fd62ea1a 82 }HAL_MMC_StateTypeDef;
NYX 0:85b3fd62ea1a 83 /**
NYX 0:85b3fd62ea1a 84 * @}
NYX 0:85b3fd62ea1a 85 */
NYX 0:85b3fd62ea1a 86
NYX 0:85b3fd62ea1a 87 /** @defgroup MMC_Exported_Types_Group2 MMC Card State enumeration structure
NYX 0:85b3fd62ea1a 88 * @{
NYX 0:85b3fd62ea1a 89 */
NYX 0:85b3fd62ea1a 90 typedef enum
NYX 0:85b3fd62ea1a 91 {
NYX 0:85b3fd62ea1a 92 HAL_MMC_CARD_READY = 0x00000001U, /*!< Card state is ready */
NYX 0:85b3fd62ea1a 93 HAL_MMC_CARD_IDENTIFICATION = 0x00000002U, /*!< Card is in identification state */
NYX 0:85b3fd62ea1a 94 HAL_MMC_CARD_STANDBY = 0x00000003U, /*!< Card is in standby state */
NYX 0:85b3fd62ea1a 95 HAL_MMC_CARD_TRANSFER = 0x00000004U, /*!< Card is in transfer state */
NYX 0:85b3fd62ea1a 96 HAL_MMC_CARD_SENDING = 0x00000005U, /*!< Card is sending an operation */
NYX 0:85b3fd62ea1a 97 HAL_MMC_CARD_RECEIVING = 0x00000006U, /*!< Card is receiving operation information */
NYX 0:85b3fd62ea1a 98 HAL_MMC_CARD_PROGRAMMING = 0x00000007U, /*!< Card is in programming state */
NYX 0:85b3fd62ea1a 99 HAL_MMC_CARD_DISCONNECTED = 0x00000008U, /*!< Card is disconnected */
NYX 0:85b3fd62ea1a 100 HAL_MMC_CARD_ERROR = 0x000000FFU /*!< Card response Error */
NYX 0:85b3fd62ea1a 101 }HAL_MMC_CardStateTypeDef;
NYX 0:85b3fd62ea1a 102 /**
NYX 0:85b3fd62ea1a 103 * @}
NYX 0:85b3fd62ea1a 104 */
NYX 0:85b3fd62ea1a 105
NYX 0:85b3fd62ea1a 106 /** @defgroup MMC_Exported_Types_Group3 MMC Handle Structure definition
NYX 0:85b3fd62ea1a 107 * @{
NYX 0:85b3fd62ea1a 108 */
NYX 0:85b3fd62ea1a 109 #define MMC_InitTypeDef SDIO_InitTypeDef
NYX 0:85b3fd62ea1a 110 #define MMC_TypeDef SDIO_TypeDef
NYX 0:85b3fd62ea1a 111
NYX 0:85b3fd62ea1a 112 /**
NYX 0:85b3fd62ea1a 113 * @brief MMC Card Information Structure definition
NYX 0:85b3fd62ea1a 114 */
NYX 0:85b3fd62ea1a 115 typedef struct
NYX 0:85b3fd62ea1a 116 {
NYX 0:85b3fd62ea1a 117 uint32_t CardType; /*!< Specifies the card Type */
NYX 0:85b3fd62ea1a 118
NYX 0:85b3fd62ea1a 119 uint32_t Class; /*!< Specifies the class of the card class */
NYX 0:85b3fd62ea1a 120
NYX 0:85b3fd62ea1a 121 uint32_t RelCardAdd; /*!< Specifies the Relative Card Address */
NYX 0:85b3fd62ea1a 122
NYX 0:85b3fd62ea1a 123 uint32_t BlockNbr; /*!< Specifies the Card Capacity in blocks */
NYX 0:85b3fd62ea1a 124
NYX 0:85b3fd62ea1a 125 uint32_t BlockSize; /*!< Specifies one block size in bytes */
NYX 0:85b3fd62ea1a 126
NYX 0:85b3fd62ea1a 127 uint32_t LogBlockNbr; /*!< Specifies the Card logical Capacity in blocks */
NYX 0:85b3fd62ea1a 128
NYX 0:85b3fd62ea1a 129 uint32_t LogBlockSize; /*!< Specifies logical block size in bytes */
NYX 0:85b3fd62ea1a 130
NYX 0:85b3fd62ea1a 131 }HAL_MMC_CardInfoTypeDef;
NYX 0:85b3fd62ea1a 132
NYX 0:85b3fd62ea1a 133 /**
NYX 0:85b3fd62ea1a 134 * @brief MMC handle Structure definition
NYX 0:85b3fd62ea1a 135 */
NYX 0:85b3fd62ea1a 136 typedef struct
NYX 0:85b3fd62ea1a 137 {
NYX 0:85b3fd62ea1a 138 MMC_TypeDef *Instance; /*!< MMC registers base address */
NYX 0:85b3fd62ea1a 139
NYX 0:85b3fd62ea1a 140 MMC_InitTypeDef Init; /*!< MMC required parameters */
NYX 0:85b3fd62ea1a 141
NYX 0:85b3fd62ea1a 142 HAL_LockTypeDef Lock; /*!< MMC locking object */
NYX 0:85b3fd62ea1a 143
NYX 0:85b3fd62ea1a 144 uint32_t *pTxBuffPtr; /*!< Pointer to MMC Tx transfer Buffer */
NYX 0:85b3fd62ea1a 145
NYX 0:85b3fd62ea1a 146 uint32_t TxXferSize; /*!< MMC Tx Transfer size */
NYX 0:85b3fd62ea1a 147
NYX 0:85b3fd62ea1a 148 uint32_t *pRxBuffPtr; /*!< Pointer to MMC Rx transfer Buffer */
NYX 0:85b3fd62ea1a 149
NYX 0:85b3fd62ea1a 150 uint32_t RxXferSize; /*!< MMC Rx Transfer size */
NYX 0:85b3fd62ea1a 151
NYX 0:85b3fd62ea1a 152 __IO uint32_t Context; /*!< MMC transfer context */
NYX 0:85b3fd62ea1a 153
NYX 0:85b3fd62ea1a 154 __IO HAL_MMC_StateTypeDef State; /*!< MMC card State */
NYX 0:85b3fd62ea1a 155
NYX 0:85b3fd62ea1a 156 __IO uint32_t ErrorCode; /*!< MMC Card Error codes */
NYX 0:85b3fd62ea1a 157
NYX 0:85b3fd62ea1a 158 DMA_HandleTypeDef *hdmarx; /*!< MMC Rx DMA handle parameters */
NYX 0:85b3fd62ea1a 159
NYX 0:85b3fd62ea1a 160 DMA_HandleTypeDef *hdmatx; /*!< MMC Tx DMA handle parameters */
NYX 0:85b3fd62ea1a 161
NYX 0:85b3fd62ea1a 162 HAL_MMC_CardInfoTypeDef MmcCard; /*!< MMC Card information */
NYX 0:85b3fd62ea1a 163
NYX 0:85b3fd62ea1a 164 uint32_t CSD[4U]; /*!< MMC card specific data table */
NYX 0:85b3fd62ea1a 165
NYX 0:85b3fd62ea1a 166 uint32_t CID[4U]; /*!< MMC card identification number table */
NYX 0:85b3fd62ea1a 167
NYX 0:85b3fd62ea1a 168 }MMC_HandleTypeDef;
NYX 0:85b3fd62ea1a 169
NYX 0:85b3fd62ea1a 170 /**
NYX 0:85b3fd62ea1a 171 * @}
NYX 0:85b3fd62ea1a 172 */
NYX 0:85b3fd62ea1a 173
NYX 0:85b3fd62ea1a 174 /** @defgroup MMC_Exported_Types_Group4 Card Specific Data: CSD Register
NYX 0:85b3fd62ea1a 175 * @{
NYX 0:85b3fd62ea1a 176 */
NYX 0:85b3fd62ea1a 177 typedef struct
NYX 0:85b3fd62ea1a 178 {
NYX 0:85b3fd62ea1a 179 __IO uint8_t CSDStruct; /*!< CSD structure */
NYX 0:85b3fd62ea1a 180 __IO uint8_t SysSpecVersion; /*!< System specification version */
NYX 0:85b3fd62ea1a 181 __IO uint8_t Reserved1; /*!< Reserved */
NYX 0:85b3fd62ea1a 182 __IO uint8_t TAAC; /*!< Data read access time 1 */
NYX 0:85b3fd62ea1a 183 __IO uint8_t NSAC; /*!< Data read access time 2 in CLK cycles */
NYX 0:85b3fd62ea1a 184 __IO uint8_t MaxBusClkFrec; /*!< Max. bus clock frequency */
NYX 0:85b3fd62ea1a 185 __IO uint16_t CardComdClasses; /*!< Card command classes */
NYX 0:85b3fd62ea1a 186 __IO uint8_t RdBlockLen; /*!< Max. read data block length */
NYX 0:85b3fd62ea1a 187 __IO uint8_t PartBlockRead; /*!< Partial blocks for read allowed */
NYX 0:85b3fd62ea1a 188 __IO uint8_t WrBlockMisalign; /*!< Write block misalignment */
NYX 0:85b3fd62ea1a 189 __IO uint8_t RdBlockMisalign; /*!< Read block misalignment */
NYX 0:85b3fd62ea1a 190 __IO uint8_t DSRImpl; /*!< DSR implemented */
NYX 0:85b3fd62ea1a 191 __IO uint8_t Reserved2; /*!< Reserved */
NYX 0:85b3fd62ea1a 192 __IO uint32_t DeviceSize; /*!< Device Size */
NYX 0:85b3fd62ea1a 193 __IO uint8_t MaxRdCurrentVDDMin; /*!< Max. read current @ VDD min */
NYX 0:85b3fd62ea1a 194 __IO uint8_t MaxRdCurrentVDDMax; /*!< Max. read current @ VDD max */
NYX 0:85b3fd62ea1a 195 __IO uint8_t MaxWrCurrentVDDMin; /*!< Max. write current @ VDD min */
NYX 0:85b3fd62ea1a 196 __IO uint8_t MaxWrCurrentVDDMax; /*!< Max. write current @ VDD max */
NYX 0:85b3fd62ea1a 197 __IO uint8_t DeviceSizeMul; /*!< Device size multiplier */
NYX 0:85b3fd62ea1a 198 __IO uint8_t EraseGrSize; /*!< Erase group size */
NYX 0:85b3fd62ea1a 199 __IO uint8_t EraseGrMul; /*!< Erase group size multiplier */
NYX 0:85b3fd62ea1a 200 __IO uint8_t WrProtectGrSize; /*!< Write protect group size */
NYX 0:85b3fd62ea1a 201 __IO uint8_t WrProtectGrEnable; /*!< Write protect group enable */
NYX 0:85b3fd62ea1a 202 __IO uint8_t ManDeflECC; /*!< Manufacturer default ECC */
NYX 0:85b3fd62ea1a 203 __IO uint8_t WrSpeedFact; /*!< Write speed factor */
NYX 0:85b3fd62ea1a 204 __IO uint8_t MaxWrBlockLen; /*!< Max. write data block length */
NYX 0:85b3fd62ea1a 205 __IO uint8_t WriteBlockPaPartial; /*!< Partial blocks for write allowed */
NYX 0:85b3fd62ea1a 206 __IO uint8_t Reserved3; /*!< Reserved */
NYX 0:85b3fd62ea1a 207 __IO uint8_t ContentProtectAppli; /*!< Content protection application */
NYX 0:85b3fd62ea1a 208 __IO uint8_t FileFormatGrouop; /*!< File format group */
NYX 0:85b3fd62ea1a 209 __IO uint8_t CopyFlag; /*!< Copy flag (OTP) */
NYX 0:85b3fd62ea1a 210 __IO uint8_t PermWrProtect; /*!< Permanent write protection */
NYX 0:85b3fd62ea1a 211 __IO uint8_t TempWrProtect; /*!< Temporary write protection */
NYX 0:85b3fd62ea1a 212 __IO uint8_t FileFormat; /*!< File format */
NYX 0:85b3fd62ea1a 213 __IO uint8_t ECC; /*!< ECC code */
NYX 0:85b3fd62ea1a 214 __IO uint8_t CSD_CRC; /*!< CSD CRC */
NYX 0:85b3fd62ea1a 215 __IO uint8_t Reserved4; /*!< Always 1 */
NYX 0:85b3fd62ea1a 216
NYX 0:85b3fd62ea1a 217 }HAL_MMC_CardCSDTypeDef;
NYX 0:85b3fd62ea1a 218 /**
NYX 0:85b3fd62ea1a 219 * @}
NYX 0:85b3fd62ea1a 220 */
NYX 0:85b3fd62ea1a 221
NYX 0:85b3fd62ea1a 222 /** @defgroup MMC_Exported_Types_Group5 Card Identification Data: CID Register
NYX 0:85b3fd62ea1a 223 * @{
NYX 0:85b3fd62ea1a 224 */
NYX 0:85b3fd62ea1a 225 typedef struct
NYX 0:85b3fd62ea1a 226 {
NYX 0:85b3fd62ea1a 227 __IO uint8_t ManufacturerID; /*!< Manufacturer ID */
NYX 0:85b3fd62ea1a 228 __IO uint16_t OEM_AppliID; /*!< OEM/Application ID */
NYX 0:85b3fd62ea1a 229 __IO uint32_t ProdName1; /*!< Product Name part1 */
NYX 0:85b3fd62ea1a 230 __IO uint8_t ProdName2; /*!< Product Name part2 */
NYX 0:85b3fd62ea1a 231 __IO uint8_t ProdRev; /*!< Product Revision */
NYX 0:85b3fd62ea1a 232 __IO uint32_t ProdSN; /*!< Product Serial Number */
NYX 0:85b3fd62ea1a 233 __IO uint8_t Reserved1; /*!< Reserved1 */
NYX 0:85b3fd62ea1a 234 __IO uint16_t ManufactDate; /*!< Manufacturing Date */
NYX 0:85b3fd62ea1a 235 __IO uint8_t CID_CRC; /*!< CID CRC */
NYX 0:85b3fd62ea1a 236 __IO uint8_t Reserved2; /*!< Always 1 */
NYX 0:85b3fd62ea1a 237
NYX 0:85b3fd62ea1a 238 }HAL_MMC_CardCIDTypeDef;
NYX 0:85b3fd62ea1a 239 /**
NYX 0:85b3fd62ea1a 240 * @}
NYX 0:85b3fd62ea1a 241 */
NYX 0:85b3fd62ea1a 242
NYX 0:85b3fd62ea1a 243 /** @defgroup MMC_Exported_Types_Group6 MMC Card Status returned by ACMD13
NYX 0:85b3fd62ea1a 244 * @{
NYX 0:85b3fd62ea1a 245 */
NYX 0:85b3fd62ea1a 246 typedef struct
NYX 0:85b3fd62ea1a 247 {
NYX 0:85b3fd62ea1a 248 __IO uint8_t DataBusWidth; /*!< Shows the currently defined data bus width */
NYX 0:85b3fd62ea1a 249 __IO uint8_t SecuredMode; /*!< Card is in secured mode of operation */
NYX 0:85b3fd62ea1a 250 __IO uint16_t CardType; /*!< Carries information about card type */
NYX 0:85b3fd62ea1a 251 __IO uint32_t ProtectedAreaSize; /*!< Carries information about the capacity of protected area */
NYX 0:85b3fd62ea1a 252 __IO uint8_t SpeedClass; /*!< Carries information about the speed class of the card */
NYX 0:85b3fd62ea1a 253 __IO uint8_t PerformanceMove; /*!< Carries information about the card's performance move */
NYX 0:85b3fd62ea1a 254 __IO uint8_t AllocationUnitSize; /*!< Carries information about the card's allocation unit size */
NYX 0:85b3fd62ea1a 255 __IO uint16_t EraseSize; /*!< Determines the number of AUs to be erased in one operation */
NYX 0:85b3fd62ea1a 256 __IO uint8_t EraseTimeout; /*!< Determines the timeout for any number of AU erase */
NYX 0:85b3fd62ea1a 257 __IO uint8_t EraseOffset; /*!< Carries information about the erase offset */
NYX 0:85b3fd62ea1a 258
NYX 0:85b3fd62ea1a 259 }HAL_MMC_CardStatusTypeDef;
NYX 0:85b3fd62ea1a 260 /**
NYX 0:85b3fd62ea1a 261 * @}
NYX 0:85b3fd62ea1a 262 */
NYX 0:85b3fd62ea1a 263
NYX 0:85b3fd62ea1a 264 /**
NYX 0:85b3fd62ea1a 265 * @}
NYX 0:85b3fd62ea1a 266 */
NYX 0:85b3fd62ea1a 267
NYX 0:85b3fd62ea1a 268 /* Exported constants --------------------------------------------------------*/
NYX 0:85b3fd62ea1a 269 /** @defgroup MMC_Exported_Constants Exported Constants
NYX 0:85b3fd62ea1a 270 * @{
NYX 0:85b3fd62ea1a 271 */
NYX 0:85b3fd62ea1a 272
NYX 0:85b3fd62ea1a 273 #define BLOCKSIZE 512U /*!< Block size is 512 bytes */
NYX 0:85b3fd62ea1a 274
NYX 0:85b3fd62ea1a 275 #define CAPACITY 0x400000U /*!< Log Block Nuumber for 2 G bytes Cards */
NYX 0:85b3fd62ea1a 276
NYX 0:85b3fd62ea1a 277 /** @defgroup MMC_Exported_Constansts_Group1 MMC Error status enumeration Structure definition
NYX 0:85b3fd62ea1a 278 * @{
NYX 0:85b3fd62ea1a 279 */
NYX 0:85b3fd62ea1a 280 #define HAL_MMC_ERROR_NONE SDMMC_ERROR_NONE /*!< No error */
NYX 0:85b3fd62ea1a 281 #define HAL_MMC_ERROR_CMD_CRC_FAIL SDMMC_ERROR_CMD_CRC_FAIL /*!< Command response received (but CRC check failed) */
NYX 0:85b3fd62ea1a 282 #define HAL_MMC_ERROR_DATA_CRC_FAIL SDMMC_ERROR_DATA_CRC_FAIL /*!< Data block sent/received (CRC check failed) */
NYX 0:85b3fd62ea1a 283 #define HAL_MMC_ERROR_CMD_RSP_TIMEOUT SDMMC_ERROR_CMD_RSP_TIMEOUT /*!< Command response timeout */
NYX 0:85b3fd62ea1a 284 #define HAL_MMC_ERROR_DATA_TIMEOUT SDMMC_ERROR_DATA_TIMEOUT /*!< Data timeout */
NYX 0:85b3fd62ea1a 285 #define HAL_MMC_ERROR_TX_UNDERRUN SDMMC_ERROR_TX_UNDERRUN /*!< Transmit FIFO underrun */
NYX 0:85b3fd62ea1a 286 #define HAL_MMC_ERROR_RX_OVERRUN SDMMC_ERROR_RX_OVERRUN /*!< Receive FIFO overrun */
NYX 0:85b3fd62ea1a 287 #define HAL_MMC_ERROR_ADDR_MISALIGNED SDMMC_ERROR_ADDR_MISALIGNED /*!< Misaligned address */
NYX 0:85b3fd62ea1a 288 #define HAL_MMC_ERROR_BLOCK_LEN_ERR SDMMC_ERROR_BLOCK_LEN_ERR /*!< Transferred block length is not allowed for the card or the
NYX 0:85b3fd62ea1a 289 number of transferred bytes does not match the block length */
NYX 0:85b3fd62ea1a 290 #define HAL_MMC_ERROR_ERASE_SEQ_ERR SDMMC_ERROR_ERASE_SEQ_ERR /*!< An error in the sequence of erase command occurs */
NYX 0:85b3fd62ea1a 291 #define HAL_MMC_ERROR_BAD_ERASE_PARAM SDMMC_ERROR_BAD_ERASE_PARAM /*!< An invalid selection for erase groups */
NYX 0:85b3fd62ea1a 292 #define HAL_MMC_ERROR_WRITE_PROT_VIOLATION SDMMC_ERROR_WRITE_PROT_VIOLATION /*!< Attempt to program a write protect block */
NYX 0:85b3fd62ea1a 293 #define HAL_MMC_ERROR_LOCK_UNLOCK_FAILED SDMMC_ERROR_LOCK_UNLOCK_FAILED /*!< Sequence or password error has been detected in unlock
NYX 0:85b3fd62ea1a 294 command or if there was an attempt to access a locked card */
NYX 0:85b3fd62ea1a 295 #define HAL_MMC_ERROR_COM_CRC_FAILED SDMMC_ERROR_COM_CRC_FAILED /*!< CRC check of the previous command failed */
NYX 0:85b3fd62ea1a 296 #define HAL_MMC_ERROR_ILLEGAL_CMD SDMMC_ERROR_ILLEGAL_CMD /*!< Command is not legal for the card state */
NYX 0:85b3fd62ea1a 297 #define HAL_MMC_ERROR_CARD_ECC_FAILED SDMMC_ERROR_CARD_ECC_FAILED /*!< Card internal ECC was applied but failed to correct the data */
NYX 0:85b3fd62ea1a 298 #define HAL_MMC_ERROR_CC_ERR SDMMC_ERROR_CC_ERR /*!< Internal card controller error */
NYX 0:85b3fd62ea1a 299 #define HAL_MMC_ERROR_GENERAL_UNKNOWN_ERR SDMMC_ERROR_GENERAL_UNKNOWN_ERR /*!< General or unknown error */
NYX 0:85b3fd62ea1a 300 #define HAL_MMC_ERROR_STREAM_READ_UNDERRUN SDMMC_ERROR_STREAM_READ_UNDERRUN /*!< The card could not sustain data reading in stream rmode */
NYX 0:85b3fd62ea1a 301 #define HAL_MMC_ERROR_STREAM_WRITE_OVERRUN SDMMC_ERROR_STREAM_WRITE_OVERRUN /*!< The card could not sustain data programming in stream mode */
NYX 0:85b3fd62ea1a 302 #define HAL_MMC_ERROR_CID_CSD_OVERWRITE SDMMC_ERROR_CID_CSD_OVERWRITE /*!< CID/CSD overwrite error */
NYX 0:85b3fd62ea1a 303 #define HAL_MMC_ERROR_WP_ERASE_SKIP SDMMC_ERROR_WP_ERASE_SKIP /*!< Only partial address space was erased */
NYX 0:85b3fd62ea1a 304 #define HAL_MMC_ERROR_CARD_ECC_DISABLED SDMMC_ERROR_CARD_ECC_DISABLED /*!< Command has been executed without using internal ECC */
NYX 0:85b3fd62ea1a 305 #define HAL_MMC_ERROR_ERASE_RESET SDMMC_ERROR_ERASE_RESET /*!< Erase sequence was cleared before executing because an out
NYX 0:85b3fd62ea1a 306 of erase sequence command was received */
NYX 0:85b3fd62ea1a 307 #define HAL_MMC_ERROR_AKE_SEQ_ERR SDMMC_ERROR_AKE_SEQ_ERR /*!< Error in sequence of authentication */
NYX 0:85b3fd62ea1a 308 #define HAL_MMC_ERROR_INVALID_VOLTRANGE SDMMC_ERROR_INVALID_VOLTRANGE /*!< Error in case of invalid voltage range */
NYX 0:85b3fd62ea1a 309 #define HAL_MMC_ERROR_ADDR_OUT_OF_RANGE SDMMC_ERROR_ADDR_OUT_OF_RANGE /*!< Error when addressed block is out of range */
NYX 0:85b3fd62ea1a 310 #define HAL_MMC_ERROR_REQUEST_NOT_APPLICABLE SDMMC_ERROR_REQUEST_NOT_APPLICABLE /*!< Error when command request is not applicable */
NYX 0:85b3fd62ea1a 311 #define HAL_MMC_ERROR_PARAM SDMMC_ERROR_INVALID_PARAMETER /*!< the used parameter is not valid */
NYX 0:85b3fd62ea1a 312 #define HAL_MMC_ERROR_UNSUPPORTED_FEATURE SDMMC_ERROR_UNSUPPORTED_FEATURE /*!< Error when feature is not insupported */
NYX 0:85b3fd62ea1a 313 #define HAL_MMC_ERROR_BUSY SDMMC_ERROR_BUSY /*!< Error when transfer process is busy */
NYX 0:85b3fd62ea1a 314 #define HAL_MMC_ERROR_DMA SDMMC_ERROR_DMA /*!< Error while DMA transfer */
NYX 0:85b3fd62ea1a 315 #define HAL_MMC_ERROR_TIMEOUT SDMMC_ERROR_TIMEOUT /*!< Timeout error */
NYX 0:85b3fd62ea1a 316
NYX 0:85b3fd62ea1a 317 /**
NYX 0:85b3fd62ea1a 318 * @}
NYX 0:85b3fd62ea1a 319 */
NYX 0:85b3fd62ea1a 320
NYX 0:85b3fd62ea1a 321 /** @defgroup MMC_Exported_Constansts_Group2 MMC context enumeration structure
NYX 0:85b3fd62ea1a 322 * @{
NYX 0:85b3fd62ea1a 323 */
NYX 0:85b3fd62ea1a 324 #define MMC_CONTEXT_NONE 0x00000000U /*!< None */
NYX 0:85b3fd62ea1a 325 #define MMC_CONTEXT_READ_SINGLE_BLOCK 0x00000001U /*!< Read single block operation */
NYX 0:85b3fd62ea1a 326 #define MMC_CONTEXT_READ_MULTIPLE_BLOCK 0x00000002U /*!< Read multiple blocks operation */
NYX 0:85b3fd62ea1a 327 #define MMC_CONTEXT_WRITE_SINGLE_BLOCK 0x00000010U /*!< Write single block operation */
NYX 0:85b3fd62ea1a 328 #define MMC_CONTEXT_WRITE_MULTIPLE_BLOCK 0x00000020U /*!< Write multiple blocks operation */
NYX 0:85b3fd62ea1a 329 #define MMC_CONTEXT_IT 0x00000008U /*!< Process in Interrupt mode */
NYX 0:85b3fd62ea1a 330 #define MMC_CONTEXT_DMA 0x00000080U /*!< Process in DMA mode */
NYX 0:85b3fd62ea1a 331
NYX 0:85b3fd62ea1a 332 /**
NYX 0:85b3fd62ea1a 333 * @}
NYX 0:85b3fd62ea1a 334 */
NYX 0:85b3fd62ea1a 335
NYX 0:85b3fd62ea1a 336 /** @defgroup MMC_Exported_Constansts_Group3 MMC Voltage mode
NYX 0:85b3fd62ea1a 337 * @{
NYX 0:85b3fd62ea1a 338 */
NYX 0:85b3fd62ea1a 339 /**
NYX 0:85b3fd62ea1a 340 * @brief
NYX 0:85b3fd62ea1a 341 */
NYX 0:85b3fd62ea1a 342 #define MMC_HIGH_VOLTAGE_RANGE 0x80FF8000U /*!< VALUE OF ARGUMENT */
NYX 0:85b3fd62ea1a 343 #define MMC_DUAL_VOLTAGE_RANGE 0x80FF8080U /*!< VALUE OF ARGUMENT */
NYX 0:85b3fd62ea1a 344 #define eMMC_HIGH_VOLTAGE_RANGE 0xC0FF8000U /*!< for eMMC > 2Gb sector mode */
NYX 0:85b3fd62ea1a 345 #define eMMC_DUAL_VOLTAGE_RANGE 0xC0FF8080U /*!< for eMMC > 2Gb sector mode */
NYX 0:85b3fd62ea1a 346 #define MMC_INVALID_VOLTAGE_RANGE 0x0001FF01U
NYX 0:85b3fd62ea1a 347 /**
NYX 0:85b3fd62ea1a 348 * @}
NYX 0:85b3fd62ea1a 349 */
NYX 0:85b3fd62ea1a 350
NYX 0:85b3fd62ea1a 351 /** @defgroup MMC_Exported_Constansts_Group4 MMC Memory Cards
NYX 0:85b3fd62ea1a 352 * @{
NYX 0:85b3fd62ea1a 353 */
NYX 0:85b3fd62ea1a 354 #define MMC_HIGH_VOLTAGE_CARD 0x00000000U
NYX 0:85b3fd62ea1a 355 #define MMC_DUAL_VOLTAGE_CARD 0x00000001U
NYX 0:85b3fd62ea1a 356 /**
NYX 0:85b3fd62ea1a 357 * @}
NYX 0:85b3fd62ea1a 358 */
NYX 0:85b3fd62ea1a 359
NYX 0:85b3fd62ea1a 360 /**
NYX 0:85b3fd62ea1a 361 * @}
NYX 0:85b3fd62ea1a 362 */
NYX 0:85b3fd62ea1a 363
NYX 0:85b3fd62ea1a 364 /* Exported macro ------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 365 /** @defgroup MMC_Exported_macros MMC Exported Macros
NYX 0:85b3fd62ea1a 366 * @brief macros to handle interrupts and specific clock configurations
NYX 0:85b3fd62ea1a 367 * @{
NYX 0:85b3fd62ea1a 368 */
NYX 0:85b3fd62ea1a 369
NYX 0:85b3fd62ea1a 370 /**
NYX 0:85b3fd62ea1a 371 * @brief Enable the MMC device.
NYX 0:85b3fd62ea1a 372 * @retval None
NYX 0:85b3fd62ea1a 373 */
NYX 0:85b3fd62ea1a 374 #define __HAL_MMC_ENABLE(__HANDLE__) __SDIO_ENABLE((__HANDLE__)->Instance)
NYX 0:85b3fd62ea1a 375
NYX 0:85b3fd62ea1a 376 /**
NYX 0:85b3fd62ea1a 377 * @brief Disable the MMC device.
NYX 0:85b3fd62ea1a 378 * @retval None
NYX 0:85b3fd62ea1a 379 */
NYX 0:85b3fd62ea1a 380 #define __HAL_MMC_DISABLE(__HANDLE__) __SDIO_DISABLE((__HANDLE__)->Instance)
NYX 0:85b3fd62ea1a 381
NYX 0:85b3fd62ea1a 382 /**
NYX 0:85b3fd62ea1a 383 * @brief Enable the SDMMC DMA transfer.
NYX 0:85b3fd62ea1a 384 * @retval None
NYX 0:85b3fd62ea1a 385 */
NYX 0:85b3fd62ea1a 386 #define __HAL_MMC_DMA_ENABLE(__HANDLE__) __SDIO_DMA_ENABLE((__HANDLE__)->Instance)
NYX 0:85b3fd62ea1a 387
NYX 0:85b3fd62ea1a 388 /**
NYX 0:85b3fd62ea1a 389 * @brief Disable the SDMMC DMA transfer.
NYX 0:85b3fd62ea1a 390 * @retval None
NYX 0:85b3fd62ea1a 391 */
NYX 0:85b3fd62ea1a 392 #define __HAL_MMC_DMA_DISABLE(__HANDLE__) __SDIO_DMA_DISABLE((__HANDLE__)->Instance)
NYX 0:85b3fd62ea1a 393
NYX 0:85b3fd62ea1a 394 /**
NYX 0:85b3fd62ea1a 395 * @brief Enable the MMC device interrupt.
NYX 0:85b3fd62ea1a 396 * @param __HANDLE__: MMC Handle
NYX 0:85b3fd62ea1a 397 * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be enabled.
NYX 0:85b3fd62ea1a 398 * This parameter can be one or a combination of the following values:
NYX 0:85b3fd62ea1a 399 * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
NYX 0:85b3fd62ea1a 400 * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
NYX 0:85b3fd62ea1a 401 * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
NYX 0:85b3fd62ea1a 402 * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
NYX 0:85b3fd62ea1a 403 * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
NYX 0:85b3fd62ea1a 404 * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
NYX 0:85b3fd62ea1a 405 * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
NYX 0:85b3fd62ea1a 406 * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
NYX 0:85b3fd62ea1a 407 * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
NYX 0:85b3fd62ea1a 408 * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
NYX 0:85b3fd62ea1a 409 * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
NYX 0:85b3fd62ea1a 410 * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
NYX 0:85b3fd62ea1a 411 * @arg SDIO_IT_RXACT: Data receive in progress interrupt
NYX 0:85b3fd62ea1a 412 * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
NYX 0:85b3fd62ea1a 413 * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
NYX 0:85b3fd62ea1a 414 * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
NYX 0:85b3fd62ea1a 415 * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
NYX 0:85b3fd62ea1a 416 * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
NYX 0:85b3fd62ea1a 417 * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
NYX 0:85b3fd62ea1a 418 * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
NYX 0:85b3fd62ea1a 419 * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
NYX 0:85b3fd62ea1a 420 * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
NYX 0:85b3fd62ea1a 421 * @retval None
NYX 0:85b3fd62ea1a 422 */
NYX 0:85b3fd62ea1a 423 #define __HAL_MMC_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDIO_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
NYX 0:85b3fd62ea1a 424
NYX 0:85b3fd62ea1a 425 /**
NYX 0:85b3fd62ea1a 426 * @brief Disable the MMC device interrupt.
NYX 0:85b3fd62ea1a 427 * @param __HANDLE__: MMC Handle
NYX 0:85b3fd62ea1a 428 * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be disabled.
NYX 0:85b3fd62ea1a 429 * This parameter can be one or a combination of the following values:
NYX 0:85b3fd62ea1a 430 * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
NYX 0:85b3fd62ea1a 431 * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
NYX 0:85b3fd62ea1a 432 * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
NYX 0:85b3fd62ea1a 433 * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
NYX 0:85b3fd62ea1a 434 * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
NYX 0:85b3fd62ea1a 435 * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
NYX 0:85b3fd62ea1a 436 * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
NYX 0:85b3fd62ea1a 437 * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
NYX 0:85b3fd62ea1a 438 * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
NYX 0:85b3fd62ea1a 439 * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
NYX 0:85b3fd62ea1a 440 * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
NYX 0:85b3fd62ea1a 441 * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
NYX 0:85b3fd62ea1a 442 * @arg SDIO_IT_RXACT: Data receive in progress interrupt
NYX 0:85b3fd62ea1a 443 * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
NYX 0:85b3fd62ea1a 444 * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
NYX 0:85b3fd62ea1a 445 * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
NYX 0:85b3fd62ea1a 446 * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
NYX 0:85b3fd62ea1a 447 * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
NYX 0:85b3fd62ea1a 448 * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
NYX 0:85b3fd62ea1a 449 * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
NYX 0:85b3fd62ea1a 450 * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
NYX 0:85b3fd62ea1a 451 * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
NYX 0:85b3fd62ea1a 452 * @retval None
NYX 0:85b3fd62ea1a 453 */
NYX 0:85b3fd62ea1a 454 #define __HAL_MMC_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDIO_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
NYX 0:85b3fd62ea1a 455
NYX 0:85b3fd62ea1a 456 /**
NYX 0:85b3fd62ea1a 457 * @brief Check whether the specified MMC flag is set or not.
NYX 0:85b3fd62ea1a 458 * @param __HANDLE__: MMC Handle
NYX 0:85b3fd62ea1a 459 * @param __FLAG__: specifies the flag to check.
NYX 0:85b3fd62ea1a 460 * This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 461 * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
NYX 0:85b3fd62ea1a 462 * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
NYX 0:85b3fd62ea1a 463 * @arg SDIO_FLAG_CTIMEOUT: Command response timeout
NYX 0:85b3fd62ea1a 464 * @arg SDIO_FLAG_DTIMEOUT: Data timeout
NYX 0:85b3fd62ea1a 465 * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
NYX 0:85b3fd62ea1a 466 * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
NYX 0:85b3fd62ea1a 467 * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
NYX 0:85b3fd62ea1a 468 * @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
NYX 0:85b3fd62ea1a 469 * @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
NYX 0:85b3fd62ea1a 470 * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
NYX 0:85b3fd62ea1a 471 * @arg SDIO_FLAG_CMDACT: Command transfer in progress
NYX 0:85b3fd62ea1a 472 * @arg SDIO_FLAG_TXACT: Data transmit in progress
NYX 0:85b3fd62ea1a 473 * @arg SDIO_FLAG_RXACT: Data receive in progress
NYX 0:85b3fd62ea1a 474 * @arg SDIO_FLAG_TXFIFOHE: Transmit FIFO Half Empty
NYX 0:85b3fd62ea1a 475 * @arg SDIO_FLAG_RXFIFOHF: Receive FIFO Half Full
NYX 0:85b3fd62ea1a 476 * @arg SDIO_FLAG_TXFIFOF: Transmit FIFO full
NYX 0:85b3fd62ea1a 477 * @arg SDIO_FLAG_RXFIFOF: Receive FIFO full
NYX 0:85b3fd62ea1a 478 * @arg SDIO_FLAG_TXFIFOE: Transmit FIFO empty
NYX 0:85b3fd62ea1a 479 * @arg SDIO_FLAG_RXFIFOE: Receive FIFO empty
NYX 0:85b3fd62ea1a 480 * @arg SDIO_FLAG_TXDAVL: Data available in transmit FIFO
NYX 0:85b3fd62ea1a 481 * @arg SDIO_FLAG_RXDAVL: Data available in receive FIFO
NYX 0:85b3fd62ea1a 482 * @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received
NYX 0:85b3fd62ea1a 483 * @retval The new state of MMC FLAG (SET or RESET).
NYX 0:85b3fd62ea1a 484 */
NYX 0:85b3fd62ea1a 485 #define __HAL_MMC_GET_FLAG(__HANDLE__, __FLAG__) __SDIO_GET_FLAG((__HANDLE__)->Instance, (__FLAG__))
NYX 0:85b3fd62ea1a 486
NYX 0:85b3fd62ea1a 487 /**
NYX 0:85b3fd62ea1a 488 * @brief Clear the MMC's pending flags.
NYX 0:85b3fd62ea1a 489 * @param __HANDLE__: MMC Handle
NYX 0:85b3fd62ea1a 490 * @param __FLAG__: specifies the flag to clear.
NYX 0:85b3fd62ea1a 491 * This parameter can be one or a combination of the following values:
NYX 0:85b3fd62ea1a 492 * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
NYX 0:85b3fd62ea1a 493 * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
NYX 0:85b3fd62ea1a 494 * @arg SDIO_FLAG_CTIMEOUT: Command response timeout
NYX 0:85b3fd62ea1a 495 * @arg SDIO_FLAG_DTIMEOUT: Data timeout
NYX 0:85b3fd62ea1a 496 * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
NYX 0:85b3fd62ea1a 497 * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
NYX 0:85b3fd62ea1a 498 * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
NYX 0:85b3fd62ea1a 499 * @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
NYX 0:85b3fd62ea1a 500 * @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
NYX 0:85b3fd62ea1a 501 * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
NYX 0:85b3fd62ea1a 502 * @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received
NYX 0:85b3fd62ea1a 503 * @retval None
NYX 0:85b3fd62ea1a 504 */
NYX 0:85b3fd62ea1a 505 #define __HAL_MMC_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDIO_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__))
NYX 0:85b3fd62ea1a 506
NYX 0:85b3fd62ea1a 507 /**
NYX 0:85b3fd62ea1a 508 * @brief Check whether the specified MMC interrupt has occurred or not.
NYX 0:85b3fd62ea1a 509 * @param __HANDLE__: MMC Handle
NYX 0:85b3fd62ea1a 510 * @param __INTERRUPT__: specifies the SDMMC interrupt source to check.
NYX 0:85b3fd62ea1a 511 * This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 512 * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
NYX 0:85b3fd62ea1a 513 * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
NYX 0:85b3fd62ea1a 514 * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
NYX 0:85b3fd62ea1a 515 * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
NYX 0:85b3fd62ea1a 516 * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
NYX 0:85b3fd62ea1a 517 * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
NYX 0:85b3fd62ea1a 518 * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
NYX 0:85b3fd62ea1a 519 * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
NYX 0:85b3fd62ea1a 520 * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
NYX 0:85b3fd62ea1a 521 * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
NYX 0:85b3fd62ea1a 522 * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
NYX 0:85b3fd62ea1a 523 * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
NYX 0:85b3fd62ea1a 524 * @arg SDIO_IT_RXACT: Data receive in progress interrupt
NYX 0:85b3fd62ea1a 525 * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
NYX 0:85b3fd62ea1a 526 * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
NYX 0:85b3fd62ea1a 527 * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
NYX 0:85b3fd62ea1a 528 * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
NYX 0:85b3fd62ea1a 529 * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
NYX 0:85b3fd62ea1a 530 * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
NYX 0:85b3fd62ea1a 531 * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
NYX 0:85b3fd62ea1a 532 * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
NYX 0:85b3fd62ea1a 533 * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
NYX 0:85b3fd62ea1a 534 * @retval The new state of MMC IT (SET or RESET).
NYX 0:85b3fd62ea1a 535 */
NYX 0:85b3fd62ea1a 536 #define __HAL_MMC_GET_IT(__HANDLE__, __INTERRUPT__) __SDIO_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__))
NYX 0:85b3fd62ea1a 537
NYX 0:85b3fd62ea1a 538 /**
NYX 0:85b3fd62ea1a 539 * @brief Clear the MMC's interrupt pending bits.
NYX 0:85b3fd62ea1a 540 * @param __HANDLE__: MMC Handle
NYX 0:85b3fd62ea1a 541 * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
NYX 0:85b3fd62ea1a 542 * This parameter can be one or a combination of the following values:
NYX 0:85b3fd62ea1a 543 * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
NYX 0:85b3fd62ea1a 544 * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
NYX 0:85b3fd62ea1a 545 * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
NYX 0:85b3fd62ea1a 546 * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
NYX 0:85b3fd62ea1a 547 * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
NYX 0:85b3fd62ea1a 548 * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
NYX 0:85b3fd62ea1a 549 * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
NYX 0:85b3fd62ea1a 550 * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
NYX 0:85b3fd62ea1a 551 * @arg SDIO_IT_DATAEND: Data end (data counter, SDMMC_DCOUNT, is zero) interrupt
NYX 0:85b3fd62ea1a 552 * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
NYX 0:85b3fd62ea1a 553 * @retval None
NYX 0:85b3fd62ea1a 554 */
NYX 0:85b3fd62ea1a 555 #define __HAL_MMC_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDIO_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__))
NYX 0:85b3fd62ea1a 556
NYX 0:85b3fd62ea1a 557 /**
NYX 0:85b3fd62ea1a 558 * @}
NYX 0:85b3fd62ea1a 559 */
NYX 0:85b3fd62ea1a 560
NYX 0:85b3fd62ea1a 561 /* Exported functions --------------------------------------------------------*/
NYX 0:85b3fd62ea1a 562 /** @defgroup MMC_Exported_Functions MMC Exported Functions
NYX 0:85b3fd62ea1a 563 * @{
NYX 0:85b3fd62ea1a 564 */
NYX 0:85b3fd62ea1a 565
NYX 0:85b3fd62ea1a 566 /** @defgroup MMC_Exported_Functions_Group1 Initialization and de-initialization functions
NYX 0:85b3fd62ea1a 567 * @{
NYX 0:85b3fd62ea1a 568 */
NYX 0:85b3fd62ea1a 569 HAL_StatusTypeDef HAL_MMC_Init(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 570 HAL_StatusTypeDef HAL_MMC_InitCard(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 571 HAL_StatusTypeDef HAL_MMC_DeInit (MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 572 void HAL_MMC_MspInit(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 573 void HAL_MMC_MspDeInit(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 574 /**
NYX 0:85b3fd62ea1a 575 * @}
NYX 0:85b3fd62ea1a 576 */
NYX 0:85b3fd62ea1a 577
NYX 0:85b3fd62ea1a 578 /** @defgroup MMC_Exported_Functions_Group2 Input and Output operation functions
NYX 0:85b3fd62ea1a 579 * @{
NYX 0:85b3fd62ea1a 580 */
NYX 0:85b3fd62ea1a 581 /* Blocking mode: Polling */
NYX 0:85b3fd62ea1a 582 HAL_StatusTypeDef HAL_MMC_ReadBlocks(MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout);
NYX 0:85b3fd62ea1a 583 HAL_StatusTypeDef HAL_MMC_WriteBlocks(MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout);
NYX 0:85b3fd62ea1a 584 HAL_StatusTypeDef HAL_MMC_Erase(MMC_HandleTypeDef *hmmc, uint32_t BlockStartAdd, uint32_t BlockEndAdd);
NYX 0:85b3fd62ea1a 585 /* Non-Blocking mode: IT */
NYX 0:85b3fd62ea1a 586 HAL_StatusTypeDef HAL_MMC_ReadBlocks_IT(MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
NYX 0:85b3fd62ea1a 587 HAL_StatusTypeDef HAL_MMC_WriteBlocks_IT(MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
NYX 0:85b3fd62ea1a 588 /* Non-Blocking mode: DMA */
NYX 0:85b3fd62ea1a 589 HAL_StatusTypeDef HAL_MMC_ReadBlocks_DMA(MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
NYX 0:85b3fd62ea1a 590 HAL_StatusTypeDef HAL_MMC_WriteBlocks_DMA(MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
NYX 0:85b3fd62ea1a 591
NYX 0:85b3fd62ea1a 592 void HAL_MMC_IRQHandler(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 593
NYX 0:85b3fd62ea1a 594 /* Callback in non blocking modes (DMA) */
NYX 0:85b3fd62ea1a 595 void HAL_MMC_TxCpltCallback(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 596 void HAL_MMC_RxCpltCallback(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 597 void HAL_MMC_ErrorCallback(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 598 void HAL_MMC_AbortCallback(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 599 /**
NYX 0:85b3fd62ea1a 600 * @}
NYX 0:85b3fd62ea1a 601 */
NYX 0:85b3fd62ea1a 602
NYX 0:85b3fd62ea1a 603 /** @defgroup MMC_Exported_Functions_Group3 Peripheral Control functions
NYX 0:85b3fd62ea1a 604 * @{
NYX 0:85b3fd62ea1a 605 */
NYX 0:85b3fd62ea1a 606 HAL_StatusTypeDef HAL_MMC_ConfigWideBusOperation(MMC_HandleTypeDef *hmmc, uint32_t WideMode);
NYX 0:85b3fd62ea1a 607 /**
NYX 0:85b3fd62ea1a 608 * @}
NYX 0:85b3fd62ea1a 609 */
NYX 0:85b3fd62ea1a 610
NYX 0:85b3fd62ea1a 611 /** @defgroup MMC_Exported_Functions_Group4 MMC card related functions
NYX 0:85b3fd62ea1a 612 * @{
NYX 0:85b3fd62ea1a 613 */
NYX 0:85b3fd62ea1a 614 HAL_MMC_CardStateTypeDef HAL_MMC_GetCardState(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 615 HAL_StatusTypeDef HAL_MMC_GetCardCID(MMC_HandleTypeDef *hmmc, HAL_MMC_CardCIDTypeDef *pCID);
NYX 0:85b3fd62ea1a 616 HAL_StatusTypeDef HAL_MMC_GetCardCSD(MMC_HandleTypeDef *hmmc, HAL_MMC_CardCSDTypeDef *pCSD);
NYX 0:85b3fd62ea1a 617 HAL_StatusTypeDef HAL_MMC_GetCardInfo(MMC_HandleTypeDef *hmmc, HAL_MMC_CardInfoTypeDef *pCardInfo);
NYX 0:85b3fd62ea1a 618 /**
NYX 0:85b3fd62ea1a 619 * @}
NYX 0:85b3fd62ea1a 620 */
NYX 0:85b3fd62ea1a 621
NYX 0:85b3fd62ea1a 622 /** @defgroup MMC_Exported_Functions_Group5 Peripheral State and Errors functions
NYX 0:85b3fd62ea1a 623 * @{
NYX 0:85b3fd62ea1a 624 */
NYX 0:85b3fd62ea1a 625 HAL_MMC_StateTypeDef HAL_MMC_GetState(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 626 uint32_t HAL_MMC_GetError(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 627 /**
NYX 0:85b3fd62ea1a 628 * @}
NYX 0:85b3fd62ea1a 629 */
NYX 0:85b3fd62ea1a 630
NYX 0:85b3fd62ea1a 631 /** @defgroup MMC_Exported_Functions_Group6 Perioheral Abort management
NYX 0:85b3fd62ea1a 632 * @{
NYX 0:85b3fd62ea1a 633 */
NYX 0:85b3fd62ea1a 634 HAL_StatusTypeDef HAL_MMC_Abort(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 635 HAL_StatusTypeDef HAL_MMC_Abort_IT(MMC_HandleTypeDef *hmmc);
NYX 0:85b3fd62ea1a 636 /**
NYX 0:85b3fd62ea1a 637 * @}
NYX 0:85b3fd62ea1a 638 */
NYX 0:85b3fd62ea1a 639
NYX 0:85b3fd62ea1a 640 /* Private types -------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 641 /** @defgroup MMC_Private_Types MMC Private Types
NYX 0:85b3fd62ea1a 642 * @{
NYX 0:85b3fd62ea1a 643 */
NYX 0:85b3fd62ea1a 644
NYX 0:85b3fd62ea1a 645 /**
NYX 0:85b3fd62ea1a 646 * @}
NYX 0:85b3fd62ea1a 647 */
NYX 0:85b3fd62ea1a 648
NYX 0:85b3fd62ea1a 649 /* Private defines -----------------------------------------------------------*/
NYX 0:85b3fd62ea1a 650 /** @defgroup MMC_Private_Defines MMC Private Defines
NYX 0:85b3fd62ea1a 651 * @{
NYX 0:85b3fd62ea1a 652 */
NYX 0:85b3fd62ea1a 653
NYX 0:85b3fd62ea1a 654 /**
NYX 0:85b3fd62ea1a 655 * @}
NYX 0:85b3fd62ea1a 656 */
NYX 0:85b3fd62ea1a 657
NYX 0:85b3fd62ea1a 658 /* Private variables ---------------------------------------------------------*/
NYX 0:85b3fd62ea1a 659 /** @defgroup MMC_Private_Variables MMC Private Variables
NYX 0:85b3fd62ea1a 660 * @{
NYX 0:85b3fd62ea1a 661 */
NYX 0:85b3fd62ea1a 662
NYX 0:85b3fd62ea1a 663 /**
NYX 0:85b3fd62ea1a 664 * @}
NYX 0:85b3fd62ea1a 665 */
NYX 0:85b3fd62ea1a 666
NYX 0:85b3fd62ea1a 667 /* Private constants ---------------------------------------------------------*/
NYX 0:85b3fd62ea1a 668 /** @defgroup MMC_Private_Constants MMC Private Constants
NYX 0:85b3fd62ea1a 669 * @{
NYX 0:85b3fd62ea1a 670 */
NYX 0:85b3fd62ea1a 671
NYX 0:85b3fd62ea1a 672 /**
NYX 0:85b3fd62ea1a 673 * @}
NYX 0:85b3fd62ea1a 674 */
NYX 0:85b3fd62ea1a 675
NYX 0:85b3fd62ea1a 676 /* Private macros ------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 677 /** @defgroup MMC_Private_Macros MMC Private Macros
NYX 0:85b3fd62ea1a 678 * @{
NYX 0:85b3fd62ea1a 679 */
NYX 0:85b3fd62ea1a 680
NYX 0:85b3fd62ea1a 681 /**
NYX 0:85b3fd62ea1a 682 * @}
NYX 0:85b3fd62ea1a 683 */
NYX 0:85b3fd62ea1a 684
NYX 0:85b3fd62ea1a 685 /* Private functions prototypes ----------------------------------------------*/
NYX 0:85b3fd62ea1a 686 /** @defgroup MMC_Private_Functions_Prototypes MMC Private Functions Prototypes
NYX 0:85b3fd62ea1a 687 * @{
NYX 0:85b3fd62ea1a 688 */
NYX 0:85b3fd62ea1a 689
NYX 0:85b3fd62ea1a 690 /**
NYX 0:85b3fd62ea1a 691 * @}
NYX 0:85b3fd62ea1a 692 */
NYX 0:85b3fd62ea1a 693
NYX 0:85b3fd62ea1a 694 /* Private functions ---------------------------------------------------------*/
NYX 0:85b3fd62ea1a 695 /** @defgroup MMC_Private_Functions MMC Private Functions
NYX 0:85b3fd62ea1a 696 * @{
NYX 0:85b3fd62ea1a 697 */
NYX 0:85b3fd62ea1a 698
NYX 0:85b3fd62ea1a 699 /**
NYX 0:85b3fd62ea1a 700 * @}
NYX 0:85b3fd62ea1a 701 */
NYX 0:85b3fd62ea1a 702
NYX 0:85b3fd62ea1a 703 /**
NYX 0:85b3fd62ea1a 704 * @}
NYX 0:85b3fd62ea1a 705 */
NYX 0:85b3fd62ea1a 706
NYX 0:85b3fd62ea1a 707 /**
NYX 0:85b3fd62ea1a 708 * @}
NYX 0:85b3fd62ea1a 709 */
NYX 0:85b3fd62ea1a 710
NYX 0:85b3fd62ea1a 711 /**
NYX 0:85b3fd62ea1a 712 * @}
NYX 0:85b3fd62ea1a 713 */
NYX 0:85b3fd62ea1a 714
NYX 0:85b3fd62ea1a 715 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
NYX 0:85b3fd62ea1a 716 STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
NYX 0:85b3fd62ea1a 717 STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
NYX 0:85b3fd62ea1a 718
NYX 0:85b3fd62ea1a 719 #ifdef __cplusplus
NYX 0:85b3fd62ea1a 720 }
NYX 0:85b3fd62ea1a 721 #endif
NYX 0:85b3fd62ea1a 722
NYX 0:85b3fd62ea1a 723
NYX 0:85b3fd62ea1a 724 #endif /* __STM32F4xx_HAL_MMC_H */
NYX 0:85b3fd62ea1a 725
NYX 0:85b3fd62ea1a 726 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/