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