23#include "configuration.h"
215 char name[CONFIG_SD_MAX_NAME_LEN];
295 .help =
"Lists active sd objects, usage: sd list",
300 .help =
"Shows sd object info, usage: sd info <sd object>",
347 "sd_init_subsys: cmd_register error"
354 "sd_init_subsys: subsys initialized"
371 "sd_deinit_subsys: subsys is not initialized"
379 "sd_deinit_subsys: subsys deinitialized"
393 "sd_start_subsys: subsys started"
400 "sd_start_subsys: subsys not initialized or already started"
417 "sd_stop_subsys: subsys stopped"
424 "sd_stop_subsys: subsys not initialized or already already stopped"
442 "sd_init_handle: subsys not initialized"
452 "sd_init_handle: subsystem out of memory space"
462 "sd_init_handle: invalid argument"
469 for(uint32_t i = 0; i < CONFIG_SD_MAX_OBJECTS; i++) {
526 uint32_t spi_pclk = 0;
535 uint32_t spi_pclk_cpy = spi_pclk;
536 uint32_t div_factor = 2;
537 while(div_factor <= 256) {
538 spi_pclk = spi_pclk / div_factor;
540 if(spi_pclk >= 100000 && spi_pclk <= 400000) {
544 spi_pclk = spi_pclk_cpy;
548 switch (div_factor) {
585 DELAY(CONFIG_SD_HW_INIT_WAIT_TIME);
593 uint8_t dummy_tx = 0xFF;
594 for(uint8_t i = 0; i < 10; i++) {
605 "sd_init_handle: failed to enter idle state, deinitializing handle"
615 bool no_response =
false;
621 "sd_init_handle: failed to get SD card type, deinitializing handle"
635 "sd_init_handle: failed to initiate initialization of SD Ver.2, deinitializing handle"
647 "sd_init_handle: failed to obtain SD Ver 2. information, deinitializing handle"
654 else if(no_response) {
667 "sd_init_handle: unknown card, deinitializing handle"
683 "sd_init_handle: unknown card, deinitializing handle"
697 "sd_init_handle: failed to initialize, deinitializing handle"
711 "sd_init_handle: sd handle %s initialized",
732 "sd_deinit_handle: handle not initialized"
741 "sd_deinit_handle: no such handle to deinitialize"
747 for(uint32_t i = 0; i < CONFIG_SD_MAX_OBJECTS; i++) {
762 "sd_deinit_handle: sd handle %s deinitialized",
769 if(i == CONFIG_SD_MAX_OBJECTS - 1) {
773 "sd_deinit_handle: no such handle to deinitialize"
807 uint32_t start_time = 0;
808 uint32_t elapsed_time = 0;
815 "sd_read: subsys or handle not initialized or started"
821 if(sd_handle == NULL || num_sectors == 0) {
829 start_sector = start_sector * sd_handle->
block_len;
832 if(num_sectors == 1) {
840 if(cmd_response.
r1 != 0x0) {
846 uint8_t token = 0xFF;
852 }
while(token == 0xFF && elapsed_time <= CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT);
854 if(elapsed_time > CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT) {
879 if(cmd_response.
r1 != 0x0) {
884 for(uint32_t i = 0; i < num_sectors; i++) {
885 uint8_t token = 0xFF;
891 }
while(token == 0xFF && elapsed_time <= CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT);
893 if(elapsed_time > CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT) {
918 }
while(cmd_response.
r1 != 0x0 && retry++ < CONFIG_SD_INVALID_RESP_RETRY_NUM);
920 if(cmd_response.
r1 != 0x00) {
935 uint32_t start_time = 0;
936 uint32_t elapsed_time = 0;
942 "sd_write: subsys not initialized or started"
948 if(sd_handle == NULL || num_sectors == 0) {
956 start_sector = start_sector * sd_handle->
block_len;
961 if(num_sectors == 1) {
969 if(cmd_response.
r1 != 0x0) {
975 uint8_t token = 0xFE;
979 uint8_t dummy_crc[2] = { 0xFF, 0xFF };
982 uint8_t data_resp = 0xFF;
988 }
while(data_resp == 0xFF && elapsed_time <= CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT);
990 if(elapsed_time > CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT) {
996 if((data_resp & 0b11111) != 0b00101) {
1003 uint8_t busy = 0x00;
1008 }
while(busy == 0x00 && elapsed_time <= CONFIG_SD_BUSY_TIMOUT);
1010 if(elapsed_time > CONFIG_SD_BUSY_TIMOUT) {
1024 if(cmd_response.
r1 != 0x0) {
1030 for(uint32_t i = 0; i < num_sectors; i++) {
1031 uint8_t token = 0xFC;
1035 uint8_t dummy_crc[2] = { 0xFF, 0xFF };
1038 uint8_t data_resp = 0xFF;
1044 }
while(data_resp == 0xFF && elapsed_time <= CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT);
1046 if(elapsed_time > CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT) {
1052 if((data_resp & 0b11111) != 0b00101) {
1058 uint8_t busy = 0x00;
1063 }
while(busy == 0x00 && elapsed_time <= CONFIG_SD_BUSY_TIMOUT);
1065 if(elapsed_time > CONFIG_SD_BUSY_TIMOUT) {
1073 uint8_t stop_tran_token = 0xFD;
1076 uint8_t busy = 0x00;
1081 }
while(busy == 0x00 && elapsed_time <= CONFIG_SD_BUSY_TIMOUT);
1083 if(elapsed_time > CONFIG_SD_BUSY_TIMOUT) {
1133 uint32_t start_time;
1134 uint32_t elapsed_time;
1141 err =
sd_send_cmd(spi_instance, 55, 0,
false, &dummy);
1146 "sd_send_cmd: unknown error"
1156 else if(index == 0x08) {
1160 cmd[0] = 0x40 | index;
1161 cmd[1] = (arg >> 24) & 0xFF;
1162 cmd[2] = (arg >> 16) & 0xFF;
1163 cmd[3] = (arg >> 8) & 0xFF;
1164 cmd[4] = arg & 0xFF;
1167 spi_send(spi_instance, cmd,
sizeof(cmd));
1181 }
while ((r1 & 0x80) && elapsed_time <= CONFIG_SD_R1_RESP_TIMEOUT);
1183 cmd_response_o->
r1 = r1;
1185 if(elapsed_time > CONFIG_SD_R1_RESP_TIMEOUT) {
1189 "sd_send_cmd: timed out"
1196 index == 0 || index == 1 || index == 41 || index == 9 ||
1197 index == 10 || index == 16 || index == 17 || index == 18 ||
1198 index == 23 || index == 24 || index == 25 || index == 55
1201 memset(cmd_response_o->
r3, 0,
sizeof(cmd_response_o->
r3));
1202 memset(cmd_response_o->
r7, 0,
sizeof(cmd_response_o->
r7));
1204 else if(index == 58) {
1206 memset(cmd_response_o->
r7, 0,
sizeof(cmd_response_o->
r7));
1209 else if(index == 8) {
1211 memset(cmd_response_o->
r3, 0,
sizeof(cmd_response_o->
r3));
1214 else if(index == 12) {
1216 memset(cmd_response_o->
r3, 0,
sizeof(cmd_response_o->
r3));
1217 memset(cmd_response_o->
r7, 0,
sizeof(cmd_response_o->
r7));
1225 }
while(rx == 0x00 && elapsed_time <= CONFIG_SD_R1B_RESP_TIMEOUT);
1227 if(elapsed_time > CONFIG_SD_R1B_RESP_TIMEOUT) {
1231 "sd_send_cmd: timed out"
1259 uint8_t dummy[2] = { 0xFF, 0xFF };
1291 uint8_t retries = 0;
1295 if(err !=
ERR_OK || !(cmd_response.
r1 & 0x01)) {
1299 "sd_go_idle_state: command execution failure, retry %d/%d in %d ms",
1300 retries, CONFIG_SD_CMD_SEND_ERROR_RETRY_NUM, CONFIG_SD_CMD_SEND_ERROR_RETRY_LATENCY
1302 DELAY(CONFIG_SD_CMD_SEND_ERROR_RETRY_LATENCY);
1304 }
while ((err !=
ERR_OK || !(cmd_response.
r1 & 0x01)) && retries < CONFIG_SD_CMD_SEND_ERROR_RETRY_NUM);
1306 if(err !=
ERR_OK || !(cmd_response.
r1 & 0x01)) {
1310 "sd_go_idle_state: command execution failure"
1347 uint8_t expected[] = { 0x00, 0x00, 0x01, 0xAA };
1348 for(uint8_t i = 0; i < 4; i++) {
1349 if(cmd_response.
r7[i] != expected[i]) {
1353 "sd_send_if_cond: initialization failure"
1386 uint32_t retries = 0;
1395 "sd_app_send_op_cond: R1 response timeout"
1401 if(cmd_response.
r1 != 0x00) {
1405 "sd_app_send_op_cond: invalid R1 response, retry %d/%d in %d ms",
1406 retries, CONFIG_SD_INVALID_RESP_RETRY_NUM, CONFIG_SD_INVALID_RESP_RETRY_TIMEOUT
1408 DELAY(CONFIG_SD_INVALID_RESP_RETRY_TIMEOUT);
1410 }
while(cmd_response.
r1 == 0x01 && retries < CONFIG_SD_INVALID_RESP_RETRY_NUM);
1412 if(cmd_response.
r1 != 0x00) {
1416 "sd_app_send_op_cond: initialization failure"
1449 "sd_read_ocr: failed to read ocr"
1456 ((uint32_t)cmd_response.
r3[0] << 24) |
1457 ((uint32_t)cmd_response.
r3[1] << 16) |
1458 ((uint32_t)cmd_response.
r3[2] << 8) |
1459 ((uint32_t)cmd_response.
r3[3]);
1467 bool voltage_low_found =
false;
1468 for(uint8_t ocr_counter = 4; ocr_counter < 24; ocr_counter++) {
1469 if((ocr >> ocr_counter) & 0x1 && !voltage_low_found) {
1471 voltage_low_found =
true;
1473 else if((ocr >> ocr_counter) & 0x1 && voltage_low_found) {
1498 uint32_t retries = 0;
1507 "sd_send_op_cond: R1 response timeout"
1512 }
while(cmd_response.
r1 == 0x01 && retries < CONFIG_SD_INVALID_RESP_RETRY_NUM);
1514 if(cmd_response.
r1 != 0x00) {
1518 "sd_send_op_cond: initialization failure"
1549 "sd_set_blocklen: failed to set block length"
1555 if(cmd_response.
r1 != 0x00)
1580 uint8_t csd_raw[16];
1584 if (err !=
ERR_OK || cmd_response.
r1 != 0x00) {
1586 "sd_read_csd: failed to send CMD9");
1592 uint32_t elapsed_time = 0;
1597 }
while (token != 0xFE && elapsed_time <= CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT);
1599 if (elapsed_time > CONFIG_SD_DATA_TOKEN_RECV_TIMEOUT || token != 0xFE) {
1601 "sd_read_csd: timeout waiting for data token");
1605 memset(csd_raw, 0,
sizeof(csd_raw));
1615 switch (csd_structure) {
1766 "sd_cmd_list_handler: invalid arguments"
1771 for(uint32_t i = 0; i < CONFIG_SD_MAX_OBJECTS; i++) {
1808 "sd_cmd_info_handler: invalid arguments"
1813 for(uint32_t i = 0; i < CONFIG_SD_MAX_OBJECTS; i++) {
1831 "type: %s, addr mode: %s, capacity: %d mb, block size: %d byte, block count: %d",
1842 if(i == CONFIG_SD_MAX_OBJECTS - 1) {
1846 "sd_cmd_info_handler: no such handle"
static struct internal_state_s internal_state
Singleton instance of the SysTick driver internal state.
Arm Cortex-M4 SysTick driver public API.
Command subsystem public API.
Common utility module public API.
System-wide error code definitions.
ERR_te cmd_deregister(CMD_CLIENT_INFO_ts const *cmd_client_info)
Deregisters a client from the command subsystem.
ERR_te cmd_register(CMD_CLIENT_INFO_ts *cmd_client_info)
Registers a client with the command subsystem.
bool str_cmp(const char *str1, const char *str2)
Compares two null-terminated strings for equality.
int str_cpy(char *str_to, const char *str_from, uint32_t len)
Copies a null-terminated string into a destination buffer.
uint32_t extract_bits(const uint8_t *data, uint16_t start_bit, uint8_t num_bits)
Extracts a range of bits from a big-endian byte array.
uint32_t get_str_len(char const *str)
Returns the length of a string, excluding the null terminator.
#define DELAY(ms)
Blocking delay using the system tick counter.
uint32_t systick_get_ms(void)
Returns the number of milliseconds elapsed since SysTick was initialized.
ERR_te
Standard return type used by all public API functions.
@ ERR_UNINITIALZIED_OBJECT
@ ERR_DEINITIALIZATION_FAILURE
@ ERR_MODULE_ALREADY_INITIALIZED
@ ERR_INITIALIZATION_FAILURE
ERR_te init_log(void)
Initializes the logging subsystem.
ERR_te init_systick(void)
Initializes the SysTick timer.
ERR_te io_init_handle(IO_CFG_ts *io_cfg, IO_HANDLE_ts **io_handle_o)
Initializes and registers an IO handle.
ERR_te io_start_subsys(void)
Starts the IO subsystem.
ERR_te io_init_subsys(void)
Initializes the IO subsystem.
struct io_handle_s IO_HANDLE_ts
Opaque handle representing an IO instance.
#define LOG_CRITICAL(subsys, lvl, fmt,...)
#define LOG_ERROR(subsys, lvl, fmt,...)
#define LOG_INFO(subsys, lvl, fmt,...)
LOG_LEVEL_te
Log severity levels, in ascending order of severity.
MODULES_te
Identifies a subsystem for use in logging and CLI output.
static ERR_te sd_cmd_info_handler(uint32_t argc, char **argv)
CLI handler for the "info" command. Logs detailed information about a named SD card handle.
static ERR_te sd_cmd_list_handler(uint32_t argc, char **argv)
CLI handler for the "list" command. Logs the names of all active SD card handles.
static ERR_te sd_cease_comms(SD_HANDLE_ts *sd_handle, bool deinit)
Raises CS, sends two dummy bytes, and disables SPI. Optionally deinitializes the handle.
static ERR_te sd_app_send_op_cond(SD_HANDLE_ts *sd_handle, uint32_t arg)
Issues ACMD41 to initiate SD card initialization (SD Ver.2 and Ver.1).
static ERR_te sd_read_ocr(SD_HANDLE_ts *sd_handle)
Reads the OCR register via CMD58 and stores power-up status, addressing mode, and voltage range.
static ERR_te sd_send_cmd(SPI_REGDEF_ts *spi_instance, uint8_t index, uint32_t arg, bool acmd, CMD_RESPONSE_ts *cmd_response_o)
Transmits a single SPI-mode SD command and receives the response.
static ERR_te sd_go_idle_state(SD_HANDLE_ts *sd_handle)
Issues CMD0 to reset the SD card into idle (SPI) mode.
static ERR_te decode_csd_v1(const uint8_t *csd_raw, SD_CSD_INFO_ts *csd_info_o)
Decodes a CSD v1.0 register (SDSC cards) into a SD_CSD_INFO_ts structure.
static ERR_te sd_send_op_cond(SD_HANDLE_ts *sd_handle)
Issues CMD1 to initiate MMC Ver.3 card initialization.
static ERR_te decode_csd_v2(const uint8_t *csd_raw, SD_CSD_INFO_ts *csd_info_o)
Decodes a CSD v2.0 register (SDHC/SDXC cards) into a SD_CSD_INFO_ts structure.
static ERR_te sd_set_blocklen(SD_HANDLE_ts *sd_handle)
Issues CMD16 to set the block length to 512 bytes for byte-addressed cards.
static ERR_te sd_read_csd(SD_HANDLE_ts *sd_handle)
Issues CMD9 to read the CSD register and stores capacity information in the handle.
static ERR_te sd_send_if_cond(SD_HANDLE_ts *sd_handle, bool *match_o, bool *no_resp_o)
Issues CMD8 to determine whether the card is SD Ver.2 or older.
ERR_te sd_start_subsys(void)
Starts the SD card subsystem.
ERR_te sd_stop_subsys(void)
Stops the SD card subsystem.
ERR_te sd_deinit_handle(SD_HANDLE_ts *sd_handle)
Deinitializes an SD card handle and resets the SPI peripheral.
ERR_te sd_init_subsys(void)
Initializes the SD card subsystem.
ERR_te sd_read(SD_HANDLE_ts *sd_handle, uint8_t *read_buf, uint32_t start_sector, uint32_t num_sectors)
Reads one or more sectors from the SD card.
ERR_te sd_write(SD_HANDLE_ts *sd_handle, uint8_t *write_buf, uint32_t start_sector, uint32_t num_sectors)
Writes one or more sectors to the SD card.
ERR_te sd_init_handle(SD_CFG_ts *sd_cfg, SD_HANDLE_ts **sd_handle_o)
Initializes an SD card handle and performs the full SPI-mode power-up sequence.
ERR_te sd_deinit_subsys(void)
Deinitializes the SD card subsystem.
ERR_te sd_get_sector_size(SD_HANDLE_ts *sd_handle, uint32_t *sector_size_o)
Retrieves the sector (block) size of the SD card in bytes.
ERR_te sd_get_sector_count(SD_HANDLE_ts *sd_handle, uint32_t *sector_count_o)
Retrieves the total sector (block) count of the SD card.
ERR_te sd_get_handle_init(SD_HANDLE_ts *sd_handle, bool *handle_init_o)
Retrieves the initialization state of an SD card handle.
struct sd_handle_s SD_HANDLE_ts
Opaque handle representing an SD card instance.
void gpio_write(GPIO_REGDEF_ts *gpio_port, uint8_t gpio_pin, PIN_STATUS_te pin_status)
Drives a GPIO output pin high or low.
void gpio_init(GPIO_CFG_ts *gpio_cfg)
Initializes a GPIO pin according to the given configuration.
GPIO_PIN_te
GPIO pin number within a port (0–15).
GPIO_ALTERNATE_FUNCTION_te
GPIO alternate function mapping (AF0–AF15).
@ GPIO_MODE_ALTERNATE_FUNCTION
uint32_t rcc_get_apb2_clk(void)
Returns the current APB2 (high-speed) peripheral bus clock frequency in Hz.
uint32_t rcc_get_apb1_clk(void)
Returns the current APB1 (low-speed) peripheral bus clock frequency in Hz.
void spi_send(SPI_REGDEF_ts *spi_instance, uint8_t *tx_buffer, uint32_t len)
Blocking SPI transmit. Sends len bytes from tx_buffer.
void spi_deinit(SPI_REGDEF_ts const *spi_instance)
Deinitializes the SPI peripheral and disables its clock.
void spi_init(SPI_CFG_ts *spi_cfg)
Initializes the SPI peripheral with the given configuration.
void spi_receive(SPI_REGDEF_ts *spi_instance, uint8_t *rx_buffer, uint32_t len)
Blocking SPI receive. Reads len bytes into rx_buffer.
void spi_set_comm(SPI_REGDEF_ts *spi_instance, EN_STATUS_te en_status)
Enables or disables the SPI peripheral (SPE bit).
void spi_set_pclk_div(SPI_REGDEF_ts *spi_instance, SPI_MASTER_SCLK_SPEED_te pclk_div)
Changes the SPI master clock speed divisor at runtime.
@ SPI_CLOCK_PHASE_FIRST_TRANSITION
@ SPI_DATA_FRAME_FORMATE_8_BIT
@ SPI_SLAVE_SELECT_MODE_SW
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_8
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_2
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_16
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_4
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_256
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_32
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_128
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_64
@ SPI_CLOCK_POLARITY_0_IDLE
Common initialization public API.
Digital IO module public API.
Log subsystem public API.
System module identifier definitions.
SD_MIN_OPERATING_VOLTAGE_te
Minimum allowed operating voltage of the SD card, decoded from the OCR register.
@ SD_MIN_OPERATING_VOLTAGE_2_6V
@ SD_MIN_OPERATING_VOLTAGE_2_2V
@ SD_MIN_OPERATING_VOLTAGE_1_8V
@ SD_MIN_OPERATING_VOLTAGE_3_5V
@ SD_MIN_OPERATING_VOLTAGE_1_7V
@ SD_MIN_OPERATING_VOLTAGE_3_3V
@ SD_MIN_OPERATING_VOLTAGE_1_6V
@ SD_MIN_OPERATING_VOLTAGE_3_2V
@ SD_MIN_OPERATING_VOLTAGE_2_9V
@ SD_MIN_OPERATING_VOLTAGE_2_8V
@ SD_MIN_OPERATING_VOLTAGE_2_3V
@ SD_MIN_OPERATING_VOLTAGE_2_5V
@ SD_MIN_OPERATING_VOLTAGE_2_0V
@ SD_MIN_OPERATING_VOLTAGE_3_1V
@ SD_MIN_OPERATING_VOLTAGE_3_4V
@ SD_MIN_OPERATING_VOLTAGE_2_4V
@ SD_MIN_OPERATING_VOLTAGE_3_0V
@ SD_MIN_OPERATING_VOLTAGE_2_1V
@ SD_MIN_OPERATING_VOLTAGE_1_9V
@ SD_MIN_OPERATING_VOLTAGE_2_7V
SD_TYPE_te
Card type decoded from the OCR Capacity Status bit.
CMD_INFO_ts sd_cmds[]
Table of CLI commands registered by the SD card subsystem.
SD_MAX_OPERATIING_VOLTAGE_te
Maximum allowed operating voltage of the SD card, decoded from the OCR register.
@ SD_MAX_OPERATING_VOLTAGE_1_9V
@ SD_MAX_OPERATING_VOLTAGE_2_2V
@ SD_MAX_OPERATING_VOLTAGE_2_8V
@ SD_MAX_OPERATING_VOLTAGE_1_8V
@ SD_MAX_OPERATING_VOLTAGE_3_2V
@ SD_MAX_OPERATING_VOLTAGE_2_3V
@ SD_MAX_OPERATING_VOLTAGE_2_4V
@ SD_MAX_OPERATING_VOLTAGE_3_3V
@ SD_MAX_OPERATING_VOLTAGE_1_7V
@ SD_MAX_OPERATING_VOLTAGE_3_5V
@ SD_MAX_OPERATING_VOLTAGE_3_4V
@ SD_MAX_OPERATING_VOLTAGE_2_1V
@ SD_MAX_OPERATING_VOLTAGE_2_6V
@ SD_MAX_OPERATING_VOLTAGE_3_6V
@ SD_MAX_OPERATING_VOLTAGE_2_7V
@ SD_MAX_OPERATING_VOLTAGE_2_0V
@ SD_MAX_OPERATING_VOLTAGE_2_9V
@ SD_MAX_OPERATING_VOLTAGE_2_5V
@ SD_MAX_OPERATING_VOLTAGE_3_0V
@ SD_MAX_OPERATING_VOLTAGE_3_1V
CMD_CLIENT_INFO_ts sd_cmd_client_info
Registration descriptor passed to the command subsystem.
SD_PWRUP_STATUS_te
Power-up completion status decoded from the OCR register.
OCR_te
Bit positions within the 32-bit OCR register.
SD_ADDR_MODE_te
Addressing mode used by the SD card for read/write sector addresses.
SD card driver public API.
STM32F401RE MCU-specific peripheral register definitions and bit position enumerations.
STM32F401RE GPIO driver public API.
STM32F401RE RCC driver public API.
STM32F401RE SPI driver public API.
Describes a subsystem client registering with the command module.
Describes a single command exposed by a client.
Holds the R1, R3, and R7 response bytes returned by the SD card after a command.
Configuration structure for initializing a GPIO pin.
GPIO_ALTERNATE_FUNCTION_te alternate_function
GPIO peripheral register map.
Configuration structure for initializing an IO handle.
char name[CONFIG_IO_MAX_NAME_LEN]
GPIO_CFG_ts * gpio_handle
Configuration structure for initializing an SD card handle.
GPIO_REGDEF_ts * miso_gpio_port
GPIO_PIN_te sclk_gpio_pin
GPIO_REGDEF_ts * mosi_gpio_port
char name[CONFIG_SD_MAX_NAME_LEN]
GPIO_REGDEF_ts * cs_gpio_port
SPI_REGDEF_ts * spi_instance
GPIO_PIN_te mosi_gpio_pin
GPIO_ALTERNATE_FUNCTION_te gpio_alternate_function
GPIO_REGDEF_ts * sclk_gpio_port
GPIO_PIN_te miso_gpio_pin
Decoded contents of the SD card CSD register.
uint8_t read_blk_misalign
struct SD_CSD_INFO_ts::@241120010163000272306350371036221161033372031231 v1
uint8_t perm_write_protect
uint8_t tmp_write_protect
struct SD_CSD_INFO_ts::@123136205353006350230173346147067177263037234074 v2
uint8_t write_blk_misalign
Configuration structure for initializing an SPI peripheral.
SPI_CLOCK_POLARITY_te clock_polarity
SPI_SLAVE_SELECT_MODE_te slave_select_mode
SPI_MASTER_SCLK_SPEED_te master_sclk_speed
SPI_DATA_FRAME_FORMAT_te data_frame_format
SPI_CLOCK_PHASE_te clock_phase
SPI_BIT_FIRST_te bit_first
SPI peripheral register map.
Internal state of the SysTick driver.
SD_HANDLE_ts sds[CONFIG_SD_MAX_OBJECTS]
Internal structure representing a single SD card handle instance.
SD_MAX_OPERATIING_VOLTAGE_te max_operating_voltage
GPIO_REGDEF_ts * mosi_gpio_port
char name[CONFIG_SD_MAX_NAME_LEN]
GPIO_REGDEF_ts * sclk_gpio_port
GPIO_PIN_te mosi_gpio_pin
SD_MIN_OPERATING_VOLTAGE_te min_operating_voltage
GPIO_PIN_te miso_gpio_pin
GPIO_REGDEF_ts * cs_gpio_port
SD_ADDR_MODE_te addr_mode
GPIO_REGDEF_ts * miso_gpio_port
GPIO_PIN_te sclk_gpio_pin
SD_PWRUP_STATUS_te pwrup_status
SPI_REGDEF_ts * spi_instance
GPIO_ALTERNATE_FUNCTION_te gpio_alternate_function