Nexus Embedded Platform 1.0.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
flash.h File Reference

Full physical Flash geometry and explicit bounded regions. More...

#include "nexus/core/time.h"

Go to the source code of this file.

Data Structures

struct  nx_flash_sector_t
 Erase sector geometry, with offset relative to full physical Flash. More...
struct  nx_flash_geometry_t
 Read-only physical geometry; platform reserves no product storage. More...
struct  nx_flash_region_t
 Explicit consumer-selected bounds; no implicit product partition. More...
struct  nx_flash_ops_t
 Shared read-only methods using one provider state. More...
struct  nx_flash_port
 Immutable interface pointing to caller-owned state. More...

Typedefs

typedef struct nx_flash_port nx_flash_port_t

Functions

const nx_flash_geometry_t * nx_flash_port_geometry (const nx_flash_port_t *port)
 Query exact physical Flash geometry without side effects.
nx_result_t nx_flash_port_read (const nx_flash_port_t *port, uint32_t offset, void *data, size_t length)
 Read bounded physical Flash without retaining destination.
nx_result_t nx_flash_port_program (const nx_flash_port_t *port, uint32_t offset, const void *data, size_t length, nx_time_us_t deadline)
 Program aligned physical Flash and settle all hardware pulses.
nx_result_t nx_flash_port_erase (const nx_flash_port_t *port, uint32_t offset, size_t length, nx_time_us_t deadline)
 Erase a whole physical sector range with pulse settlement.
nx_result_t nx_flash_region_validate (const nx_flash_region_t *region)
 Validate region bounds against physical geometry.
nx_result_t nx_flash_region_read (const nx_flash_region_t *region, uint32_t offset, void *data, size_t length)
 Read within an explicit physical region.
nx_result_t nx_flash_region_program (const nx_flash_region_t *region, uint32_t offset, const void *data, size_t length, nx_time_us_t deadline)
 Program within an explicitly writable physical region.
nx_result_t nx_flash_region_erase (const nx_flash_region_t *region, uint32_t offset, size_t length, nx_time_us_t deadline)
 Erase whole physical sectors within a writable region.

Detailed Description

Full physical Flash geometry and explicit bounded regions.

Author
Nexus Team

Definition in file flash.h.

Typedef Documentation

◆ nx_flash_port_t

Definition at line 15 of file flash.h.

Function Documentation

◆ nx_flash_port_erase()

nx_result_t nx_flash_port_erase ( const nx_flash_port_t * port,
uint32_t offset,
size_t length,
nx_time_us_t deadline )

Erase a whole physical sector range with pulse settlement.

Parameters
[in,out]portSingle execution owner.
[in]offsetExact sector-start physical offset.
[in]lengthPositive sum of whole sectors.
[in]deadlineAbsolute deadline checked between erase pulses.
Returns
Success or INVALID/TIMEOUT/IO; partial erase is possible on timeout/error. Return waits for current pulse to become idle.

◆ nx_flash_port_geometry()

const nx_flash_geometry_t * nx_flash_port_geometry ( const nx_flash_port_t * port)

Query exact physical Flash geometry without side effects.

Parameters
[in]portSelected exact-density physical Flash provider.
Returns
Immutable geometry, or NULL for invalid port.

◆ nx_flash_port_program()

nx_result_t nx_flash_port_program ( const nx_flash_port_t * port,
uint32_t offset,
const void * data,
size_t length,
nx_time_us_t deadline )

Program aligned physical Flash and settle all hardware pulses.

Parameters
[in,out]portSingle execution owner with valid voltage/clock policy.
[in]offsetProgram-unit aligned physical offset.
[in]dataAligned-length input retained only until return.
[in]lengthPositive program-unit multiple.
[in]deadlineAbsolute deadline checked between hardware pulses.
Returns
Success or INVALID/TIMEOUT/IO. Return proves no remaining buffer/hardware access; an active pulse cannot be preempted.
Note
Task-only CPU-active operation. Product owns execution-from- Flash stall, watchdog and power-loss policy. No RAM fake on MCU.

◆ nx_flash_port_read()

nx_result_t nx_flash_port_read ( const nx_flash_port_t * port,
uint32_t offset,
void * data,
size_t length )

Read bounded physical Flash without retaining destination.

Parameters
[in]portFixed provider; no concurrent erase/program.
[in]offsetPhysical relative offset.
[out]dataDestination not retained beyond return.
[in]lengthByte count; zero permitted with NULL data.
Returns
Success or INVALID; no access on rejected range/overflow.

◆ nx_flash_region_erase()

nx_result_t nx_flash_region_erase ( const nx_flash_region_t * region,
uint32_t offset,
size_t length,
nx_time_us_t deadline )

Erase whole physical sectors within a writable region.

Parameters
[in]regionExplicit valid writable region.
[in]offsetRegion-relative sector boundary.
[in]lengthSum of whole sector lengths.
[in]deadlineAbsolute pulse deadline.
Returns
Success, INVALID/PERMISSION or underlying pulse result.

◆ nx_flash_region_program()

nx_result_t nx_flash_region_program ( const nx_flash_region_t * region,
uint32_t offset,
const void * data,
size_t length,
nx_time_us_t deadline )

Program within an explicitly writable physical region.

Parameters
[in]regionValid writable region.
[in]offsetRegion-relative aligned offset.
[in]dataInput buffer; borrowed until return only.
[in]lengthAligned positive length.
[in]deadlineAbsolute pulse deadline.
Returns
Success, INVALID/PERMISSION or underlying pulse result.

◆ nx_flash_region_read()

nx_result_t nx_flash_region_read ( const nx_flash_region_t * region,
uint32_t offset,
void * data,
size_t length )

Read within an explicit physical region.

Parameters
[in]regionValid region.
[in]offsetRegion-relative byte offset.
[out]dataDestination buffer.
[in]lengthByte count.
Returns
Success or INVALID without access outside the region.

◆ nx_flash_region_validate()

nx_result_t nx_flash_region_validate ( const nx_flash_region_t * region)

Validate region bounds against physical geometry.

Parameters
[in]regionExplicit caller-owned region description.
Returns
Success or INVALID; erase geometry is checked per operation.