|
GPS Device
|
Public functions to interact with the SD card subsystem. More...

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. | |
Public functions to interact with the SD card subsystem.
| ERR_te sd_init_subsys | ( | void | ) |
Initializes the SD card subsystem.
Resets the internal state, initializes logging and systick dependencies, and registers the CLI commands.
Must be called before any other SD API function.
Definition at line 325 of file sd.c.

| ERR_te sd_deinit_subsys | ( | void | ) |
Deinitializes the SD card subsystem.
Resets the internal state to zero and deregisters the CLI commands.
Definition at line 361 of file sd.c.

| ERR_te sd_start_subsys | ( | void | ) |
Starts the SD card subsystem.
Enables sd_read and sd_write operations.
Definition at line 386 of file sd.c.
| ERR_te sd_stop_subsys | ( | void | ) |
Stops the SD card subsystem.
Definition at line 410 of file sd.c.
| 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.
Configures all GPIO pins and the SPI peripheral, then executes the SD card initialization sequence (idle state, interface condition check, ACMD41/CMD1, OCR read, CSD read). On success, the SPI clock is ramped to maximum speed.
If any step of the initialization sequence fails, the handle is automatically deinitialized and an error is returned.
| [in] | sd_cfg | Pointer to the SD card configuration structure. |
| [out] | sd_handle_o | Pointer to a handle pointer that will be set to the allocated SD card instance. |
sd_cfg is NULLDefinition at line 434 of file sd.c.

| ERR_te sd_deinit_handle | ( | SD_HANDLE_ts * | sd_handle | ) |
Deinitializes an SD card handle and resets the SPI peripheral.
| [in] | sd_handle | Pointer to the handle to deinitialize. |
Definition at line 727 of file sd.c.


| ERR_te sd_get_handle_init | ( | SD_HANDLE_ts * | sd_handle, |
| bool * | handle_init_o ) |
Retrieves the initialization state of an SD card handle.
| [in] | sd_handle | Pointer to the SD card handle to query. |
| [out] | handle_init_o | Pointer to a boolean that will receive the initialization state. |
| 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.
The value is determined from the CSD register during sd_init_handle and is used by the FatFs diskio layer.
| [in] | sd_handle | Pointer to the SD card handle. |
| [out] | sector_count_o | Pointer to a variable that will receive the sector count. |
| 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.
For SDHC cards this is always 512 bytes. For SDSC cards it is determined from the CSD register. Used by the FatFs diskio layer.
| [in] | sd_handle | Pointer to the SD card handle. |
| [out] | sector_size_o | Pointer to a variable that will receive the sector size 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.
Reads num_sectors consecutive sectors starting at start_sector into read_buf. Uses CMD17 for single-sector reads and CMD18 + CMD12 for multi-sector reads. Handles both byte-addressed (SDSC) and block-addressed (SDHC) cards transparently.
| [in] | sd_handle | Pointer to the SD card handle. |
| [out] | read_buf | Pointer to the destination buffer. Must be at least num_sectors × sector size bytes. |
| [in] | start_sector | Zero-based index of the first sector to read. |
| [in] | num_sectors | Number of consecutive sectors to read. |
sd_handle is NULL or num_sectors is 0Definition at line 805 of file sd.c.

| 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.
Writes num_sectors consecutive sectors from write_buf starting at start_sector. Uses CMD24 for single-sector writes and CMD25 + CMD12 for multi-sector writes. Handles both byte-addressed (SDSC) and block-addressed (SDHC) cards transparently.
| [in] | sd_handle | Pointer to the SD card handle. |
| [in] | write_buf | Pointer to the source data buffer. Must contain at least num_sectors × sector size bytes. |
| [in] | start_sector | Zero-based index of the first sector to write. |
| [in] | num_sectors | Number of consecutive sectors to write. |
sd_handle is NULL or num_sectors is 0Definition at line 933 of file sd.c.

| ERR_te sd_ioctl | ( | SD_HANDLE_ts * | sd_handle | ) |
Executes an IOCTL control command on the SD card handle.
Used by the FatFs diskio layer to perform control operations such as flushing write buffers or querying card parameters.
| [in] | sd_handle | Pointer to the SD card handle. |