Solaris Software
Loading...
Searching...
No Matches
storagePort.c File Reference

ESP32-S3 SD card storage port implementation. More...

#include "storagePort.h"
#include "macrosEsp32.h"
#include "../spi/spiPort.h"
#include "driver/spi_common.h"
#include "driver/gpio.h"
#include "driver/sdspi_host.h"
#include "sdmmc_cmd.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
Include dependency graph for storagePort.c:

Go to the source code of this file.

Functions

SPP_RetVal_t SPP_PORTS_HAL_ESP32_storageInit (void)
 Initializes the SD card using SDSPI.
SPP_RetVal_t SPP_PORTS_HAL_ESP32_storageWrite (const void *p_buffer, spp_uint32_t first_block, spp_uint16_t count)
 Writes raw 512-byte sectors directly to the SD card.

Variables

static sdspi_dev_handle_t sdHandle
static sdmmc_card_t sdCard
static spp_bool_t s_storageInitialized = false

Detailed Description

ESP32-S3 SD card storage port implementation.

Definition in file storagePort.c.

Function Documentation

◆ SPP_PORTS_HAL_ESP32_storageInit()

SPP_RetVal_t SPP_PORTS_HAL_ESP32_storageInit ( void )

Initializes the SD card using SDSPI.

Requires the SPI bus to be initialized. Attempts SD card initialization up to five times.

Returns
K_SPP_OK on success, K_SPP_ERROR otherwise.

Definition at line 33 of file storagePort.c.

References K_ESP32_PIN_CS_BMP, K_ESP32_PIN_CS_ICM, K_ESP32_PIN_CS_SDC, K_ESP32_PIN_CS_SX1262, K_ESP32_SPI_HOST, K_SPP_ERROR, K_SPP_OK, s_storageInitialized, sdCard, sdHandle, SPP_PORTS_HAL_ESP32_spiIsBusInitialized(), and SPP_PORTS_HAL_ESP32_storageInit().

Referenced by SPP_PORTS_HAL_ESP32_storageInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_PORTS_HAL_ESP32_storageWrite()

SPP_RetVal_t SPP_PORTS_HAL_ESP32_storageWrite ( const void * p_buffer,
spp_uint32_t first_block,
spp_uint16_t count )

Writes raw 512-byte sectors directly to the SD card.

Parameters
p_bufferPointer to the data to write.
first_blockFirst sector to write.
countNumber of consecutive sectors.
Returns
K_SPP_OK on success, K_SPP_ERROR_NULL_POINTER for a NULL buffer, K_SPP_ERROR otherwise.

Definition at line 90 of file storagePort.c.

References K_SPP_ERROR, K_SPP_ERROR_NULL_POINTER, K_SPP_OK, s_storageInitialized, sdCard, and SPP_PORTS_HAL_ESP32_storageWrite().

Referenced by SPP_PORTS_HAL_ESP32_storageWrite().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ sdHandle

sdspi_dev_handle_t sdHandle
static

Definition at line 25 of file storagePort.c.

Referenced by SPP_PORTS_HAL_ESP32_storageInit().

◆ sdCard

sdmmc_card_t sdCard
static

◆ s_storageInitialized

spp_bool_t s_storageInitialized = false
static