LPCOpen Platform for LPC18XX/43XX microcontrollers  18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
Macros | Enumerations | Functions
sdio_18xx_43xx.h File Reference

Go to the source code of this file.

Macros

#define SDIO_CMD_RESP_R1   (1UL << 6)
 SDIO Command Responses. More...
 
#define SDIO_CMD_RESP_R2   (3UL << 6)
 
#define SDIO_CMD_RESP_R3   (1UL << 6)
 
#define SDIO_CMD_RESP_R4   (1UL << 6)
 
#define SDIO_CMD_RESP_R5   (1UL << 6)
 
#define SDIO_CMD_RESP_R6   (1UL << 6)
 
#define SDIO_CMD_CRC   (1UL << 8) /**! Response must have a valid CRC */
 SDIO Command misc options. More...
 
#define SDIO_CMD_DATA   (1UL << 9) /**! Command is a data transfer command */
 
#define CMD0   (0 | (1 << 15))
 List of commands. More...
 
#define CMD5   (5 | SDIO_CMD_RESP_R4)
 
#define CMD3   (3 | SDIO_CMD_RESP_R6)
 
#define CMD7   (7 | SDIO_CMD_RESP_R1)
 
#define CMD52   (52 | SDIO_CMD_RESP_R5 | SDIO_CMD_CRC)
 
#define CMD53   (53 | SDIO_CMD_RESP_R5 | SDIO_CMD_DATA | SDIO_CMD_CRC)
 
#define SDIO_ERROR   -1 /**! General SDIO Error */
 SDIO Error numbers. More...
 
#define SDIO_ERR_FNUM   -2 /**! Error getting Number of functions supported */
 
#define SDIO_ERR_READWRITE   -3 /**! Error when performing Read/write of data */
 
#define SDIO_ERR_VOLT   -4 /**! Error Reading or setting up the voltage to 3v3 */
 
#define SDIO_ERR_RCA   -5 /**! Error during RCA phase */
 
#define SDIO_ERR_INVFUNC   -6 /**! Invalid function argument */
 
#define SDIO_ERR_INVARG   -7 /**! Invalid argument supplied to function */
 
#define SDIO_VOLT_3_3   0x00100000UL /* for CMD5 */
 
#define SDIO_MODE_BLOCK   (1UL << 27)
 Block mode transfer flag. More...
 
#define SDIO_MODE_BUFFER   (1UL << 26)
 Buffer mode transfer flag. More...
 
#define SDIO_AREA_CIA   0 /* function 0 */
 
#define SDIO_CCCR_LSC   0x40u /* card is low-speed cards */
 
#define SDIO_CCCR_4BLS   0x80u /* 4-bit support for low-speed cards */
 
#define SDIO_POWER_INIT   1
 
#define SDIO_CLK_HISPEED   33000000UL /* High-Speed Clock */
 
#define SDIO_CLK_FULLSPEED   16000000UL /* Full-Speed Clock */
 
#define SDIO_CLK_LOWSPEED   400000 /* Low-Speed Clock */
 

Enumerations

enum  SDIO_EVENT {
  SDIO_START_COMMAND, SDIO_START_DATA, SDIO_WAIT_DELAY, SDIO_WAIT_COMMAND,
  SDIO_WAIT_DATA, SDIO_CARD_DETECT, SDIO_CMD_ERR, SDIO_CMD_DONE,
  SDIO_DATA_ERR, SDIO_DATA_DONE, SDIO_CARD_INT
}
 SDIO Driver events. More...
 

Functions

int SDIO_Card_Init (LPC_SDMMC_T *pSDMMC, uint32_t freq)
 Initialize the SDIO card. More...
 
int SDIO_Write_Direct (LPC_SDMMC_T *pSDMMC, uint32_t func, uint32_t addr, uint32_t data)
 Write 8-Bit register from SDIO register space. More...
 
int SDIO_WriteRead_Direct (LPC_SDMMC_T *pSDMMC, uint32_t func, uint32_t addr, uint32_t *data)
 Write 8-Bit register from SDIO register space and read the register back. More...
 
int SDIO_Read_Direct (LPC_SDMMC_T *pSDMMC, uint32_t func, uint32_t addr, uint32_t *data)
 Read an 8-Bit register from SDIO register space. More...
 
void SDIO_Setup_Callback (LPC_SDMMC_T *pSDMMC, void(*wake_evt)(LPC_SDMMC_T *pSDMMC, uint32_t event, void *arg), uint32_t(*wait_evt)(LPC_SDMMC_T *pSDMMC, uint32_t event, void *arg))
 Setup SDIO wait and wakeup callbacks. More...
 
void SDIO_Handler (LPC_SDMMC_T *pSDMMC)
 SDIO Event handler [Should be called from SDIO interrupt handler]. More...
 
uint32_t SDIO_Send_Command (LPC_SDMMC_T *pSDMMC, uint32_t cmd, uint32_t arg)
 Sends a command to the SDIO Card [Example CMD52]. More...
 
uint32_t SDIO_Card_GetBlockSize (LPC_SDMMC_T *pSDMMC, uint32_t func)
 Gets the block size of a given function. More...
 
int SDIO_Card_SetBlockSize (LPC_SDMMC_T *pSDMMC, uint32_t func, uint32_t blkSize)
 Sets the block size of a given function. More...
 
int SDIO_Card_WriteData (LPC_SDMMC_T *pSDMMC, uint32_t func, uint32_t dest_addr, const uint8_t *src_addr, uint32_t size, uint32_t flags)
 Writes stream or block of data to the SDIO card [Using CMD53]. More...
 
int SDIO_Card_ReadData (LPC_SDMMC_T *pSDMMC, uint32_t func, uint8_t *dest_addr, uint32_t src_addr, uint32_t size, uint32_t flags)
 Reads stream or block of data from the SDIO card [Using CMD53]. More...
 
int SDIO_Card_DisableInt (LPC_SDMMC_T *pSDMMC, uint32_t func)
 Disable SDIO interrupt for a given function. More...
 
int SDIO_Card_EnableInt (LPC_SDMMC_T *pSDMMC, uint32_t func)
 Enable SDIO interrupt for a given function. More...