MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | sdio_card_t |
SDIO card state. More... | |
Macros | |
#define | FSL_SDIO_DRIVER_VERSION (MAKE_VERSION(2U, 2U, 13U)) /*2.2.13*/ |
Middleware version. More... | |
#define | FSL_SDIO_MAX_IO_NUMS (7U) |
sdio device support maximum IO number | |
Typedefs | |
typedef void(* | sdio_io_irq_handler_t )(sdio_card_t *card, uint32_t func) |
sdio io handler | |
Enumerations | |
enum | sdio_io_direction_t { kSDIO_IORead = 0U, kSDIO_IOWrite = 1U } |
sdio io read/write direction More... | |
Variables | |
SDMMCHOST_CONFIG | sdio_card_t::host |
Host information. | |
sdiocard_usr_param_t | sdio_card_t::usrParam |
user parameter | |
bool | sdio_card_t::noInternalAlign |
use this flag to disable sdmmc align. More... | |
bool | sdio_card_t::isHostReady |
use this flag to indicate if need host re-init or not | |
bool | sdio_card_t::memPresentFlag |
indicate if memory present | |
uint32_t | sdio_card_t::busClock_Hz |
SD bus clock frequency united in Hz. | |
uint32_t | sdio_card_t::relativeAddress |
Relative address of the card. | |
uint8_t | sdio_card_t::sdVersion |
SD version. | |
sd_timing_mode_t | sdio_card_t::currentTiming |
current timing mode | |
sd_driver_strength_t | sdio_card_t::driverStrength |
driver strength | |
sd_max_current_t | sdio_card_t::maxCurrent |
card current limit | |
sdmmc_operation_voltage_t | sdio_card_t::operationVoltage |
card operation voltage | |
uint8_t | sdio_card_t::sdioVersion |
SDIO version. | |
uint8_t | sdio_card_t::cccrVersioin |
CCCR version. | |
uint8_t | sdio_card_t::ioTotalNumber |
total number of IO function | |
uint32_t | sdio_card_t::cccrflags |
Flags in _sd_card_flag. | |
uint32_t | sdio_card_t::io0blockSize |
record the io0 block size | |
uint32_t | sdio_card_t::ocr |
Raw OCR content, only 24bit avalible for SDIO card. | |
uint32_t | sdio_card_t::commonCISPointer |
point to common CIS | |
sdio_common_cis_t | sdio_card_t::commonCIS |
CIS table. | |
sdio_fbr_t | sdio_card_t::ioFBR [FSL_SDIO_MAX_IO_NUMS] |
FBR table. | |
sdio_func_cis_t | sdio_card_t::funcCIS [FSL_SDIO_MAX_IO_NUMS] |
function CIS table | |
sdio_io_irq_handler_t | sdio_card_t::ioIRQHandler [FSL_SDIO_MAX_IO_NUMS] |
io IRQ handler | |
uint8_t | sdio_card_t::ioIntIndex |
used to record current enabled io interrupt index | |
uint8_t | sdio_card_t::ioIntNums |
used to record total enabled io interrupt numbers | |
Initialization and deinitialization | |
status_t | SDIO_Init (sdio_card_t *card) |
SDIO card init function. More... | |
void | SDIO_Deinit (sdio_card_t *card) |
SDIO card deinit, include card and host deinit. More... | |
status_t | SDIO_CardInit (sdio_card_t *card) |
Initializes the card. More... | |
void | SDIO_CardDeinit (sdio_card_t *card) |
Deinitializes the card. More... | |
status_t | SDIO_HostInit (sdio_card_t *card) |
initialize the host. More... | |
void | SDIO_HostDeinit (sdio_card_t *card) |
Deinitializes the host. More... | |
void | SDIO_HostReset (SDMMCHOST_CONFIG *host) |
reset the host. More... | |
void | SDIO_PowerOnCard (SDMMCHOST_TYPE *base, const sdmmchost_pwr_card_t *pwr) |
power on card. More... | |
void | SDIO_PowerOffCard (SDMMCHOST_TYPE *base, const sdmmchost_pwr_card_t *pwr) |
power on card. More... | |
status_t | SDIO_CardInActive (sdio_card_t *card) |
set SDIO card to inactive state More... | |
status_t | SDIO_GetCardCapability (sdio_card_t *card, sdio_func_num_t func) |
get SDIO card capability More... | |
status_t | SDIO_SetBlockSize (sdio_card_t *card, sdio_func_num_t func, uint32_t blockSize) |
set SDIO card block size More... | |
status_t | SDIO_CardReset (sdio_card_t *card) |
set SDIO card reset More... | |
status_t | SDIO_SetDataBusWidth (sdio_card_t *card, sdio_bus_width_t busWidth) |
set SDIO card data bus width More... | |
status_t | SDIO_SwitchToHighSpeed (sdio_card_t *card) |
switch the card to high speed More... | |
status_t | SDIO_ReadCIS (sdio_card_t *card, sdio_func_num_t func, const uint32_t *tupleList, uint32_t tupleNum) |
read SDIO card CIS for each function More... | |
status_t | SDIO_WaitCardDetectStatus (SDMMCHOST_TYPE *hostBase, const sdmmchost_detect_card_t *cd, bool waitCardStatus) |
sdio wait card detect function. More... | |
bool | SDIO_IsCardPresent (sdio_card_t *card) |
sdio card present check function. More... | |
IO operations | |
status_t | SDIO_IO_Write_Direct (sdio_card_t *card, sdio_func_num_t func, uint32_t regAddr, uint8_t *data, bool raw) |
IO direct write transfer function. More... | |
status_t | SDIO_IO_Read_Direct (sdio_card_t *card, sdio_func_num_t func, uint32_t regAddr, uint8_t *data) |
IO direct read transfer function. More... | |
status_t | SDIO_IO_RW_Direct (sdio_card_t *card, sdio_io_direction_t direction, sdio_func_num_t func, uint32_t regAddr, uint8_t dataIn, uint8_t *dataOut) |
IO direct read/write transfer function. More... | |
status_t | SDIO_IO_Write_Extended (sdio_card_t *card, sdio_func_num_t func, uint32_t regAddr, uint8_t *buffer, uint32_t count, uint32_t flags) |
IO extended write transfer function. More... | |
status_t | SDIO_IO_Read_Extended (sdio_card_t *card, sdio_func_num_t func, uint32_t regAddr, uint8_t *buffer, uint32_t count, uint32_t flags) |
IO extended read transfer function. More... | |
status_t | SDIO_EnableIOInterrupt (sdio_card_t *card, sdio_func_num_t func, bool enable) |
enable IO interrupt More... | |
status_t | SDIO_EnableIO (sdio_card_t *card, sdio_func_num_t func, bool enable) |
enable IO and wait IO ready More... | |
status_t | SDIO_SelectIO (sdio_card_t *card, sdio_func_num_t func) |
select IO More... | |
status_t | SDIO_AbortIO (sdio_card_t *card, sdio_func_num_t func) |
Abort IO transfer. More... | |
status_t | SDIO_SetDriverStrength (sdio_card_t *card, sd_driver_strength_t driverStrength) |
Set driver strength. More... | |
status_t | SDIO_EnableAsyncInterrupt (sdio_card_t *card, bool enable) |
Enable/Disable Async interrupt. More... | |
status_t | SDIO_GetPendingInterrupt (sdio_card_t *card, uint8_t *pendingInt) |
Get pending interrupt. More... | |
status_t | SDIO_IO_Transfer (sdio_card_t *card, sdio_command_t cmd, uint32_t argument, uint32_t blockSize, uint8_t *txData, uint8_t *rxData, uint16_t dataSize, uint32_t *response) |
sdio card io transfer function. More... | |
void | SDIO_SetIOIRQHandler (sdio_card_t *card, sdio_func_num_t func, sdio_io_irq_handler_t handler) |
sdio set io IRQ handler. More... | |
The SDIO card driver provide card initialization/IO direct and extend command interface.
Not support yet
struct _sdio_card |
sdio card descriptor
Define the card structure including the necessary fields to identify and describe the card.
Data Fields | |
SDMMCHOST_CONFIG | host |
Host information. | |
sdiocard_usr_param_t | usrParam |
user parameter | |
bool | noInternalAlign |
use this flag to disable sdmmc align. More... | |
bool | isHostReady |
use this flag to indicate if need host re-init or not | |
bool | memPresentFlag |
indicate if memory present | |
uint32_t | busClock_Hz |
SD bus clock frequency united in Hz. | |
uint32_t | relativeAddress |
Relative address of the card. | |
uint8_t | sdVersion |
SD version. | |
sd_timing_mode_t | currentTiming |
current timing mode | |
sd_driver_strength_t | driverStrength |
driver strength | |
sd_max_current_t | maxCurrent |
card current limit | |
sdmmc_operation_voltage_t | operationVoltage |
card operation voltage | |
uint8_t | sdioVersion |
SDIO version. | |
uint8_t | cccrVersioin |
CCCR version. | |
uint8_t | ioTotalNumber |
total number of IO function | |
uint32_t | cccrflags |
Flags in _sd_card_flag. | |
uint32_t | io0blockSize |
record the io0 block size | |
uint32_t | ocr |
Raw OCR content, only 24bit avalible for SDIO card. | |
uint32_t | commonCISPointer |
point to common CIS | |
sdio_common_cis_t | commonCIS |
CIS table. | |
sdio_fbr_t | ioFBR [FSL_SDIO_MAX_IO_NUMS] |
FBR table. | |
sdio_func_cis_t | funcCIS [FSL_SDIO_MAX_IO_NUMS] |
function CIS table | |
sdio_io_irq_handler_t | ioIRQHandler [FSL_SDIO_MAX_IO_NUMS] |
io IRQ handler | |
uint8_t | ioIntIndex |
used to record current enabled io interrupt index | |
uint8_t | ioIntNums |
used to record total enabled io interrupt numbers | |
#define FSL_SDIO_DRIVER_VERSION (MAKE_VERSION(2U, 2U, 13U)) /*2.2.13*/ |
enum sdio_io_direction_t |
status_t SDIO_Init | ( | sdio_card_t * | card | ) |
card | Card descriptor. |
kStatus_SDMMC_GoIdleFailed | |
kStatus_SDMMC_HandShakeOperationConditionFailed | |
kStatus_SDMMC_SDIO_InvalidCard | |
kStatus_SDMMC_SDIO_InvalidVoltage | |
kStatus_SDMMC_SendRelativeAddressFailed | |
kStatus_SDMMC_SelectCardFailed | |
kStatus_SDMMC_SDIO_SwitchHighSpeedFail | |
kStatus_SDMMC_SDIO_ReadCISFail | |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
void SDIO_Deinit | ( | sdio_card_t * | card | ) |
card | Card descriptor. |
status_t SDIO_CardInit | ( | sdio_card_t * | card | ) |
This function initializes the card only, make sure the host is ready when call this function, otherwise it will return kStatus_SDMMC_HostNotReady.
card | Card descriptor. |
kStatus_SDMMC_HostNotReady | host is not ready. |
kStatus_SDMMC_GoIdleFailed | Go idle failed. |
kStatus_SDMMC_NotSupportYet | Card not support. |
kStatus_SDMMC_SendOperationConditionFailed | Send operation condition failed. |
kStatus_SDMMC_AllSendCidFailed | Send CID failed. |
kStatus_SDMMC_SendRelativeAddressFailed | Send relative address failed. |
kStatus_SDMMC_SendCsdFailed | Send CSD failed. |
kStatus_SDMMC_SelectCardFailed | Send SELECT_CARD command failed. |
kStatus_SDMMC_SendScrFailed | Send SCR failed. |
kStatus_SDMMC_SetBusWidthFailed | Set bus width failed. |
kStatus_SDMMC_SwitchHighSpeedFailed | Switch high speed failed. |
kStatus_SDMMC_SetCardBlockSizeFailed | Set card block size failed. |
kStatus_Success | Operate successfully. |
void SDIO_CardDeinit | ( | sdio_card_t * | card | ) |
This function deinitializes the specific card.
card | Card descriptor. |
status_t SDIO_HostInit | ( | sdio_card_t * | card | ) |
This function deinitializes the specific host.
card | Card descriptor. |
void SDIO_HostDeinit | ( | sdio_card_t * | card | ) |
This function deinitializes the host.
card | Card descriptor. |
void SDIO_HostReset | ( | SDMMCHOST_CONFIG * | host | ) |
This function reset the specific host.
host | host descriptor. |
void SDIO_PowerOnCard | ( | SDMMCHOST_TYPE * | base, |
const sdmmchost_pwr_card_t * | pwr | ||
) |
The power on operation depend on host or the user define power on function.
base | host base address. |
pwr | user define power control configuration |
void SDIO_PowerOffCard | ( | SDMMCHOST_TYPE * | base, |
const sdmmchost_pwr_card_t * | pwr | ||
) |
The power off operation depend on host or the user define power on function.
base | host base address. |
pwr | user define power control configuration |
status_t SDIO_CardInActive | ( | sdio_card_t * | card | ) |
card | Card descriptor. |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_GetCardCapability | ( | sdio_card_t * | card, |
sdio_func_num_t | func | ||
) |
card | Card descriptor. |
function | IO number |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_SetBlockSize | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
uint32_t | blockSize | ||
) |
card | Card descriptor. |
function | io number |
block | size |
kStatus_SDMMC_SetCardBlockSizeFailed | |
kStatus_SDMMC_SDIO_InvalidArgument | |
kStatus_Success |
status_t SDIO_CardReset | ( | sdio_card_t * | card | ) |
card | Card descriptor. |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_SetDataBusWidth | ( | sdio_card_t * | card, |
sdio_bus_width_t | busWidth | ||
) |
card | Card descriptor. |
data | bus width |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_SwitchToHighSpeed | ( | sdio_card_t * | card | ) |
card | Card descriptor. |
kStatus_SDMMC_TransferFailed | |
kStatus_SDMMC_SDIO_SwitchHighSpeedFail | |
kStatus_Success |
status_t SDIO_ReadCIS | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
const uint32_t * | tupleList, | ||
uint32_t | tupleNum | ||
) |
card | Card descriptor. |
function | io number |
tuple | code list |
tuple | code number |
kStatus_SDMMC_SDIO_ReadCISFail | |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_WaitCardDetectStatus | ( | SDMMCHOST_TYPE * | hostBase, |
const sdmmchost_detect_card_t * | cd, | ||
bool | waitCardStatus | ||
) |
Detect card through GPIO, CD, DATA3.
card | card descriptor. |
card | detect configuration |
waitCardStatus | wait card detect status |
bool SDIO_IsCardPresent | ( | sdio_card_t * | card | ) |
card | card descriptor. |
status_t SDIO_IO_Write_Direct | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
uint32_t | regAddr, | ||
uint8_t * | data, | ||
bool | raw | ||
) |
card | Card descriptor. |
function | IO numner |
register | address |
the | data pinter to write |
raw | flag, indicate read after write or write only |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_IO_Read_Direct | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
uint32_t | regAddr, | ||
uint8_t * | data | ||
) |
card | Card descriptor. |
function | IO number |
register | address |
data | pointer to read |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_IO_RW_Direct | ( | sdio_card_t * | card, |
sdio_io_direction_t | direction, | ||
sdio_func_num_t | func, | ||
uint32_t | regAddr, | ||
uint8_t | dataIn, | ||
uint8_t * | dataOut | ||
) |
card | Card descriptor. |
direction | io access direction, please reference sdio_io_direction_t. |
function | IO number |
register | address |
dataIn | data to write |
dataOut | data pointer for readback data, support both for read and write, when application want readback the data after write command, dataOut should not be NULL. |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_IO_Write_Extended | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
uint32_t | regAddr, | ||
uint8_t * | buffer, | ||
uint32_t | count, | ||
uint32_t | flags | ||
) |
card | Card descriptor. |
function | IO number |
register | address |
data | buffer to write |
data | count |
write | flags |
kStatus_SDMMC_TransferFailed | |
kStatus_SDMMC_SDIO_InvalidArgument | |
kStatus_Success |
status_t SDIO_IO_Read_Extended | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
uint32_t | regAddr, | ||
uint8_t * | buffer, | ||
uint32_t | count, | ||
uint32_t | flags | ||
) |
card | Card descriptor. |
function | IO number |
register | address |
data | buffer to read |
data | count |
write | flags |
kStatus_SDMMC_TransferFailed | |
kStatus_SDMMC_SDIO_InvalidArgument | |
kStatus_Success |
status_t SDIO_EnableIOInterrupt | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
bool | enable | ||
) |
card | Card descriptor. |
function | IO number |
enable/disable | flag |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_EnableIO | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
bool | enable | ||
) |
card | Card descriptor. |
function | IO number |
enable/disable | flag |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_SelectIO | ( | sdio_card_t * | card, |
sdio_func_num_t | func | ||
) |
card | Card descriptor. |
function | IO number |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_AbortIO | ( | sdio_card_t * | card, |
sdio_func_num_t | func | ||
) |
card | Card descriptor. |
function | IO number |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_SetDriverStrength | ( | sdio_card_t * | card, |
sd_driver_strength_t | driverStrength | ||
) |
card | Card descriptor. |
driverStrength | target driver strength. |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_EnableAsyncInterrupt | ( | sdio_card_t * | card, |
bool | enable | ||
) |
card | Card descriptor. |
func | function io number. |
enable | true is enable, false is disable. |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_GetPendingInterrupt | ( | sdio_card_t * | card, |
uint8_t * | pendingInt | ||
) |
card | Card descriptor. |
pendingInt | pointer store pending interrupt |
kStatus_SDMMC_TransferFailed | |
kStatus_Success |
status_t SDIO_IO_Transfer | ( | sdio_card_t * | card, |
sdio_command_t | cmd, | ||
uint32_t | argument, | ||
uint32_t | blockSize, | ||
uint8_t * | txData, | ||
uint8_t * | rxData, | ||
uint16_t | dataSize, | ||
uint32_t * | response | ||
) |
This function can be used for trnansfer direct/extend command. Please pay attention to the non-align data buffer address transfer, if data buffer address can not meet host controller internal DMA requirement, sdio driver will try to use internal align buffer if data size is not bigger than internal buffer size, Align address transfer always can get a better performance, so if application want sdio driver make sure buffer address align, please redefine the SDMMC_GLOBAL_BUFFER_SIZE macro to a value which is big enough for your application.
card | card descriptor. |
cmd | command to transfer |
argument | argument to transfer |
blockSize | used for block mode. |
txData | tx buffer pointer or NULL |
rxData | rx buffer pointer or NULL |
dataSize | transfer data size |
response | reponse pointer, if application want read response back, please set it to a NON-NULL pointer. |
void SDIO_SetIOIRQHandler | ( | sdio_card_t * | card, |
sdio_func_num_t | func, | ||
sdio_io_irq_handler_t | handler | ||
) |
card | card descriptor. |
func | function io number. |
handler,io | IRQ handler. |
bool sdio_card_t::noInternalAlign |
If disable, sdmmc will not make sure the data buffer address is word align, otherwise all the transfer are align to low level driver