![]() |
LPCOpen Platform for LPC18XX/43XX microcontrollers
18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
|
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... | |
| #define CMD0 (0 | (1 << 15)) |
List of commands.
Definition at line 74 of file sdio_18xx_43xx.h.
| #define CMD3 (3 | SDIO_CMD_RESP_R6) |
Definition at line 76 of file sdio_18xx_43xx.h.
| #define CMD5 (5 | SDIO_CMD_RESP_R4) |
Definition at line 75 of file sdio_18xx_43xx.h.
| #define CMD52 (52 | SDIO_CMD_RESP_R5 | SDIO_CMD_CRC) |
Definition at line 78 of file sdio_18xx_43xx.h.
| #define CMD53 (53 | SDIO_CMD_RESP_R5 | SDIO_CMD_DATA | SDIO_CMD_CRC) |
Definition at line 79 of file sdio_18xx_43xx.h.
| #define CMD7 (7 | SDIO_CMD_RESP_R1) |
Definition at line 77 of file sdio_18xx_43xx.h.
| #define SDIO_AREA_CIA 0 /* function 0 */ |
Definition at line 114 of file sdio_18xx_43xx.h.
| #define SDIO_CCCR_4BLS 0x80u /* 4-bit support for low-speed cards */ |
Definition at line 118 of file sdio_18xx_43xx.h.
| #define SDIO_CCCR_LSC 0x40u /* card is low-speed cards */ |
Definition at line 117 of file sdio_18xx_43xx.h.
| #define SDIO_CLK_FULLSPEED 16000000UL /* Full-Speed Clock */ |
Definition at line 123 of file sdio_18xx_43xx.h.
| #define SDIO_CLK_HISPEED 33000000UL /* High-Speed Clock */ |
Definition at line 122 of file sdio_18xx_43xx.h.
| #define SDIO_CLK_LOWSPEED 400000 /* Low-Speed Clock */ |
Definition at line 124 of file sdio_18xx_43xx.h.
| #define SDIO_CMD_CRC (1UL << 8) /**! Response must have a valid CRC */ |
SDIO Command misc options.
Definition at line 70 of file sdio_18xx_43xx.h.
| #define SDIO_CMD_DATA (1UL << 9) /**! Command is a data transfer command */ |
Definition at line 71 of file sdio_18xx_43xx.h.
| #define SDIO_CMD_RESP_R1 (1UL << 6) |
SDIO Command Responses.
Definition at line 62 of file sdio_18xx_43xx.h.
| #define SDIO_CMD_RESP_R2 (3UL << 6) |
Definition at line 63 of file sdio_18xx_43xx.h.
| #define SDIO_CMD_RESP_R3 (1UL << 6) |
Definition at line 64 of file sdio_18xx_43xx.h.
| #define SDIO_CMD_RESP_R4 (1UL << 6) |
Definition at line 65 of file sdio_18xx_43xx.h.
| #define SDIO_CMD_RESP_R5 (1UL << 6) |
Definition at line 66 of file sdio_18xx_43xx.h.
| #define SDIO_CMD_RESP_R6 (1UL << 6) |
Definition at line 67 of file sdio_18xx_43xx.h.
| #define SDIO_ERR_FNUM -2 /**! Error getting Number of functions supported */ |
Definition at line 83 of file sdio_18xx_43xx.h.
| #define SDIO_ERR_INVARG -7 /**! Invalid argument supplied to function */ |
Definition at line 88 of file sdio_18xx_43xx.h.
| #define SDIO_ERR_INVFUNC -6 /**! Invalid function argument */ |
Definition at line 87 of file sdio_18xx_43xx.h.
| #define SDIO_ERR_RCA -5 /**! Error during RCA phase */ |
Definition at line 86 of file sdio_18xx_43xx.h.
| #define SDIO_ERR_READWRITE -3 /**! Error when performing Read/write of data */ |
Definition at line 84 of file sdio_18xx_43xx.h.
| #define SDIO_ERR_VOLT -4 /**! Error Reading or setting up the voltage to 3v3 */ |
Definition at line 85 of file sdio_18xx_43xx.h.
| #define SDIO_ERROR -1 /**! General SDIO Error */ |
SDIO Error numbers.
Definition at line 82 of file sdio_18xx_43xx.h.
| #define SDIO_MODE_BLOCK (1UL << 27) |
Block mode transfer flag.
When this flag is specified in a transfer the data will be transfered in blocks if not it will be transfered in bytes. See SDIO_Card_DataRead(), SDIO_Card_DataWrite() for more information.
Definition at line 99 of file sdio_18xx_43xx.h.
| #define SDIO_MODE_BUFFER (1UL << 26) |
Buffer mode transfer flag.
Default mode for SDIO_Card_ReadData() and SDIO_Card_WriteData() is FIFO mode in FIFO mode all the given data will be written to or read from the same register address in the function. This flag will set the transfers to BUFFER mode; in BUFFER mode read first byte will be read from the given source address and the next byte will be read from the next source address (i.e src_addr + 1), and so on, in BUFFER mode write first byte will be written to dest_addr, next byte will be written to dest_addr + 1 and so on.
Definition at line 111 of file sdio_18xx_43xx.h.
| #define SDIO_POWER_INIT 1 |
Definition at line 120 of file sdio_18xx_43xx.h.
| #define SDIO_VOLT_3_3 0x00100000UL /* for CMD5 */ |
Definition at line 90 of file sdio_18xx_43xx.h.
| enum SDIO_EVENT |
SDIO Driver events.
Definition at line 45 of file sdio_18xx_43xx.h.
| int SDIO_Card_DisableInt | ( | LPC_SDMMC_T * | pSDMMC, |
| uint32_t | func | ||
| ) |
Disable SDIO interrupt for a given function.
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
Definition at line 302 of file sdio_18xx_43xx.c.
| int SDIO_Card_EnableInt | ( | LPC_SDMMC_T * | pSDMMC, |
| uint32_t | func | ||
| ) |
Enable SDIO interrupt for a given function.
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
Definition at line 283 of file sdio_18xx_43xx.c.
| uint32_t SDIO_Card_GetBlockSize | ( | LPC_SDMMC_T * | pSDMMC, |
| uint32_t | func | ||
| ) |
Gets the block size of a given function.
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
Definition at line 184 of file sdio_18xx_43xx.c.
| int SDIO_Card_Init | ( | LPC_SDMMC_T * | pSDMMC, |
| uint32_t | freq | ||
| ) |
Initialize the SDIO card.
| pSDMMC | : SDMMC peripheral selected |
| freq | : Initial frequency to use during the enumeration |
Definition at line 326 of file sdio_18xx_43xx.c.
| 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].
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
| dest_addr | : memory where the data to be read into |
| src_addr | : Register address from which data to be read (inside func register space) |
| size | : Number of Bytes/Blocks to be transfered [Must be in the range 1 to 512] |
| flags | : Or-ed value of SDIO_MODE_BLOCK, SDIO_MODE_BUFFER |
Definition at line 239 of file sdio_18xx_43xx.c.
| int SDIO_Card_SetBlockSize | ( | LPC_SDMMC_T * | pSDMMC, |
| uint32_t | func, | ||
| uint32_t | blkSize | ||
| ) |
Sets the block size of a given function.
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
| blkSize | : Block size to set |
Definition at line 160 of file sdio_18xx_43xx.c.
| 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].
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
| dest_addr | : Address where the data to be written (inside func register space) |
| src_addr | : Buffer from which data to be taken |
| size | : Number of Bytes/Blocks to be transfered [Must be in the range 1 to 512] |
| flags | : Or-ed value of SDIO_MODE_BLOCK, SDIO_MODE_BUFFER |
Definition at line 193 of file sdio_18xx_43xx.c.
| void SDIO_Handler | ( | LPC_SDMMC_T * | pSDMMC | ) |
SDIO Event handler [Should be called from SDIO interrupt handler].
| pSDMMC | : SDMMC peripheral selected |
Definition at line 479 of file sdio_18xx_43xx.c.
| 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.
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
| addr | : Address of the register to read |
| data | : Pointer to memory where the 8-bit data be stored |
Definition at line 424 of file sdio_18xx_43xx.c.
| uint32_t SDIO_Send_Command | ( | LPC_SDMMC_T * | pSDMMC, |
| uint32_t | cmd, | ||
| uint32_t | arg | ||
| ) |
Sends a command to the SDIO Card [Example CMD52].
| pSDMMC | : SDMMC peripheral selected |
| cmd | : Command to be sent along with any flags |
| arg | : Argument for the command |
Definition at line 454 of file sdio_18xx_43xx.c.
| void SDIO_Setup_Callback | ( | LPC_SDMMC_T * | pSDMMC, |
| void(*)(LPC_SDMMC_T *pSDMMC, uint32_t event, void *arg) | wake_evt, | ||
| uint32_t(*)(LPC_SDMMC_T *pSDMMC, uint32_t event, void *arg) | wait_evt | ||
| ) |
Setup SDIO wait and wakeup callbacks.
| pSDMMC | : SDMMC peripheral selected |
| wake_evt | : Wakeup event call-back handler |
| wait_evt | : Wait event call-back handler |
Definition at line 445 of file sdio_18xx_43xx.c.
| 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.
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
| addr | : Address of the register to read |
| data | : 8-bit data be written |
Definition at line 381 of file sdio_18xx_43xx.c.
| 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.
| pSDMMC | : SDMMC peripheral selected |
| func | : function number [0 to 7] [0 = CIA function] |
| addr | : Address of the register to read |
| data | : Pointer to memory where the 8-bit data be stored |
Definition at line 402 of file sdio_18xx_43xx.c.
1.8.3.1