epio
A cycle-accurate RP2350 PIO emulator
Loading...
Searching...
No Matches
Functions
SRAM API

Functions for simulating RP2350 SRAM access from PIO programs. More...

Functions

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.
 

Detailed Description

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.

Function Documentation

◆ 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
epioThe epio instance.
addrSRAM 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
epioThe epio instance.
addrSRAM 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
epioThe epio instance.
addrSRAM 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
epioThe epio instance.
addrStarting SRAM address.
dataPointer to source data.
lenNumber 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
epioThe epio instance.
addrSRAM address to write.
valueThe 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
epioThe epio instance.
addrSRAM address to write. Must be 2-byte aligned.
valueThe 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
epioThe epio instance.
addrSRAM address to write. Must be 4-byte aligned.
valueThe 32-bit value to write.