Hal Drivers for L4
Dependents: BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo
Fork of STM32L4xx_HAL_Driver by
Inc/stm32l4xx_ll_sdmmc.h@0:80ee8f3b695e, 2015-11-02 (annotated)
- Committer:
- EricLew
- Date:
- Mon Nov 02 19:37:23 2015 +0000
- Revision:
- 0:80ee8f3b695e
Errors are with definitions of LCD and QSPI functions. I believe all .h and .c files are uploaded, but there may need to be certain functions called.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EricLew | 0:80ee8f3b695e | 1 | /** |
EricLew | 0:80ee8f3b695e | 2 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 3 | * @file stm32l4xx_ll_sdmmc.h |
EricLew | 0:80ee8f3b695e | 4 | * @author MCD Application Team |
EricLew | 0:80ee8f3b695e | 5 | * @version V1.1.0 |
EricLew | 0:80ee8f3b695e | 6 | * @date 16-September-2015 |
EricLew | 0:80ee8f3b695e | 7 | * @brief Header file of low layer SDMMC HAL module. |
EricLew | 0:80ee8f3b695e | 8 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 9 | * @attention |
EricLew | 0:80ee8f3b695e | 10 | * |
EricLew | 0:80ee8f3b695e | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
EricLew | 0:80ee8f3b695e | 12 | * |
EricLew | 0:80ee8f3b695e | 13 | * Redistribution and use in source and binary forms, with or without modification, |
EricLew | 0:80ee8f3b695e | 14 | * are permitted provided that the following conditions are met: |
EricLew | 0:80ee8f3b695e | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
EricLew | 0:80ee8f3b695e | 16 | * this list of conditions and the following disclaimer. |
EricLew | 0:80ee8f3b695e | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
EricLew | 0:80ee8f3b695e | 18 | * this list of conditions and the following disclaimer in the documentation |
EricLew | 0:80ee8f3b695e | 19 | * and/or other materials provided with the distribution. |
EricLew | 0:80ee8f3b695e | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
EricLew | 0:80ee8f3b695e | 21 | * may be used to endorse or promote products derived from this software |
EricLew | 0:80ee8f3b695e | 22 | * without specific prior written permission. |
EricLew | 0:80ee8f3b695e | 23 | * |
EricLew | 0:80ee8f3b695e | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
EricLew | 0:80ee8f3b695e | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
EricLew | 0:80ee8f3b695e | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
EricLew | 0:80ee8f3b695e | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
EricLew | 0:80ee8f3b695e | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
EricLew | 0:80ee8f3b695e | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
EricLew | 0:80ee8f3b695e | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
EricLew | 0:80ee8f3b695e | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
EricLew | 0:80ee8f3b695e | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
EricLew | 0:80ee8f3b695e | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
EricLew | 0:80ee8f3b695e | 34 | * |
EricLew | 0:80ee8f3b695e | 35 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 36 | */ |
EricLew | 0:80ee8f3b695e | 37 | |
EricLew | 0:80ee8f3b695e | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 39 | #ifndef __STM32L4xx_LL_SDMMC_H |
EricLew | 0:80ee8f3b695e | 40 | #define __STM32L4xx_LL_SDMMC_H |
EricLew | 0:80ee8f3b695e | 41 | |
EricLew | 0:80ee8f3b695e | 42 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 43 | extern "C" { |
EricLew | 0:80ee8f3b695e | 44 | #endif |
EricLew | 0:80ee8f3b695e | 45 | |
EricLew | 0:80ee8f3b695e | 46 | /* Includes ------------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 47 | #include "stm32l4xx_hal_def.h" |
EricLew | 0:80ee8f3b695e | 48 | |
EricLew | 0:80ee8f3b695e | 49 | /** @addtogroup STM32L4xx_Driver |
EricLew | 0:80ee8f3b695e | 50 | * @{ |
EricLew | 0:80ee8f3b695e | 51 | */ |
EricLew | 0:80ee8f3b695e | 52 | |
EricLew | 0:80ee8f3b695e | 53 | /** @addtogroup SDMMC_LL |
EricLew | 0:80ee8f3b695e | 54 | * @{ |
EricLew | 0:80ee8f3b695e | 55 | */ |
EricLew | 0:80ee8f3b695e | 56 | |
EricLew | 0:80ee8f3b695e | 57 | /* Exported types ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 58 | /** @defgroup SDMMC_LL_Exported_Types SDMMC_LL Exported Types |
EricLew | 0:80ee8f3b695e | 59 | * @{ |
EricLew | 0:80ee8f3b695e | 60 | */ |
EricLew | 0:80ee8f3b695e | 61 | |
EricLew | 0:80ee8f3b695e | 62 | /** |
EricLew | 0:80ee8f3b695e | 63 | * @brief SDMMC Configuration Structure definition |
EricLew | 0:80ee8f3b695e | 64 | */ |
EricLew | 0:80ee8f3b695e | 65 | typedef struct |
EricLew | 0:80ee8f3b695e | 66 | { |
EricLew | 0:80ee8f3b695e | 67 | uint32_t ClockEdge; /*!< Specifies the clock transition on which the bit capture is made. |
EricLew | 0:80ee8f3b695e | 68 | This parameter can be a value of @ref SDMMC_LL_Clock_Edge */ |
EricLew | 0:80ee8f3b695e | 69 | |
EricLew | 0:80ee8f3b695e | 70 | uint32_t ClockBypass; /*!< Specifies whether the SDMMC Clock divider bypass is |
EricLew | 0:80ee8f3b695e | 71 | enabled or disabled. |
EricLew | 0:80ee8f3b695e | 72 | This parameter can be a value of @ref SDMMC_LL_Clock_Bypass */ |
EricLew | 0:80ee8f3b695e | 73 | |
EricLew | 0:80ee8f3b695e | 74 | uint32_t ClockPowerSave; /*!< Specifies whether SDMMC Clock output is enabled or |
EricLew | 0:80ee8f3b695e | 75 | disabled when the bus is idle. |
EricLew | 0:80ee8f3b695e | 76 | This parameter can be a value of @ref SDMMC_LL_Clock_Power_Save */ |
EricLew | 0:80ee8f3b695e | 77 | |
EricLew | 0:80ee8f3b695e | 78 | uint32_t BusWide; /*!< Specifies the SDMMC bus width. |
EricLew | 0:80ee8f3b695e | 79 | This parameter can be a value of @ref SDMMC_LL_Bus_Wide */ |
EricLew | 0:80ee8f3b695e | 80 | |
EricLew | 0:80ee8f3b695e | 81 | uint32_t HardwareFlowControl; /*!< Specifies whether the SDMMC hardware flow control is enabled or disabled. |
EricLew | 0:80ee8f3b695e | 82 | This parameter can be a value of @ref SDMMC_LL_Hardware_Flow_Control */ |
EricLew | 0:80ee8f3b695e | 83 | |
EricLew | 0:80ee8f3b695e | 84 | uint32_t ClockDiv; /*!< Specifies the clock frequency of the SDMMC controller. |
EricLew | 0:80ee8f3b695e | 85 | This parameter can be a value between Min_Data = 0 and Max_Data = 255 */ |
EricLew | 0:80ee8f3b695e | 86 | |
EricLew | 0:80ee8f3b695e | 87 | }SDMMC_InitTypeDef; |
EricLew | 0:80ee8f3b695e | 88 | |
EricLew | 0:80ee8f3b695e | 89 | |
EricLew | 0:80ee8f3b695e | 90 | /** |
EricLew | 0:80ee8f3b695e | 91 | * @brief SDMMC Command Control structure |
EricLew | 0:80ee8f3b695e | 92 | */ |
EricLew | 0:80ee8f3b695e | 93 | typedef struct |
EricLew | 0:80ee8f3b695e | 94 | { |
EricLew | 0:80ee8f3b695e | 95 | uint32_t Argument; /*!< Specifies the SDMMC command argument which is sent |
EricLew | 0:80ee8f3b695e | 96 | to a card as part of a command message. If a command |
EricLew | 0:80ee8f3b695e | 97 | contains an argument, it must be loaded into this register |
EricLew | 0:80ee8f3b695e | 98 | before writing the command to the command register. */ |
EricLew | 0:80ee8f3b695e | 99 | |
EricLew | 0:80ee8f3b695e | 100 | uint32_t CmdIndex; /*!< Specifies the SDMMC command index. It must be Min_Data = 0 and |
EricLew | 0:80ee8f3b695e | 101 | Max_Data = 64 */ |
EricLew | 0:80ee8f3b695e | 102 | |
EricLew | 0:80ee8f3b695e | 103 | uint32_t Response; /*!< Specifies the SDMMC response type. |
EricLew | 0:80ee8f3b695e | 104 | This parameter can be a value of @ref SDMMC_LL_Response_Type */ |
EricLew | 0:80ee8f3b695e | 105 | |
EricLew | 0:80ee8f3b695e | 106 | uint32_t WaitForInterrupt; /*!< Specifies whether SDMMC wait for interrupt request is |
EricLew | 0:80ee8f3b695e | 107 | enabled or disabled. |
EricLew | 0:80ee8f3b695e | 108 | This parameter can be a value of @ref SDMMC_LL_Wait_Interrupt_State */ |
EricLew | 0:80ee8f3b695e | 109 | |
EricLew | 0:80ee8f3b695e | 110 | uint32_t CPSM; /*!< Specifies whether SDMMC Command path state machine (CPSM) |
EricLew | 0:80ee8f3b695e | 111 | is enabled or disabled. |
EricLew | 0:80ee8f3b695e | 112 | This parameter can be a value of @ref SDMMC_LL_CPSM_State */ |
EricLew | 0:80ee8f3b695e | 113 | }SDMMC_CmdInitTypeDef; |
EricLew | 0:80ee8f3b695e | 114 | |
EricLew | 0:80ee8f3b695e | 115 | |
EricLew | 0:80ee8f3b695e | 116 | /** |
EricLew | 0:80ee8f3b695e | 117 | * @brief SDMMC Data Control structure |
EricLew | 0:80ee8f3b695e | 118 | */ |
EricLew | 0:80ee8f3b695e | 119 | typedef struct |
EricLew | 0:80ee8f3b695e | 120 | { |
EricLew | 0:80ee8f3b695e | 121 | uint32_t DataTimeOut; /*!< Specifies the data timeout period in card bus clock periods. */ |
EricLew | 0:80ee8f3b695e | 122 | |
EricLew | 0:80ee8f3b695e | 123 | uint32_t DataLength; /*!< Specifies the number of data bytes to be transferred. */ |
EricLew | 0:80ee8f3b695e | 124 | |
EricLew | 0:80ee8f3b695e | 125 | uint32_t DataBlockSize; /*!< Specifies the data block size for block transfer. |
EricLew | 0:80ee8f3b695e | 126 | This parameter can be a value of @ref SDMMC_LL_Data_Block_Size */ |
EricLew | 0:80ee8f3b695e | 127 | |
EricLew | 0:80ee8f3b695e | 128 | uint32_t TransferDir; /*!< Specifies the data transfer direction, whether the transfer |
EricLew | 0:80ee8f3b695e | 129 | is a read or write. |
EricLew | 0:80ee8f3b695e | 130 | This parameter can be a value of @ref SDMMC_LL_Transfer_Direction */ |
EricLew | 0:80ee8f3b695e | 131 | |
EricLew | 0:80ee8f3b695e | 132 | uint32_t TransferMode; /*!< Specifies whether data transfer is in stream or block mode. |
EricLew | 0:80ee8f3b695e | 133 | This parameter can be a value of @ref SDMMC_LL_Transfer_Type */ |
EricLew | 0:80ee8f3b695e | 134 | |
EricLew | 0:80ee8f3b695e | 135 | uint32_t DPSM; /*!< Specifies whether SDMMC Data path state machine (DPSM) |
EricLew | 0:80ee8f3b695e | 136 | is enabled or disabled. |
EricLew | 0:80ee8f3b695e | 137 | This parameter can be a value of @ref SDMMC_LL_DPSM_State */ |
EricLew | 0:80ee8f3b695e | 138 | }SDMMC_DataInitTypeDef; |
EricLew | 0:80ee8f3b695e | 139 | |
EricLew | 0:80ee8f3b695e | 140 | /** |
EricLew | 0:80ee8f3b695e | 141 | * @} |
EricLew | 0:80ee8f3b695e | 142 | */ |
EricLew | 0:80ee8f3b695e | 143 | |
EricLew | 0:80ee8f3b695e | 144 | /* Exported constants --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 145 | /** @defgroup SDMMC_LL_Exported_Constants SDMMC_LL Exported Constants |
EricLew | 0:80ee8f3b695e | 146 | * @{ |
EricLew | 0:80ee8f3b695e | 147 | */ |
EricLew | 0:80ee8f3b695e | 148 | |
EricLew | 0:80ee8f3b695e | 149 | /** @defgroup SDMMC_LL_Clock_Edge Clock Edge |
EricLew | 0:80ee8f3b695e | 150 | * @{ |
EricLew | 0:80ee8f3b695e | 151 | */ |
EricLew | 0:80ee8f3b695e | 152 | #define SDMMC_CLOCK_EDGE_RISING ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 153 | #define SDMMC_CLOCK_EDGE_FALLING SDMMC_CLKCR_NEGEDGE |
EricLew | 0:80ee8f3b695e | 154 | |
EricLew | 0:80ee8f3b695e | 155 | #define IS_SDMMC_CLOCK_EDGE(EDGE) (((EDGE) == SDMMC_CLOCK_EDGE_RISING) || \ |
EricLew | 0:80ee8f3b695e | 156 | ((EDGE) == SDMMC_CLOCK_EDGE_FALLING)) |
EricLew | 0:80ee8f3b695e | 157 | /** |
EricLew | 0:80ee8f3b695e | 158 | * @} |
EricLew | 0:80ee8f3b695e | 159 | */ |
EricLew | 0:80ee8f3b695e | 160 | |
EricLew | 0:80ee8f3b695e | 161 | /** @defgroup SDMMC_LL_Clock_Bypass Clock Bypass |
EricLew | 0:80ee8f3b695e | 162 | * @{ |
EricLew | 0:80ee8f3b695e | 163 | */ |
EricLew | 0:80ee8f3b695e | 164 | #define SDMMC_CLOCK_BYPASS_DISABLE ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 165 | #define SDMMC_CLOCK_BYPASS_ENABLE SDMMC_CLKCR_BYPASS |
EricLew | 0:80ee8f3b695e | 166 | |
EricLew | 0:80ee8f3b695e | 167 | #define IS_SDMMC_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDMMC_CLOCK_BYPASS_DISABLE) || \ |
EricLew | 0:80ee8f3b695e | 168 | ((BYPASS) == SDMMC_CLOCK_BYPASS_ENABLE)) |
EricLew | 0:80ee8f3b695e | 169 | /** |
EricLew | 0:80ee8f3b695e | 170 | * @} |
EricLew | 0:80ee8f3b695e | 171 | */ |
EricLew | 0:80ee8f3b695e | 172 | |
EricLew | 0:80ee8f3b695e | 173 | /** @defgroup SDMMC_LL_Clock_Power_Save Clock Power Saving |
EricLew | 0:80ee8f3b695e | 174 | * @{ |
EricLew | 0:80ee8f3b695e | 175 | */ |
EricLew | 0:80ee8f3b695e | 176 | #define SDMMC_CLOCK_POWER_SAVE_DISABLE ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 177 | #define SDMMC_CLOCK_POWER_SAVE_ENABLE SDMMC_CLKCR_PWRSAV |
EricLew | 0:80ee8f3b695e | 178 | |
EricLew | 0:80ee8f3b695e | 179 | #define IS_SDMMC_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDMMC_CLOCK_POWER_SAVE_DISABLE) || \ |
EricLew | 0:80ee8f3b695e | 180 | ((SAVE) == SDMMC_CLOCK_POWER_SAVE_ENABLE)) |
EricLew | 0:80ee8f3b695e | 181 | /** |
EricLew | 0:80ee8f3b695e | 182 | * @} |
EricLew | 0:80ee8f3b695e | 183 | */ |
EricLew | 0:80ee8f3b695e | 184 | |
EricLew | 0:80ee8f3b695e | 185 | /** @defgroup SDMMC_LL_Bus_Wide Bus Width |
EricLew | 0:80ee8f3b695e | 186 | * @{ |
EricLew | 0:80ee8f3b695e | 187 | */ |
EricLew | 0:80ee8f3b695e | 188 | #define SDMMC_BUS_WIDE_1B ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 189 | #define SDMMC_BUS_WIDE_4B SDMMC_CLKCR_WIDBUS_0 |
EricLew | 0:80ee8f3b695e | 190 | #define SDMMC_BUS_WIDE_8B SDMMC_CLKCR_WIDBUS_1 |
EricLew | 0:80ee8f3b695e | 191 | |
EricLew | 0:80ee8f3b695e | 192 | #define IS_SDMMC_BUS_WIDE(WIDE) (((WIDE) == SDMMC_BUS_WIDE_1B) || \ |
EricLew | 0:80ee8f3b695e | 193 | ((WIDE) == SDMMC_BUS_WIDE_4B) || \ |
EricLew | 0:80ee8f3b695e | 194 | ((WIDE) == SDMMC_BUS_WIDE_8B)) |
EricLew | 0:80ee8f3b695e | 195 | /** |
EricLew | 0:80ee8f3b695e | 196 | * @} |
EricLew | 0:80ee8f3b695e | 197 | */ |
EricLew | 0:80ee8f3b695e | 198 | |
EricLew | 0:80ee8f3b695e | 199 | /** @defgroup SDMMC_LL_Hardware_Flow_Control Hardware Flow Control |
EricLew | 0:80ee8f3b695e | 200 | * @{ |
EricLew | 0:80ee8f3b695e | 201 | */ |
EricLew | 0:80ee8f3b695e | 202 | #define SDMMC_HARDWARE_FLOW_CONTROL_DISABLE ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 203 | #define SDMMC_HARDWARE_FLOW_CONTROL_ENABLE SDMMC_CLKCR_HWFC_EN |
EricLew | 0:80ee8f3b695e | 204 | |
EricLew | 0:80ee8f3b695e | 205 | #define IS_SDMMC_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDMMC_HARDWARE_FLOW_CONTROL_DISABLE) || \ |
EricLew | 0:80ee8f3b695e | 206 | ((CONTROL) == SDMMC_HARDWARE_FLOW_CONTROL_ENABLE)) |
EricLew | 0:80ee8f3b695e | 207 | /** |
EricLew | 0:80ee8f3b695e | 208 | * @} |
EricLew | 0:80ee8f3b695e | 209 | */ |
EricLew | 0:80ee8f3b695e | 210 | |
EricLew | 0:80ee8f3b695e | 211 | /** @defgroup SDMMC_LL_Clock_Division Clock Division |
EricLew | 0:80ee8f3b695e | 212 | * @{ |
EricLew | 0:80ee8f3b695e | 213 | */ |
EricLew | 0:80ee8f3b695e | 214 | #define IS_SDMMC_CLKDIV(DIV) ((DIV) <= 0xFF) |
EricLew | 0:80ee8f3b695e | 215 | /** |
EricLew | 0:80ee8f3b695e | 216 | * @} |
EricLew | 0:80ee8f3b695e | 217 | */ |
EricLew | 0:80ee8f3b695e | 218 | |
EricLew | 0:80ee8f3b695e | 219 | /** @defgroup SDMMC_LL_Command_Index Command Index |
EricLew | 0:80ee8f3b695e | 220 | * @{ |
EricLew | 0:80ee8f3b695e | 221 | */ |
EricLew | 0:80ee8f3b695e | 222 | #define IS_SDMMC_CMD_INDEX(INDEX) ((INDEX) < 0x40) |
EricLew | 0:80ee8f3b695e | 223 | /** |
EricLew | 0:80ee8f3b695e | 224 | * @} |
EricLew | 0:80ee8f3b695e | 225 | */ |
EricLew | 0:80ee8f3b695e | 226 | |
EricLew | 0:80ee8f3b695e | 227 | /** @defgroup SDMMC_LL_Response_Type Response Type |
EricLew | 0:80ee8f3b695e | 228 | * @{ |
EricLew | 0:80ee8f3b695e | 229 | */ |
EricLew | 0:80ee8f3b695e | 230 | #define SDMMC_RESPONSE_NO ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 231 | #define SDMMC_RESPONSE_SHORT SDMMC_CMD_WAITRESP_0 |
EricLew | 0:80ee8f3b695e | 232 | #define SDMMC_RESPONSE_LONG SDMMC_CMD_WAITRESP |
EricLew | 0:80ee8f3b695e | 233 | |
EricLew | 0:80ee8f3b695e | 234 | #define IS_SDMMC_RESPONSE(RESPONSE) (((RESPONSE) == SDMMC_RESPONSE_NO) || \ |
EricLew | 0:80ee8f3b695e | 235 | ((RESPONSE) == SDMMC_RESPONSE_SHORT) || \ |
EricLew | 0:80ee8f3b695e | 236 | ((RESPONSE) == SDMMC_RESPONSE_LONG)) |
EricLew | 0:80ee8f3b695e | 237 | /** |
EricLew | 0:80ee8f3b695e | 238 | * @} |
EricLew | 0:80ee8f3b695e | 239 | */ |
EricLew | 0:80ee8f3b695e | 240 | |
EricLew | 0:80ee8f3b695e | 241 | /** @defgroup SDMMC_LL_Wait_Interrupt_State Wait Interrupt |
EricLew | 0:80ee8f3b695e | 242 | * @{ |
EricLew | 0:80ee8f3b695e | 243 | */ |
EricLew | 0:80ee8f3b695e | 244 | #define SDMMC_WAIT_NO ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 245 | #define SDMMC_WAIT_IT SDMMC_CMD_WAITINT |
EricLew | 0:80ee8f3b695e | 246 | #define SDMMC_WAIT_PEND SDMMC_CMD_WAITPEND |
EricLew | 0:80ee8f3b695e | 247 | |
EricLew | 0:80ee8f3b695e | 248 | #define IS_SDMMC_WAIT(WAIT) (((WAIT) == SDMMC_WAIT_NO) || \ |
EricLew | 0:80ee8f3b695e | 249 | ((WAIT) == SDMMC_WAIT_IT) || \ |
EricLew | 0:80ee8f3b695e | 250 | ((WAIT) == SDMMC_WAIT_PEND)) |
EricLew | 0:80ee8f3b695e | 251 | /** |
EricLew | 0:80ee8f3b695e | 252 | * @} |
EricLew | 0:80ee8f3b695e | 253 | */ |
EricLew | 0:80ee8f3b695e | 254 | |
EricLew | 0:80ee8f3b695e | 255 | /** @defgroup SDMMC_LL_CPSM_State CPSM State |
EricLew | 0:80ee8f3b695e | 256 | * @{ |
EricLew | 0:80ee8f3b695e | 257 | */ |
EricLew | 0:80ee8f3b695e | 258 | #define SDMMC_CPSM_DISABLE ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 259 | #define SDMMC_CPSM_ENABLE SDMMC_CMD_CPSMEN |
EricLew | 0:80ee8f3b695e | 260 | |
EricLew | 0:80ee8f3b695e | 261 | #define IS_SDMMC_CPSM(CPSM) (((CPSM) == SDMMC_CPSM_DISABLE) || \ |
EricLew | 0:80ee8f3b695e | 262 | ((CPSM) == SDMMC_CPSM_ENABLE)) |
EricLew | 0:80ee8f3b695e | 263 | /** |
EricLew | 0:80ee8f3b695e | 264 | * @} |
EricLew | 0:80ee8f3b695e | 265 | */ |
EricLew | 0:80ee8f3b695e | 266 | |
EricLew | 0:80ee8f3b695e | 267 | /** @defgroup SDMMC_LL_Response_Registers Response Register |
EricLew | 0:80ee8f3b695e | 268 | * @{ |
EricLew | 0:80ee8f3b695e | 269 | */ |
EricLew | 0:80ee8f3b695e | 270 | #define SDMMC_RESP1 ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 271 | #define SDMMC_RESP2 ((uint32_t)0x00000004) |
EricLew | 0:80ee8f3b695e | 272 | #define SDMMC_RESP3 ((uint32_t)0x00000008) |
EricLew | 0:80ee8f3b695e | 273 | #define SDMMC_RESP4 ((uint32_t)0x0000000C) |
EricLew | 0:80ee8f3b695e | 274 | |
EricLew | 0:80ee8f3b695e | 275 | #define IS_SDMMC_RESP(RESP) (((RESP) == SDMMC_RESP1) || \ |
EricLew | 0:80ee8f3b695e | 276 | ((RESP) == SDMMC_RESP2) || \ |
EricLew | 0:80ee8f3b695e | 277 | ((RESP) == SDMMC_RESP3) || \ |
EricLew | 0:80ee8f3b695e | 278 | ((RESP) == SDMMC_RESP4)) |
EricLew | 0:80ee8f3b695e | 279 | /** |
EricLew | 0:80ee8f3b695e | 280 | * @} |
EricLew | 0:80ee8f3b695e | 281 | */ |
EricLew | 0:80ee8f3b695e | 282 | |
EricLew | 0:80ee8f3b695e | 283 | /** @defgroup SDMMC_LL_Data_Length Data Lenght |
EricLew | 0:80ee8f3b695e | 284 | * @{ |
EricLew | 0:80ee8f3b695e | 285 | */ |
EricLew | 0:80ee8f3b695e | 286 | #define IS_SDMMC_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFF) |
EricLew | 0:80ee8f3b695e | 287 | /** |
EricLew | 0:80ee8f3b695e | 288 | * @} |
EricLew | 0:80ee8f3b695e | 289 | */ |
EricLew | 0:80ee8f3b695e | 290 | |
EricLew | 0:80ee8f3b695e | 291 | /** @defgroup SDMMC_LL_Data_Block_Size Data Block Size |
EricLew | 0:80ee8f3b695e | 292 | * @{ |
EricLew | 0:80ee8f3b695e | 293 | */ |
EricLew | 0:80ee8f3b695e | 294 | #define SDMMC_DATABLOCK_SIZE_1B ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 295 | #define SDMMC_DATABLOCK_SIZE_2B SDMMC_DCTRL_DBLOCKSIZE_0 |
EricLew | 0:80ee8f3b695e | 296 | #define SDMMC_DATABLOCK_SIZE_4B SDMMC_DCTRL_DBLOCKSIZE_1 |
EricLew | 0:80ee8f3b695e | 297 | #define SDMMC_DATABLOCK_SIZE_8B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1) |
EricLew | 0:80ee8f3b695e | 298 | #define SDMMC_DATABLOCK_SIZE_16B SDMMC_DCTRL_DBLOCKSIZE_2 |
EricLew | 0:80ee8f3b695e | 299 | #define SDMMC_DATABLOCK_SIZE_32B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_2) |
EricLew | 0:80ee8f3b695e | 300 | #define SDMMC_DATABLOCK_SIZE_64B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2) |
EricLew | 0:80ee8f3b695e | 301 | #define SDMMC_DATABLOCK_SIZE_128B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2) |
EricLew | 0:80ee8f3b695e | 302 | #define SDMMC_DATABLOCK_SIZE_256B SDMMC_DCTRL_DBLOCKSIZE_3 |
EricLew | 0:80ee8f3b695e | 303 | #define SDMMC_DATABLOCK_SIZE_512B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_3) |
EricLew | 0:80ee8f3b695e | 304 | #define SDMMC_DATABLOCK_SIZE_1024B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_3) |
EricLew | 0:80ee8f3b695e | 305 | #define SDMMC_DATABLOCK_SIZE_2048B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_3) |
EricLew | 0:80ee8f3b695e | 306 | #define SDMMC_DATABLOCK_SIZE_4096B (SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3) |
EricLew | 0:80ee8f3b695e | 307 | #define SDMMC_DATABLOCK_SIZE_8192B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3) |
EricLew | 0:80ee8f3b695e | 308 | #define SDMMC_DATABLOCK_SIZE_16384B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3) |
EricLew | 0:80ee8f3b695e | 309 | |
EricLew | 0:80ee8f3b695e | 310 | #define IS_SDMMC_BLOCK_SIZE(SIZE) (((SIZE) == SDMMC_DATABLOCK_SIZE_1B) || \ |
EricLew | 0:80ee8f3b695e | 311 | ((SIZE) == SDMMC_DATABLOCK_SIZE_2B) || \ |
EricLew | 0:80ee8f3b695e | 312 | ((SIZE) == SDMMC_DATABLOCK_SIZE_4B) || \ |
EricLew | 0:80ee8f3b695e | 313 | ((SIZE) == SDMMC_DATABLOCK_SIZE_8B) || \ |
EricLew | 0:80ee8f3b695e | 314 | ((SIZE) == SDMMC_DATABLOCK_SIZE_16B) || \ |
EricLew | 0:80ee8f3b695e | 315 | ((SIZE) == SDMMC_DATABLOCK_SIZE_32B) || \ |
EricLew | 0:80ee8f3b695e | 316 | ((SIZE) == SDMMC_DATABLOCK_SIZE_64B) || \ |
EricLew | 0:80ee8f3b695e | 317 | ((SIZE) == SDMMC_DATABLOCK_SIZE_128B) || \ |
EricLew | 0:80ee8f3b695e | 318 | ((SIZE) == SDMMC_DATABLOCK_SIZE_256B) || \ |
EricLew | 0:80ee8f3b695e | 319 | ((SIZE) == SDMMC_DATABLOCK_SIZE_512B) || \ |
EricLew | 0:80ee8f3b695e | 320 | ((SIZE) == SDMMC_DATABLOCK_SIZE_1024B) || \ |
EricLew | 0:80ee8f3b695e | 321 | ((SIZE) == SDMMC_DATABLOCK_SIZE_2048B) || \ |
EricLew | 0:80ee8f3b695e | 322 | ((SIZE) == SDMMC_DATABLOCK_SIZE_4096B) || \ |
EricLew | 0:80ee8f3b695e | 323 | ((SIZE) == SDMMC_DATABLOCK_SIZE_8192B) || \ |
EricLew | 0:80ee8f3b695e | 324 | ((SIZE) == SDMMC_DATABLOCK_SIZE_16384B)) |
EricLew | 0:80ee8f3b695e | 325 | /** |
EricLew | 0:80ee8f3b695e | 326 | * @} |
EricLew | 0:80ee8f3b695e | 327 | */ |
EricLew | 0:80ee8f3b695e | 328 | |
EricLew | 0:80ee8f3b695e | 329 | /** @defgroup SDMMC_LL_Transfer_Direction Transfer Direction |
EricLew | 0:80ee8f3b695e | 330 | * @{ |
EricLew | 0:80ee8f3b695e | 331 | */ |
EricLew | 0:80ee8f3b695e | 332 | #define SDMMC_TRANSFER_DIR_TO_CARD ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 333 | #define SDMMC_TRANSFER_DIR_TO_SDMMC SDMMC_DCTRL_DTDIR |
EricLew | 0:80ee8f3b695e | 334 | |
EricLew | 0:80ee8f3b695e | 335 | #define IS_SDMMC_TRANSFER_DIR(DIR) (((DIR) == SDMMC_TRANSFER_DIR_TO_CARD) || \ |
EricLew | 0:80ee8f3b695e | 336 | ((DIR) == SDMMC_TRANSFER_DIR_TO_SDMMC)) |
EricLew | 0:80ee8f3b695e | 337 | /** |
EricLew | 0:80ee8f3b695e | 338 | * @} |
EricLew | 0:80ee8f3b695e | 339 | */ |
EricLew | 0:80ee8f3b695e | 340 | |
EricLew | 0:80ee8f3b695e | 341 | /** @defgroup SDMMC_LL_Transfer_Type Transfer Type |
EricLew | 0:80ee8f3b695e | 342 | * @{ |
EricLew | 0:80ee8f3b695e | 343 | */ |
EricLew | 0:80ee8f3b695e | 344 | #define SDMMC_TRANSFER_MODE_BLOCK ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 345 | #define SDMMC_TRANSFER_MODE_STREAM SDMMC_DCTRL_DTMODE |
EricLew | 0:80ee8f3b695e | 346 | |
EricLew | 0:80ee8f3b695e | 347 | #define IS_SDMMC_TRANSFER_MODE(MODE) (((MODE) == SDMMC_TRANSFER_MODE_BLOCK) || \ |
EricLew | 0:80ee8f3b695e | 348 | ((MODE) == SDMMC_TRANSFER_MODE_STREAM)) |
EricLew | 0:80ee8f3b695e | 349 | /** |
EricLew | 0:80ee8f3b695e | 350 | * @} |
EricLew | 0:80ee8f3b695e | 351 | */ |
EricLew | 0:80ee8f3b695e | 352 | |
EricLew | 0:80ee8f3b695e | 353 | /** @defgroup SDMMC_LL_DPSM_State DPSM State |
EricLew | 0:80ee8f3b695e | 354 | * @{ |
EricLew | 0:80ee8f3b695e | 355 | */ |
EricLew | 0:80ee8f3b695e | 356 | #define SDMMC_DPSM_DISABLE ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 357 | #define SDMMC_DPSM_ENABLE SDMMC_DCTRL_DTEN |
EricLew | 0:80ee8f3b695e | 358 | |
EricLew | 0:80ee8f3b695e | 359 | #define IS_SDMMC_DPSM(DPSM) (((DPSM) == SDMMC_DPSM_DISABLE) ||\ |
EricLew | 0:80ee8f3b695e | 360 | ((DPSM) == SDMMC_DPSM_ENABLE)) |
EricLew | 0:80ee8f3b695e | 361 | /** |
EricLew | 0:80ee8f3b695e | 362 | * @} |
EricLew | 0:80ee8f3b695e | 363 | */ |
EricLew | 0:80ee8f3b695e | 364 | |
EricLew | 0:80ee8f3b695e | 365 | /** @defgroup SDMMC_LL_Read_Wait_Mode Read Wait Mode |
EricLew | 0:80ee8f3b695e | 366 | * @{ |
EricLew | 0:80ee8f3b695e | 367 | */ |
EricLew | 0:80ee8f3b695e | 368 | #define SDMMC_READ_WAIT_MODE_DATA2 ((uint32_t)0x00000000) |
EricLew | 0:80ee8f3b695e | 369 | #define SDMMC_READ_WAIT_MODE_CLK (SDMMC_DCTRL_RWMOD) |
EricLew | 0:80ee8f3b695e | 370 | |
EricLew | 0:80ee8f3b695e | 371 | #define IS_SDMMC_READWAIT_MODE(MODE) (((MODE) == SDMMC_READ_WAIT_MODE_CLK) || \ |
EricLew | 0:80ee8f3b695e | 372 | ((MODE) == SDMMC_READ_WAIT_MODE_DATA2)) |
EricLew | 0:80ee8f3b695e | 373 | /** |
EricLew | 0:80ee8f3b695e | 374 | * @} |
EricLew | 0:80ee8f3b695e | 375 | */ |
EricLew | 0:80ee8f3b695e | 376 | |
EricLew | 0:80ee8f3b695e | 377 | /** @defgroup SDMMC_LL_Interrupt_sources Interrupt Sources |
EricLew | 0:80ee8f3b695e | 378 | * @{ |
EricLew | 0:80ee8f3b695e | 379 | */ |
EricLew | 0:80ee8f3b695e | 380 | #define SDMMC_IT_CCRCFAIL SDMMC_STA_CCRCFAIL |
EricLew | 0:80ee8f3b695e | 381 | #define SDMMC_IT_DCRCFAIL SDMMC_STA_DCRCFAIL |
EricLew | 0:80ee8f3b695e | 382 | #define SDMMC_IT_CTIMEOUT SDMMC_STA_CTIMEOUT |
EricLew | 0:80ee8f3b695e | 383 | #define SDMMC_IT_DTIMEOUT SDMMC_STA_DTIMEOUT |
EricLew | 0:80ee8f3b695e | 384 | #define SDMMC_IT_TXUNDERR SDMMC_STA_TXUNDERR |
EricLew | 0:80ee8f3b695e | 385 | #define SDMMC_IT_RXOVERR SDMMC_STA_RXOVERR |
EricLew | 0:80ee8f3b695e | 386 | #define SDMMC_IT_CMDREND SDMMC_STA_CMDREND |
EricLew | 0:80ee8f3b695e | 387 | #define SDMMC_IT_CMDSENT SDMMC_STA_CMDSENT |
EricLew | 0:80ee8f3b695e | 388 | #define SDMMC_IT_DATAEND SDMMC_STA_DATAEND |
EricLew | 0:80ee8f3b695e | 389 | #define SDMMC_IT_DBCKEND SDMMC_STA_DBCKEND |
EricLew | 0:80ee8f3b695e | 390 | #define SDMMC_IT_CMDACT SDMMC_STA_CMDACT |
EricLew | 0:80ee8f3b695e | 391 | #define SDMMC_IT_TXACT SDMMC_STA_TXACT |
EricLew | 0:80ee8f3b695e | 392 | #define SDMMC_IT_RXACT SDMMC_STA_RXACT |
EricLew | 0:80ee8f3b695e | 393 | #define SDMMC_IT_TXFIFOHE SDMMC_STA_TXFIFOHE |
EricLew | 0:80ee8f3b695e | 394 | #define SDMMC_IT_RXFIFOHF SDMMC_STA_RXFIFOHF |
EricLew | 0:80ee8f3b695e | 395 | #define SDMMC_IT_TXFIFOF SDMMC_STA_TXFIFOF |
EricLew | 0:80ee8f3b695e | 396 | #define SDMMC_IT_RXFIFOF SDMMC_STA_RXFIFOF |
EricLew | 0:80ee8f3b695e | 397 | #define SDMMC_IT_TXFIFOE SDMMC_STA_TXFIFOE |
EricLew | 0:80ee8f3b695e | 398 | #define SDMMC_IT_RXFIFOE SDMMC_STA_RXFIFOE |
EricLew | 0:80ee8f3b695e | 399 | #define SDMMC_IT_TXDAVL SDMMC_STA_TXDAVL |
EricLew | 0:80ee8f3b695e | 400 | #define SDMMC_IT_RXDAVL SDMMC_STA_RXDAVL |
EricLew | 0:80ee8f3b695e | 401 | #define SDMMC_IT_SDIOIT SDMMC_STA_SDIOIT |
EricLew | 0:80ee8f3b695e | 402 | /** |
EricLew | 0:80ee8f3b695e | 403 | * @} |
EricLew | 0:80ee8f3b695e | 404 | */ |
EricLew | 0:80ee8f3b695e | 405 | |
EricLew | 0:80ee8f3b695e | 406 | /** @defgroup SDMMC_LL_Flags Flags |
EricLew | 0:80ee8f3b695e | 407 | * @{ |
EricLew | 0:80ee8f3b695e | 408 | */ |
EricLew | 0:80ee8f3b695e | 409 | #define SDMMC_FLAG_CCRCFAIL SDMMC_STA_CCRCFAIL |
EricLew | 0:80ee8f3b695e | 410 | #define SDMMC_FLAG_DCRCFAIL SDMMC_STA_DCRCFAIL |
EricLew | 0:80ee8f3b695e | 411 | #define SDMMC_FLAG_CTIMEOUT SDMMC_STA_CTIMEOUT |
EricLew | 0:80ee8f3b695e | 412 | #define SDMMC_FLAG_DTIMEOUT SDMMC_STA_DTIMEOUT |
EricLew | 0:80ee8f3b695e | 413 | #define SDMMC_FLAG_TXUNDERR SDMMC_STA_TXUNDERR |
EricLew | 0:80ee8f3b695e | 414 | #define SDMMC_FLAG_RXOVERR SDMMC_STA_RXOVERR |
EricLew | 0:80ee8f3b695e | 415 | #define SDMMC_FLAG_CMDREND SDMMC_STA_CMDREND |
EricLew | 0:80ee8f3b695e | 416 | #define SDMMC_FLAG_CMDSENT SDMMC_STA_CMDSENT |
EricLew | 0:80ee8f3b695e | 417 | #define SDMMC_FLAG_DATAEND SDMMC_STA_DATAEND |
EricLew | 0:80ee8f3b695e | 418 | #define SDMMC_FLAG_DBCKEND SDMMC_STA_DBCKEND |
EricLew | 0:80ee8f3b695e | 419 | #define SDMMC_FLAG_CMDACT SDMMC_STA_CMDACT |
EricLew | 0:80ee8f3b695e | 420 | #define SDMMC_FLAG_TXACT SDMMC_STA_TXACT |
EricLew | 0:80ee8f3b695e | 421 | #define SDMMC_FLAG_RXACT SDMMC_STA_RXACT |
EricLew | 0:80ee8f3b695e | 422 | #define SDMMC_FLAG_TXFIFOHE SDMMC_STA_TXFIFOHE |
EricLew | 0:80ee8f3b695e | 423 | #define SDMMC_FLAG_RXFIFOHF SDMMC_STA_RXFIFOHF |
EricLew | 0:80ee8f3b695e | 424 | #define SDMMC_FLAG_TXFIFOF SDMMC_STA_TXFIFOF |
EricLew | 0:80ee8f3b695e | 425 | #define SDMMC_FLAG_RXFIFOF SDMMC_STA_RXFIFOF |
EricLew | 0:80ee8f3b695e | 426 | #define SDMMC_FLAG_TXFIFOE SDMMC_STA_TXFIFOE |
EricLew | 0:80ee8f3b695e | 427 | #define SDMMC_FLAG_RXFIFOE SDMMC_STA_RXFIFOE |
EricLew | 0:80ee8f3b695e | 428 | #define SDMMC_FLAG_TXDAVL SDMMC_STA_TXDAVL |
EricLew | 0:80ee8f3b695e | 429 | #define SDMMC_FLAG_RXDAVL SDMMC_STA_RXDAVL |
EricLew | 0:80ee8f3b695e | 430 | #define SDMMC_FLAG_SDIOIT SDMMC_STA_SDIOIT |
EricLew | 0:80ee8f3b695e | 431 | /** |
EricLew | 0:80ee8f3b695e | 432 | * @} |
EricLew | 0:80ee8f3b695e | 433 | */ |
EricLew | 0:80ee8f3b695e | 434 | |
EricLew | 0:80ee8f3b695e | 435 | /** |
EricLew | 0:80ee8f3b695e | 436 | * @} |
EricLew | 0:80ee8f3b695e | 437 | */ |
EricLew | 0:80ee8f3b695e | 438 | |
EricLew | 0:80ee8f3b695e | 439 | /* Exported macro ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 440 | /** @defgroup SDMMC_LL_Exported_macros SDMMC_LL Exported Macros |
EricLew | 0:80ee8f3b695e | 441 | * @{ |
EricLew | 0:80ee8f3b695e | 442 | */ |
EricLew | 0:80ee8f3b695e | 443 | |
EricLew | 0:80ee8f3b695e | 444 | /** @defgroup SDMMC_LL_Register Bits And Addresses Definitions |
EricLew | 0:80ee8f3b695e | 445 | * @brief SDMMC_LL registers bit address in the alias region |
EricLew | 0:80ee8f3b695e | 446 | * @{ |
EricLew | 0:80ee8f3b695e | 447 | */ |
EricLew | 0:80ee8f3b695e | 448 | /* ---------------------- SDMMC registers bit mask --------------------------- */ |
EricLew | 0:80ee8f3b695e | 449 | /* --- CLKCR Register ---*/ |
EricLew | 0:80ee8f3b695e | 450 | /* CLKCR register clear mask */ |
EricLew | 0:80ee8f3b695e | 451 | #define CLKCR_CLEAR_MASK ((uint32_t)(SDMMC_CLKCR_CLKDIV | SDMMC_CLKCR_PWRSAV |\ |
EricLew | 0:80ee8f3b695e | 452 | SDMMC_CLKCR_BYPASS | SDMMC_CLKCR_WIDBUS |\ |
EricLew | 0:80ee8f3b695e | 453 | SDMMC_CLKCR_NEGEDGE | SDMMC_CLKCR_HWFC_EN)) |
EricLew | 0:80ee8f3b695e | 454 | |
EricLew | 0:80ee8f3b695e | 455 | /* --- DCTRL Register ---*/ |
EricLew | 0:80ee8f3b695e | 456 | /* SDMMC DCTRL Clear Mask */ |
EricLew | 0:80ee8f3b695e | 457 | #define DCTRL_CLEAR_MASK ((uint32_t)(SDMMC_DCTRL_DTEN | SDMMC_DCTRL_DTDIR |\ |
EricLew | 0:80ee8f3b695e | 458 | SDMMC_DCTRL_DTMODE | SDMMC_DCTRL_DBLOCKSIZE)) |
EricLew | 0:80ee8f3b695e | 459 | |
EricLew | 0:80ee8f3b695e | 460 | /* --- CMD Register ---*/ |
EricLew | 0:80ee8f3b695e | 461 | /* CMD Register clear mask */ |
EricLew | 0:80ee8f3b695e | 462 | #define CMD_CLEAR_MASK ((uint32_t)(SDMMC_CMD_CMDINDEX | SDMMC_CMD_WAITRESP |\ |
EricLew | 0:80ee8f3b695e | 463 | SDMMC_CMD_WAITINT | SDMMC_CMD_WAITPEND |\ |
EricLew | 0:80ee8f3b695e | 464 | SDMMC_CMD_CPSMEN | SDMMC_CMD_SDIOSUSPEND)) |
EricLew | 0:80ee8f3b695e | 465 | |
EricLew | 0:80ee8f3b695e | 466 | /* SDMMC Intialization Frequency (400KHz max) */ |
EricLew | 0:80ee8f3b695e | 467 | #define SDMMC_INIT_CLK_DIV ((uint8_t)0x76) |
EricLew | 0:80ee8f3b695e | 468 | |
EricLew | 0:80ee8f3b695e | 469 | /* SDMMC Data Transfer Frequency (25MHz max) */ |
EricLew | 0:80ee8f3b695e | 470 | #define SDMMC_TRANSFER_CLK_DIV ((uint8_t)0x0) |
EricLew | 0:80ee8f3b695e | 471 | |
EricLew | 0:80ee8f3b695e | 472 | /** |
EricLew | 0:80ee8f3b695e | 473 | * @} |
EricLew | 0:80ee8f3b695e | 474 | */ |
EricLew | 0:80ee8f3b695e | 475 | |
EricLew | 0:80ee8f3b695e | 476 | /** @defgroup SDMMC_LL_Interrupt_Clock Interrupt And Clock Configuration |
EricLew | 0:80ee8f3b695e | 477 | * @brief macros to handle interrupts and specific clock configurations |
EricLew | 0:80ee8f3b695e | 478 | * @{ |
EricLew | 0:80ee8f3b695e | 479 | */ |
EricLew | 0:80ee8f3b695e | 480 | |
EricLew | 0:80ee8f3b695e | 481 | /** |
EricLew | 0:80ee8f3b695e | 482 | * @brief Enable the SDMMC device. |
EricLew | 0:80ee8f3b695e | 483 | * @param __INSTANCE__: SDMMC Instance |
EricLew | 0:80ee8f3b695e | 484 | * @retval None |
EricLew | 0:80ee8f3b695e | 485 | */ |
EricLew | 0:80ee8f3b695e | 486 | #define __SDMMC_ENABLE(__INSTANCE__) ((__INSTANCE__)->CLKCR |= SDMMC_CLKCR_CLKEN) |
EricLew | 0:80ee8f3b695e | 487 | |
EricLew | 0:80ee8f3b695e | 488 | /** |
EricLew | 0:80ee8f3b695e | 489 | * @brief Disable the SDMMC device. |
EricLew | 0:80ee8f3b695e | 490 | * @param __INSTANCE__: SDMMC Instance |
EricLew | 0:80ee8f3b695e | 491 | * @retval None |
EricLew | 0:80ee8f3b695e | 492 | */ |
EricLew | 0:80ee8f3b695e | 493 | #define __SDMMC_DISABLE(__INSTANCE__) ((__INSTANCE__)->CLKCR &= ~SDMMC_CLKCR_CLKEN) |
EricLew | 0:80ee8f3b695e | 494 | |
EricLew | 0:80ee8f3b695e | 495 | /** |
EricLew | 0:80ee8f3b695e | 496 | * @brief Enable the SDMMC DMA transfer. |
EricLew | 0:80ee8f3b695e | 497 | * @param None |
EricLew | 0:80ee8f3b695e | 498 | * @retval None |
EricLew | 0:80ee8f3b695e | 499 | */ |
EricLew | 0:80ee8f3b695e | 500 | #define __SDMMC_DMA_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_DMAEN) |
EricLew | 0:80ee8f3b695e | 501 | /** |
EricLew | 0:80ee8f3b695e | 502 | * @brief Disable the SDMMC DMA transfer. |
EricLew | 0:80ee8f3b695e | 503 | * @param None |
EricLew | 0:80ee8f3b695e | 504 | * @retval None |
EricLew | 0:80ee8f3b695e | 505 | */ |
EricLew | 0:80ee8f3b695e | 506 | #define __SDMMC_DMA_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_DMAEN) |
EricLew | 0:80ee8f3b695e | 507 | |
EricLew | 0:80ee8f3b695e | 508 | /** |
EricLew | 0:80ee8f3b695e | 509 | * @brief Enable the SDMMC device interrupt. |
EricLew | 0:80ee8f3b695e | 510 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 511 | * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be enabled. |
EricLew | 0:80ee8f3b695e | 512 | * This parameter can be one or a combination of the following values: |
EricLew | 0:80ee8f3b695e | 513 | * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
EricLew | 0:80ee8f3b695e | 514 | * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
EricLew | 0:80ee8f3b695e | 515 | * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt |
EricLew | 0:80ee8f3b695e | 516 | * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt |
EricLew | 0:80ee8f3b695e | 517 | * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
EricLew | 0:80ee8f3b695e | 518 | * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt |
EricLew | 0:80ee8f3b695e | 519 | * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt |
EricLew | 0:80ee8f3b695e | 520 | * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt |
EricLew | 0:80ee8f3b695e | 521 | * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
EricLew | 0:80ee8f3b695e | 522 | * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
EricLew | 0:80ee8f3b695e | 523 | * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt |
EricLew | 0:80ee8f3b695e | 524 | * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt |
EricLew | 0:80ee8f3b695e | 525 | * @arg SDMMC_IT_RXACT: Data receive in progress interrupt |
EricLew | 0:80ee8f3b695e | 526 | * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
EricLew | 0:80ee8f3b695e | 527 | * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
EricLew | 0:80ee8f3b695e | 528 | * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt |
EricLew | 0:80ee8f3b695e | 529 | * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt |
EricLew | 0:80ee8f3b695e | 530 | * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt |
EricLew | 0:80ee8f3b695e | 531 | * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt |
EricLew | 0:80ee8f3b695e | 532 | * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt |
EricLew | 0:80ee8f3b695e | 533 | * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt |
EricLew | 0:80ee8f3b695e | 534 | * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt |
EricLew | 0:80ee8f3b695e | 535 | * @retval None |
EricLew | 0:80ee8f3b695e | 536 | */ |
EricLew | 0:80ee8f3b695e | 537 | #define __SDMMC_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK |= (__INTERRUPT__)) |
EricLew | 0:80ee8f3b695e | 538 | |
EricLew | 0:80ee8f3b695e | 539 | /** |
EricLew | 0:80ee8f3b695e | 540 | * @brief Disable the SDMMC device interrupt. |
EricLew | 0:80ee8f3b695e | 541 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 542 | * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be disabled. |
EricLew | 0:80ee8f3b695e | 543 | * This parameter can be one or a combination of the following values: |
EricLew | 0:80ee8f3b695e | 544 | * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
EricLew | 0:80ee8f3b695e | 545 | * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
EricLew | 0:80ee8f3b695e | 546 | * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt |
EricLew | 0:80ee8f3b695e | 547 | * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt |
EricLew | 0:80ee8f3b695e | 548 | * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
EricLew | 0:80ee8f3b695e | 549 | * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt |
EricLew | 0:80ee8f3b695e | 550 | * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt |
EricLew | 0:80ee8f3b695e | 551 | * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt |
EricLew | 0:80ee8f3b695e | 552 | * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
EricLew | 0:80ee8f3b695e | 553 | * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
EricLew | 0:80ee8f3b695e | 554 | * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt |
EricLew | 0:80ee8f3b695e | 555 | * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt |
EricLew | 0:80ee8f3b695e | 556 | * @arg SDMMC_IT_RXACT: Data receive in progress interrupt |
EricLew | 0:80ee8f3b695e | 557 | * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
EricLew | 0:80ee8f3b695e | 558 | * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
EricLew | 0:80ee8f3b695e | 559 | * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt |
EricLew | 0:80ee8f3b695e | 560 | * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt |
EricLew | 0:80ee8f3b695e | 561 | * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt |
EricLew | 0:80ee8f3b695e | 562 | * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt |
EricLew | 0:80ee8f3b695e | 563 | * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt |
EricLew | 0:80ee8f3b695e | 564 | * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt |
EricLew | 0:80ee8f3b695e | 565 | * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt |
EricLew | 0:80ee8f3b695e | 566 | * @retval None |
EricLew | 0:80ee8f3b695e | 567 | */ |
EricLew | 0:80ee8f3b695e | 568 | #define __SDMMC_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK &= ~(__INTERRUPT__)) |
EricLew | 0:80ee8f3b695e | 569 | |
EricLew | 0:80ee8f3b695e | 570 | /** |
EricLew | 0:80ee8f3b695e | 571 | * @brief Checks whether the specified SDMMC flag is set or not. |
EricLew | 0:80ee8f3b695e | 572 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 573 | * @param __FLAG__: specifies the flag to check. |
EricLew | 0:80ee8f3b695e | 574 | * This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 575 | * @arg SDMMC_FLAG_CCRCFAIL: Command response received (CRC check failed) |
EricLew | 0:80ee8f3b695e | 576 | * @arg SDMMC_FLAG_DCRCFAIL: Data block sent/received (CRC check failed) |
EricLew | 0:80ee8f3b695e | 577 | * @arg SDMMC_FLAG_CTIMEOUT: Command response timeout |
EricLew | 0:80ee8f3b695e | 578 | * @arg SDMMC_FLAG_DTIMEOUT: Data timeout |
EricLew | 0:80ee8f3b695e | 579 | * @arg SDMMC_FLAG_TXUNDERR: Transmit FIFO underrun error |
EricLew | 0:80ee8f3b695e | 580 | * @arg SDMMC_FLAG_RXOVERR: Received FIFO overrun error |
EricLew | 0:80ee8f3b695e | 581 | * @arg SDMMC_FLAG_CMDREND: Command response received (CRC check passed) |
EricLew | 0:80ee8f3b695e | 582 | * @arg SDMMC_FLAG_CMDSENT: Command sent (no response required) |
EricLew | 0:80ee8f3b695e | 583 | * @arg SDMMC_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) |
EricLew | 0:80ee8f3b695e | 584 | * @arg SDMMC_FLAG_DBCKEND: Data block sent/received (CRC check passed) |
EricLew | 0:80ee8f3b695e | 585 | * @arg SDMMC_FLAG_CMDACT: Command transfer in progress |
EricLew | 0:80ee8f3b695e | 586 | * @arg SDMMC_FLAG_TXACT: Data transmit in progress |
EricLew | 0:80ee8f3b695e | 587 | * @arg SDMMC_FLAG_RXACT: Data receive in progress |
EricLew | 0:80ee8f3b695e | 588 | * @arg SDMMC_FLAG_TXFIFOHE: Transmit FIFO Half Empty |
EricLew | 0:80ee8f3b695e | 589 | * @arg SDMMC_FLAG_RXFIFOHF: Receive FIFO Half Full |
EricLew | 0:80ee8f3b695e | 590 | * @arg SDMMC_FLAG_TXFIFOF: Transmit FIFO full |
EricLew | 0:80ee8f3b695e | 591 | * @arg SDMMC_FLAG_RXFIFOF: Receive FIFO full |
EricLew | 0:80ee8f3b695e | 592 | * @arg SDMMC_FLAG_TXFIFOE: Transmit FIFO empty |
EricLew | 0:80ee8f3b695e | 593 | * @arg SDMMC_FLAG_RXFIFOE: Receive FIFO empty |
EricLew | 0:80ee8f3b695e | 594 | * @arg SDMMC_FLAG_TXDAVL: Data available in transmit FIFO |
EricLew | 0:80ee8f3b695e | 595 | * @arg SDMMC_FLAG_RXDAVL: Data available in receive FIFO |
EricLew | 0:80ee8f3b695e | 596 | * @arg SDMMC_FLAG_SDMMCIT: SD I/O interrupt received |
EricLew | 0:80ee8f3b695e | 597 | * @retval The new state of SDMMC_FLAG (SET or RESET). |
EricLew | 0:80ee8f3b695e | 598 | */ |
EricLew | 0:80ee8f3b695e | 599 | #define __SDMMC_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->STA &(__FLAG__)) != RESET) |
EricLew | 0:80ee8f3b695e | 600 | |
EricLew | 0:80ee8f3b695e | 601 | |
EricLew | 0:80ee8f3b695e | 602 | /** |
EricLew | 0:80ee8f3b695e | 603 | * @brief Clears the SDMMC pending flags. |
EricLew | 0:80ee8f3b695e | 604 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 605 | * @param __FLAG__: specifies the flag to clear. |
EricLew | 0:80ee8f3b695e | 606 | * This parameter can be one or a combination of the following values: |
EricLew | 0:80ee8f3b695e | 607 | * @arg SDMMC_FLAG_CCRCFAIL: Command response received (CRC check failed) |
EricLew | 0:80ee8f3b695e | 608 | * @arg SDMMC_FLAG_DCRCFAIL: Data block sent/received (CRC check failed) |
EricLew | 0:80ee8f3b695e | 609 | * @arg SDMMC_FLAG_CTIMEOUT: Command response timeout |
EricLew | 0:80ee8f3b695e | 610 | * @arg SDMMC_FLAG_DTIMEOUT: Data timeout |
EricLew | 0:80ee8f3b695e | 611 | * @arg SDMMC_FLAG_TXUNDERR: Transmit FIFO underrun error |
EricLew | 0:80ee8f3b695e | 612 | * @arg SDMMC_FLAG_RXOVERR: Received FIFO overrun error |
EricLew | 0:80ee8f3b695e | 613 | * @arg SDMMC_FLAG_CMDREND: Command response received (CRC check passed) |
EricLew | 0:80ee8f3b695e | 614 | * @arg SDMMC_FLAG_CMDSENT: Command sent (no response required) |
EricLew | 0:80ee8f3b695e | 615 | * @arg SDMMC_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) |
EricLew | 0:80ee8f3b695e | 616 | * @arg SDMMC_FLAG_DBCKEND: Data block sent/received (CRC check passed) |
EricLew | 0:80ee8f3b695e | 617 | * @arg SDMMC_FLAG_SDMMCIT: SD I/O interrupt received |
EricLew | 0:80ee8f3b695e | 618 | * @retval None |
EricLew | 0:80ee8f3b695e | 619 | */ |
EricLew | 0:80ee8f3b695e | 620 | #define __SDMMC_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->ICR = (__FLAG__)) |
EricLew | 0:80ee8f3b695e | 621 | |
EricLew | 0:80ee8f3b695e | 622 | /** |
EricLew | 0:80ee8f3b695e | 623 | * @brief Checks whether the specified SDMMC interrupt has occurred or not. |
EricLew | 0:80ee8f3b695e | 624 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 625 | * @param __INTERRUPT__: specifies the SDMMC interrupt source to check. |
EricLew | 0:80ee8f3b695e | 626 | * This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 627 | * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
EricLew | 0:80ee8f3b695e | 628 | * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
EricLew | 0:80ee8f3b695e | 629 | * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt |
EricLew | 0:80ee8f3b695e | 630 | * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt |
EricLew | 0:80ee8f3b695e | 631 | * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
EricLew | 0:80ee8f3b695e | 632 | * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt |
EricLew | 0:80ee8f3b695e | 633 | * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt |
EricLew | 0:80ee8f3b695e | 634 | * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt |
EricLew | 0:80ee8f3b695e | 635 | * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt |
EricLew | 0:80ee8f3b695e | 636 | * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt |
EricLew | 0:80ee8f3b695e | 637 | * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt |
EricLew | 0:80ee8f3b695e | 638 | * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt |
EricLew | 0:80ee8f3b695e | 639 | * @arg SDMMC_IT_RXACT: Data receive in progress interrupt |
EricLew | 0:80ee8f3b695e | 640 | * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt |
EricLew | 0:80ee8f3b695e | 641 | * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt |
EricLew | 0:80ee8f3b695e | 642 | * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt |
EricLew | 0:80ee8f3b695e | 643 | * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt |
EricLew | 0:80ee8f3b695e | 644 | * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt |
EricLew | 0:80ee8f3b695e | 645 | * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt |
EricLew | 0:80ee8f3b695e | 646 | * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt |
EricLew | 0:80ee8f3b695e | 647 | * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt |
EricLew | 0:80ee8f3b695e | 648 | * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt |
EricLew | 0:80ee8f3b695e | 649 | * @retval The new state of SDMMC_IT (SET or RESET). |
EricLew | 0:80ee8f3b695e | 650 | */ |
EricLew | 0:80ee8f3b695e | 651 | #define __SDMMC_GET_IT(__INSTANCE__, __INTERRUPT__) (((__INSTANCE__)->STA &(__INTERRUPT__)) == (__INTERRUPT__)) |
EricLew | 0:80ee8f3b695e | 652 | |
EricLew | 0:80ee8f3b695e | 653 | /** |
EricLew | 0:80ee8f3b695e | 654 | * @brief Clears the SDMMC's interrupt pending bits. |
EricLew | 0:80ee8f3b695e | 655 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 656 | * @param __INTERRUPT__: specifies the interrupt pending bit to clear. |
EricLew | 0:80ee8f3b695e | 657 | * This parameter can be one or a combination of the following values: |
EricLew | 0:80ee8f3b695e | 658 | * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt |
EricLew | 0:80ee8f3b695e | 659 | * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt |
EricLew | 0:80ee8f3b695e | 660 | * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt |
EricLew | 0:80ee8f3b695e | 661 | * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt |
EricLew | 0:80ee8f3b695e | 662 | * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt |
EricLew | 0:80ee8f3b695e | 663 | * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt |
EricLew | 0:80ee8f3b695e | 664 | * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt |
EricLew | 0:80ee8f3b695e | 665 | * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt |
EricLew | 0:80ee8f3b695e | 666 | * @arg SDMMC_IT_DATAEND: Data end (data counter, SDMMC_DCOUNT, is zero) interrupt |
EricLew | 0:80ee8f3b695e | 667 | * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt |
EricLew | 0:80ee8f3b695e | 668 | * @retval None |
EricLew | 0:80ee8f3b695e | 669 | */ |
EricLew | 0:80ee8f3b695e | 670 | #define __SDMMC_CLEAR_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->ICR = (__INTERRUPT__)) |
EricLew | 0:80ee8f3b695e | 671 | |
EricLew | 0:80ee8f3b695e | 672 | /** |
EricLew | 0:80ee8f3b695e | 673 | * @brief Enable Start the SD I/O Read Wait operation. |
EricLew | 0:80ee8f3b695e | 674 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 675 | * @retval None |
EricLew | 0:80ee8f3b695e | 676 | */ |
EricLew | 0:80ee8f3b695e | 677 | #define __SDMMC_START_READWAIT_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_RWSTART) |
EricLew | 0:80ee8f3b695e | 678 | |
EricLew | 0:80ee8f3b695e | 679 | /** |
EricLew | 0:80ee8f3b695e | 680 | * @brief Disable Start the SD I/O Read Wait operations. |
EricLew | 0:80ee8f3b695e | 681 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 682 | * @retval None |
EricLew | 0:80ee8f3b695e | 683 | */ |
EricLew | 0:80ee8f3b695e | 684 | #define __SDMMC_START_READWAIT_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_RWSTART) |
EricLew | 0:80ee8f3b695e | 685 | |
EricLew | 0:80ee8f3b695e | 686 | /** |
EricLew | 0:80ee8f3b695e | 687 | * @brief Enable Start the SD I/O Read Wait operation. |
EricLew | 0:80ee8f3b695e | 688 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 689 | * @retval None |
EricLew | 0:80ee8f3b695e | 690 | */ |
EricLew | 0:80ee8f3b695e | 691 | #define __SDMMC_STOP_READWAIT_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_RWSTOP) |
EricLew | 0:80ee8f3b695e | 692 | |
EricLew | 0:80ee8f3b695e | 693 | /** |
EricLew | 0:80ee8f3b695e | 694 | * @brief Disable Stop the SD I/O Read Wait operations. |
EricLew | 0:80ee8f3b695e | 695 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 696 | * @retval None |
EricLew | 0:80ee8f3b695e | 697 | */ |
EricLew | 0:80ee8f3b695e | 698 | #define __SDMMC_STOP_READWAIT_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_RWSTOP) |
EricLew | 0:80ee8f3b695e | 699 | |
EricLew | 0:80ee8f3b695e | 700 | /** |
EricLew | 0:80ee8f3b695e | 701 | * @brief Enable the SD I/O Mode Operation. |
EricLew | 0:80ee8f3b695e | 702 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 703 | * @retval None |
EricLew | 0:80ee8f3b695e | 704 | */ |
EricLew | 0:80ee8f3b695e | 705 | #define __SDMMC_OPERATION_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_SDIOEN) |
EricLew | 0:80ee8f3b695e | 706 | |
EricLew | 0:80ee8f3b695e | 707 | /** |
EricLew | 0:80ee8f3b695e | 708 | * @brief Disable the SD I/O Mode Operation. |
EricLew | 0:80ee8f3b695e | 709 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 710 | * @retval None |
EricLew | 0:80ee8f3b695e | 711 | */ |
EricLew | 0:80ee8f3b695e | 712 | #define __SDMMC_OPERATION_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_SDIOEN) |
EricLew | 0:80ee8f3b695e | 713 | |
EricLew | 0:80ee8f3b695e | 714 | /** |
EricLew | 0:80ee8f3b695e | 715 | * @brief Enable the SD I/O Suspend command sending. |
EricLew | 0:80ee8f3b695e | 716 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 717 | * @retval None |
EricLew | 0:80ee8f3b695e | 718 | */ |
EricLew | 0:80ee8f3b695e | 719 | #define __SDMMC_SUSPEND_CMD_ENABLE(__INSTANCE__) ((__INSTANCE__)->CMD |= SDMMC_CMD_SDIOSUSPEND) |
EricLew | 0:80ee8f3b695e | 720 | |
EricLew | 0:80ee8f3b695e | 721 | /** |
EricLew | 0:80ee8f3b695e | 722 | * @brief Disable the SD I/O Suspend command sending. |
EricLew | 0:80ee8f3b695e | 723 | * @param __INSTANCE__: Pointer to SDMMC register base |
EricLew | 0:80ee8f3b695e | 724 | * @retval None |
EricLew | 0:80ee8f3b695e | 725 | */ |
EricLew | 0:80ee8f3b695e | 726 | #define __SDMMC_SUSPEND_CMD_DISABLE(__INSTANCE__) ((__INSTANCE__)->CMD &= ~SDMMC_CMD_SDIOSUSPEND) |
EricLew | 0:80ee8f3b695e | 727 | |
EricLew | 0:80ee8f3b695e | 728 | /** |
EricLew | 0:80ee8f3b695e | 729 | * @} |
EricLew | 0:80ee8f3b695e | 730 | */ |
EricLew | 0:80ee8f3b695e | 731 | |
EricLew | 0:80ee8f3b695e | 732 | /** |
EricLew | 0:80ee8f3b695e | 733 | * @} |
EricLew | 0:80ee8f3b695e | 734 | */ |
EricLew | 0:80ee8f3b695e | 735 | |
EricLew | 0:80ee8f3b695e | 736 | /* Exported functions --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 737 | /** @addtogroup SDMMC_LL_Exported_Functions |
EricLew | 0:80ee8f3b695e | 738 | * @{ |
EricLew | 0:80ee8f3b695e | 739 | */ |
EricLew | 0:80ee8f3b695e | 740 | |
EricLew | 0:80ee8f3b695e | 741 | /* Initialization/de-initialization functions **********************************/ |
EricLew | 0:80ee8f3b695e | 742 | /** @addtogroup HAL_SDMMC_LL_Group1 |
EricLew | 0:80ee8f3b695e | 743 | * @{ |
EricLew | 0:80ee8f3b695e | 744 | */ |
EricLew | 0:80ee8f3b695e | 745 | HAL_StatusTypeDef SDMMC_Init(SDMMC_TypeDef *SDMMCx, SDMMC_InitTypeDef Init); |
EricLew | 0:80ee8f3b695e | 746 | /** |
EricLew | 0:80ee8f3b695e | 747 | * @} |
EricLew | 0:80ee8f3b695e | 748 | */ |
EricLew | 0:80ee8f3b695e | 749 | |
EricLew | 0:80ee8f3b695e | 750 | /* I/O operation functions *****************************************************/ |
EricLew | 0:80ee8f3b695e | 751 | /** @addtogroup HAL_SDMMC_LL_Group2 |
EricLew | 0:80ee8f3b695e | 752 | * @{ |
EricLew | 0:80ee8f3b695e | 753 | */ |
EricLew | 0:80ee8f3b695e | 754 | /* Blocking mode: Polling */ |
EricLew | 0:80ee8f3b695e | 755 | uint32_t SDMMC_ReadFIFO(SDMMC_TypeDef *SDMMCx); |
EricLew | 0:80ee8f3b695e | 756 | HAL_StatusTypeDef SDMMC_WriteFIFO(SDMMC_TypeDef *SDMMCx, uint32_t *pWriteData); |
EricLew | 0:80ee8f3b695e | 757 | /** |
EricLew | 0:80ee8f3b695e | 758 | * @} |
EricLew | 0:80ee8f3b695e | 759 | */ |
EricLew | 0:80ee8f3b695e | 760 | |
EricLew | 0:80ee8f3b695e | 761 | /* Peripheral Control functions ************************************************/ |
EricLew | 0:80ee8f3b695e | 762 | /** @addtogroup HAL_SDMMC_LL_Group3 |
EricLew | 0:80ee8f3b695e | 763 | * @{ |
EricLew | 0:80ee8f3b695e | 764 | */ |
EricLew | 0:80ee8f3b695e | 765 | HAL_StatusTypeDef SDMMC_PowerState_ON(SDMMC_TypeDef *SDMMCx); |
EricLew | 0:80ee8f3b695e | 766 | HAL_StatusTypeDef SDMMC_PowerState_OFF(SDMMC_TypeDef *SDMMCx); |
EricLew | 0:80ee8f3b695e | 767 | uint32_t SDMMC_GetPowerState(SDMMC_TypeDef *SDMMCx); |
EricLew | 0:80ee8f3b695e | 768 | |
EricLew | 0:80ee8f3b695e | 769 | /* Command path state machine (CPSM) management functions */ |
EricLew | 0:80ee8f3b695e | 770 | HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command); |
EricLew | 0:80ee8f3b695e | 771 | uint8_t SDMMC_GetCommandResponse(SDMMC_TypeDef *SDMMCx); |
EricLew | 0:80ee8f3b695e | 772 | uint32_t SDMMC_GetResponse(SDMMC_TypeDef *SDMMCx, uint32_t Response); |
EricLew | 0:80ee8f3b695e | 773 | |
EricLew | 0:80ee8f3b695e | 774 | /* Data path state machine (DPSM) management functions */ |
EricLew | 0:80ee8f3b695e | 775 | HAL_StatusTypeDef SDMMC_DataConfig(SDMMC_TypeDef *SDMMCx, SDMMC_DataInitTypeDef* Data); |
EricLew | 0:80ee8f3b695e | 776 | uint32_t SDMMC_GetDataCounter(SDMMC_TypeDef *SDMMCx); |
EricLew | 0:80ee8f3b695e | 777 | uint32_t SDMMC_GetFIFOCount(SDMMC_TypeDef *SDMMCx); |
EricLew | 0:80ee8f3b695e | 778 | |
EricLew | 0:80ee8f3b695e | 779 | /* SDMMC Cards mode management functions */ |
EricLew | 0:80ee8f3b695e | 780 | HAL_StatusTypeDef SDMMC_SetSDMMCReadWaitMode(SDMMC_TypeDef *SDMMCx, uint32_t SDMMC_ReadWaitMode); |
EricLew | 0:80ee8f3b695e | 781 | |
EricLew | 0:80ee8f3b695e | 782 | /** |
EricLew | 0:80ee8f3b695e | 783 | * @} |
EricLew | 0:80ee8f3b695e | 784 | */ |
EricLew | 0:80ee8f3b695e | 785 | |
EricLew | 0:80ee8f3b695e | 786 | /** |
EricLew | 0:80ee8f3b695e | 787 | * @} |
EricLew | 0:80ee8f3b695e | 788 | */ |
EricLew | 0:80ee8f3b695e | 789 | |
EricLew | 0:80ee8f3b695e | 790 | /** |
EricLew | 0:80ee8f3b695e | 791 | * @} |
EricLew | 0:80ee8f3b695e | 792 | */ |
EricLew | 0:80ee8f3b695e | 793 | |
EricLew | 0:80ee8f3b695e | 794 | /** |
EricLew | 0:80ee8f3b695e | 795 | * @} |
EricLew | 0:80ee8f3b695e | 796 | */ |
EricLew | 0:80ee8f3b695e | 797 | |
EricLew | 0:80ee8f3b695e | 798 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 799 | } |
EricLew | 0:80ee8f3b695e | 800 | #endif |
EricLew | 0:80ee8f3b695e | 801 | |
EricLew | 0:80ee8f3b695e | 802 | #endif /* __STM32L4xx_LL_SDMMC_H */ |
EricLew | 0:80ee8f3b695e | 803 | |
EricLew | 0:80ee8f3b695e | 804 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
EricLew | 0:80ee8f3b695e | 805 |