Out-of-office display, GFX
 All Classes Files Functions Variables Enumerations Enumerator Groups
Files | Macros | Functions
SST39 flash memory driver

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.

Detailed Description

Driver for SST39 series parallell flash memory devices.

Author
Andreas Misje
Date
20.03.13

Macro Definition Documentation

#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.

Function Documentation

void sst39_eraseSector ( uint32_t  address)

Erase a given sector in the flash memory.

Parameters
addressaddress 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.

See Also
sst39_readWord()
Parameters
addressthe address to data that will be read
bufferbuffer to store data in
bufferLenlength 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.

See Also
sst39_readBytes()
Parameters
addressthe address to data that will be read
bufferbuffer to store data in
bufferLenlength 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.

Parameters
addressthe address to data that will be read
Returns
the requested data
int sst39_size ( )

Get the size of the device.

$2^n$, where $n$ 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.

See Also
sst39_writeWord()
Parameters
addressthe address to where the data should be stored
dataan array of bytes to write
lenlength of the data array
Returns
0 if the write succeeded, non-zero if the data could not be verified after the write operation
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.

Parameters
addressthe address to where the data should be stored
datathe data to write
Returns
0 if the write succeeded, non-zero if the data could not be verified after the write operation