172 #define SDIO_OFFSET (SDIO_BASE - PERIPH_BASE)
176 #define CLKCR_OFFSET (SDIO_OFFSET + 0x04)
177 #define CLKEN_BitNumber 0x08
178 #define CLKCR_CLKEN_BB (PERIPH_BB_BASE + (CLKCR_OFFSET * 32) + (CLKEN_BitNumber * 4))
182 #define CMD_OFFSET (SDIO_OFFSET + 0x0C)
183 #define SDIOSUSPEND_BitNumber 0x0B
184 #define CMD_SDIOSUSPEND_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (SDIOSUSPEND_BitNumber * 4))
187 #define ENCMDCOMPL_BitNumber 0x0C
188 #define CMD_ENCMDCOMPL_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (ENCMDCOMPL_BitNumber * 4))
191 #define NIEN_BitNumber 0x0D
192 #define CMD_NIEN_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (NIEN_BitNumber * 4))
195 #define ATACMD_BitNumber 0x0E
196 #define CMD_ATACMD_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (ATACMD_BitNumber * 4))
200 #define DCTRL_OFFSET (SDIO_OFFSET + 0x2C)
201 #define DMAEN_BitNumber 0x03
202 #define DCTRL_DMAEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (DMAEN_BitNumber * 4))
205 #define RWSTART_BitNumber 0x08
206 #define DCTRL_RWSTART_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWSTART_BitNumber * 4))
209 #define RWSTOP_BitNumber 0x09
210 #define DCTRL_RWSTOP_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWSTOP_BitNumber * 4))
213 #define RWMOD_BitNumber 0x0A
214 #define DCTRL_RWMOD_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWMOD_BitNumber * 4))
217 #define SDIOEN_BitNumber 0x0B
218 #define DCTRL_SDIOEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (SDIOEN_BitNumber * 4))
223 #define CLKCR_CLEAR_MASK ((uint32_t)0xFFFF8100)
227 #define PWR_PWRCTRL_MASK ((uint32_t)0xFFFFFFFC)
231 #define DCTRL_CLEAR_MASK ((uint32_t)0xFFFFFF08)
235 #define CMD_CLEAR_MASK ((uint32_t)0xFFFFF800)
238 #define SDIO_RESP_ADDR ((uint32_t)(SDIO_BASE + 0x14))
284 assert_param(IS_SDIO_CLOCK_EDGE(SDIO_InitStruct->
SDIO_ClockEdge));
287 assert_param(IS_SDIO_BUS_WIDE(SDIO_InitStruct->
SDIO_BusWide));
292 tmpreg = SDIO->CLKCR;
295 tmpreg &= CLKCR_CLEAR_MASK;
308 SDIO->CLKCR = tmpreg;
337 assert_param(IS_FUNCTIONAL_STATE(NewState));
339 *(__IO uint32_t *) CLKCR_CLKEN_BB = (uint32_t)NewState;
353 assert_param(IS_SDIO_POWER_STATE(SDIO_PowerState));
355 SDIO->POWER = SDIO_PowerState;
369 return (SDIO->POWER & (~PWR_PWRCTRL_MASK));
404 assert_param(IS_SDIO_CMD_INDEX(SDIO_CmdInitStruct->
SDIO_CmdIndex));
405 assert_param(IS_SDIO_RESPONSE(SDIO_CmdInitStruct->
SDIO_Response));
406 assert_param(IS_SDIO_WAIT(SDIO_CmdInitStruct->
SDIO_Wait));
407 assert_param(IS_SDIO_CPSM(SDIO_CmdInitStruct->
SDIO_CPSM));
417 tmpreg &= CMD_CLEAR_MASK;
442 SDIO_CmdInitStruct->
SDIO_CPSM = SDIO_CPSM_Disable;
452 return (uint8_t)(SDIO->RESPCMD);
467 __IO uint32_t tmp = 0;
470 assert_param(IS_SDIO_RESP(SDIO_RESP));
472 tmp = SDIO_RESP_ADDR + SDIO_RESP;
474 return (*(__IO uint32_t *) tmp);
508 assert_param(IS_SDIO_DATA_LENGTH(SDIO_DataInitStruct->
SDIO_DataLength));
512 assert_param(IS_SDIO_DPSM(SDIO_DataInitStruct->
SDIO_DPSM));
524 tmpreg = SDIO->DCTRL;
526 tmpreg &= DCTRL_CLEAR_MASK;
535 SDIO->DCTRL = tmpreg;
552 SDIO_DataInitStruct->
SDIO_DPSM = SDIO_DPSM_Disable;
592 return SDIO->FIFOCNT;
622 assert_param(IS_FUNCTIONAL_STATE(NewState));
624 *(__IO uint32_t *) DCTRL_RWSTART_BB = (uint32_t) NewState;
636 assert_param(IS_FUNCTIONAL_STATE(NewState));
638 *(__IO uint32_t *) DCTRL_RWSTOP_BB = (uint32_t) NewState;
652 assert_param(IS_SDIO_READWAIT_MODE(SDIO_ReadWaitMode));
654 *(__IO uint32_t *) DCTRL_RWMOD_BB = SDIO_ReadWaitMode;
666 assert_param(IS_FUNCTIONAL_STATE(NewState));
668 *(__IO uint32_t *) DCTRL_SDIOEN_BB = (uint32_t)NewState;
680 assert_param(IS_FUNCTIONAL_STATE(NewState));
682 *(__IO uint32_t *) CMD_SDIOSUSPEND_BB = (uint32_t)NewState;
712 assert_param(IS_FUNCTIONAL_STATE(NewState));
714 *(__IO uint32_t *) CMD_ENCMDCOMPL_BB = (uint32_t)NewState;
726 assert_param(IS_FUNCTIONAL_STATE(NewState));
728 *(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)((~((uint32_t)NewState)) & ((uint32_t)0x1));
740 assert_param(IS_FUNCTIONAL_STATE(NewState));
742 *(__IO uint32_t *) CMD_ATACMD_BB = (uint32_t)NewState;
772 assert_param(IS_FUNCTIONAL_STATE(NewState));
774 *(__IO uint32_t *) DCTRL_DMAEN_BB = (uint32_t)NewState;
830 assert_param(IS_SDIO_IT(SDIO_IT));
831 assert_param(IS_FUNCTIONAL_STATE(NewState));
833 if (NewState != DISABLE)
836 SDIO->MASK |= SDIO_IT;
841 SDIO->MASK &= ~SDIO_IT;
877 FlagStatus bitstatus = RESET;
880 assert_param(IS_SDIO_FLAG(SDIO_FLAG));
882 if ((SDIO->STA & SDIO_FLAG) != (uint32_t)RESET)
915 assert_param(IS_SDIO_CLEAR_FLAG(SDIO_FLAG));
917 SDIO->ICR = SDIO_FLAG;
953 ITStatus bitstatus = RESET;
956 assert_param(IS_SDIO_GET_IT(SDIO_IT));
957 if ((SDIO->STA & SDIO_IT) != (uint32_t)RESET)
990 assert_param(IS_SDIO_CLEAR_IT(SDIO_IT));
This file contains all the functions prototypes for the RCC firmware library.
void SDIO_WriteData(uint32_t Data)
Write one data word to Tx FIFO.
void SDIO_SetPowerState(uint32_t SDIO_PowerState)
Sets the power status of the controller.
uint32_t SDIO_GetFIFOCount(void)
Returns the number of words left to be written to or read from FIFO.
uint32_t SDIO_HardwareFlowControl
uint32_t SDIO_TransferDir
uint32_t SDIO_DataTimeOut
uint32_t SDIO_GetPowerState(void)
Gets the power status of the controller.
void SDIO_ClearFlag(uint32_t SDIO_FLAG)
Clears the SDIO's pending flags.
void SDIO_SendCEATACmd(FunctionalState NewState)
Sends CE-ATA command (CMD61).
uint32_t SDIO_ClockPowerSave
ITStatus SDIO_GetITStatus(uint32_t SDIO_IT)
Checks whether the specified SDIO interrupt has occurred or not.
uint32_t SDIO_TransferMode
void SDIO_SetSDIOReadWaitMode(uint32_t SDIO_ReadWaitMode)
Sets one of the two options of inserting read wait interval.
void SDIO_CEATAITCmd(FunctionalState NewState)
Enables or disables the CE-ATA interrupt.
uint32_t SDIO_ReadData(void)
Read one data word from Rx FIFO.
uint32_t SDIO_ClockBypass
void SDIO_StructInit(SDIO_InitTypeDef *SDIO_InitStruct)
Fills each SDIO_InitStruct member with its default value.
void SDIO_DataConfig(SDIO_DataInitTypeDef *SDIO_DataInitStruct)
Initializes the SDIO data path according to the specified parameters in the SDIO_DataInitStruct.
void SDIO_SetSDIOOperation(FunctionalState NewState)
Enables or disables the SD I/O Mode Operation.
uint8_t SDIO_GetCommandResponse(void)
Returns command index of last command for which response received.
uint32_t SDIO_GetDataCounter(void)
Returns number of remaining data bytes to be transferred.
This file contains all the functions prototypes for the SDIO firmware library.
void SDIO_StartSDIOReadWait(FunctionalState NewState)
Starts the SD I/O Read Wait operation.
void SDIO_CmdStructInit(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct)
Fills each SDIO_CmdInitStruct member with its default value.
void SDIO_ITConfig(uint32_t SDIO_IT, FunctionalState NewState)
Enables or disables the SDIO interrupts.
FlagStatus SDIO_GetFlagStatus(uint32_t SDIO_FLAG)
Checks whether the specified SDIO flag is set or not.
void SDIO_SendCommand(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct)
Initializes the SDIO Command according to the specified parameters in the SDIO_CmdInitStruct and send...
void SDIO_DeInit(void)
Deinitializes the SDIO peripheral registers to their default reset values.
void SDIO_SendSDIOSuspendCmd(FunctionalState NewState)
Enables or disables the SD I/O Mode suspend command sending.
void SDIO_Init(SDIO_InitTypeDef *SDIO_InitStruct)
Initializes the SDIO peripheral according to the specified parameters in the SDIO_InitStruct.
void SDIO_ClearITPendingBit(uint32_t SDIO_IT)
Clears the SDIO's interrupt pending bits.
void SDIO_CommandCompletionCmd(FunctionalState NewState)
Enables or disables the command completion signal.
void SDIO_DMACmd(FunctionalState NewState)
Enables or disables the SDIO DMA request.
void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
Forces or releases High Speed APB (APB2) peripheral reset.
uint32_t SDIO_DataBlockSize
void SDIO_DataStructInit(SDIO_DataInitTypeDef *SDIO_DataInitStruct)
Fills each SDIO_DataInitStruct member with its default value.
void SDIO_ClockCmd(FunctionalState NewState)
Enables or disables the SDIO Clock.
void SDIO_StopSDIOReadWait(FunctionalState NewState)
Stops the SD I/O Read Wait operation.
uint32_t SDIO_GetResponse(uint32_t SDIO_RESP)
Returns response received from the card for the last command.