This code simulates a 64kB SPI-RAM (23LCV512) for use with simavr.
AGPLv3+ and NO WARRANTY!
SDI-mode ("dual-SPI") is unsupported and there can be only a single RAM inside your project.
You can uncomment #define VERBOSE
in the header-file to make the code print details about what is happening.
void RAM_init(void);
void ce_RAM(void * dummy, const uint32_t value);
uint8_t spi_RAM(void * dummy, const uint8_t rx);
void RAM_cleanup(void);
This function must be called before any other function to set some internal things up.
Those are the callbacks you need to provide to the SPI-dispatcher, see documentation there. It should be possible to use this code without the SPI-dispatcher but you might need to write some glue-code. Beware that there can only be one RAM inside your project (Use NULL
for the pointer to the internal data structure you specify when initializing the SPI-dispatcher).
To be called once the simulation has finished to clean up some internal stuff.