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