SDIO API
SDIO (Secure Digital Input/Output) 安全数字输入输出API接口。
Header File
Functions
-
bk_err_t bk_sdio_host_driver_init(void)
Init the sdio host driver.
This API init the resoure common:
Init sdio host driver control memory
- Attention
1. This API should be called before any other sdio host APIs
- 返回
BK_OK: succeed
others: other errors.
-
bk_err_t bk_sdio_host_driver_deinit(void)
Deinit the sdio host driver.
This API free all resource related to sdio host and disable sdio host
- 返回
BK_OK: succeed
others: other errors.
-
bk_err_t bk_sdio_host_init(const sdio_host_config_t *config)
Init the sdio host.
This API init the sdio host:
Power up the sdio
Configure the sdio clock soure to 26M
Enable sdio host interrupt
Map the sdio to dedicated GPIO port
Set the clock frequency and bus width
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
BK_ERR_NULL_PARAM: config is NULL
others: other errors.
-
bk_err_t bk_sdio_host_deinit(void)
Deinit the sdio host.
This API deinit the sdio host:
Reset all configuration of sdio host to default value
Clear sdio host interrupt status
Power down the sdio host
Disable sdio host interrupt
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
others: other errors.
-
bk_err_t bk_sdio_host_set_clock_freq(sdio_host_clock_freq_t clock_freq)
Set the sdio host clock frequency.
- 参数
clock_freq – clock frequency
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
others: other errors.
-
bk_err_t bk_sdio_host_send_command(const sdio_host_cmd_cfg_t *command)
Send the command from host to slave.
- 参数
command – the configuration information for the command
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
BK_ERR_NULL_PARAM: command is NULL
others: other errors.
-
bk_err_t bk_sdio_host_wait_cmd_response(uint32_t cmd_index)
Host wait for salve command response.
- 参数
cmd_index – the command index
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
BK_ERR_SDIO_HOST_CMD_RSP_TIMEOUT: sdio host wait slave command over time
BK_ERR_SDIO_HOST_CMD_RSP_CRC_FAIL: sdio host wait slave command crc fail
others: other errors.
-
uint32_t bk_sdio_host_get_cmd_rsp_argument(sdio_host_response_t argument_index)
Get the command response.
- 参数
argument_index – the command argument index
- 返回
the response register value
-
bk_err_t bk_sdio_host_config_data(const sdio_host_data_config_t *data_config)
Config the data.
- 参数
data_config – the configuration information for the data
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
BK_ERR_NULL_PARAM: data_config is NULL
others: other errors.
-
bk_err_t bk_sdio_host_set_data_timeout(uint32_t timeout)
Set the data timeout.
- 参数
timeout – the data timeout
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
others: other errors.
-
bk_err_t bk_sdio_host_write_fifo(const uint8_t *write_data, uint32_t data_size)
Write data to tx fifo.
- 参数
write_data – pointer to data to write
data_size – size of data to be sent, the data_size value should be aligned with 512 bytes.
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
BK_ERR_NULL_PARAM: write_data is NULL
BK_ERR_SDIO_HOST_DATA_TIMEOUT: sdio host wait slave data timeout
BK_ERR_SDIO_HOST_DATA_CRC_FAIL: sdio host receive slave data crc fail
others: other errors.
-
bk_err_t bk_sdio_host_wait_receive_data(void)
Host wait slave data.
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_NOT_INIT: sdio host driver not init
BK_ERR_SDIO_HOST_DATA_TIMEOUT: sdio host wait slave data timeout
BK_ERR_SDIO_HOST_DATA_CRC_FAIL: sdio host receive slave data crc fail
others: other errors.
-
bk_err_t bk_sdio_host_read_fifo(uint32_t *save_v_p)
Read data from rx fifo with timeout mode.
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_READ_DATA_FAIL: sdio host read data from FIFO timeout
*save_v_p:if success, will save read value to this pointer.
-
bk_err_t bk_sdio_host_read_blks_fifo(uint8_t *read_data, uint32_t blk_cnt)
Read many blocks data from rx fifo with timeout mode.
- 参数
blk_cnt:read – how many blocks data out from SDIO FIFO. the block_size is 512 bytes.
- 返回
BK_OK: succeed
BK_ERR_SDIO_HOST_READ_DATA_FAIL: sdio host read data from FIFO timeout
*read_data:if success, will save read value to this pointer.