NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
flashfs.h File Reference
#include <stdint.h>
#include "drivers/flash.h"
Include dependency graph for flashfs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FLASHFS_WRITE_BUFFER_SIZE   128
 
#define FLASHFS_WRITE_BUFFER_USABLE   (FLASHFS_WRITE_BUFFER_SIZE - 1)
 
#define FLASHFS_WRITE_BUFFER_AUTO_FLUSH_LEN   64
 

Functions

void flashfsEraseCompletely (void)
 
void flashfsEraseRange (uint32_t start, uint32_t end)
 
uint32_t flashfsGetSize (void)
 
uint32_t flashfsGetOffset (void)
 
uint32_t flashfsGetWriteBufferFreeSpace (void)
 
uint32_t flashfsGetWriteBufferSize (void)
 
int flashfsIdentifyStartOfFreeSpace (void)
 
const flashGeometry_tflashfsGetGeometry (void)
 
void flashfsSeekAbs (uint32_t offset)
 
void flashfsSeekRel (int32_t offset)
 
void flashfsWriteByte (uint8_t byte)
 
void flashfsWrite (const uint8_t *data, unsigned int len, bool sync)
 
int flashfsReadAbs (uint32_t offset, uint8_t *data, unsigned int len)
 
bool flashfsFlushAsync (void)
 
void flashfsFlushSync (void)
 
void flashfsInit (void)
 
bool flashfsIsReady (void)
 
bool flashfsIsEOF (void)
 

Macro Definition Documentation

#define FLASHFS_WRITE_BUFFER_AUTO_FLUSH_LEN   64
#define FLASHFS_WRITE_BUFFER_SIZE   128
#define FLASHFS_WRITE_BUFFER_USABLE   (FLASHFS_WRITE_BUFFER_SIZE - 1)

Function Documentation

void flashfsEraseCompletely ( void  )

Here is the call graph for this function:

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.

Here is the call graph for this function:

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.

const flashGeometry_t* flashfsGetGeometry ( void  )

Here is the call graph for this function:

uint32_t flashfsGetOffset ( void  )

Get the current offset of the file pointer within the volume.

uint32_t flashfsGetSize ( void  )

Here is the call graph for this function:

uint32_t flashfsGetWriteBufferFreeSpace ( void  )

Get the number of bytes that can currently be written to flashfs without any blocking or data loss.

Here is the call graph for this function:

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

Here is the call graph for this function:

void flashfsInit ( void  )

Call after initializing the flash chip in order to set up the filesystem.

Here is the call graph for this function:

bool flashfsIsEOF ( void  )

Returns true if the file pointer is at the end of the device.

Here is the call graph for this function:

bool flashfsIsReady ( void  )

Return true if the flash is not currently occupied with an operation.

Here is the call graph for this function:

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.

Here is the call graph for this function:

void flashfsSeekAbs ( uint32_t  offset)

Here is the call graph for this function:

void flashfsSeekRel ( int32_t  offset)

Here is the call graph for this function:

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.

Here is the call graph for this function: