Macros | |
| #define | SPI_SD_LOG(...) |
| #define | CSD_VERSION_V1_0 (0U) |
| #define | CSD_VERSION_V2_0 (1U) |
| #define | CSD_VERSION_V3_0 (2U) |
| #define | CMD_WAIT_RESP_TIMEOUT (0xFFFFFFFFU) |
| #define | SPI_SPEED_INIT_HZ (400000U) |
| #define | SPI_SD_SPEED_MAX_HZ (20000000U) |
| #define | SPI_SD_AUTO_PROBE_COUNT (5U) |
| #define | SPI_SPEED_PROBE_FREQ (12000000U) |
| #define | CRC16_CCITT_SEED 0 |
| #define | CRC16_CCITT_POLY16 0x1021 |
| #define | SPI_SD_RETRY_COUNT (5U) |
| #define | SPI_SD_DELAY_DEFAULT_US (100U) |
Functions | |
| static hpm_stat_t | send_sdcard_command (uint8_t cmd, uint32_t arg, uint8_t crc) |
| static hpm_stat_t | read_sdcard_buffer (uint8_t *buf, uint32_t len) |
| static hpm_stat_t | read_sdcard_info (spi_sdcard_info_t *cardinfo) |
| static uint8_t | crc7_calc (uint8_t *data, uint8_t len) |
| static bool | check_cid_data (bool check_crc) |
| static hpm_stat_t | sdcard_wait_not_busy (void) |
| static uint8_t | sdcard_read_r1_status (void) |
| static hpm_stat_t | sdcard_wait_data_token (uint8_t token) |
| hpm_stat_t | sdcard_spi_status (void) |
| hpm_stat_t | sdcard_spi_init (sdcard_spi_interface_t *spi_io) |
| hpm_stat_t | sdcard_spi_get_card_info (spi_sdcard_info_t *cardinfo) |
| hpm_stat_t | sdcard_spi_read_block (uint32_t sector, uint8_t *buffer) |
| hpm_stat_t | sdcard_spi_write_block (uint32_t sector, uint8_t *buffer) |
| hpm_stat_t | sdcard_spi_read_multi_block (uint8_t *buffer, uint32_t start_sector, uint32_t num_sectors) |
| hpm_stat_t | sdcard_spi_write_multi_block (uint8_t *buffer, uint32_t sector, uint32_t num_sectors) |
Variables | |
| static volatile sdcard_type_t | g_card_type |
| static spi_sdcard_info_t | g_card_info |
| static volatile bool | sdcard_init_status |
| static volatile sdcard_spi_interface_t * | g_spi_dev = NULL |
| static volatile uint32_t | g_spi_max_speed |
| static uint8_t | dummy_write_byte = 0xFFU |
| static uint8_t | dummy_read_byte |
| #define CMD_WAIT_RESP_TIMEOUT (0xFFFFFFFFU) |
| #define CRC16_CCITT_POLY16 0x1021 |
| #define CRC16_CCITT_SEED 0 |
| #define CSD_VERSION_V1_0 (0U) |
| #define CSD_VERSION_V2_0 (1U) |
| #define CSD_VERSION_V3_0 (2U) |
| #define SPI_SD_AUTO_PROBE_COUNT (5U) |
| #define SPI_SD_DELAY_DEFAULT_US (100U) |
| #define SPI_SD_LOG | ( | ... | ) |
| #define SPI_SD_RETRY_COUNT (5U) |
| #define SPI_SD_SPEED_MAX_HZ (20000000U) |
| #define SPI_SPEED_INIT_HZ (400000U) |
| #define SPI_SPEED_PROBE_FREQ (12000000U) |
|
static |
|
static |
|
static |
|
static |
|
static |
| hpm_stat_t sdcard_spi_get_card_info | ( | spi_sdcard_info_t * | cardinfo | ) |
| hpm_stat_t sdcard_spi_init | ( | sdcard_spi_interface_t * | spi_io | ) |
| hpm_stat_t sdcard_spi_read_block | ( | uint32_t | sector, |
| uint8_t * | buffer | ||
| ) |
| hpm_stat_t sdcard_spi_read_multi_block | ( | uint8_t * | buffer, |
| uint32_t | start_sector, | ||
| uint32_t | num_sectors | ||
| ) |
| hpm_stat_t sdcard_spi_status | ( | void | ) |
| hpm_stat_t sdcard_spi_write_block | ( | uint32_t | sector, |
| uint8_t * | buffer | ||
| ) |
| hpm_stat_t sdcard_spi_write_multi_block | ( | uint8_t * | buffer, |
| uint32_t | sector, | ||
| uint32_t | num_sectors | ||
| ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |