mbed SDK library sources

Fork of mbed-src by mbed official

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Mon Feb 03 09:30:05 2014 +0000
Revision:
84:f54042cbc282
Parent:
70:c1fbde68b492
Synchronized with git revision bbbd8699601c42149ccf0c37bc42bb6856ccc4c6

Full URL: https://github.com/mbedmicro/mbed/commit/bbbd8699601c42149ccf0c37bc42bb6856ccc4c6/

[NUCLEO_L152RE/F030_R8] SPI, I2C, Ticker, PWM updates

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