ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
persistent_config.h File Reference
#include <stddef.h>
#include <string.h>
#include "hardware/flash.h"
#include "hardware/sync.h"
#include "drivers/gpio_driver.h"
#include "drivers/pio_tx_rx_driver.h"
#include "drivers/w5500_driver.h"
#include "system/common.h"
Include dependency graph for persistent_config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  config_t
 Persistent configuration blob stored in flash. More...
 

Functions

bool config_read (config_t *cfg)
 Read configuration from flash.
 
void config_write (const config_t *cfg)
 Write configuration to flash.
 
bool config_is_valid (void)
 Check if flash configuration magic marker is valid.
 
void dump_config (void)
 Print current configuration to console/log output.
 
void config_wipe (void)
 Erase persistent configuration sector.
 
void print_memory_usage (void)
 Print RAM usage statistics.
 
void print_flash_usage (void)
 Print flash usage statistics.
 

Function Documentation

◆ config_is_valid()

bool config_is_valid ( void  )

Check if flash configuration magic marker is valid.

Returns
true when stored configuration is valid.

Definition at line 123 of file persistent_config.c.

References CONFIG_MAGIC, config_t::magic, and nonsafe_config_read().

Referenced by main().

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

◆ config_read()

bool config_read ( config_t cfg)

Read configuration from flash.

Parameters
cfgDestination object.
Returns
true when valid config was read.

Definition at line 103 of file persistent_config.c.

References CONFIG_MAGIC, config_t::magic, and nonsafe_config_read().

Referenced by main().

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

◆ config_wipe()

void config_wipe ( void  )

Erase persistent configuration sector.

Definition at line 114 of file persistent_config.c.

References FLASH_TARGET_OFFSET.

Referenced by event_dispatch().

Here is the caller graph for this function:

◆ config_write()

void config_write ( const config_t cfg)

Write configuration to flash.

Parameters
cfgSource config object.

Definition at line 177 of file persistent_config.c.

References CONFIG_MAGIC, FLASH_TARGET_OFFSET, and config_t::magic.

Referenced by event_dispatch().

Here is the caller graph for this function:

◆ dump_config()

◆ print_flash_usage()

void print_flash_usage ( void  )

Print flash usage statistics.

Definition at line 78 of file persistent_config.c.

References BYTES_PER_KIBIBYTE, LOG_PLAIN, PRIu32, and W55RP20_FLASH_TOTAL_BYTES.

Referenced by event_dispatch().

Here is the caller graph for this function:

◆ print_memory_usage()

void print_memory_usage ( void  )

Print RAM usage statistics.

Definition at line 44 of file persistent_config.c.

References BYTES_PER_KIBIBYTE, LOG_PLAIN, PRIu32, RAM_BASE_ADDRESS, and RAM_TOTAL_KIBIBYTES.

Referenced by event_dispatch().

Here is the caller graph for this function: