Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

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