mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Dec 02 11:30:05 2013 +0000
Revision:
52:a51c77007319
Child:
70:c1fbde68b492
Synchronized with git revision 49df530ae72ce97ccc773d1f2c13b38e868e6abd

Full URL: https://github.com/mbedmicro/mbed/commit/49df530ae72ce97ccc773d1f2c13b38e868e6abd/

Add STMicroelectronics NUCLEO_F103RB target

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 52:a51c77007319 1 /**
mbed_official 52:a51c77007319 2 ******************************************************************************
mbed_official 52:a51c77007319 3 * @file stm32f10x_sdio.h
mbed_official 52:a51c77007319 4 * @author MCD Application Team
mbed_official 52:a51c77007319 5 * @version V3.5.0
mbed_official 52:a51c77007319 6 * @date 11-March-2011
mbed_official 52:a51c77007319 7 * @brief This file contains all the functions prototypes for the SDIO firmware
mbed_official 52:a51c77007319 8 * library.
mbed_official 52:a51c77007319 9 ******************************************************************************
mbed_official 52:a51c77007319 10 * @attention
mbed_official 52:a51c77007319 11 *
mbed_official 52:a51c77007319 12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
mbed_official 52:a51c77007319 13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
mbed_official 52:a51c77007319 14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
mbed_official 52:a51c77007319 15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
mbed_official 52:a51c77007319 16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
mbed_official 52:a51c77007319 17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
mbed_official 52:a51c77007319 18 *
mbed_official 52:a51c77007319 19 * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
mbed_official 52:a51c77007319 20 ******************************************************************************
mbed_official 52:a51c77007319 21 */
mbed_official 52:a51c77007319 22
mbed_official 52:a51c77007319 23 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 52:a51c77007319 24 #ifndef __STM32F10x_SDIO_H
mbed_official 52:a51c77007319 25 #define __STM32F10x_SDIO_H
mbed_official 52:a51c77007319 26
mbed_official 52:a51c77007319 27 #ifdef __cplusplus
mbed_official 52:a51c77007319 28 extern "C" {
mbed_official 52:a51c77007319 29 #endif
mbed_official 52:a51c77007319 30
mbed_official 52:a51c77007319 31 /* Includes ------------------------------------------------------------------*/
mbed_official 52:a51c77007319 32 #include "stm32f10x.h"
mbed_official 52:a51c77007319 33
mbed_official 52:a51c77007319 34 /** @addtogroup STM32F10x_StdPeriph_Driver
mbed_official 52:a51c77007319 35 * @{
mbed_official 52:a51c77007319 36 */
mbed_official 52:a51c77007319 37
mbed_official 52:a51c77007319 38 /** @addtogroup SDIO
mbed_official 52:a51c77007319 39 * @{
mbed_official 52:a51c77007319 40 */
mbed_official 52:a51c77007319 41
mbed_official 52:a51c77007319 42 /** @defgroup SDIO_Exported_Types
mbed_official 52:a51c77007319 43 * @{
mbed_official 52:a51c77007319 44 */
mbed_official 52:a51c77007319 45
mbed_official 52:a51c77007319 46 typedef struct
mbed_official 52:a51c77007319 47 {
mbed_official 52:a51c77007319 48 uint32_t SDIO_ClockEdge; /*!< Specifies the clock transition on which the bit capture is made.
mbed_official 52:a51c77007319 49 This parameter can be a value of @ref SDIO_Clock_Edge */
mbed_official 52:a51c77007319 50
mbed_official 52:a51c77007319 51 uint32_t SDIO_ClockBypass; /*!< Specifies whether the SDIO Clock divider bypass is
mbed_official 52:a51c77007319 52 enabled or disabled.
mbed_official 52:a51c77007319 53 This parameter can be a value of @ref SDIO_Clock_Bypass */
mbed_official 52:a51c77007319 54
mbed_official 52:a51c77007319 55 uint32_t SDIO_ClockPowerSave; /*!< Specifies whether SDIO Clock output is enabled or
mbed_official 52:a51c77007319 56 disabled when the bus is idle.
mbed_official 52:a51c77007319 57 This parameter can be a value of @ref SDIO_Clock_Power_Save */
mbed_official 52:a51c77007319 58
mbed_official 52:a51c77007319 59 uint32_t SDIO_BusWide; /*!< Specifies the SDIO bus width.
mbed_official 52:a51c77007319 60 This parameter can be a value of @ref SDIO_Bus_Wide */
mbed_official 52:a51c77007319 61
mbed_official 52:a51c77007319 62 uint32_t SDIO_HardwareFlowControl; /*!< Specifies whether the SDIO hardware flow control is enabled or disabled.
mbed_official 52:a51c77007319 63 This parameter can be a value of @ref SDIO_Hardware_Flow_Control */
mbed_official 52:a51c77007319 64
mbed_official 52:a51c77007319 65 uint8_t SDIO_ClockDiv; /*!< Specifies the clock frequency of the SDIO controller.
mbed_official 52:a51c77007319 66 This parameter can be a value between 0x00 and 0xFF. */
mbed_official 52:a51c77007319 67
mbed_official 52:a51c77007319 68 } SDIO_InitTypeDef;
mbed_official 52:a51c77007319 69
mbed_official 52:a51c77007319 70 typedef struct
mbed_official 52:a51c77007319 71 {
mbed_official 52:a51c77007319 72 uint32_t SDIO_Argument; /*!< Specifies the SDIO command argument which is sent
mbed_official 52:a51c77007319 73 to a card as part of a command message. If a command
mbed_official 52:a51c77007319 74 contains an argument, it must be loaded into this register
mbed_official 52:a51c77007319 75 before writing the command to the command register */
mbed_official 52:a51c77007319 76
mbed_official 52:a51c77007319 77 uint32_t SDIO_CmdIndex; /*!< Specifies the SDIO command index. It must be lower than 0x40. */
mbed_official 52:a51c77007319 78
mbed_official 52:a51c77007319 79 uint32_t SDIO_Response; /*!< Specifies the SDIO response type.
mbed_official 52:a51c77007319 80 This parameter can be a value of @ref SDIO_Response_Type */
mbed_official 52:a51c77007319 81
mbed_official 52:a51c77007319 82 uint32_t SDIO_Wait; /*!< Specifies whether SDIO wait-for-interrupt request is enabled or disabled.
mbed_official 52:a51c77007319 83 This parameter can be a value of @ref SDIO_Wait_Interrupt_State */
mbed_official 52:a51c77007319 84
mbed_official 52:a51c77007319 85 uint32_t SDIO_CPSM; /*!< Specifies whether SDIO Command path state machine (CPSM)
mbed_official 52:a51c77007319 86 is enabled or disabled.
mbed_official 52:a51c77007319 87 This parameter can be a value of @ref SDIO_CPSM_State */
mbed_official 52:a51c77007319 88 } SDIO_CmdInitTypeDef;
mbed_official 52:a51c77007319 89
mbed_official 52:a51c77007319 90 typedef struct
mbed_official 52:a51c77007319 91 {
mbed_official 52:a51c77007319 92 uint32_t SDIO_DataTimeOut; /*!< Specifies the data timeout period in card bus clock periods. */
mbed_official 52:a51c77007319 93
mbed_official 52:a51c77007319 94 uint32_t SDIO_DataLength; /*!< Specifies the number of data bytes to be transferred. */
mbed_official 52:a51c77007319 95
mbed_official 52:a51c77007319 96 uint32_t SDIO_DataBlockSize; /*!< Specifies the data block size for block transfer.
mbed_official 52:a51c77007319 97 This parameter can be a value of @ref SDIO_Data_Block_Size */
mbed_official 52:a51c77007319 98
mbed_official 52:a51c77007319 99 uint32_t SDIO_TransferDir; /*!< Specifies the data transfer direction, whether the transfer
mbed_official 52:a51c77007319 100 is a read or write.
mbed_official 52:a51c77007319 101 This parameter can be a value of @ref SDIO_Transfer_Direction */
mbed_official 52:a51c77007319 102
mbed_official 52:a51c77007319 103 uint32_t SDIO_TransferMode; /*!< Specifies whether data transfer is in stream or block mode.
mbed_official 52:a51c77007319 104 This parameter can be a value of @ref SDIO_Transfer_Type */
mbed_official 52:a51c77007319 105
mbed_official 52:a51c77007319 106 uint32_t SDIO_DPSM; /*!< Specifies whether SDIO Data path state machine (DPSM)
mbed_official 52:a51c77007319 107 is enabled or disabled.
mbed_official 52:a51c77007319 108 This parameter can be a value of @ref SDIO_DPSM_State */
mbed_official 52:a51c77007319 109 } SDIO_DataInitTypeDef;
mbed_official 52:a51c77007319 110
mbed_official 52:a51c77007319 111 /**
mbed_official 52:a51c77007319 112 * @}
mbed_official 52:a51c77007319 113 */
mbed_official 52:a51c77007319 114
mbed_official 52:a51c77007319 115 /** @defgroup SDIO_Exported_Constants
mbed_official 52:a51c77007319 116 * @{
mbed_official 52:a51c77007319 117 */
mbed_official 52:a51c77007319 118
mbed_official 52:a51c77007319 119 /** @defgroup SDIO_Clock_Edge
mbed_official 52:a51c77007319 120 * @{
mbed_official 52:a51c77007319 121 */
mbed_official 52:a51c77007319 122
mbed_official 52:a51c77007319 123 #define SDIO_ClockEdge_Rising ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 124 #define SDIO_ClockEdge_Falling ((uint32_t)0x00002000)
mbed_official 52:a51c77007319 125 #define IS_SDIO_CLOCK_EDGE(EDGE) (((EDGE) == SDIO_ClockEdge_Rising) || \
mbed_official 52:a51c77007319 126 ((EDGE) == SDIO_ClockEdge_Falling))
mbed_official 52:a51c77007319 127 /**
mbed_official 52:a51c77007319 128 * @}
mbed_official 52:a51c77007319 129 */
mbed_official 52:a51c77007319 130
mbed_official 52:a51c77007319 131 /** @defgroup SDIO_Clock_Bypass
mbed_official 52:a51c77007319 132 * @{
mbed_official 52:a51c77007319 133 */
mbed_official 52:a51c77007319 134
mbed_official 52:a51c77007319 135 #define SDIO_ClockBypass_Disable ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 136 #define SDIO_ClockBypass_Enable ((uint32_t)0x00000400)
mbed_official 52:a51c77007319 137 #define IS_SDIO_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDIO_ClockBypass_Disable) || \
mbed_official 52:a51c77007319 138 ((BYPASS) == SDIO_ClockBypass_Enable))
mbed_official 52:a51c77007319 139 /**
mbed_official 52:a51c77007319 140 * @}
mbed_official 52:a51c77007319 141 */
mbed_official 52:a51c77007319 142
mbed_official 52:a51c77007319 143 /** @defgroup SDIO_Clock_Power_Save
mbed_official 52:a51c77007319 144 * @{
mbed_official 52:a51c77007319 145 */
mbed_official 52:a51c77007319 146
mbed_official 52:a51c77007319 147 #define SDIO_ClockPowerSave_Disable ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 148 #define SDIO_ClockPowerSave_Enable ((uint32_t)0x00000200)
mbed_official 52:a51c77007319 149 #define IS_SDIO_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDIO_ClockPowerSave_Disable) || \
mbed_official 52:a51c77007319 150 ((SAVE) == SDIO_ClockPowerSave_Enable))
mbed_official 52:a51c77007319 151 /**
mbed_official 52:a51c77007319 152 * @}
mbed_official 52:a51c77007319 153 */
mbed_official 52:a51c77007319 154
mbed_official 52:a51c77007319 155 /** @defgroup SDIO_Bus_Wide
mbed_official 52:a51c77007319 156 * @{
mbed_official 52:a51c77007319 157 */
mbed_official 52:a51c77007319 158
mbed_official 52:a51c77007319 159 #define SDIO_BusWide_1b ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 160 #define SDIO_BusWide_4b ((uint32_t)0x00000800)
mbed_official 52:a51c77007319 161 #define SDIO_BusWide_8b ((uint32_t)0x00001000)
mbed_official 52:a51c77007319 162 #define IS_SDIO_BUS_WIDE(WIDE) (((WIDE) == SDIO_BusWide_1b) || ((WIDE) == SDIO_BusWide_4b) || \
mbed_official 52:a51c77007319 163 ((WIDE) == SDIO_BusWide_8b))
mbed_official 52:a51c77007319 164
mbed_official 52:a51c77007319 165 /**
mbed_official 52:a51c77007319 166 * @}
mbed_official 52:a51c77007319 167 */
mbed_official 52:a51c77007319 168
mbed_official 52:a51c77007319 169 /** @defgroup SDIO_Hardware_Flow_Control
mbed_official 52:a51c77007319 170 * @{
mbed_official 52:a51c77007319 171 */
mbed_official 52:a51c77007319 172
mbed_official 52:a51c77007319 173 #define SDIO_HardwareFlowControl_Disable ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 174 #define SDIO_HardwareFlowControl_Enable ((uint32_t)0x00004000)
mbed_official 52:a51c77007319 175 #define IS_SDIO_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDIO_HardwareFlowControl_Disable) || \
mbed_official 52:a51c77007319 176 ((CONTROL) == SDIO_HardwareFlowControl_Enable))
mbed_official 52:a51c77007319 177 /**
mbed_official 52:a51c77007319 178 * @}
mbed_official 52:a51c77007319 179 */
mbed_official 52:a51c77007319 180
mbed_official 52:a51c77007319 181 /** @defgroup SDIO_Power_State
mbed_official 52:a51c77007319 182 * @{
mbed_official 52:a51c77007319 183 */
mbed_official 52:a51c77007319 184
mbed_official 52:a51c77007319 185 #define SDIO_PowerState_OFF ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 186 #define SDIO_PowerState_ON ((uint32_t)0x00000003)
mbed_official 52:a51c77007319 187 #define IS_SDIO_POWER_STATE(STATE) (((STATE) == SDIO_PowerState_OFF) || ((STATE) == SDIO_PowerState_ON))
mbed_official 52:a51c77007319 188 /**
mbed_official 52:a51c77007319 189 * @}
mbed_official 52:a51c77007319 190 */
mbed_official 52:a51c77007319 191
mbed_official 52:a51c77007319 192
mbed_official 52:a51c77007319 193 /** @defgroup SDIO_Interrupt_sources
mbed_official 52:a51c77007319 194 * @{
mbed_official 52:a51c77007319 195 */
mbed_official 52:a51c77007319 196
mbed_official 52:a51c77007319 197 #define SDIO_IT_CCRCFAIL ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 198 #define SDIO_IT_DCRCFAIL ((uint32_t)0x00000002)
mbed_official 52:a51c77007319 199 #define SDIO_IT_CTIMEOUT ((uint32_t)0x00000004)
mbed_official 52:a51c77007319 200 #define SDIO_IT_DTIMEOUT ((uint32_t)0x00000008)
mbed_official 52:a51c77007319 201 #define SDIO_IT_TXUNDERR ((uint32_t)0x00000010)
mbed_official 52:a51c77007319 202 #define SDIO_IT_RXOVERR ((uint32_t)0x00000020)
mbed_official 52:a51c77007319 203 #define SDIO_IT_CMDREND ((uint32_t)0x00000040)
mbed_official 52:a51c77007319 204 #define SDIO_IT_CMDSENT ((uint32_t)0x00000080)
mbed_official 52:a51c77007319 205 #define SDIO_IT_DATAEND ((uint32_t)0x00000100)
mbed_official 52:a51c77007319 206 #define SDIO_IT_STBITERR ((uint32_t)0x00000200)
mbed_official 52:a51c77007319 207 #define SDIO_IT_DBCKEND ((uint32_t)0x00000400)
mbed_official 52:a51c77007319 208 #define SDIO_IT_CMDACT ((uint32_t)0x00000800)
mbed_official 52:a51c77007319 209 #define SDIO_IT_TXACT ((uint32_t)0x00001000)
mbed_official 52:a51c77007319 210 #define SDIO_IT_RXACT ((uint32_t)0x00002000)
mbed_official 52:a51c77007319 211 #define SDIO_IT_TXFIFOHE ((uint32_t)0x00004000)
mbed_official 52:a51c77007319 212 #define SDIO_IT_RXFIFOHF ((uint32_t)0x00008000)
mbed_official 52:a51c77007319 213 #define SDIO_IT_TXFIFOF ((uint32_t)0x00010000)
mbed_official 52:a51c77007319 214 #define SDIO_IT_RXFIFOF ((uint32_t)0x00020000)
mbed_official 52:a51c77007319 215 #define SDIO_IT_TXFIFOE ((uint32_t)0x00040000)
mbed_official 52:a51c77007319 216 #define SDIO_IT_RXFIFOE ((uint32_t)0x00080000)
mbed_official 52:a51c77007319 217 #define SDIO_IT_TXDAVL ((uint32_t)0x00100000)
mbed_official 52:a51c77007319 218 #define SDIO_IT_RXDAVL ((uint32_t)0x00200000)
mbed_official 52:a51c77007319 219 #define SDIO_IT_SDIOIT ((uint32_t)0x00400000)
mbed_official 52:a51c77007319 220 #define SDIO_IT_CEATAEND ((uint32_t)0x00800000)
mbed_official 52:a51c77007319 221 #define IS_SDIO_IT(IT) ((((IT) & (uint32_t)0xFF000000) == 0x00) && ((IT) != (uint32_t)0x00))
mbed_official 52:a51c77007319 222 /**
mbed_official 52:a51c77007319 223 * @}
mbed_official 52:a51c77007319 224 */
mbed_official 52:a51c77007319 225
mbed_official 52:a51c77007319 226 /** @defgroup SDIO_Command_Index
mbed_official 52:a51c77007319 227 * @{
mbed_official 52:a51c77007319 228 */
mbed_official 52:a51c77007319 229
mbed_official 52:a51c77007319 230 #define IS_SDIO_CMD_INDEX(INDEX) ((INDEX) < 0x40)
mbed_official 52:a51c77007319 231 /**
mbed_official 52:a51c77007319 232 * @}
mbed_official 52:a51c77007319 233 */
mbed_official 52:a51c77007319 234
mbed_official 52:a51c77007319 235 /** @defgroup SDIO_Response_Type
mbed_official 52:a51c77007319 236 * @{
mbed_official 52:a51c77007319 237 */
mbed_official 52:a51c77007319 238
mbed_official 52:a51c77007319 239 #define SDIO_Response_No ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 240 #define SDIO_Response_Short ((uint32_t)0x00000040)
mbed_official 52:a51c77007319 241 #define SDIO_Response_Long ((uint32_t)0x000000C0)
mbed_official 52:a51c77007319 242 #define IS_SDIO_RESPONSE(RESPONSE) (((RESPONSE) == SDIO_Response_No) || \
mbed_official 52:a51c77007319 243 ((RESPONSE) == SDIO_Response_Short) || \
mbed_official 52:a51c77007319 244 ((RESPONSE) == SDIO_Response_Long))
mbed_official 52:a51c77007319 245 /**
mbed_official 52:a51c77007319 246 * @}
mbed_official 52:a51c77007319 247 */
mbed_official 52:a51c77007319 248
mbed_official 52:a51c77007319 249 /** @defgroup SDIO_Wait_Interrupt_State
mbed_official 52:a51c77007319 250 * @{
mbed_official 52:a51c77007319 251 */
mbed_official 52:a51c77007319 252
mbed_official 52:a51c77007319 253 #define SDIO_Wait_No ((uint32_t)0x00000000) /*!< SDIO No Wait, TimeOut is enabled */
mbed_official 52:a51c77007319 254 #define SDIO_Wait_IT ((uint32_t)0x00000100) /*!< SDIO Wait Interrupt Request */
mbed_official 52:a51c77007319 255 #define SDIO_Wait_Pend ((uint32_t)0x00000200) /*!< SDIO Wait End of transfer */
mbed_official 52:a51c77007319 256 #define IS_SDIO_WAIT(WAIT) (((WAIT) == SDIO_Wait_No) || ((WAIT) == SDIO_Wait_IT) || \
mbed_official 52:a51c77007319 257 ((WAIT) == SDIO_Wait_Pend))
mbed_official 52:a51c77007319 258 /**
mbed_official 52:a51c77007319 259 * @}
mbed_official 52:a51c77007319 260 */
mbed_official 52:a51c77007319 261
mbed_official 52:a51c77007319 262 /** @defgroup SDIO_CPSM_State
mbed_official 52:a51c77007319 263 * @{
mbed_official 52:a51c77007319 264 */
mbed_official 52:a51c77007319 265
mbed_official 52:a51c77007319 266 #define SDIO_CPSM_Disable ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 267 #define SDIO_CPSM_Enable ((uint32_t)0x00000400)
mbed_official 52:a51c77007319 268 #define IS_SDIO_CPSM(CPSM) (((CPSM) == SDIO_CPSM_Enable) || ((CPSM) == SDIO_CPSM_Disable))
mbed_official 52:a51c77007319 269 /**
mbed_official 52:a51c77007319 270 * @}
mbed_official 52:a51c77007319 271 */
mbed_official 52:a51c77007319 272
mbed_official 52:a51c77007319 273 /** @defgroup SDIO_Response_Registers
mbed_official 52:a51c77007319 274 * @{
mbed_official 52:a51c77007319 275 */
mbed_official 52:a51c77007319 276
mbed_official 52:a51c77007319 277 #define SDIO_RESP1 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 278 #define SDIO_RESP2 ((uint32_t)0x00000004)
mbed_official 52:a51c77007319 279 #define SDIO_RESP3 ((uint32_t)0x00000008)
mbed_official 52:a51c77007319 280 #define SDIO_RESP4 ((uint32_t)0x0000000C)
mbed_official 52:a51c77007319 281 #define IS_SDIO_RESP(RESP) (((RESP) == SDIO_RESP1) || ((RESP) == SDIO_RESP2) || \
mbed_official 52:a51c77007319 282 ((RESP) == SDIO_RESP3) || ((RESP) == SDIO_RESP4))
mbed_official 52:a51c77007319 283 /**
mbed_official 52:a51c77007319 284 * @}
mbed_official 52:a51c77007319 285 */
mbed_official 52:a51c77007319 286
mbed_official 52:a51c77007319 287 /** @defgroup SDIO_Data_Length
mbed_official 52:a51c77007319 288 * @{
mbed_official 52:a51c77007319 289 */
mbed_official 52:a51c77007319 290
mbed_official 52:a51c77007319 291 #define IS_SDIO_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFF)
mbed_official 52:a51c77007319 292 /**
mbed_official 52:a51c77007319 293 * @}
mbed_official 52:a51c77007319 294 */
mbed_official 52:a51c77007319 295
mbed_official 52:a51c77007319 296 /** @defgroup SDIO_Data_Block_Size
mbed_official 52:a51c77007319 297 * @{
mbed_official 52:a51c77007319 298 */
mbed_official 52:a51c77007319 299
mbed_official 52:a51c77007319 300 #define SDIO_DataBlockSize_1b ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 301 #define SDIO_DataBlockSize_2b ((uint32_t)0x00000010)
mbed_official 52:a51c77007319 302 #define SDIO_DataBlockSize_4b ((uint32_t)0x00000020)
mbed_official 52:a51c77007319 303 #define SDIO_DataBlockSize_8b ((uint32_t)0x00000030)
mbed_official 52:a51c77007319 304 #define SDIO_DataBlockSize_16b ((uint32_t)0x00000040)
mbed_official 52:a51c77007319 305 #define SDIO_DataBlockSize_32b ((uint32_t)0x00000050)
mbed_official 52:a51c77007319 306 #define SDIO_DataBlockSize_64b ((uint32_t)0x00000060)
mbed_official 52:a51c77007319 307 #define SDIO_DataBlockSize_128b ((uint32_t)0x00000070)
mbed_official 52:a51c77007319 308 #define SDIO_DataBlockSize_256b ((uint32_t)0x00000080)
mbed_official 52:a51c77007319 309 #define SDIO_DataBlockSize_512b ((uint32_t)0x00000090)
mbed_official 52:a51c77007319 310 #define SDIO_DataBlockSize_1024b ((uint32_t)0x000000A0)
mbed_official 52:a51c77007319 311 #define SDIO_DataBlockSize_2048b ((uint32_t)0x000000B0)
mbed_official 52:a51c77007319 312 #define SDIO_DataBlockSize_4096b ((uint32_t)0x000000C0)
mbed_official 52:a51c77007319 313 #define SDIO_DataBlockSize_8192b ((uint32_t)0x000000D0)
mbed_official 52:a51c77007319 314 #define SDIO_DataBlockSize_16384b ((uint32_t)0x000000E0)
mbed_official 52:a51c77007319 315 #define IS_SDIO_BLOCK_SIZE(SIZE) (((SIZE) == SDIO_DataBlockSize_1b) || \
mbed_official 52:a51c77007319 316 ((SIZE) == SDIO_DataBlockSize_2b) || \
mbed_official 52:a51c77007319 317 ((SIZE) == SDIO_DataBlockSize_4b) || \
mbed_official 52:a51c77007319 318 ((SIZE) == SDIO_DataBlockSize_8b) || \
mbed_official 52:a51c77007319 319 ((SIZE) == SDIO_DataBlockSize_16b) || \
mbed_official 52:a51c77007319 320 ((SIZE) == SDIO_DataBlockSize_32b) || \
mbed_official 52:a51c77007319 321 ((SIZE) == SDIO_DataBlockSize_64b) || \
mbed_official 52:a51c77007319 322 ((SIZE) == SDIO_DataBlockSize_128b) || \
mbed_official 52:a51c77007319 323 ((SIZE) == SDIO_DataBlockSize_256b) || \
mbed_official 52:a51c77007319 324 ((SIZE) == SDIO_DataBlockSize_512b) || \
mbed_official 52:a51c77007319 325 ((SIZE) == SDIO_DataBlockSize_1024b) || \
mbed_official 52:a51c77007319 326 ((SIZE) == SDIO_DataBlockSize_2048b) || \
mbed_official 52:a51c77007319 327 ((SIZE) == SDIO_DataBlockSize_4096b) || \
mbed_official 52:a51c77007319 328 ((SIZE) == SDIO_DataBlockSize_8192b) || \
mbed_official 52:a51c77007319 329 ((SIZE) == SDIO_DataBlockSize_16384b))
mbed_official 52:a51c77007319 330 /**
mbed_official 52:a51c77007319 331 * @}
mbed_official 52:a51c77007319 332 */
mbed_official 52:a51c77007319 333
mbed_official 52:a51c77007319 334 /** @defgroup SDIO_Transfer_Direction
mbed_official 52:a51c77007319 335 * @{
mbed_official 52:a51c77007319 336 */
mbed_official 52:a51c77007319 337
mbed_official 52:a51c77007319 338 #define SDIO_TransferDir_ToCard ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 339 #define SDIO_TransferDir_ToSDIO ((uint32_t)0x00000002)
mbed_official 52:a51c77007319 340 #define IS_SDIO_TRANSFER_DIR(DIR) (((DIR) == SDIO_TransferDir_ToCard) || \
mbed_official 52:a51c77007319 341 ((DIR) == SDIO_TransferDir_ToSDIO))
mbed_official 52:a51c77007319 342 /**
mbed_official 52:a51c77007319 343 * @}
mbed_official 52:a51c77007319 344 */
mbed_official 52:a51c77007319 345
mbed_official 52:a51c77007319 346 /** @defgroup SDIO_Transfer_Type
mbed_official 52:a51c77007319 347 * @{
mbed_official 52:a51c77007319 348 */
mbed_official 52:a51c77007319 349
mbed_official 52:a51c77007319 350 #define SDIO_TransferMode_Block ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 351 #define SDIO_TransferMode_Stream ((uint32_t)0x00000004)
mbed_official 52:a51c77007319 352 #define IS_SDIO_TRANSFER_MODE(MODE) (((MODE) == SDIO_TransferMode_Stream) || \
mbed_official 52:a51c77007319 353 ((MODE) == SDIO_TransferMode_Block))
mbed_official 52:a51c77007319 354 /**
mbed_official 52:a51c77007319 355 * @}
mbed_official 52:a51c77007319 356 */
mbed_official 52:a51c77007319 357
mbed_official 52:a51c77007319 358 /** @defgroup SDIO_DPSM_State
mbed_official 52:a51c77007319 359 * @{
mbed_official 52:a51c77007319 360 */
mbed_official 52:a51c77007319 361
mbed_official 52:a51c77007319 362 #define SDIO_DPSM_Disable ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 363 #define SDIO_DPSM_Enable ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 364 #define IS_SDIO_DPSM(DPSM) (((DPSM) == SDIO_DPSM_Enable) || ((DPSM) == SDIO_DPSM_Disable))
mbed_official 52:a51c77007319 365 /**
mbed_official 52:a51c77007319 366 * @}
mbed_official 52:a51c77007319 367 */
mbed_official 52:a51c77007319 368
mbed_official 52:a51c77007319 369 /** @defgroup SDIO_Flags
mbed_official 52:a51c77007319 370 * @{
mbed_official 52:a51c77007319 371 */
mbed_official 52:a51c77007319 372
mbed_official 52:a51c77007319 373 #define SDIO_FLAG_CCRCFAIL ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 374 #define SDIO_FLAG_DCRCFAIL ((uint32_t)0x00000002)
mbed_official 52:a51c77007319 375 #define SDIO_FLAG_CTIMEOUT ((uint32_t)0x00000004)
mbed_official 52:a51c77007319 376 #define SDIO_FLAG_DTIMEOUT ((uint32_t)0x00000008)
mbed_official 52:a51c77007319 377 #define SDIO_FLAG_TXUNDERR ((uint32_t)0x00000010)
mbed_official 52:a51c77007319 378 #define SDIO_FLAG_RXOVERR ((uint32_t)0x00000020)
mbed_official 52:a51c77007319 379 #define SDIO_FLAG_CMDREND ((uint32_t)0x00000040)
mbed_official 52:a51c77007319 380 #define SDIO_FLAG_CMDSENT ((uint32_t)0x00000080)
mbed_official 52:a51c77007319 381 #define SDIO_FLAG_DATAEND ((uint32_t)0x00000100)
mbed_official 52:a51c77007319 382 #define SDIO_FLAG_STBITERR ((uint32_t)0x00000200)
mbed_official 52:a51c77007319 383 #define SDIO_FLAG_DBCKEND ((uint32_t)0x00000400)
mbed_official 52:a51c77007319 384 #define SDIO_FLAG_CMDACT ((uint32_t)0x00000800)
mbed_official 52:a51c77007319 385 #define SDIO_FLAG_TXACT ((uint32_t)0x00001000)
mbed_official 52:a51c77007319 386 #define SDIO_FLAG_RXACT ((uint32_t)0x00002000)
mbed_official 52:a51c77007319 387 #define SDIO_FLAG_TXFIFOHE ((uint32_t)0x00004000)
mbed_official 52:a51c77007319 388 #define SDIO_FLAG_RXFIFOHF ((uint32_t)0x00008000)
mbed_official 52:a51c77007319 389 #define SDIO_FLAG_TXFIFOF ((uint32_t)0x00010000)
mbed_official 52:a51c77007319 390 #define SDIO_FLAG_RXFIFOF ((uint32_t)0x00020000)
mbed_official 52:a51c77007319 391 #define SDIO_FLAG_TXFIFOE ((uint32_t)0x00040000)
mbed_official 52:a51c77007319 392 #define SDIO_FLAG_RXFIFOE ((uint32_t)0x00080000)
mbed_official 52:a51c77007319 393 #define SDIO_FLAG_TXDAVL ((uint32_t)0x00100000)
mbed_official 52:a51c77007319 394 #define SDIO_FLAG_RXDAVL ((uint32_t)0x00200000)
mbed_official 52:a51c77007319 395 #define SDIO_FLAG_SDIOIT ((uint32_t)0x00400000)
mbed_official 52:a51c77007319 396 #define SDIO_FLAG_CEATAEND ((uint32_t)0x00800000)
mbed_official 52:a51c77007319 397 #define IS_SDIO_FLAG(FLAG) (((FLAG) == SDIO_FLAG_CCRCFAIL) || \
mbed_official 52:a51c77007319 398 ((FLAG) == SDIO_FLAG_DCRCFAIL) || \
mbed_official 52:a51c77007319 399 ((FLAG) == SDIO_FLAG_CTIMEOUT) || \
mbed_official 52:a51c77007319 400 ((FLAG) == SDIO_FLAG_DTIMEOUT) || \
mbed_official 52:a51c77007319 401 ((FLAG) == SDIO_FLAG_TXUNDERR) || \
mbed_official 52:a51c77007319 402 ((FLAG) == SDIO_FLAG_RXOVERR) || \
mbed_official 52:a51c77007319 403 ((FLAG) == SDIO_FLAG_CMDREND) || \
mbed_official 52:a51c77007319 404 ((FLAG) == SDIO_FLAG_CMDSENT) || \
mbed_official 52:a51c77007319 405 ((FLAG) == SDIO_FLAG_DATAEND) || \
mbed_official 52:a51c77007319 406 ((FLAG) == SDIO_FLAG_STBITERR) || \
mbed_official 52:a51c77007319 407 ((FLAG) == SDIO_FLAG_DBCKEND) || \
mbed_official 52:a51c77007319 408 ((FLAG) == SDIO_FLAG_CMDACT) || \
mbed_official 52:a51c77007319 409 ((FLAG) == SDIO_FLAG_TXACT) || \
mbed_official 52:a51c77007319 410 ((FLAG) == SDIO_FLAG_RXACT) || \
mbed_official 52:a51c77007319 411 ((FLAG) == SDIO_FLAG_TXFIFOHE) || \
mbed_official 52:a51c77007319 412 ((FLAG) == SDIO_FLAG_RXFIFOHF) || \
mbed_official 52:a51c77007319 413 ((FLAG) == SDIO_FLAG_TXFIFOF) || \
mbed_official 52:a51c77007319 414 ((FLAG) == SDIO_FLAG_RXFIFOF) || \
mbed_official 52:a51c77007319 415 ((FLAG) == SDIO_FLAG_TXFIFOE) || \
mbed_official 52:a51c77007319 416 ((FLAG) == SDIO_FLAG_RXFIFOE) || \
mbed_official 52:a51c77007319 417 ((FLAG) == SDIO_FLAG_TXDAVL) || \
mbed_official 52:a51c77007319 418 ((FLAG) == SDIO_FLAG_RXDAVL) || \
mbed_official 52:a51c77007319 419 ((FLAG) == SDIO_FLAG_SDIOIT) || \
mbed_official 52:a51c77007319 420 ((FLAG) == SDIO_FLAG_CEATAEND))
mbed_official 52:a51c77007319 421
mbed_official 52:a51c77007319 422 #define IS_SDIO_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFF3FF800) == 0x00) && ((FLAG) != (uint32_t)0x00))
mbed_official 52:a51c77007319 423
mbed_official 52:a51c77007319 424 #define IS_SDIO_GET_IT(IT) (((IT) == SDIO_IT_CCRCFAIL) || \
mbed_official 52:a51c77007319 425 ((IT) == SDIO_IT_DCRCFAIL) || \
mbed_official 52:a51c77007319 426 ((IT) == SDIO_IT_CTIMEOUT) || \
mbed_official 52:a51c77007319 427 ((IT) == SDIO_IT_DTIMEOUT) || \
mbed_official 52:a51c77007319 428 ((IT) == SDIO_IT_TXUNDERR) || \
mbed_official 52:a51c77007319 429 ((IT) == SDIO_IT_RXOVERR) || \
mbed_official 52:a51c77007319 430 ((IT) == SDIO_IT_CMDREND) || \
mbed_official 52:a51c77007319 431 ((IT) == SDIO_IT_CMDSENT) || \
mbed_official 52:a51c77007319 432 ((IT) == SDIO_IT_DATAEND) || \
mbed_official 52:a51c77007319 433 ((IT) == SDIO_IT_STBITERR) || \
mbed_official 52:a51c77007319 434 ((IT) == SDIO_IT_DBCKEND) || \
mbed_official 52:a51c77007319 435 ((IT) == SDIO_IT_CMDACT) || \
mbed_official 52:a51c77007319 436 ((IT) == SDIO_IT_TXACT) || \
mbed_official 52:a51c77007319 437 ((IT) == SDIO_IT_RXACT) || \
mbed_official 52:a51c77007319 438 ((IT) == SDIO_IT_TXFIFOHE) || \
mbed_official 52:a51c77007319 439 ((IT) == SDIO_IT_RXFIFOHF) || \
mbed_official 52:a51c77007319 440 ((IT) == SDIO_IT_TXFIFOF) || \
mbed_official 52:a51c77007319 441 ((IT) == SDIO_IT_RXFIFOF) || \
mbed_official 52:a51c77007319 442 ((IT) == SDIO_IT_TXFIFOE) || \
mbed_official 52:a51c77007319 443 ((IT) == SDIO_IT_RXFIFOE) || \
mbed_official 52:a51c77007319 444 ((IT) == SDIO_IT_TXDAVL) || \
mbed_official 52:a51c77007319 445 ((IT) == SDIO_IT_RXDAVL) || \
mbed_official 52:a51c77007319 446 ((IT) == SDIO_IT_SDIOIT) || \
mbed_official 52:a51c77007319 447 ((IT) == SDIO_IT_CEATAEND))
mbed_official 52:a51c77007319 448
mbed_official 52:a51c77007319 449 #define IS_SDIO_CLEAR_IT(IT) ((((IT) & (uint32_t)0xFF3FF800) == 0x00) && ((IT) != (uint32_t)0x00))
mbed_official 52:a51c77007319 450
mbed_official 52:a51c77007319 451 /**
mbed_official 52:a51c77007319 452 * @}
mbed_official 52:a51c77007319 453 */
mbed_official 52:a51c77007319 454
mbed_official 52:a51c77007319 455 /** @defgroup SDIO_Read_Wait_Mode
mbed_official 52:a51c77007319 456 * @{
mbed_official 52:a51c77007319 457 */
mbed_official 52:a51c77007319 458
mbed_official 52:a51c77007319 459 #define SDIO_ReadWaitMode_CLK ((uint32_t)0x00000001)
mbed_official 52:a51c77007319 460 #define SDIO_ReadWaitMode_DATA2 ((uint32_t)0x00000000)
mbed_official 52:a51c77007319 461 #define IS_SDIO_READWAIT_MODE(MODE) (((MODE) == SDIO_ReadWaitMode_CLK) || \
mbed_official 52:a51c77007319 462 ((MODE) == SDIO_ReadWaitMode_DATA2))
mbed_official 52:a51c77007319 463 /**
mbed_official 52:a51c77007319 464 * @}
mbed_official 52:a51c77007319 465 */
mbed_official 52:a51c77007319 466
mbed_official 52:a51c77007319 467 /**
mbed_official 52:a51c77007319 468 * @}
mbed_official 52:a51c77007319 469 */
mbed_official 52:a51c77007319 470
mbed_official 52:a51c77007319 471 /** @defgroup SDIO_Exported_Macros
mbed_official 52:a51c77007319 472 * @{
mbed_official 52:a51c77007319 473 */
mbed_official 52:a51c77007319 474
mbed_official 52:a51c77007319 475 /**
mbed_official 52:a51c77007319 476 * @}
mbed_official 52:a51c77007319 477 */
mbed_official 52:a51c77007319 478
mbed_official 52:a51c77007319 479 /** @defgroup SDIO_Exported_Functions
mbed_official 52:a51c77007319 480 * @{
mbed_official 52:a51c77007319 481 */
mbed_official 52:a51c77007319 482
mbed_official 52:a51c77007319 483 void SDIO_DeInit(void);
mbed_official 52:a51c77007319 484 void SDIO_Init(SDIO_InitTypeDef* SDIO_InitStruct);
mbed_official 52:a51c77007319 485 void SDIO_StructInit(SDIO_InitTypeDef* SDIO_InitStruct);
mbed_official 52:a51c77007319 486 void SDIO_ClockCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 487 void SDIO_SetPowerState(uint32_t SDIO_PowerState);
mbed_official 52:a51c77007319 488 uint32_t SDIO_GetPowerState(void);
mbed_official 52:a51c77007319 489 void SDIO_ITConfig(uint32_t SDIO_IT, FunctionalState NewState);
mbed_official 52:a51c77007319 490 void SDIO_DMACmd(FunctionalState NewState);
mbed_official 52:a51c77007319 491 void SDIO_SendCommand(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct);
mbed_official 52:a51c77007319 492 void SDIO_CmdStructInit(SDIO_CmdInitTypeDef* SDIO_CmdInitStruct);
mbed_official 52:a51c77007319 493 uint8_t SDIO_GetCommandResponse(void);
mbed_official 52:a51c77007319 494 uint32_t SDIO_GetResponse(uint32_t SDIO_RESP);
mbed_official 52:a51c77007319 495 void SDIO_DataConfig(SDIO_DataInitTypeDef* SDIO_DataInitStruct);
mbed_official 52:a51c77007319 496 void SDIO_DataStructInit(SDIO_DataInitTypeDef* SDIO_DataInitStruct);
mbed_official 52:a51c77007319 497 uint32_t SDIO_GetDataCounter(void);
mbed_official 52:a51c77007319 498 uint32_t SDIO_ReadData(void);
mbed_official 52:a51c77007319 499 void SDIO_WriteData(uint32_t Data);
mbed_official 52:a51c77007319 500 uint32_t SDIO_GetFIFOCount(void);
mbed_official 52:a51c77007319 501 void SDIO_StartSDIOReadWait(FunctionalState NewState);
mbed_official 52:a51c77007319 502 void SDIO_StopSDIOReadWait(FunctionalState NewState);
mbed_official 52:a51c77007319 503 void SDIO_SetSDIOReadWaitMode(uint32_t SDIO_ReadWaitMode);
mbed_official 52:a51c77007319 504 void SDIO_SetSDIOOperation(FunctionalState NewState);
mbed_official 52:a51c77007319 505 void SDIO_SendSDIOSuspendCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 506 void SDIO_CommandCompletionCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 507 void SDIO_CEATAITCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 508 void SDIO_SendCEATACmd(FunctionalState NewState);
mbed_official 52:a51c77007319 509 FlagStatus SDIO_GetFlagStatus(uint32_t SDIO_FLAG);
mbed_official 52:a51c77007319 510 void SDIO_ClearFlag(uint32_t SDIO_FLAG);
mbed_official 52:a51c77007319 511 ITStatus SDIO_GetITStatus(uint32_t SDIO_IT);
mbed_official 52:a51c77007319 512 void SDIO_ClearITPendingBit(uint32_t SDIO_IT);
mbed_official 52:a51c77007319 513
mbed_official 52:a51c77007319 514 #ifdef __cplusplus
mbed_official 52:a51c77007319 515 }
mbed_official 52:a51c77007319 516 #endif
mbed_official 52:a51c77007319 517
mbed_official 52:a51c77007319 518 #endif /* __STM32F10x_SDIO_H */
mbed_official 52:a51c77007319 519 /**
mbed_official 52:a51c77007319 520 * @}
mbed_official 52:a51c77007319 521 */
mbed_official 52:a51c77007319 522
mbed_official 52:a51c77007319 523 /**
mbed_official 52:a51c77007319 524 * @}
mbed_official 52:a51c77007319 525 */
mbed_official 52:a51c77007319 526
mbed_official 52:a51c77007319 527 /**
mbed_official 52:a51c77007319 528 * @}
mbed_official 52:a51c77007319 529 */
mbed_official 52:a51c77007319 530
mbed_official 52:a51c77007319 531 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/