Go to the source code of this file.
Macros | |
#define | FLASHFS_WRITE_BUFFER_AUTO_FLUSH_LEN 64 |
#define | FLASHFS_WRITE_BUFFER_SIZE 128 |
#define | FLASHFS_WRITE_BUFFER_USABLE (FLASHFS_WRITE_BUFFER_SIZE - 1) |
Functions | |
void | flashfsEraseCompletely () |
void | flashfsEraseRange (uint32_t start, uint32_t end) |
bool | flashfsFlushAsync () |
void | flashfsFlushSync () |
const flashGeometry_t * | flashfsGetGeometry () |
uint32_t | flashfsGetOffset () |
uint32_t | flashfsGetSize () |
uint32_t | flashfsGetWriteBufferFreeSpace () |
uint32_t | flashfsGetWriteBufferSize () |
int | flashfsIdentifyStartOfFreeSpace () |
void | flashfsInit () |
bool | flashfsIsEOF () |
bool | flashfsIsReady () |
int | flashfsReadAbs (uint32_t offset, uint8_t *data, unsigned int len) |
void | flashfsSeekAbs (uint32_t offset) |
void | flashfsSeekRel (int32_t offset) |
void | flashfsWrite (const uint8_t *data, unsigned int len, bool sync) |
void | flashfsWriteByte (uint8_t byte) |
#define FLASHFS_WRITE_BUFFER_AUTO_FLUSH_LEN 64 |
Definition at line 32 of file drv_flashfs.h.
#define FLASHFS_WRITE_BUFFER_SIZE 128 |
Definition at line 28 of file drv_flashfs.h.
#define FLASHFS_WRITE_BUFFER_USABLE (FLASHFS_WRITE_BUFFER_SIZE - 1) |
Definition at line 29 of file drv_flashfs.h.
void flashfsEraseCompletely | ( | ) |
Definition at line 72 of file drv_flashfs.c.
void flashfsEraseRange | ( | uint32_t | start, |
uint32_t | end | ||
) |
Start and end must lie on sector boundaries, or they will be rounded out to sector boundaries such that all the bytes in the range [start...end) are erased.
Definition at line 85 of file drv_flashfs.c.
bool flashfsFlushAsync | ( | ) |
If the flash is ready to accept writes, flush the buffer to it.
Returns true if all data in the buffer has been flushed to the device, or false if there is still data to be written (call flush again later).
Definition at line 310 of file drv_flashfs.c.
void flashfsFlushSync | ( | ) |
Wait for the flash to become ready and begin flushing any buffered data to flash.
The flash will still be busy some time after this sync completes, but space will be freed up to accept more writes in the write buffer.
Definition at line 333 of file drv_flashfs.c.
const flashGeometry_t* flashfsGetGeometry | ( | ) |
Definition at line 145 of file drv_flashfs.c.
uint32_t flashfsGetOffset | ( | ) |
Get the current offset of the file pointer within the volume.
Definition at line 275 of file drv_flashfs.c.
uint32_t flashfsGetSize | ( | ) |
Definition at line 116 of file drv_flashfs.c.
uint32_t flashfsGetWriteBufferFreeSpace | ( | ) |
Get the number of bytes that can currently be written to flashfs without any blocking or data loss.
Definition at line 140 of file drv_flashfs.c.
uint32_t flashfsGetWriteBufferSize | ( | ) |
Get the size of the largest single write that flashfs could ever accept without blocking or data loss.
Definition at line 132 of file drv_flashfs.c.
int flashfsIdentifyStartOfFreeSpace | ( | ) |
Find the offset of the start of the free space on the device (or the size of the device if it is full).
Definition at line 489 of file drv_flashfs.c.
void flashfsInit | ( | ) |
Call after initializing the flash chip in order to set up the filesystem.
Definition at line 565 of file drv_flashfs.c.
bool flashfsIsEOF | ( | ) |
Returns true if the file pointer is at the end of the device.
Definition at line 558 of file drv_flashfs.c.
bool flashfsIsReady | ( | ) |
Return true if the flash is not currently occupied with an operation.
Definition at line 111 of file drv_flashfs.c.
int flashfsReadAbs | ( | uint32_t | address, |
uint8_t * | buffer, | ||
unsigned int | len | ||
) |
Read len
bytes from the given address into the supplied buffer.
Returns the number of bytes actually read which may be less than that requested.
Definition at line 468 of file drv_flashfs.c.
void flashfsSeekAbs | ( | uint32_t | offset | ) |
Definition at line 349 of file drv_flashfs.c.
void flashfsSeekRel | ( | int32_t | offset | ) |
Definition at line 356 of file drv_flashfs.c.
void flashfsWrite | ( | const uint8_t * | data, |
unsigned int | len, | ||
bool | sync | ||
) |
Write the given buffer to the flash either synchronously or asynchronously depending on the 'sync' parameter.
If writing asynchronously, data will be silently discarded if the buffer overflows. If writing synchronously, the routine will block waiting for the flash to become ready so will never drop data.
Definition at line 385 of file drv_flashfs.c.
void flashfsWriteByte | ( | uint8_t | byte | ) |
Write the given byte asynchronously to the flash. If the buffer overflows, data is silently discarded.
Definition at line 366 of file drv_flashfs.c.