Out-of-office display, GFX
|
Driver for SST39 series parallell flash memory devices. More...
Files | |
file | sst39FlashDriver.h |
Macros | |
#define | SST_EPMP_CS_BASE_ADDRESS GFX_EPMP_CS2_BASE_ADDRESS |
Flash memory device address. | |
#define | SST_FLASH_SIZE 0x40000 |
Capacity of flash memory device. | |
#define | SST_ENABLE_STDOUT_ERRORS |
Allows this driver to report errors to stdout. |
Functions | |
int | sst39_writeWord (uint32_t address, uint16_t data) |
Write a word (16 bit) to the flash memory. | |
int | sst39_writeBytes (uint32_t address, const uint8_t *data, size_t len) |
Write a series of bytes to the flash memory. | |
uint16_t | sst39_readWord (uint32_t address) |
Read a word (16 bit) from the flash memory. | |
void | sst39_readBytes (uint32_t address, uint8_t *buffer, size_t bufferLen) |
Read a series of bytes from the flash memory. | |
void | sst39_readBytesBlocking (uint32_t address, uint8_t *buffer, size_t bufferLen) |
Read a series of bytes from the flash memory, not re-enabling EPMP bypass mode between writes. | |
void | sst39_eraseChip () |
Erase everything in the flash memory. | |
void | sst39_eraseSector (uint32_t address) |
Erase a given sector in the flash memory. | |
int | sst39_size () |
Get the size of the device. | |
int | sst39_test () |
Checks the device's manufacture and device ID. |
Driver for SST39 series parallell flash memory devices.
#define SST_EPMP_CS_BASE_ADDRESS GFX_EPMP_CS2_BASE_ADDRESS |
Flash memory device address.
This define is required.
#define SST_FLASH_SIZE 0x40000 |
Capacity of flash memory device.
Not required. If defined, and if SST_ENABLE_STDOUT_ERRORS is defined, attempts to write and write outside the address range of the device will be logged as errors to stdout.
void sst39_eraseSector | ( | uint32_t | address | ) |
Erase a given sector in the flash memory.
address | address of the sector to erase |
void sst39_readBytes | ( | uint32_t | address, |
uint8_t * | buffer, | ||
size_t | bufferLen | ||
) |
Read a series of bytes from the flash memory.
This function does the same as sst39_readWord(), but it operates on a series of bytes instead of one word. EPMP bypass will be disabled and re-enabled between every read operation.
address | the address to data that will be read |
buffer | buffer to store data in |
bufferLen | length of buffer |
void sst39_readBytesBlocking | ( | uint32_t | address, |
uint8_t * | buffer, | ||
size_t | bufferLen | ||
) |
Read a series of bytes from the flash memory, not re-enabling EPMP bypass mode between writes.
This function does the same as sst39_readBytes(), but is only disables and re-enables EPMP bypass mode once.
address | the address to data that will be read |
buffer | buffer to store data in |
bufferLen | length of buffer |
uint16_t sst39_readWord | ( | uint32_t | address | ) |
Read a word (16 bit) from the flash memory.
This function will temporarily disable EPMP bypass mode, request a read from the flash, wait until the EPMP module is ready and return the data from the EPMP buffer.
address | the address to data that will be read |
int sst39_size | ( | ) |
Get the size of the device.
, where
is the return value of this function, gives number of bytes the device can contain.
int sst39_writeBytes | ( | uint32_t | address, |
const uint8_t * | data, | ||
size_t | len | ||
) |
Write a series of bytes to the flash memory.
This functions does the same as sst39_writeWord(), but it operates on a series of bytes instead of one word. EPMP bypass will be disabled and re-enabled between every write operation.
address | the address to where the data should be stored |
data | an array of bytes to write |
len | length of the data array |
int sst39_writeWord | ( | uint32_t | address, |
uint16_t | data | ||
) |
Write a word (16 bit) to the flash memory.
This function will temporarily disable EPMP bypass mode, wait until the EPMP module is ready and write the data. It will then busy-wait until the data is written and check that the data was successfully written by reading the same address twice from the flash.
address | the address to where the data should be stored |
data | the data to write |