Functions for simulating RP2350 SRAM access from PIO programs.
More...
|
| EPIO_EXPORT uint8_t * | epio_get_sram_ptr (epio_t *epio) |
| | Get a direct pointer to the emulated SRAM buffer.
|
| |
| EPIO_EXPORT uint8_t | epio_sram_read_byte (epio_t *epio, uint32_t addr) |
| | Read a byte from the emulated SRAM.
|
| |
| EPIO_EXPORT void | epio_sram_set (epio_t *epio, uint32_t addr, uint8_t *data, size_t len) |
| | Write a block of data into the emulated SRAM.
|
| |
| EPIO_EXPORT uint16_t | epio_sram_read_halfword (epio_t *epio, uint32_t addr) |
| | Read a halfword (16-bit) from the emulated SRAM.
|
| |
| EPIO_EXPORT uint32_t | epio_sram_read_word (epio_t *epio, uint32_t addr) |
| | Read a word (32-bit) from the emulated SRAM.
|
| |
| EPIO_EXPORT void | epio_sram_write_byte (epio_t *epio, uint32_t addr, uint8_t value) |
| | Write a byte to the emulated SRAM.
|
| |
| EPIO_EXPORT void | epio_sram_write_halfword (epio_t *epio, uint32_t addr, uint16_t value) |
| | Write a halfword (16-bit) to the emulated SRAM.
|
| |
| EPIO_EXPORT void | epio_sram_write_word (epio_t *epio, uint32_t addr, uint32_t value) |
| | Write a word (32-bit) to the emulated SRAM.
|
| |
Functions for simulating RP2350 SRAM access from PIO programs.
These functions allow tests to set up and inspect SRAM contents, simulating the RP2350 memory map for PIO programs that read or write SRAM via DMA or direct addressing.
◆ epio_get_sram_ptr()
| EPIO_EXPORT uint8_t * epio_get_sram_ptr |
( |
epio_t * |
epio | ) |
|
Get a direct pointer to the emulated SRAM buffer.
Returns the raw backing buffer for epio's emulated SRAM. The returned pointer is valid for the lifetime of the epio instance; address addr in the RP2350 memory map corresponds to offset (addr - MIN_SRAM_ADDR) in this buffer.
The primary use is to unify the firmware's sram_to_host() backing store with epio's SRAM after calling epio_from_apio(), so that subsequent firmware SRAM writes land directly in the running simulation without any explicit syncing step.
- Parameters
-
| epio | The epio instance. Must not be NULL. |
- Returns
- Pointer to the internal SRAM buffer; never NULL for a valid instance.
- See also
- epio_sram_set(), epio_sram_read_byte()
◆ epio_sram_read_byte()
| EPIO_EXPORT uint8_t epio_sram_read_byte |
( |
epio_t * |
epio, |
|
|
uint32_t |
addr |
|
) |
| |
Read a byte from the emulated SRAM.
- Parameters
-
| epio | The epio instance. |
| addr | SRAM address to read. |
- Returns
- The byte value at
addr.
◆ epio_sram_read_halfword()
| EPIO_EXPORT uint16_t epio_sram_read_halfword |
( |
epio_t * |
epio, |
|
|
uint32_t |
addr |
|
) |
| |
Read a halfword (16-bit) from the emulated SRAM.
- Parameters
-
| epio | The epio instance. |
| addr | SRAM address to read. Must be 2-byte aligned. |
- Returns
- The 16-bit value at
addr.
◆ epio_sram_read_word()
| EPIO_EXPORT uint32_t epio_sram_read_word |
( |
epio_t * |
epio, |
|
|
uint32_t |
addr |
|
) |
| |
Read a word (32-bit) from the emulated SRAM.
- Parameters
-
| epio | The epio instance. |
| addr | SRAM address to read. Must be 4-byte aligned. |
- Returns
- The 32-bit value at
addr.
◆ epio_sram_set()
| EPIO_EXPORT void epio_sram_set |
( |
epio_t * |
epio, |
|
|
uint32_t |
addr, |
|
|
uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
Write a block of data into the emulated SRAM.
Copies len bytes from data into the emulated SRAM starting at addr. Use this to pre-populate SRAM with test data before execution.
- Parameters
-
| epio | The epio instance. |
| addr | Starting SRAM address. |
| data | Pointer to source data. |
| len | Number of bytes to write. |
◆ epio_sram_write_byte()
| EPIO_EXPORT void epio_sram_write_byte |
( |
epio_t * |
epio, |
|
|
uint32_t |
addr, |
|
|
uint8_t |
value |
|
) |
| |
Write a byte to the emulated SRAM.
- Parameters
-
| epio | The epio instance. |
| addr | SRAM address to write. |
| value | The byte value to write. |
◆ epio_sram_write_halfword()
| EPIO_EXPORT void epio_sram_write_halfword |
( |
epio_t * |
epio, |
|
|
uint32_t |
addr, |
|
|
uint16_t |
value |
|
) |
| |
Write a halfword (16-bit) to the emulated SRAM.
- Parameters
-
| epio | The epio instance. |
| addr | SRAM address to write. Must be 2-byte aligned. |
| value | The 16-bit value to write. |
◆ epio_sram_write_word()
| EPIO_EXPORT void epio_sram_write_word |
( |
epio_t * |
epio, |
|
|
uint32_t |
addr, |
|
|
uint32_t |
value |
|
) |
| |
Write a word (32-bit) to the emulated SRAM.
- Parameters
-
| epio | The epio instance. |
| addr | SRAM address to write. Must be 4-byte aligned. |
| value | The 32-bit value to write. |