libdragon
|
EEPROM support. More...
Go to the source code of this file.
Macros | |
#define | EEPROM_BLOCK_SIZE 8 |
Size of an EEPROM save block in bytes. | |
Enumerations | |
enum | eeprom_type_t { EEPROM_NONE = 0 , EEPROM_4K = 1 , EEPROM_16K = 2 } |
EEPROM Probe Values. More... | |
Functions | |
eeprom_type_t | eeprom_present (void) |
Probe the EEPROM interface on the cartridge. | |
size_t | eeprom_total_blocks (void) |
Determine how many blocks of EEPROM exist on the cartridge. | |
void | eeprom_read (uint8_t block, uint8_t *dest) |
Read a block from EEPROM. | |
uint8_t | eeprom_write (uint8_t block, const uint8_t *src) |
Write a block to EEPROM. | |
void | eeprom_read_bytes (uint8_t *dest, size_t start, size_t len) |
Read a buffer of bytes from EEPROM. | |
void | eeprom_write_bytes (const uint8_t *src, size_t start, size_t len) |
Write a buffer of bytes to EEPROM. | |
EEPROM support.
enum eeprom_type_t |
EEPROM Probe Values.
Enumerator | |
---|---|
EEPROM_NONE | No EEPROM present. |
EEPROM_4K | 4 kilobit (64-block) EEPROM present |
EEPROM_16K | 16 kilobit (256-block) EEPROM present |
eeprom_type_t eeprom_present | ( | void | ) |
Probe the EEPROM interface on the cartridge.
Inspect the identifier half-word of the EEPROM status response to determine which EEPROM save type is available (if any).
size_t eeprom_total_blocks | ( | void | ) |
Determine how many blocks of EEPROM exist on the cartridge.
void eeprom_read | ( | uint8_t | block, |
uint8_t * | dest | ||
) |
Read a block from EEPROM.
[in] | block | Block to read data from. Joybus accesses EEPROM in 8-byte blocks. |
[out] | dest | Destination buffer for the eight bytes read from EEPROM. |
uint8_t eeprom_write | ( | uint8_t | block, |
const uint8_t * | src | ||
) |
Write a block to EEPROM.
[in] | block | Block to write data to. Joybus accesses EEPROM in 8-byte blocks. |
[in] | src | Source buffer for the eight bytes of data to write to EEPROM. |
void eeprom_read_bytes | ( | uint8_t * | dest, |
size_t | start, | ||
size_t | len | ||
) |
Read a buffer of bytes from EEPROM.
This is a high-level convenience helper that abstracts away the one-at-a-time EEPROM block access pattern.
[out] | dest | Destination buffer to read data into |
[in] | start | Byte offset in EEPROM to start reading data from |
[in] | len | Byte length of data to read into buffer |
void eeprom_write_bytes | ( | const uint8_t * | src, |
size_t | start, | ||
size_t | len | ||
) |
Write a buffer of bytes to EEPROM.
This is a high-level convenience helper that abstracts away the one-at-a-time EEPROM block access pattern.
Each EEPROM block write takes approximately 15 milliseconds; this operation may block for a while with large buffer sizes:
You may want to pause audio before calling this.
[in] | src | Source buffer containing data to write |
[in] | start | Byte offset in EEPROM to start writing data to |
[in] | len | Byte length of the src buffer |