Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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