|
GPS Device
|
SD card driver public API. More...


Go to the source code of this file.
Classes | |
| struct | SD_CFG_ts |
| Configuration structure for initializing an SD card handle. More... | |
Typedefs | |
| typedef struct sd_handle_s | SD_HANDLE_ts |
| Opaque handle representing an SD card instance. | |
Functions | |
| ERR_te | sd_init_subsys (void) |
| Initializes the SD card subsystem. | |
| ERR_te | sd_deinit_subsys (void) |
| Deinitializes the SD card subsystem. | |
| 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_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_handle (SD_HANDLE_ts *sd_handle) |
| Deinitializes an SD card handle and resets the SPI peripheral. | |
| ERR_te | sd_get_handle_init (SD_HANDLE_ts *sd_handle, bool *handle_init_o) |
| Retrieves the initialization state of an SD card handle. | |
| 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_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_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_ioctl (SD_HANDLE_ts *sd_handle) |
| Executes an IOCTL control command on the SD card handle. | |
SD card driver public API.
This module provides an SPI-based SD card driver supporting SDSC and SDHC cards in SPI mode. It handles card initialization, type detection, CSD register parsing, and sector-level read/write operations. The driver is designed to be used as the low-level backend for a FatFs diskio layer.
Card initialization in sd_init_handle performs the full SPI-mode power-up sequence:
Typical usage:
Definition in file sd.h.