libsavgba
A library to access various backup media in GBA cartridges
|
Go to the source code of this file.
Enumerations | |
enum | FlashSize { FLASH_SIZE_AUTO = 0 , FLASH_SIZE_64KB , FLASH_SIZE_128KB } |
Flash chip size. More... | |
enum | FlashManufacturer { FLASH_MFR_ATMEL = 0x1F , FLASH_MFR_PANASONIC = 0x32 , FLASH_MFR_SANYO = 0x62 , FLASH_MFR_SST = 0xBF , FLASH_MFR_MACRONIX = 0xC2 } |
Flash chip manufacturer. More... | |
enum | FlashDevice { FLASH_DEV_MX29L010 = 0x09 , FLASH_DEV_LE26FV10N1TS = 0x13 , FLASH_DEV_MN63F805MNP = 0x1B , FLASH_DEV_MX29L512 = 0x1C , FLASH_DEV_AT29LV512 = 0x3D , FLASH_DEV_LE39FW512 = 0xD4 } |
Flash chip device code. More... | |
Functions | |
int | flash_init (u8 size) |
Init Flash chip. More... | |
int | flash_reset () |
Reset Flash chip. More... | |
int | flash_read (u32 addr, u8 *data, size_t size) |
Read data from Flash (size: 64KB/128KB). More... | |
int | flash_write (u32 addr, u8 *data, size_t size) |
Write data to Flash (size: 64KB/128KB). More... | |
enum FlashDevice |
enum FlashManufacturer |
enum FlashSize |
int flash_init | ( | u8 | size | ) |
Init Flash chip.
Detect the type (and presence) of FLASH chips. It should be called once at first.
size | Flash chip size (FLASH_SIZE_AUTO / FLASH_SIZE_64KB / FLASH_SIZE_128KB ). Use FLASH_SIZE_AUTO if you don't know. |
0
for success, non-zero
for error. int flash_read | ( | u32 | addr, |
u8 * | data, | ||
size_t | size | ||
) |
Read data from Flash (size: 64KB/128KB).
addr | address in Flash (unit: byte). |
data | buffer to hold data. |
size | data size (unit: byte). |
0
for success, non-zero
for error. int flash_reset | ( | ) |
Reset Flash chip.
Erases all memory in chip, erased memory is FFh-filled.
0
for success, non-zero
for error. int flash_write | ( | u32 | addr, |
u8 * | data, | ||
size_t | size | ||
) |
Write data to Flash (size: 64KB/128KB).
Target sector will be erased.
addr | address in Flash (unit: byte). |
data | buffer to hold data. |
size | data size (unit: byte). |
0
for success, non-zero
for error.