#include <stdint.h>
#include "drivers/flash.h"
Go to the source code of this file.
#define FLASHFS_WRITE_BUFFER_AUTO_FLUSH_LEN 64 |
#define FLASHFS_WRITE_BUFFER_SIZE 128 |
void flashfsEraseCompletely |
( |
void |
| ) |
|
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.
bool flashfsFlushAsync |
( |
void |
| ) |
|
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).
void flashfsFlushSync |
( |
void |
| ) |
|
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.
uint32_t flashfsGetOffset |
( |
void |
| ) |
|
Get the current offset of the file pointer within the volume.
uint32_t flashfsGetSize |
( |
void |
| ) |
|
uint32_t flashfsGetWriteBufferFreeSpace |
( |
void |
| ) |
|
Get the number of bytes that can currently be written to flashfs without any blocking or data loss.
uint32_t flashfsGetWriteBufferSize |
( |
void |
| ) |
|
Get the size of the largest single write that flashfs could ever accept without blocking or data loss.
int flashfsIdentifyStartOfFreeSpace |
( |
void |
| ) |
|
Find the offset of the start of the free space on the device (or the size of the device if it is full).
void flashfsInit |
( |
void |
| ) |
|
Call after initializing the flash chip in order to set up the filesystem.
bool flashfsIsEOF |
( |
void |
| ) |
|
Returns true if the file pointer is at the end of the device.
bool flashfsIsReady |
( |
void |
| ) |
|
Return true if the flash is not currently occupied with an operation.
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.
void flashfsSeekAbs |
( |
uint32_t |
offset | ) |
|
void flashfsSeekRel |
( |
int32_t |
offset | ) |
|
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.
void flashfsWriteByte |
( |
uint8_t |
byte | ) |
|
Write the given byte asynchronously to the flash. If the buffer overflows, data is silently discarded.