Skip to content

File syn_port_flash.h

FileList > port > syn_port_flash.h

Go to the source code of this file

Flash storage port interface — implement these for your platform. More...

  • #include "../common/syn_defs.h"
  • #include <stddef.h>
  • #include <stdint.h>

Public Functions

Type Name
SYN_Status syn_port_flash_erase (uint32_t addr)
Erase a flash sector.
SYN_Status syn_port_flash_read (uint32_t addr, void * buf, size_t len)
Read from flash.
uint32_t syn_port_flash_sector_size (uint32_t addr)
Get the sector size for the given address.
SYN_Status syn_port_flash_write (uint32_t addr, const void * buf, size_t len)
Write to flash.

Detailed Description

Used by the parameter store module for wear-leveled persistent storage. The port exposes raw sector-level operations; SyntropicOS handles wear leveling.

Public Functions Documentation

function syn_port_flash_erase

Erase a flash sector.

SYN_Status syn_port_flash_erase (
    uint32_t addr
) 

Parameters:

  • addr Start address of the sector (must be sector-aligned).

Returns:

SYN_OK on success.


function syn_port_flash_read

Read from flash.

SYN_Status syn_port_flash_read (
    uint32_t addr,
    void * buf,
    size_t len
) 

Parameters:

  • addr Source address in flash.
  • buf Destination buffer.
  • len Number of bytes to read.

Returns:

SYN_OK on success.


function syn_port_flash_sector_size

Get the sector size for the given address.

uint32_t syn_port_flash_sector_size (
    uint32_t addr
) 

Parameters:

  • addr Address within the sector.

Returns:

Sector size in bytes.


function syn_port_flash_write

Write to flash.

SYN_Status syn_port_flash_write (
    uint32_t addr,
    const void * buf,
    size_t len
) 

Flash must be erased before writing (writes can only clear bits). The implementation should handle any alignment requirements.

Parameters:

  • addr Destination address in flash.
  • buf Source data.
  • len Number of bytes to write.

Returns:

SYN_OK on success.



The documentation for this class was generated from the following file src/syntropic/port/syn_port_flash.h