Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
TARGET_DISCO_F429ZI/stm32f4xx_ll_sdmmc.h@121:672067c3ada4, 2016-04-14 (annotated)
- Committer:
- elijahorr
- Date:
- Thu Apr 14 07:28:54 2016 +0000
- Revision:
- 121:672067c3ada4
- Parent:
- 110:165afa46840b
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 110:165afa46840b | 1 | /** |
Kojto | 110:165afa46840b | 2 | ****************************************************************************** |
Kojto | 110:165afa46840b | 3 | * @file stm32f4xx_ll_sdmmc.h |
Kojto | 110:165afa46840b | 4 | * @author MCD Application Team |
Kojto | 110:165afa46840b | 5 | * @version V1.4.1 |
Kojto | 110:165afa46840b | 6 | * @date 09-October-2015 |
Kojto | 110:165afa46840b | 7 | * @brief Header file of SDMMC HAL module. |
Kojto | 110:165afa46840b | 8 | ****************************************************************************** |
Kojto | 110:165afa46840b | 9 | * @attention |
Kojto | 110:165afa46840b | 10 | * |
Kojto | 110:165afa46840b | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Kojto | 110:165afa46840b | 12 | * |
Kojto | 110:165afa46840b | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 110:165afa46840b | 14 | * are permitted provided that the following conditions are met: |
Kojto | 110:165afa46840b | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 110:165afa46840b | 16 | * this list of conditions and the following disclaimer. |
Kojto | 110:165afa46840b | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 110:165afa46840b | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 110:165afa46840b | 19 | * and/or other materials provided with the distribution. |
Kojto | 110:165afa46840b | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 110:165afa46840b | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 110:165afa46840b | 22 | * without specific prior written permission. |
Kojto | 110:165afa46840b | 23 | * |
Kojto | 110:165afa46840b | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 110:165afa46840b | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 110:165afa46840b | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 110:165afa46840b | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 110:165afa46840b | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 110:165afa46840b | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 110:165afa46840b | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 110:165afa46840b | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 110:165afa46840b | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 110:165afa46840b | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 110:165afa46840b | 34 | * |
Kojto | 110:165afa46840b | 35 | ****************************************************************************** |
Kojto | 110:165afa46840b | 36 | */ |
Kojto | 110:165afa46840b | 37 | |
Kojto | 110:165afa46840b | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 110:165afa46840b | 39 | #ifndef __STM32F4xx_LL_SDMMC_H |
Kojto | 110:165afa46840b | 40 | #define __STM32F4xx_LL_SDMMC_H |
Kojto | 110:165afa46840b | 41 | |
Kojto | 110:165afa46840b | 42 | #ifdef __cplusplus |
Kojto | 110:165afa46840b | 43 | extern "C" { |
Kojto | 110:165afa46840b | 44 | #endif |
Kojto | 110:165afa46840b | 45 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ |
Kojto | 110:165afa46840b | 46 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ |
Kojto | 110:165afa46840b | 47 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ |
Kojto | 110:165afa46840b | 48 | defined(STM32F469xx) || defined(STM32F479xx) |
Kojto | 110:165afa46840b | 49 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 50 | #include "stm32f4xx_hal_def.h" |
Kojto | 110:165afa46840b | 51 | |
Kojto | 110:165afa46840b | 52 | /** @addtogroup STM32F4xx_Driver |
Kojto | 110:165afa46840b | 53 | * @{ |
Kojto | 110:165afa46840b | 54 | */ |
Kojto | 110:165afa46840b | 55 | |
Kojto | 110:165afa46840b | 56 | /** @addtogroup SDMMC_LL |
Kojto | 110:165afa46840b | 57 | * @{ |
Kojto | 110:165afa46840b | 58 | */ |
Kojto | 110:165afa46840b | 59 | |
Kojto | 110:165afa46840b | 60 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 61 | /** @defgroup SDMMC_LL_Exported_Types SDMMC_LL Exported Types |
Kojto | 110:165afa46840b | 62 | * @{ |
Kojto | 110:165afa46840b | 63 | */ |
Kojto | 110:165afa46840b | 64 | |
Kojto | 110:165afa46840b | 65 | /** |
Kojto | 110:165afa46840b | 66 | * @brief SDMMC Configuration Structure definition |
Kojto | 110:165afa46840b | 67 | */ |
Kojto | 110:165afa46840b | 68 | typedef struct |
Kojto | 110:165afa46840b | 69 | { |
Kojto | 110:165afa46840b | 70 | uint32_t ClockEdge; /*!< Specifies the clock transition on which the bit capture is made. |
Kojto | 110:165afa46840b | 71 | This parameter can be a value of @ref SDIO_Clock_Edge */ |
Kojto | 110:165afa46840b | 72 | |
Kojto | 110:165afa46840b | 73 | uint32_t ClockBypass; /*!< Specifies whether the SDIO Clock divider bypass is |
Kojto | 110:165afa46840b | 74 | enabled or disabled. |
Kojto | 110:165afa46840b | 75 | This parameter can be a value of @ref SDIO_Clock_Bypass */ |
Kojto | 110:165afa46840b | 76 | |
Kojto | 110:165afa46840b | 77 | uint32_t ClockPowerSave; /*!< Specifies whether SDIO Clock output is enabled or |
Kojto | 110:165afa46840b | 78 | disabled when the bus is idle. |
Kojto | 110:165afa46840b | 79 | This parameter can be a value of @ref SDIO_Clock_Power_Save */ |
Kojto | 110:165afa46840b | 80 | |
Kojto | 110:165afa46840b | 81 | uint32_t BusWide; /*!< Specifies the SDIO bus width. |
Kojto | 110:165afa46840b | 82 | This parameter can be a value of @ref SDIO_Bus_Wide */ |
Kojto | 110:165afa46840b | 83 | |
Kojto | 110:165afa46840b | 84 | uint32_t HardwareFlowControl; /*!< Specifies whether the SDIO hardware flow control is enabled or disabled. |
Kojto | 110:165afa46840b | 85 | This parameter can be a value of @ref SDIO_Hardware_Flow_Control */ |
Kojto | 110:165afa46840b | 86 | |
Kojto | 110:165afa46840b | 87 | uint32_t ClockDiv; /*!< Specifies the clock frequency of the SDIO controller. |
Kojto | 110:165afa46840b | 88 | This parameter can be a value between Min_Data = 0 and Max_Data = 255 */ |
Kojto | 110:165afa46840b | 89 | |
Kojto | 110:165afa46840b | 90 | }SDIO_InitTypeDef; |
Kojto | 110:165afa46840b | 91 | |
Kojto | 110:165afa46840b | 92 | |
Kojto | 110:165afa46840b | 93 | /** |
Kojto | 110:165afa46840b | 94 | * @brief SDIO Command Control structure |
Kojto | 110:165afa46840b | 95 | */ |
Kojto | 110:165afa46840b | 96 | typedef struct |
Kojto | 110:165afa46840b | 97 | { |
Kojto | 110:165afa46840b | 98 | uint32_t Argument; /*!< Specifies the SDIO command argument which is sent |
Kojto | 110:165afa46840b | 99 | to a card as part of a command message. If a command |
Kojto | 110:165afa46840b | 100 | contains an argument, it must be loaded into this register |
Kojto | 110:165afa46840b | 101 | before writing the command to the command register. */ |
Kojto | 110:165afa46840b | 102 | |
Kojto | 110:165afa46840b | 103 | uint32_t CmdIndex; /*!< Specifies the SDIO command index. It must be Min_Data = 0 and |
Kojto | 110:165afa46840b | 104 | Max_Data = 64 */ |
Kojto | 110:165afa46840b | 105 | |
Kojto | 110:165afa46840b | 106 | uint32_t Response; /*!< Specifies the SDIO response type. |
Kojto | 110:165afa46840b | 107 | This parameter can be a value of @ref SDIO_Response_Type */ |
Kojto | 110:165afa46840b | 108 | |
Kojto | 110:165afa46840b | 109 | uint32_t WaitForInterrupt; /*!< Specifies whether SDIO wait for interrupt request is |
Kojto | 110:165afa46840b | 110 | enabled or disabled. |
Kojto | 110:165afa46840b | 111 | This parameter can be a value of @ref SDIO_Wait_Interrupt_State */ |
Kojto | 110:165afa46840b | 112 | |
Kojto | 110:165afa46840b | 113 | uint32_t CPSM; /*!< Specifies whether SDIO Command path state machine (CPSM) |
Kojto | 110:165afa46840b | 114 | is enabled or disabled. |
Kojto | 110:165afa46840b | 115 | This parameter can be a value of @ref SDIO_CPSM_State */ |
Kojto | 110:165afa46840b | 116 | }SDIO_CmdInitTypeDef; |
Kojto | 110:165afa46840b | 117 | |
Kojto | 110:165afa46840b | 118 | |
Kojto | 110:165afa46840b | 119 | /** |
Kojto | 110:165afa46840b | 120 | * @brief SDIO Data Control structure |
Kojto | 110:165afa46840b | 121 | */ |
Kojto | 110:165afa46840b | 122 | typedef struct |
Kojto | 110:165afa46840b | 123 | { |
Kojto | 110:165afa46840b | 124 | uint32_t DataTimeOut; /*!< Specifies the data timeout period in card bus clock periods. */ |
Kojto | 110:165afa46840b | 125 | |
Kojto | 110:165afa46840b | 126 | uint32_t DataLength; /*!< Specifies the number of data bytes to be transferred. */ |
Kojto | 110:165afa46840b | 127 | |
Kojto | 110:165afa46840b | 128 | uint32_t DataBlockSize; /*!< Specifies the data block size for block transfer. |
Kojto | 110:165afa46840b | 129 | This parameter can be a value of @ref SDIO_Data_Block_Size */ |
Kojto | 110:165afa46840b | 130 | |
Kojto | 110:165afa46840b | 131 | uint32_t TransferDir; /*!< Specifies the data transfer direction, whether the transfer |
Kojto | 110:165afa46840b | 132 | is a read or write. |
Kojto | 110:165afa46840b | 133 | This parameter can be a value of @ref SDIO_Transfer_Direction */ |
Kojto | 110:165afa46840b | 134 | |
Kojto | 110:165afa46840b | 135 | uint32_t TransferMode; /*!< Specifies whether data transfer is in stream or block mode. |
Kojto | 110:165afa46840b | 136 | This parameter can be a value of @ref SDIO_Transfer_Type */ |
Kojto | 110:165afa46840b | 137 | |
Kojto | 110:165afa46840b | 138 | uint32_t DPSM; /*!< Specifies whether SDIO Data path state machine (DPSM) |
Kojto | 110:165afa46840b | 139 | is enabled or disabled. |
Kojto | 110:165afa46840b | 140 | This parameter can be a value of @ref SDIO_DPSM_State */ |
Kojto | 110:165afa46840b | 141 | }SDIO_DataInitTypeDef; |
Kojto | 110:165afa46840b | 142 | |
Kojto | 110:165afa46840b | 143 | /** |
Kojto | 110:165afa46840b | 144 | * @} |
Kojto | 110:165afa46840b | 145 | */ |
Kojto | 110:165afa46840b | 146 | |
Kojto | 110:165afa46840b | 147 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 148 | /** @defgroup SDMMC_LL_Exported_Constants SDMMC_LL Exported Constants |
Kojto | 110:165afa46840b | 149 | * @{ |
Kojto | 110:165afa46840b | 150 | */ |
Kojto | 110:165afa46840b | 151 | |
Kojto | 110:165afa46840b | 152 | /** @defgroup SDIO_Clock_Edge Clock Edge |
Kojto | 110:165afa46840b | 153 | * @{ |
Kojto | 110:165afa46840b | 154 | */ |
Kojto | 110:165afa46840b | 155 | #define SDIO_CLOCK_EDGE_RISING ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 156 | #define SDIO_CLOCK_EDGE_FALLING SDIO_CLKCR_NEGEDGE |
Kojto | 110:165afa46840b | 157 | |
Kojto | 110:165afa46840b | 158 | #define IS_SDIO_CLOCK_EDGE(EDGE) (((EDGE) == SDIO_CLOCK_EDGE_RISING) || \ |
Kojto | 110:165afa46840b | 159 | ((EDGE) == SDIO_CLOCK_EDGE_FALLING)) |
Kojto | 110:165afa46840b | 160 | /** |
Kojto | 110:165afa46840b | 161 | * @} |
Kojto | 110:165afa46840b | 162 | */ |
Kojto | 110:165afa46840b | 163 | |
Kojto | 110:165afa46840b | 164 | /** @defgroup SDIO_Clock_Bypass Clock Bypass |
Kojto | 110:165afa46840b | 165 | * @{ |
Kojto | 110:165afa46840b | 166 | */ |
Kojto | 110:165afa46840b | 167 | #define SDIO_CLOCK_BYPASS_DISABLE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 168 | #define SDIO_CLOCK_BYPASS_ENABLE SDIO_CLKCR_BYPASS |
Kojto | 110:165afa46840b | 169 | |
Kojto | 110:165afa46840b | 170 | #define IS_SDIO_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDIO_CLOCK_BYPASS_DISABLE) || \ |
Kojto | 110:165afa46840b | 171 | ((BYPASS) == SDIO_CLOCK_BYPASS_ENABLE)) |
Kojto | 110:165afa46840b | 172 | /** |
Kojto | 110:165afa46840b | 173 | * @} |
Kojto | 110:165afa46840b | 174 | */ |
Kojto | 110:165afa46840b | 175 | |
Kojto | 110:165afa46840b | 176 | /** @defgroup SDIO_Clock_Power_Save Clock Power Saving |
Kojto | 110:165afa46840b | 177 | * @{ |
Kojto | 110:165afa46840b | 178 | */ |
Kojto | 110:165afa46840b | 179 | #define SDIO_CLOCK_POWER_SAVE_DISABLE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 180 | #define SDIO_CLOCK_POWER_SAVE_ENABLE SDIO_CLKCR_PWRSAV |
Kojto | 110:165afa46840b | 181 | |
Kojto | 110:165afa46840b | 182 | #define IS_SDIO_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDIO_CLOCK_POWER_SAVE_DISABLE) || \ |
Kojto | 110:165afa46840b | 183 | ((SAVE) == SDIO_CLOCK_POWER_SAVE_ENABLE)) |
Kojto | 110:165afa46840b | 184 | /** |
Kojto | 110:165afa46840b | 185 | * @} |
Kojto | 110:165afa46840b | 186 | */ |
Kojto | 110:165afa46840b | 187 | |
Kojto | 110:165afa46840b | 188 | /** @defgroup SDIO_Bus_Wide Bus Width |
Kojto | 110:165afa46840b | 189 | * @{ |
Kojto | 110:165afa46840b | 190 | */ |
Kojto | 110:165afa46840b | 191 | #define SDIO_BUS_WIDE_1B ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 192 | #define SDIO_BUS_WIDE_4B SDIO_CLKCR_WIDBUS_0 |
Kojto | 110:165afa46840b | 193 | #define SDIO_BUS_WIDE_8B SDIO_CLKCR_WIDBUS_1 |
Kojto | 110:165afa46840b | 194 | |
Kojto | 110:165afa46840b | 195 | #define IS_SDIO_BUS_WIDE(WIDE) (((WIDE) == SDIO_BUS_WIDE_1B) || \ |
Kojto | 110:165afa46840b | 196 | ((WIDE) == SDIO_BUS_WIDE_4B) || \ |
Kojto | 110:165afa46840b | 197 | ((WIDE) == SDIO_BUS_WIDE_8B)) |
Kojto | 110:165afa46840b | 198 | /** |
Kojto | 110:165afa46840b | 199 | * @} |
Kojto | 110:165afa46840b | 200 | */ |
Kojto | 110:165afa46840b | 201 | |
Kojto | 110:165afa46840b | 202 | /** @defgroup SDIO_Hardware_Flow_Control Hardware Flow Control |
Kojto | 110:165afa46840b | 203 | * @{ |
Kojto | 110:165afa46840b | 204 | */ |
Kojto | 110:165afa46840b | 205 | #define SDIO_HARDWARE_FLOW_CONTROL_DISABLE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 206 | #define SDIO_HARDWARE_FLOW_CONTROL_ENABLE SDIO_CLKCR_HWFC_EN |
Kojto | 110:165afa46840b | 207 | |
Kojto | 110:165afa46840b | 208 | #define IS_SDIO_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDIO_HARDWARE_FLOW_CONTROL_DISABLE) || \ |
Kojto | 110:165afa46840b | 209 | ((CONTROL) == SDIO_HARDWARE_FLOW_CONTROL_ENABLE)) |
Kojto | 110:165afa46840b | 210 | /** |
Kojto | 110:165afa46840b | 211 | * @} |
Kojto | 110:165afa46840b | 212 | */ |
Kojto | 110:165afa46840b | 213 | |
Kojto | 110:165afa46840b | 214 | /** @defgroup SDIO_Clock_Division Clock Division |
Kojto | 110:165afa46840b | 215 | * @{ |
Kojto | 110:165afa46840b | 216 | */ |
Kojto | 110:165afa46840b | 217 | #define IS_SDIO_CLKDIV(DIV) ((DIV) <= 0xFF) |
Kojto | 110:165afa46840b | 218 | /** |
Kojto | 110:165afa46840b | 219 | * @} |
Kojto | 110:165afa46840b | 220 | */ |
Kojto | 110:165afa46840b | 221 | |
Kojto | 110:165afa46840b | 222 | /** @defgroup SDIO_Command_Index Command Index |
Kojto | 110:165afa46840b | 223 | * @{ |
Kojto | 110:165afa46840b | 224 | */ |
Kojto | 110:165afa46840b | 225 | #define IS_SDIO_CMD_INDEX(INDEX) ((INDEX) < 0x40) |
Kojto | 110:165afa46840b | 226 | /** |
Kojto | 110:165afa46840b | 227 | * @} |
Kojto | 110:165afa46840b | 228 | */ |
Kojto | 110:165afa46840b | 229 | |
Kojto | 110:165afa46840b | 230 | /** @defgroup SDIO_Response_Type Response Type |
Kojto | 110:165afa46840b | 231 | * @{ |
Kojto | 110:165afa46840b | 232 | */ |
Kojto | 110:165afa46840b | 233 | #define SDIO_RESPONSE_NO ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 234 | #define SDIO_RESPONSE_SHORT SDIO_CMD_WAITRESP_0 |
Kojto | 110:165afa46840b | 235 | #define SDIO_RESPONSE_LONG SDIO_CMD_WAITRESP |
Kojto | 110:165afa46840b | 236 | |
Kojto | 110:165afa46840b | 237 | #define IS_SDIO_RESPONSE(RESPONSE) (((RESPONSE) == SDIO_RESPONSE_NO) || \ |
Kojto | 110:165afa46840b | 238 | ((RESPONSE) == SDIO_RESPONSE_SHORT) || \ |
Kojto | 110:165afa46840b | 239 | ((RESPONSE) == SDIO_RESPONSE_LONG)) |
Kojto | 110:165afa46840b | 240 | /** |
Kojto | 110:165afa46840b | 241 | * @} |
Kojto | 110:165afa46840b | 242 | */ |
Kojto | 110:165afa46840b | 243 | |
Kojto | 110:165afa46840b | 244 | /** @defgroup SDIO_Wait_Interrupt_State Wait Interrupt |
Kojto | 110:165afa46840b | 245 | * @{ |
Kojto | 110:165afa46840b | 246 | */ |
Kojto | 110:165afa46840b | 247 | #define SDIO_WAIT_NO ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 248 | #define SDIO_WAIT_IT SDIO_CMD_WAITINT |
Kojto | 110:165afa46840b | 249 | #define SDIO_WAIT_PEND SDIO_CMD_WAITPEND |
Kojto | 110:165afa46840b | 250 | |
Kojto | 110:165afa46840b | 251 | #define IS_SDIO_WAIT(WAIT) (((WAIT) == SDIO_WAIT_NO) || \ |
Kojto | 110:165afa46840b | 252 | ((WAIT) == SDIO_WAIT_IT) || \ |
Kojto | 110:165afa46840b | 253 | ((WAIT) == SDIO_WAIT_PEND)) |
Kojto | 110:165afa46840b | 254 | /** |
Kojto | 110:165afa46840b | 255 | * @} |
Kojto | 110:165afa46840b | 256 | */ |
Kojto | 110:165afa46840b | 257 | |
Kojto | 110:165afa46840b | 258 | /** @defgroup SDIO_CPSM_State CPSM State |
Kojto | 110:165afa46840b | 259 | * @{ |
Kojto | 110:165afa46840b | 260 | */ |
Kojto | 110:165afa46840b | 261 | #define SDIO_CPSM_DISABLE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 262 | #define SDIO_CPSM_ENABLE SDIO_CMD_CPSMEN |
Kojto | 110:165afa46840b | 263 | |
Kojto | 110:165afa46840b | 264 | #define IS_SDIO_CPSM(CPSM) (((CPSM) == SDIO_CPSM_DISABLE) || \ |
Kojto | 110:165afa46840b | 265 | ((CPSM) == SDIO_CPSM_ENABLE)) |
Kojto | 110:165afa46840b | 266 | /** |
Kojto | 110:165afa46840b | 267 | * @} |
Kojto | 110:165afa46840b | 268 | */ |
Kojto | 110:165afa46840b | 269 | |
Kojto | 110:165afa46840b | 270 | /** @defgroup SDIO_Response_Registers Response Register |
Kojto | 110:165afa46840b | 271 | * @{ |
Kojto | 110:165afa46840b | 272 | */ |
Kojto | 110:165afa46840b | 273 | #define SDIO_RESP1 ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 274 | #define SDIO_RESP2 ((uint32_t)0x00000004) |
Kojto | 110:165afa46840b | 275 | #define SDIO_RESP3 ((uint32_t)0x00000008) |
Kojto | 110:165afa46840b | 276 | #define SDIO_RESP4 ((uint32_t)0x0000000C) |
Kojto | 110:165afa46840b | 277 | |
Kojto | 110:165afa46840b | 278 | #define IS_SDIO_RESP(RESP) (((RESP) == SDIO_RESP1) || \ |
Kojto | 110:165afa46840b | 279 | ((RESP) == SDIO_RESP2) || \ |
Kojto | 110:165afa46840b | 280 | ((RESP) == SDIO_RESP3) || \ |
Kojto | 110:165afa46840b | 281 | ((RESP) == SDIO_RESP4)) |
Kojto | 110:165afa46840b | 282 | /** |
Kojto | 110:165afa46840b | 283 | * @} |
Kojto | 110:165afa46840b | 284 | */ |
Kojto | 110:165afa46840b | 285 | |
Kojto | 110:165afa46840b | 286 | /** @defgroup SDIO_Data_Length Data Lenght |
Kojto | 110:165afa46840b | 287 | * @{ |
Kojto | 110:165afa46840b | 288 | */ |
Kojto | 110:165afa46840b | 289 | #define IS_SDIO_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFF) |
Kojto | 110:165afa46840b | 290 | /** |
Kojto | 110:165afa46840b | 291 | * @} |
Kojto | 110:165afa46840b | 292 | */ |
Kojto | 110:165afa46840b | 293 | |
Kojto | 110:165afa46840b | 294 | /** @defgroup SDIO_Data_Block_Size Data Block Size |
Kojto | 110:165afa46840b | 295 | * @{ |
Kojto | 110:165afa46840b | 296 | */ |
Kojto | 110:165afa46840b | 297 | #define SDIO_DATABLOCK_SIZE_1B ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 298 | #define SDIO_DATABLOCK_SIZE_2B SDIO_DCTRL_DBLOCKSIZE_0 |
Kojto | 110:165afa46840b | 299 | #define SDIO_DATABLOCK_SIZE_4B SDIO_DCTRL_DBLOCKSIZE_1 |
Kojto | 110:165afa46840b | 300 | #define SDIO_DATABLOCK_SIZE_8B ((uint32_t)0x00000030) |
Kojto | 110:165afa46840b | 301 | #define SDIO_DATABLOCK_SIZE_16B SDIO_DCTRL_DBLOCKSIZE_2 |
Kojto | 110:165afa46840b | 302 | #define SDIO_DATABLOCK_SIZE_32B ((uint32_t)0x00000050) |
Kojto | 110:165afa46840b | 303 | #define SDIO_DATABLOCK_SIZE_64B ((uint32_t)0x00000060) |
Kojto | 110:165afa46840b | 304 | #define SDIO_DATABLOCK_SIZE_128B ((uint32_t)0x00000070) |
Kojto | 110:165afa46840b | 305 | #define SDIO_DATABLOCK_SIZE_256B SDIO_DCTRL_DBLOCKSIZE_3 |
Kojto | 110:165afa46840b | 306 | #define SDIO_DATABLOCK_SIZE_512B ((uint32_t)0x00000090) |
Kojto | 110:165afa46840b | 307 | #define SDIO_DATABLOCK_SIZE_1024B ((uint32_t)0x000000A0) |
Kojto | 110:165afa46840b | 308 | #define SDIO_DATABLOCK_SIZE_2048B ((uint32_t)0x000000B0) |
Kojto | 110:165afa46840b | 309 | #define SDIO_DATABLOCK_SIZE_4096B ((uint32_t)0x000000C0) |
Kojto | 110:165afa46840b | 310 | #define SDIO_DATABLOCK_SIZE_8192B ((uint32_t)0x000000D0) |
Kojto | 110:165afa46840b | 311 | #define SDIO_DATABLOCK_SIZE_16384B ((uint32_t)0x000000E0) |
Kojto | 110:165afa46840b | 312 | |
Kojto | 110:165afa46840b | 313 | #define IS_SDIO_BLOCK_SIZE(SIZE) (((SIZE) == SDIO_DATABLOCK_SIZE_1B) || \ |
Kojto | 110:165afa46840b | 314 | ((SIZE) == SDIO_DATABLOCK_SIZE_2B) || \ |
Kojto | 110:165afa46840b | 315 | ((SIZE) == SDIO_DATABLOCK_SIZE_4B) || \ |
Kojto | 110:165afa46840b | 316 | ((SIZE) == SDIO_DATABLOCK_SIZE_8B) || \ |
Kojto | 110:165afa46840b | 317 | ((SIZE) == SDIO_DATABLOCK_SIZE_16B) || \ |
Kojto | 110:165afa46840b | 318 | ((SIZE) == SDIO_DATABLOCK_SIZE_32B) || \ |
Kojto | 110:165afa46840b | 319 | ((SIZE) == SDIO_DATABLOCK_SIZE_64B) || \ |
Kojto | 110:165afa46840b | 320 | ((SIZE) == SDIO_DATABLOCK_SIZE_128B) || \ |
Kojto | 110:165afa46840b | 321 | ((SIZE) == SDIO_DATABLOCK_SIZE_256B) || \ |
Kojto | 110:165afa46840b | 322 | ((SIZE) == SDIO_DATABLOCK_SIZE_512B) || \ |
Kojto | 110:165afa46840b | 323 | ((SIZE) == SDIO_DATABLOCK_SIZE_1024B) || \ |
Kojto | 110:165afa46840b | 324 | ((SIZE) == SDIO_DATABLOCK_SIZE_2048B) || \ |
Kojto | 110:165afa46840b | 325 | ((SIZE) == SDIO_DATABLOCK_SIZE_4096B) || \ |
Kojto | 110:165afa46840b | 326 | ((SIZE) == SDIO_DATABLOCK_SIZE_8192B) || \ |
Kojto | 110:165afa46840b | 327 | ((SIZE) == SDIO_DATABLOCK_SIZE_16384B)) |
Kojto | 110:165afa46840b | 328 | /** |
Kojto | 110:165afa46840b | 329 | * @} |
Kojto | 110:165afa46840b | 330 | */ |
Kojto | 110:165afa46840b | 331 | |
Kojto | 110:165afa46840b | 332 | /** @defgroup SDIO_Transfer_Direction Transfer Direction |
Kojto | 110:165afa46840b | 333 | * @{ |
Kojto | 110:165afa46840b | 334 | */ |
Kojto | 110:165afa46840b | 335 | #define SDIO_TRANSFER_DIR_TO_CARD ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 336 | #define SDIO_TRANSFER_DIR_TO_SDIO SDIO_DCTRL_DTDIR |
Kojto | 110:165afa46840b | 337 | |
Kojto | 110:165afa46840b | 338 | #define IS_SDIO_TRANSFER_DIR(DIR) (((DIR) == SDIO_TRANSFER_DIR_TO_CARD) || \ |
Kojto | 110:165afa46840b | 339 | ((DIR) == SDIO_TRANSFER_DIR_TO_SDIO)) |
Kojto | 110:165afa46840b | 340 | /** |
Kojto | 110:165afa46840b | 341 | * @} |
Kojto | 110:165afa46840b | 342 | */ |
Kojto | 110:165afa46840b | 343 | |
Kojto | 110:165afa46840b | 344 | /** @defgroup SDIO_Transfer_Type Transfer Type |
Kojto | 110:165afa46840b | 345 | * @{ |
Kojto | 110:165afa46840b | 346 | */ |
Kojto | 110:165afa46840b | 347 | #define SDIO_TRANSFER_MODE_BLOCK ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 348 | #define SDIO_TRANSFER_MODE_STREAM SDIO_DCTRL_DTMODE |
Kojto | 110:165afa46840b | 349 | |
Kojto | 110:165afa46840b | 350 | #define IS_SDIO_TRANSFER_MODE(MODE) (((MODE) == SDIO_TRANSFER_MODE_BLOCK) || \ |
Kojto | 110:165afa46840b | 351 | ((MODE) == SDIO_TRANSFER_MODE_STREAM)) |
Kojto | 110:165afa46840b | 352 | /** |
Kojto | 110:165afa46840b | 353 | * @} |
Kojto | 110:165afa46840b | 354 | */ |
Kojto | 110:165afa46840b | 355 | |
Kojto | 110:165afa46840b | 356 | /** @defgroup SDIO_DPSM_State DPSM State |
Kojto | 110:165afa46840b | 357 | * @{ |
Kojto | 110:165afa46840b | 358 | */ |
Kojto | 110:165afa46840b | 359 | #define SDIO_DPSM_DISABLE ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 360 | #define SDIO_DPSM_ENABLE SDIO_DCTRL_DTEN |
Kojto | 110:165afa46840b | 361 | |
Kojto | 110:165afa46840b | 362 | #define IS_SDIO_DPSM(DPSM) (((DPSM) == SDIO_DPSM_DISABLE) ||\ |
Kojto | 110:165afa46840b | 363 | ((DPSM) == SDIO_DPSM_ENABLE)) |
Kojto | 110:165afa46840b | 364 | /** |
Kojto | 110:165afa46840b | 365 | * @} |
Kojto | 110:165afa46840b | 366 | */ |
Kojto | 110:165afa46840b | 367 | |
Kojto | 110:165afa46840b | 368 | /** @defgroup SDIO_Read_Wait_Mode Read Wait Mode |
Kojto | 110:165afa46840b | 369 | * @{ |
Kojto | 110:165afa46840b | 370 | */ |
Kojto | 110:165afa46840b | 371 | #define SDIO_READ_WAIT_MODE_DATA2 ((uint32_t)0x00000000) |
Kojto | 110:165afa46840b | 372 | #define SDIO_READ_WAIT_MODE_CLK ((uint32_t)0x00000001) |
Kojto | 110:165afa46840b | 373 | |
Kojto | 110:165afa46840b | 374 | #define IS_SDIO_READWAIT_MODE(MODE) (((MODE) == SDIO_READ_WAIT_MODE_CLK) || \ |
Kojto | 110:165afa46840b | 375 | ((MODE) == SDIO_READ_WAIT_MODE_DATA2)) |
Kojto | 110:165afa46840b | 376 | /** |
Kojto | 110:165afa46840b | 377 | * @} |
Kojto | 110:165afa46840b | 378 | */ |
Kojto | 110:165afa46840b | 379 | |
Kojto | 110:165afa46840b | 380 | /** @defgroup SDIO_Interrupt_sources Interrupt Sources |
Kojto | 110:165afa46840b | 381 | * @{ |
Kojto | 110:165afa46840b | 382 | */ |
Kojto | 110:165afa46840b | 383 | #define SDIO_IT_CCRCFAIL SDIO_STA_CCRCFAIL |
Kojto | 110:165afa46840b | 384 | #define SDIO_IT_DCRCFAIL SDIO_STA_DCRCFAIL |
Kojto | 110:165afa46840b | 385 | #define SDIO_IT_CTIMEOUT SDIO_STA_CTIMEOUT |
Kojto | 110:165afa46840b | 386 | #define SDIO_IT_DTIMEOUT SDIO_STA_DTIMEOUT |
Kojto | 110:165afa46840b | 387 | #define SDIO_IT_TXUNDERR SDIO_STA_TXUNDERR |
Kojto | 110:165afa46840b | 388 | #define SDIO_IT_RXOVERR SDIO_STA_RXOVERR |
Kojto | 110:165afa46840b | 389 | #define SDIO_IT_CMDREND SDIO_STA_CMDREND |
Kojto | 110:165afa46840b | 390 | #define SDIO_IT_CMDSENT SDIO_STA_CMDSENT |
Kojto | 110:165afa46840b | 391 | #define SDIO_IT_DATAEND SDIO_STA_DATAEND |
Kojto | 110:165afa46840b | 392 | #define SDIO_IT_STBITERR SDIO_STA_STBITERR |
Kojto | 110:165afa46840b | 393 | #define SDIO_IT_DBCKEND SDIO_STA_DBCKEND |
Kojto | 110:165afa46840b | 394 | #define SDIO_IT_CMDACT SDIO_STA_CMDACT |
Kojto | 110:165afa46840b | 395 | #define SDIO_IT_TXACT SDIO_STA_TXACT |
Kojto | 110:165afa46840b | 396 | #define SDIO_IT_RXACT SDIO_STA_RXACT |
Kojto | 110:165afa46840b | 397 | #define SDIO_IT_TXFIFOHE SDIO_STA_TXFIFOHE |
Kojto | 110:165afa46840b | 398 | #define SDIO_IT_RXFIFOHF SDIO_STA_RXFIFOHF |
Kojto | 110:165afa46840b | 399 | #define SDIO_IT_TXFIFOF SDIO_STA_TXFIFOF |
Kojto | 110:165afa46840b | 400 | #define SDIO_IT_RXFIFOF SDIO_STA_RXFIFOF |
Kojto | 110:165afa46840b | 401 | #define SDIO_IT_TXFIFOE SDIO_STA_TXFIFOE |
Kojto | 110:165afa46840b | 402 | #define SDIO_IT_RXFIFOE SDIO_STA_RXFIFOE |
Kojto | 110:165afa46840b | 403 | #define SDIO_IT_TXDAVL SDIO_STA_TXDAVL |
Kojto | 110:165afa46840b | 404 | #define SDIO_IT_RXDAVL SDIO_STA_RXDAVL |
Kojto | 110:165afa46840b | 405 | #define SDIO_IT_SDIOIT SDIO_STA_SDIOIT |
Kojto | 110:165afa46840b | 406 | #define SDIO_IT_CEATAEND SDIO_STA_CEATAEND |
Kojto | 110:165afa46840b | 407 | /** |
Kojto | 110:165afa46840b | 408 | * @} |
Kojto | 110:165afa46840b | 409 | */ |
Kojto | 110:165afa46840b | 410 | |
Kojto | 110:165afa46840b | 411 | /** @defgroup SDIO_Flags Flags |
Kojto | 110:165afa46840b | 412 | * @{ |
Kojto | 110:165afa46840b | 413 | */ |
Kojto | 110:165afa46840b | 414 | #define SDIO_FLAG_CCRCFAIL SDIO_STA_CCRCFAIL |
Kojto | 110:165afa46840b | 415 | #define SDIO_FLAG_DCRCFAIL SDIO_STA_DCRCFAIL |
Kojto | 110:165afa46840b | 416 | #define SDIO_FLAG_CTIMEOUT SDIO_STA_CTIMEOUT |
Kojto | 110:165afa46840b | 417 | #define SDIO_FLAG_DTIMEOUT SDIO_STA_DTIMEOUT |
Kojto | 110:165afa46840b | 418 | #define SDIO_FLAG_TXUNDERR SDIO_STA_TXUNDERR |
Kojto | 110:165afa46840b | 419 | #define SDIO_FLAG_RXOVERR SDIO_STA_RXOVERR |
Kojto | 110:165afa46840b | 420 | #define SDIO_FLAG_CMDREND SDIO_STA_CMDREND |
Kojto | 110:165afa46840b | 421 | #define SDIO_FLAG_CMDSENT SDIO_STA_CMDSENT |
Kojto | 110:165afa46840b | 422 | #define SDIO_FLAG_DATAEND SDIO_STA_DATAEND |
Kojto | 110:165afa46840b | 423 | #define SDIO_FLAG_STBITERR SDIO_STA_STBITERR |
Kojto | 110:165afa46840b | 424 | #define SDIO_FLAG_DBCKEND SDIO_STA_DBCKEND |
Kojto | 110:165afa46840b | 425 | #define SDIO_FLAG_CMDACT SDIO_STA_CMDACT |
Kojto | 110:165afa46840b | 426 | #define SDIO_FLAG_TXACT SDIO_STA_TXACT |
Kojto | 110:165afa46840b | 427 | #define SDIO_FLAG_RXACT SDIO_STA_RXACT |
Kojto | 110:165afa46840b | 428 | #define SDIO_FLAG_TXFIFOHE SDIO_STA_TXFIFOHE |
Kojto | 110:165afa46840b | 429 | #define SDIO_FLAG_RXFIFOHF SDIO_STA_RXFIFOHF |
Kojto | 110:165afa46840b | 430 | #define SDIO_FLAG_TXFIFOF SDIO_STA_TXFIFOF |
Kojto | 110:165afa46840b | 431 | #define SDIO_FLAG_RXFIFOF SDIO_STA_RXFIFOF |
Kojto | 110:165afa46840b | 432 | #define SDIO_FLAG_TXFIFOE SDIO_STA_TXFIFOE |
Kojto | 110:165afa46840b | 433 | #define SDIO_FLAG_RXFIFOE SDIO_STA_RXFIFOE |
Kojto | 110:165afa46840b | 434 | #define SDIO_FLAG_TXDAVL SDIO_STA_TXDAVL |
Kojto | 110:165afa46840b | 435 | #define SDIO_FLAG_RXDAVL SDIO_STA_RXDAVL |
Kojto | 110:165afa46840b | 436 | #define SDIO_FLAG_SDIOIT SDIO_STA_SDIOIT |
Kojto | 110:165afa46840b | 437 | #define SDIO_FLAG_CEATAEND SDIO_STA_CEATAEND |
Kojto | 110:165afa46840b | 438 | /** |
Kojto | 110:165afa46840b | 439 | * @} |
Kojto | 110:165afa46840b | 440 | */ |
Kojto | 110:165afa46840b | 441 | |
Kojto | 110:165afa46840b | 442 | /** |
Kojto | 110:165afa46840b | 443 | * @} |
Kojto | 110:165afa46840b | 444 | */ |
Kojto | 110:165afa46840b | 445 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 446 | /** @defgroup SDMMC_LL_Exported_macros SDMMC_LL Exported Macros |
Kojto | 110:165afa46840b | 447 | * @{ |
Kojto | 110:165afa46840b | 448 | */ |
Kojto | 110:165afa46840b | 449 | |
Kojto | 110:165afa46840b | 450 | /** @defgroup SDMMC_LL_Alias_Region Bit Address in the alias region |
Kojto | 110:165afa46840b | 451 | * @{ |
Kojto | 110:165afa46840b | 452 | */ |
Kojto | 110:165afa46840b | 453 | /* ------------ SDIO registers bit address in the alias region -------------- */ |
Kojto | 110:165afa46840b | 454 | #define SDIO_OFFSET (SDIO_BASE - PERIPH_BASE) |
Kojto | 110:165afa46840b | 455 | |
Kojto | 110:165afa46840b | 456 | /* --- CLKCR Register ---*/ |
Kojto | 110:165afa46840b | 457 | /* Alias word address of CLKEN bit */ |
Kojto | 110:165afa46840b | 458 | #define CLKCR_OFFSET (SDIO_OFFSET + 0x04) |
Kojto | 110:165afa46840b | 459 | #define CLKEN_BITNUMBER 0x08 |
Kojto | 110:165afa46840b | 460 | #define CLKCR_CLKEN_BB (PERIPH_BB_BASE + (CLKCR_OFFSET * 32) + (CLKEN_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 461 | |
Kojto | 110:165afa46840b | 462 | /* --- CMD Register ---*/ |
Kojto | 110:165afa46840b | 463 | /* Alias word address of SDIOSUSPEND bit */ |
Kojto | 110:165afa46840b | 464 | #define CMD_OFFSET (SDIO_OFFSET + 0x0C) |
Kojto | 110:165afa46840b | 465 | #define SDIOSUSPEND_BITNUMBER 0x0B |
Kojto | 110:165afa46840b | 466 | #define CMD_SDIOSUSPEND_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (SDIOSUSPEND_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 467 | |
Kojto | 110:165afa46840b | 468 | /* Alias word address of ENCMDCOMPL bit */ |
Kojto | 110:165afa46840b | 469 | #define ENCMDCOMPL_BITNUMBER 0x0C |
Kojto | 110:165afa46840b | 470 | #define CMD_ENCMDCOMPL_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (ENCMDCOMPL_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 471 | |
Kojto | 110:165afa46840b | 472 | /* Alias word address of NIEN bit */ |
Kojto | 110:165afa46840b | 473 | #define NIEN_BITNUMBER 0x0D |
Kojto | 110:165afa46840b | 474 | #define CMD_NIEN_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (NIEN_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 475 | |
Kojto | 110:165afa46840b | 476 | /* Alias word address of ATACMD bit */ |
Kojto | 110:165afa46840b | 477 | #define ATACMD_BITNUMBER 0x0E |
Kojto | 110:165afa46840b | 478 | #define CMD_ATACMD_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (ATACMD_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 479 | |
Kojto | 110:165afa46840b | 480 | /* --- DCTRL Register ---*/ |
Kojto | 110:165afa46840b | 481 | /* Alias word address of DMAEN bit */ |
Kojto | 110:165afa46840b | 482 | #define DCTRL_OFFSET (SDIO_OFFSET + 0x2C) |
Kojto | 110:165afa46840b | 483 | #define DMAEN_BITNUMBER 0x03 |
Kojto | 110:165afa46840b | 484 | #define DCTRL_DMAEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (DMAEN_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 485 | |
Kojto | 110:165afa46840b | 486 | /* Alias word address of RWSTART bit */ |
Kojto | 110:165afa46840b | 487 | #define RWSTART_BITNUMBER 0x08 |
Kojto | 110:165afa46840b | 488 | #define DCTRL_RWSTART_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWSTART_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 489 | |
Kojto | 110:165afa46840b | 490 | /* Alias word address of RWSTOP bit */ |
Kojto | 110:165afa46840b | 491 | #define RWSTOP_BITNUMBER 0x09 |
Kojto | 110:165afa46840b | 492 | #define DCTRL_RWSTOP_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWSTOP_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 493 | |
Kojto | 110:165afa46840b | 494 | /* Alias word address of RWMOD bit */ |
Kojto | 110:165afa46840b | 495 | #define RWMOD_BITNUMBER 0x0A |
Kojto | 110:165afa46840b | 496 | #define DCTRL_RWMOD_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWMOD_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 497 | |
Kojto | 110:165afa46840b | 498 | /* Alias word address of SDIOEN bit */ |
Kojto | 110:165afa46840b | 499 | #define SDIOEN_BITNUMBER 0x0B |
Kojto | 110:165afa46840b | 500 | #define DCTRL_SDIOEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (SDIOEN_BITNUMBER * 4)) |
Kojto | 110:165afa46840b | 501 | /** |
Kojto | 110:165afa46840b | 502 | * @} |
Kojto | 110:165afa46840b | 503 | */ |
Kojto | 110:165afa46840b | 504 | |
Kojto | 110:165afa46840b | 505 | /** @defgroup SDMMC_LL_Register Bits And Addresses Definitions |
Kojto | 110:165afa46840b | 506 | * @brief SDMMC_LL registers bit address in the alias region |
Kojto | 110:165afa46840b | 507 | * @{ |
Kojto | 110:165afa46840b | 508 | */ |
Kojto | 110:165afa46840b | 509 | |
Kojto | 110:165afa46840b | 510 | /* ---------------------- SDIO registers bit mask --------------------------- */ |
Kojto | 110:165afa46840b | 511 | /* --- CLKCR Register ---*/ |
Kojto | 110:165afa46840b | 512 | /* CLKCR register clear mask */ |
Kojto | 110:165afa46840b | 513 | #define CLKCR_CLEAR_MASK ((uint32_t)(SDIO_CLKCR_CLKDIV | SDIO_CLKCR_PWRSAV |\ |
Kojto | 110:165afa46840b | 514 | SDIO_CLKCR_BYPASS | SDIO_CLKCR_WIDBUS |\ |
Kojto | 110:165afa46840b | 515 | SDIO_CLKCR_NEGEDGE | SDIO_CLKCR_HWFC_EN)) |
Kojto | 110:165afa46840b | 516 | |
Kojto | 110:165afa46840b | 517 | /* --- PWRCTRL Register ---*/ |
Kojto | 110:165afa46840b | 518 | /* --- DCTRL Register ---*/ |
Kojto | 110:165afa46840b | 519 | /* SDIO DCTRL Clear Mask */ |
Kojto | 110:165afa46840b | 520 | #define DCTRL_CLEAR_MASK ((uint32_t)(SDIO_DCTRL_DTEN | SDIO_DCTRL_DTDIR |\ |
Kojto | 110:165afa46840b | 521 | SDIO_DCTRL_DTMODE | SDIO_DCTRL_DBLOCKSIZE)) |
Kojto | 110:165afa46840b | 522 | |
Kojto | 110:165afa46840b | 523 | /* --- CMD Register ---*/ |
Kojto | 110:165afa46840b | 524 | /* CMD Register clear mask */ |
Kojto | 110:165afa46840b | 525 | #define CMD_CLEAR_MASK ((uint32_t)(SDIO_CMD_CMDINDEX | SDIO_CMD_WAITRESP |\ |
Kojto | 110:165afa46840b | 526 | SDIO_CMD_WAITINT | SDIO_CMD_WAITPEND |\ |
Kojto | 110:165afa46840b | 527 | SDIO_CMD_CPSMEN | SDIO_CMD_SDIOSUSPEND)) |
Kojto | 110:165afa46840b | 528 | |
Kojto | 110:165afa46840b | 529 | /* SDIO RESP Registers Address */ |
Kojto | 110:165afa46840b | 530 | #define SDIO_RESP_ADDR ((uint32_t)(SDIO_BASE + 0x14)) |
Kojto | 110:165afa46840b | 531 | |
Kojto | 110:165afa46840b | 532 | /* SDIO Initialization Frequency (400KHz max) */ |
Kojto | 110:165afa46840b | 533 | #define SDIO_INIT_CLK_DIV ((uint8_t)0x76) |
Kojto | 110:165afa46840b | 534 | |
Kojto | 110:165afa46840b | 535 | /* SDIO Data Transfer Frequency (25MHz max) */ |
Kojto | 110:165afa46840b | 536 | #define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x0) |
Kojto | 110:165afa46840b | 537 | /** |
Kojto | 110:165afa46840b | 538 | * @} |
Kojto | 110:165afa46840b | 539 | */ |
Kojto | 110:165afa46840b | 540 | |
Kojto | 110:165afa46840b | 541 | /** @defgroup SDMMC_LL_Interrupt_Clock Interrupt And Clock Configuration |
Kojto | 110:165afa46840b | 542 | * @brief macros to handle interrupts and specific clock configurations |
Kojto | 110:165afa46840b | 543 | * @{ |
Kojto | 110:165afa46840b | 544 | */ |
Kojto | 110:165afa46840b | 545 | |
Kojto | 110:165afa46840b | 546 | /** |
Kojto | 110:165afa46840b | 547 | * @brief Enable the SDIO device. |
Kojto | 110:165afa46840b | 548 | * @retval None |
Kojto | 110:165afa46840b | 549 | */ |
Kojto | 110:165afa46840b | 550 | #define __SDIO_ENABLE() (*(__IO uint32_t *)CLKCR_CLKEN_BB = ENABLE) |
Kojto | 110:165afa46840b | 551 | |
Kojto | 110:165afa46840b | 552 | /** |
Kojto | 110:165afa46840b | 553 | * @brief Disable the SDIO device. |
Kojto | 110:165afa46840b | 554 | * @retval None |
Kojto | 110:165afa46840b | 555 | */ |
Kojto | 110:165afa46840b | 556 | #define __SDIO_DISABLE() (*(__IO uint32_t *)CLKCR_CLKEN_BB = DISABLE) |
Kojto | 110:165afa46840b | 557 | |
Kojto | 110:165afa46840b | 558 | /** |
Kojto | 110:165afa46840b | 559 | * @brief Enable the SDIO DMA transfer. |
Kojto | 110:165afa46840b | 560 | * @retval None |
Kojto | 110:165afa46840b | 561 | */ |
Kojto | 110:165afa46840b | 562 | #define __SDIO_DMA_ENABLE() (*(__IO uint32_t *)DCTRL_DMAEN_BB = ENABLE) |
Kojto | 110:165afa46840b | 563 | |
Kojto | 110:165afa46840b | 564 | /** |
Kojto | 110:165afa46840b | 565 | * @brief Disable the SDIO DMA transfer. |
Kojto | 110:165afa46840b | 566 | * @retval None |
Kojto | 110:165afa46840b | 567 | */ |
Kojto | 110:165afa46840b | 568 | #define __SDIO_DMA_DISABLE() (*(__IO uint32_t *)DCTRL_DMAEN_BB = DISABLE) |
Kojto | 110:165afa46840b | 569 | |
Kojto | 110:165afa46840b | 570 | /** |
Kojto | 110:165afa46840b | 571 | * @brief Enable the SDIO device interrupt. |
Kojto | 110:165afa46840b | 572 | * @param __INSTANCE__ : Pointer to SDIO register base |
Kojto | 110:165afa46840b | 573 | * @param __INTERRUPT__ : specifies the SDIO interrupt sources to be enabled. |
Kojto | 110:165afa46840b | 574 | * This parameter can be one or a combination of the following values: |
Kojto | 110:165afa46840b | 575 | * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
Kojto | 110:165afa46840b | 576 | * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
Kojto | 110:165afa46840b | 577 | * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt |
Kojto | 110:165afa46840b | 578 | * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt |
Kojto | 110:165afa46840b | 579 | * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
Kojto | 110:165afa46840b | 580 | * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt |
Kojto | 110:165afa46840b | 581 | * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt |
Kojto | 110:165afa46840b | 582 | * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt |
Kojto | 110:165afa46840b | 583 | * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
Kojto | 110:165afa46840b | 584 | * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide |
Kojto | 110:165afa46840b | 585 | * bus mode interrupt |
Kojto | 110:165afa46840b | 586 | * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
Kojto | 110:165afa46840b | 587 | * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt |
Kojto | 110:165afa46840b | 588 | * @arg SDIO_IT_TXACT: Data transmit in progress interrupt |
Kojto | 110:165afa46840b | 589 | * @arg SDIO_IT_RXACT: Data receive in progress interrupt |
Kojto | 110:165afa46840b | 590 | * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
Kojto | 110:165afa46840b | 591 | * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
Kojto | 110:165afa46840b | 592 | * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt |
Kojto | 110:165afa46840b | 593 | * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt |
Kojto | 110:165afa46840b | 594 | * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt |
Kojto | 110:165afa46840b | 595 | * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt |
Kojto | 110:165afa46840b | 596 | * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt |
Kojto | 110:165afa46840b | 597 | * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt |
Kojto | 110:165afa46840b | 598 | * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt |
Kojto | 110:165afa46840b | 599 | * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt |
Kojto | 110:165afa46840b | 600 | * @retval None |
Kojto | 110:165afa46840b | 601 | */ |
Kojto | 110:165afa46840b | 602 | #define __SDIO_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK |= (__INTERRUPT__)) |
Kojto | 110:165afa46840b | 603 | |
Kojto | 110:165afa46840b | 604 | /** |
Kojto | 110:165afa46840b | 605 | * @brief Disable the SDIO device interrupt. |
Kojto | 110:165afa46840b | 606 | * @param __INSTANCE__ : Pointer to SDIO register base |
Kojto | 110:165afa46840b | 607 | * @param __INTERRUPT__ : specifies the SDIO interrupt sources to be disabled. |
Kojto | 110:165afa46840b | 608 | * This parameter can be one or a combination of the following values: |
Kojto | 110:165afa46840b | 609 | * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
Kojto | 110:165afa46840b | 610 | * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
Kojto | 110:165afa46840b | 611 | * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt |
Kojto | 110:165afa46840b | 612 | * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt |
Kojto | 110:165afa46840b | 613 | * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
Kojto | 110:165afa46840b | 614 | * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt |
Kojto | 110:165afa46840b | 615 | * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt |
Kojto | 110:165afa46840b | 616 | * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt |
Kojto | 110:165afa46840b | 617 | * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
Kojto | 110:165afa46840b | 618 | * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide |
Kojto | 110:165afa46840b | 619 | * bus mode interrupt |
Kojto | 110:165afa46840b | 620 | * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
Kojto | 110:165afa46840b | 621 | * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt |
Kojto | 110:165afa46840b | 622 | * @arg SDIO_IT_TXACT: Data transmit in progress interrupt |
Kojto | 110:165afa46840b | 623 | * @arg SDIO_IT_RXACT: Data receive in progress interrupt |
Kojto | 110:165afa46840b | 624 | * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
Kojto | 110:165afa46840b | 625 | * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
Kojto | 110:165afa46840b | 626 | * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt |
Kojto | 110:165afa46840b | 627 | * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt |
Kojto | 110:165afa46840b | 628 | * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt |
Kojto | 110:165afa46840b | 629 | * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt |
Kojto | 110:165afa46840b | 630 | * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt |
Kojto | 110:165afa46840b | 631 | * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt |
Kojto | 110:165afa46840b | 632 | * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt |
Kojto | 110:165afa46840b | 633 | * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt |
Kojto | 110:165afa46840b | 634 | * @retval None |
Kojto | 110:165afa46840b | 635 | */ |
Kojto | 110:165afa46840b | 636 | #define __SDIO_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK &= ~(__INTERRUPT__)) |
Kojto | 110:165afa46840b | 637 | |
Kojto | 110:165afa46840b | 638 | /** |
Kojto | 110:165afa46840b | 639 | * @brief Checks whether the specified SDIO flag is set or not. |
Kojto | 110:165afa46840b | 640 | * @param __INSTANCE__ : Pointer to SDIO register base |
Kojto | 110:165afa46840b | 641 | * @param __FLAG__: specifies the flag to check. |
Kojto | 110:165afa46840b | 642 | * This parameter can be one of the following values: |
Kojto | 110:165afa46840b | 643 | * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed) |
Kojto | 110:165afa46840b | 644 | * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed) |
Kojto | 110:165afa46840b | 645 | * @arg SDIO_FLAG_CTIMEOUT: Command response timeout |
Kojto | 110:165afa46840b | 646 | * @arg SDIO_FLAG_DTIMEOUT: Data timeout |
Kojto | 110:165afa46840b | 647 | * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error |
Kojto | 110:165afa46840b | 648 | * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error |
Kojto | 110:165afa46840b | 649 | * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed) |
Kojto | 110:165afa46840b | 650 | * @arg SDIO_FLAG_CMDSENT: Command sent (no response required) |
Kojto | 110:165afa46840b | 651 | * @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) |
Kojto | 110:165afa46840b | 652 | * @arg SDIO_FLAG_STBITERR: Start bit not detected on all data signals in wide bus mode. |
Kojto | 110:165afa46840b | 653 | * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed) |
Kojto | 110:165afa46840b | 654 | * @arg SDIO_FLAG_CMDACT: Command transfer in progress |
Kojto | 110:165afa46840b | 655 | * @arg SDIO_FLAG_TXACT: Data transmit in progress |
Kojto | 110:165afa46840b | 656 | * @arg SDIO_FLAG_RXACT: Data receive in progress |
Kojto | 110:165afa46840b | 657 | * @arg SDIO_FLAG_TXFIFOHE: Transmit FIFO Half Empty |
Kojto | 110:165afa46840b | 658 | * @arg SDIO_FLAG_RXFIFOHF: Receive FIFO Half Full |
Kojto | 110:165afa46840b | 659 | * @arg SDIO_FLAG_TXFIFOF: Transmit FIFO full |
Kojto | 110:165afa46840b | 660 | * @arg SDIO_FLAG_RXFIFOF: Receive FIFO full |
Kojto | 110:165afa46840b | 661 | * @arg SDIO_FLAG_TXFIFOE: Transmit FIFO empty |
Kojto | 110:165afa46840b | 662 | * @arg SDIO_FLAG_RXFIFOE: Receive FIFO empty |
Kojto | 110:165afa46840b | 663 | * @arg SDIO_FLAG_TXDAVL: Data available in transmit FIFO |
Kojto | 110:165afa46840b | 664 | * @arg SDIO_FLAG_RXDAVL: Data available in receive FIFO |
Kojto | 110:165afa46840b | 665 | * @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received |
Kojto | 110:165afa46840b | 666 | * @arg SDIO_FLAG_CEATAEND: CE-ATA command completion signal received for CMD61 |
Kojto | 110:165afa46840b | 667 | * @retval The new state of SDIO_FLAG (SET or RESET). |
Kojto | 110:165afa46840b | 668 | */ |
Kojto | 110:165afa46840b | 669 | #define __SDIO_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->STA &(__FLAG__)) != RESET) |
Kojto | 110:165afa46840b | 670 | |
Kojto | 110:165afa46840b | 671 | |
Kojto | 110:165afa46840b | 672 | /** |
Kojto | 110:165afa46840b | 673 | * @brief Clears the SDIO pending flags. |
Kojto | 110:165afa46840b | 674 | * @param __INSTANCE__ : Pointer to SDIO register base |
Kojto | 110:165afa46840b | 675 | * @param __FLAG__: specifies the flag to clear. |
Kojto | 110:165afa46840b | 676 | * This parameter can be one or a combination of the following values: |
Kojto | 110:165afa46840b | 677 | * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed) |
Kojto | 110:165afa46840b | 678 | * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed) |
Kojto | 110:165afa46840b | 679 | * @arg SDIO_FLAG_CTIMEOUT: Command response timeout |
Kojto | 110:165afa46840b | 680 | * @arg SDIO_FLAG_DTIMEOUT: Data timeout |
Kojto | 110:165afa46840b | 681 | * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error |
Kojto | 110:165afa46840b | 682 | * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error |
Kojto | 110:165afa46840b | 683 | * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed) |
Kojto | 110:165afa46840b | 684 | * @arg SDIO_FLAG_CMDSENT: Command sent (no response required) |
Kojto | 110:165afa46840b | 685 | * @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) |
Kojto | 110:165afa46840b | 686 | * @arg SDIO_FLAG_STBITERR: Start bit not detected on all data signals in wide bus mode |
Kojto | 110:165afa46840b | 687 | * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed) |
Kojto | 110:165afa46840b | 688 | * @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received |
Kojto | 110:165afa46840b | 689 | * @arg SDIO_FLAG_CEATAEND: CE-ATA command completion signal received for CMD61 |
Kojto | 110:165afa46840b | 690 | * @retval None |
Kojto | 110:165afa46840b | 691 | */ |
Kojto | 110:165afa46840b | 692 | #define __SDIO_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->ICR = (__FLAG__)) |
Kojto | 110:165afa46840b | 693 | |
Kojto | 110:165afa46840b | 694 | /** |
Kojto | 110:165afa46840b | 695 | * @brief Checks whether the specified SDIO interrupt has occurred or not. |
Kojto | 110:165afa46840b | 696 | * @param __INSTANCE__ : Pointer to SDIO register base |
Kojto | 110:165afa46840b | 697 | * @param __INTERRUPT__: specifies the SDIO interrupt source to check. |
Kojto | 110:165afa46840b | 698 | * This parameter can be one of the following values: |
Kojto | 110:165afa46840b | 699 | * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
Kojto | 110:165afa46840b | 700 | * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
Kojto | 110:165afa46840b | 701 | * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt |
Kojto | 110:165afa46840b | 702 | * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt |
Kojto | 110:165afa46840b | 703 | * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
Kojto | 110:165afa46840b | 704 | * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt |
Kojto | 110:165afa46840b | 705 | * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt |
Kojto | 110:165afa46840b | 706 | * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt |
Kojto | 110:165afa46840b | 707 | * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
Kojto | 110:165afa46840b | 708 | * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide |
Kojto | 110:165afa46840b | 709 | * bus mode interrupt |
Kojto | 110:165afa46840b | 710 | * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
Kojto | 110:165afa46840b | 711 | * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt |
Kojto | 110:165afa46840b | 712 | * @arg SDIO_IT_TXACT: Data transmit in progress interrupt |
Kojto | 110:165afa46840b | 713 | * @arg SDIO_IT_RXACT: Data receive in progress interrupt |
Kojto | 110:165afa46840b | 714 | * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
Kojto | 110:165afa46840b | 715 | * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
Kojto | 110:165afa46840b | 716 | * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt |
Kojto | 110:165afa46840b | 717 | * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt |
Kojto | 110:165afa46840b | 718 | * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt |
Kojto | 110:165afa46840b | 719 | * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt |
Kojto | 110:165afa46840b | 720 | * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt |
Kojto | 110:165afa46840b | 721 | * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt |
Kojto | 110:165afa46840b | 722 | * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt |
Kojto | 110:165afa46840b | 723 | * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt |
Kojto | 110:165afa46840b | 724 | * @retval The new state of SDIO_IT (SET or RESET). |
Kojto | 110:165afa46840b | 725 | */ |
Kojto | 110:165afa46840b | 726 | #define __SDIO_GET_IT (__INSTANCE__, __INTERRUPT__) (((__INSTANCE__)->STA &(__INTERRUPT__)) == (__INTERRUPT__)) |
Kojto | 110:165afa46840b | 727 | |
Kojto | 110:165afa46840b | 728 | /** |
Kojto | 110:165afa46840b | 729 | * @brief Clears the SDIO's interrupt pending bits. |
Kojto | 110:165afa46840b | 730 | * @param __INSTANCE__ : Pointer to SDIO register base |
Kojto | 110:165afa46840b | 731 | * @param __INTERRUPT__: specifies the interrupt pending bit to clear. |
Kojto | 110:165afa46840b | 732 | * This parameter can be one or a combination of the following values: |
Kojto | 110:165afa46840b | 733 | * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
Kojto | 110:165afa46840b | 734 | * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
Kojto | 110:165afa46840b | 735 | * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt |
Kojto | 110:165afa46840b | 736 | * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt |
Kojto | 110:165afa46840b | 737 | * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
Kojto | 110:165afa46840b | 738 | * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt |
Kojto | 110:165afa46840b | 739 | * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt |
Kojto | 110:165afa46840b | 740 | * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt |
Kojto | 110:165afa46840b | 741 | * @arg SDIO_IT_DATAEND: Data end (data counter, SDIO_DCOUNT, is zero) interrupt |
Kojto | 110:165afa46840b | 742 | * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide |
Kojto | 110:165afa46840b | 743 | * bus mode interrupt |
Kojto | 110:165afa46840b | 744 | * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt |
Kojto | 110:165afa46840b | 745 | * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 |
Kojto | 110:165afa46840b | 746 | * @retval None |
Kojto | 110:165afa46840b | 747 | */ |
Kojto | 110:165afa46840b | 748 | #define __SDIO_CLEAR_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->ICR = (__INTERRUPT__)) |
Kojto | 110:165afa46840b | 749 | |
Kojto | 110:165afa46840b | 750 | /** |
Kojto | 110:165afa46840b | 751 | * @brief Enable Start the SD I/O Read Wait operation. |
Kojto | 110:165afa46840b | 752 | * @retval None |
Kojto | 110:165afa46840b | 753 | */ |
Kojto | 110:165afa46840b | 754 | #define __SDIO_START_READWAIT_ENABLE() (*(__IO uint32_t *) DCTRL_RWSTART_BB = ENABLE) |
Kojto | 110:165afa46840b | 755 | |
Kojto | 110:165afa46840b | 756 | /** |
Kojto | 110:165afa46840b | 757 | * @brief Disable Start the SD I/O Read Wait operations. |
Kojto | 110:165afa46840b | 758 | * @retval None |
Kojto | 110:165afa46840b | 759 | */ |
Kojto | 110:165afa46840b | 760 | #define __SDIO_START_READWAIT_DISABLE() (*(__IO uint32_t *) DCTRL_RWSTART_BB = DISABLE) |
Kojto | 110:165afa46840b | 761 | |
Kojto | 110:165afa46840b | 762 | /** |
Kojto | 110:165afa46840b | 763 | * @brief Enable Start the SD I/O Read Wait operation. |
Kojto | 110:165afa46840b | 764 | * @retval None |
Kojto | 110:165afa46840b | 765 | */ |
Kojto | 110:165afa46840b | 766 | #define __SDIO_STOP_READWAIT_ENABLE() (*(__IO uint32_t *) DCTRL_RWSTOP_BB = ENABLE) |
Kojto | 110:165afa46840b | 767 | |
Kojto | 110:165afa46840b | 768 | /** |
Kojto | 110:165afa46840b | 769 | * @brief Disable Stop the SD I/O Read Wait operations. |
Kojto | 110:165afa46840b | 770 | * @retval None |
Kojto | 110:165afa46840b | 771 | */ |
Kojto | 110:165afa46840b | 772 | #define __SDIO_STOP_READWAIT_DISABLE() (*(__IO uint32_t *) DCTRL_RWSTOP_BB = DISABLE) |
Kojto | 110:165afa46840b | 773 | |
Kojto | 110:165afa46840b | 774 | /** |
Kojto | 110:165afa46840b | 775 | * @brief Enable the SD I/O Mode Operation. |
Kojto | 110:165afa46840b | 776 | * @retval None |
Kojto | 110:165afa46840b | 777 | */ |
Kojto | 110:165afa46840b | 778 | #define __SDIO_OPERATION_ENABLE() (*(__IO uint32_t *) DCTRL_SDIOEN_BB = ENABLE) |
Kojto | 110:165afa46840b | 779 | |
Kojto | 110:165afa46840b | 780 | /** |
Kojto | 110:165afa46840b | 781 | * @brief Disable the SD I/O Mode Operation. |
Kojto | 110:165afa46840b | 782 | * @retval None |
Kojto | 110:165afa46840b | 783 | */ |
Kojto | 110:165afa46840b | 784 | #define __SDIO_OPERATION_DISABLE() (*(__IO uint32_t *) DCTRL_SDIOEN_BB = DISABLE) |
Kojto | 110:165afa46840b | 785 | |
Kojto | 110:165afa46840b | 786 | /** |
Kojto | 110:165afa46840b | 787 | * @brief Enable the SD I/O Suspend command sending. |
Kojto | 110:165afa46840b | 788 | * @retval None |
Kojto | 110:165afa46840b | 789 | */ |
Kojto | 110:165afa46840b | 790 | #define __SDIO_SUSPEND_CMD_ENABLE() (*(__IO uint32_t *) CMD_SDIOSUSPEND_BB = ENABLE) |
Kojto | 110:165afa46840b | 791 | |
Kojto | 110:165afa46840b | 792 | /** |
Kojto | 110:165afa46840b | 793 | * @brief Disable the SD I/O Suspend command sending. |
Kojto | 110:165afa46840b | 794 | * @retval None |
Kojto | 110:165afa46840b | 795 | */ |
Kojto | 110:165afa46840b | 796 | #define __SDIO_SUSPEND_CMD_DISABLE() (*(__IO uint32_t *) CMD_SDIOSUSPEND_BB = DISABLE) |
Kojto | 110:165afa46840b | 797 | |
Kojto | 110:165afa46840b | 798 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ |
Kojto | 110:165afa46840b | 799 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ |
Kojto | 110:165afa46840b | 800 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) |
Kojto | 110:165afa46840b | 801 | /** |
Kojto | 110:165afa46840b | 802 | * @brief Enable the command completion signal. |
Kojto | 110:165afa46840b | 803 | * @retval None |
Kojto | 110:165afa46840b | 804 | */ |
Kojto | 110:165afa46840b | 805 | #define __SDIO_CEATA_CMD_COMPLETION_ENABLE() (*(__IO uint32_t *) CMD_ENCMDCOMPL_BB = ENABLE) |
Kojto | 110:165afa46840b | 806 | |
Kojto | 110:165afa46840b | 807 | /** |
Kojto | 110:165afa46840b | 808 | * @brief Disable the command completion signal. |
Kojto | 110:165afa46840b | 809 | * @retval None |
Kojto | 110:165afa46840b | 810 | */ |
Kojto | 110:165afa46840b | 811 | #define __SDIO_CEATA_CMD_COMPLETION_DISABLE() (*(__IO uint32_t *) CMD_ENCMDCOMPL_BB = DISABLE) |
Kojto | 110:165afa46840b | 812 | |
Kojto | 110:165afa46840b | 813 | /** |
Kojto | 110:165afa46840b | 814 | * @brief Enable the CE-ATA interrupt. |
Kojto | 110:165afa46840b | 815 | * @retval None |
Kojto | 110:165afa46840b | 816 | */ |
Kojto | 110:165afa46840b | 817 | #define __SDIO_CEATA_ENABLE_IT() (*(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)0) |
Kojto | 110:165afa46840b | 818 | |
Kojto | 110:165afa46840b | 819 | /** |
Kojto | 110:165afa46840b | 820 | * @brief Disable the CE-ATA interrupt. |
Kojto | 110:165afa46840b | 821 | * @retval None |
Kojto | 110:165afa46840b | 822 | */ |
Kojto | 110:165afa46840b | 823 | #define __SDIO_CEATA_DISABLE_IT() (*(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)1) |
Kojto | 110:165afa46840b | 824 | |
Kojto | 110:165afa46840b | 825 | /** |
Kojto | 110:165afa46840b | 826 | * @brief Enable send CE-ATA command (CMD61). |
Kojto | 110:165afa46840b | 827 | * @retval None |
Kojto | 110:165afa46840b | 828 | */ |
Kojto | 110:165afa46840b | 829 | #define __SDIO_CEATA_SENDCMD_ENABLE() (*(__IO uint32_t *) CMD_ATACMD_BB = ENABLE) |
Kojto | 110:165afa46840b | 830 | |
Kojto | 110:165afa46840b | 831 | /** |
Kojto | 110:165afa46840b | 832 | * @brief Disable send CE-ATA command (CMD61). |
Kojto | 110:165afa46840b | 833 | * @retval None |
Kojto | 110:165afa46840b | 834 | */ |
Kojto | 110:165afa46840b | 835 | #define __SDIO_CEATA_SENDCMD_DISABLE() (*(__IO uint32_t *) CMD_ATACMD_BB = DISABLE) |
Kojto | 110:165afa46840b | 836 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE ||\ |
Kojto | 110:165afa46840b | 837 | STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ |
Kojto | 110:165afa46840b | 838 | /** |
Kojto | 110:165afa46840b | 839 | * @} |
Kojto | 110:165afa46840b | 840 | */ |
Kojto | 110:165afa46840b | 841 | |
Kojto | 110:165afa46840b | 842 | /** |
Kojto | 110:165afa46840b | 843 | * @} |
Kojto | 110:165afa46840b | 844 | */ |
Kojto | 110:165afa46840b | 845 | |
Kojto | 110:165afa46840b | 846 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 110:165afa46840b | 847 | /** @addtogroup SDMMC_LL_Exported_Functions |
Kojto | 110:165afa46840b | 848 | * @{ |
Kojto | 110:165afa46840b | 849 | */ |
Kojto | 110:165afa46840b | 850 | |
Kojto | 110:165afa46840b | 851 | /* Initialization/de-initialization functions **********************************/ |
Kojto | 110:165afa46840b | 852 | /** @addtogroup HAL_SDMMC_LL_Group1 |
Kojto | 110:165afa46840b | 853 | * @{ |
Kojto | 110:165afa46840b | 854 | */ |
Kojto | 110:165afa46840b | 855 | HAL_StatusTypeDef SDIO_Init(SDIO_TypeDef *SDIOx, SDIO_InitTypeDef Init); |
Kojto | 110:165afa46840b | 856 | /** |
Kojto | 110:165afa46840b | 857 | * @} |
Kojto | 110:165afa46840b | 858 | */ |
Kojto | 110:165afa46840b | 859 | |
Kojto | 110:165afa46840b | 860 | /* I/O operation functions *****************************************************/ |
Kojto | 110:165afa46840b | 861 | /** @addtogroup HAL_SDMMC_LL_Group2 |
Kojto | 110:165afa46840b | 862 | * @{ |
Kojto | 110:165afa46840b | 863 | */ |
Kojto | 110:165afa46840b | 864 | /* Blocking mode: Polling */ |
Kojto | 110:165afa46840b | 865 | uint32_t SDIO_ReadFIFO(SDIO_TypeDef *SDIOx); |
Kojto | 110:165afa46840b | 866 | HAL_StatusTypeDef SDIO_WriteFIFO(SDIO_TypeDef *SDIOx, uint32_t *pWriteData); |
Kojto | 110:165afa46840b | 867 | /** |
Kojto | 110:165afa46840b | 868 | * @} |
Kojto | 110:165afa46840b | 869 | */ |
Kojto | 110:165afa46840b | 870 | |
Kojto | 110:165afa46840b | 871 | /* Peripheral Control functions ************************************************/ |
Kojto | 110:165afa46840b | 872 | /** @addtogroup HAL_SDMMC_LL_Group3 |
Kojto | 110:165afa46840b | 873 | * @{ |
Kojto | 110:165afa46840b | 874 | */ |
Kojto | 110:165afa46840b | 875 | HAL_StatusTypeDef SDIO_PowerState_ON(SDIO_TypeDef *SDIOx); |
Kojto | 110:165afa46840b | 876 | HAL_StatusTypeDef SDIO_PowerState_OFF(SDIO_TypeDef *SDIOx); |
Kojto | 110:165afa46840b | 877 | uint32_t SDIO_GetPowerState(SDIO_TypeDef *SDIOx); |
Kojto | 110:165afa46840b | 878 | |
Kojto | 110:165afa46840b | 879 | /* Command path state machine (CPSM) management functions */ |
Kojto | 110:165afa46840b | 880 | HAL_StatusTypeDef SDIO_SendCommand(SDIO_TypeDef *SDIOx, SDIO_CmdInitTypeDef *SDIO_CmdInitStruct); |
Kojto | 110:165afa46840b | 881 | uint8_t SDIO_GetCommandResponse(SDIO_TypeDef *SDIOx); |
Kojto | 110:165afa46840b | 882 | uint32_t SDIO_GetResponse(uint32_t SDIO_RESP); |
Kojto | 110:165afa46840b | 883 | |
Kojto | 110:165afa46840b | 884 | /* Data path state machine (DPSM) management functions */ |
Kojto | 110:165afa46840b | 885 | HAL_StatusTypeDef SDIO_DataConfig(SDIO_TypeDef *SDIOx, SDIO_DataInitTypeDef* SDIO_DataInitStruct); |
Kojto | 110:165afa46840b | 886 | uint32_t SDIO_GetDataCounter(SDIO_TypeDef *SDIOx); |
Kojto | 110:165afa46840b | 887 | uint32_t SDIO_GetFIFOCount(SDIO_TypeDef *SDIOx); |
Kojto | 110:165afa46840b | 888 | |
Kojto | 110:165afa46840b | 889 | /* SDIO IO Cards mode management functions */ |
Kojto | 110:165afa46840b | 890 | HAL_StatusTypeDef SDIO_SetSDIOReadWaitMode(uint32_t SDIO_ReadWaitMode); |
Kojto | 110:165afa46840b | 891 | |
Kojto | 110:165afa46840b | 892 | /** |
Kojto | 110:165afa46840b | 893 | * @} |
Kojto | 110:165afa46840b | 894 | */ |
Kojto | 110:165afa46840b | 895 | |
Kojto | 110:165afa46840b | 896 | /** |
Kojto | 110:165afa46840b | 897 | * @} |
Kojto | 110:165afa46840b | 898 | */ |
Kojto | 110:165afa46840b | 899 | |
Kojto | 110:165afa46840b | 900 | /** |
Kojto | 110:165afa46840b | 901 | * @} |
Kojto | 110:165afa46840b | 902 | */ |
Kojto | 110:165afa46840b | 903 | |
Kojto | 110:165afa46840b | 904 | /** |
Kojto | 110:165afa46840b | 905 | * @} |
Kojto | 110:165afa46840b | 906 | */ |
Kojto | 110:165afa46840b | 907 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || |
Kojto | 110:165afa46840b | 908 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */ |
Kojto | 110:165afa46840b | 909 | #ifdef __cplusplus |
Kojto | 110:165afa46840b | 910 | } |
Kojto | 110:165afa46840b | 911 | #endif |
Kojto | 110:165afa46840b | 912 | |
Kojto | 110:165afa46840b | 913 | #endif /* __STM32F4xx_LL_SDMMC_H */ |
Kojto | 110:165afa46840b | 914 | |
Kojto | 110:165afa46840b | 915 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |