SDIO Driver

[中文]

Overview

SDIO (Secure Digital I/O) host interface for high-speed command/data transfers with SDIO devices.

Functional Description

  • Host mode with 1-bit/4-bit bus

  • Configurable clock frequencies

  • Command send/response, data block transfer

  • FIFO assisted read/write

  • Interrupts and error detection (CRC/timeout)

Development Guide

  1. Init driver and host: bk_sdio_host_driver_init(), bk_sdio_host_init(&cfg)

  2. Send command: bk_sdio_host_send_cmd() and wait response

  3. Configure data path: bk_sdio_host_config_data()

  4. Receive/transmit data by FIFO helpers

Notes

  • Match clock and bus width with the device

  • Check signal integrity for high speed

API Reference

  • bk_sdio_host_driver_init/deinit, bk_sdio_host_init/deinit

  • bk_sdio_host_set_clock_freq

  • bk_sdio_host_send_cmd, bk_sdio_host_wait_cmd_rsp

  • bk_sdio_host_config_data, bk_sdio_host_wait_receive_data

  • bk_sdio_host_write_fifo, bk_sdio_host_read_fifo, bk_sdio_host_read_blks_fifo

Examples

Read 2 blocks of 512B:

sdio_host_config_t cfg = {0};
bk_sdio_host_driver_init();
bk_sdio_host_init(&cfg);
sdio_host_data_config_t dc = {0};
bk_sdio_host_config_data(&dc);
bk_sdio_host_wait_receive_data();
uint8_t buf[1024];
bk_sdio_host_read_blks_fifo(buf, 2);

Error Codes

  • BK_ERR_SDIO_HOST_NOT_INIT, BK_ERR_SDIO_HOST_CMD_RSP_TIMEOUT/CRC_FAIL, BK_ERR_SDIO_HOST_DATA_TIMEOUT/CRC_FAIL