dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_streamfs.c File Reference
#include "pios.h"
#include "pios_flash.h"
#include "pios_streamfs_priv.h"
#include "pios_mutex.h"
#include "pios_semaphore.h"
#include "pios_thread.h"
#include <stdbool.h>
#include <stddef.h>
#include <pios_com.h>

Go to the source code of this file.

Data Structures

struct  streamfs_state
 
struct  streamfs_footer
 

Macros

#define MIN(x, y)   ((x) < (y) ? (x) : (y))
 
#define PIOS_STREAMFS_TASK_PRIORITY   PIOS_THREAD_PRIO_LOW
 
#define PIOS_STREAMFS_TASK_STACK_BYTES   1000
 

Enumerations

enum  pios_flashfs_streamfs_dev_magic { PIOS_FLASHFS_STREAMFS_DEV_MAGIC = 0x93A40F82 }
 

Functions

static void PIOS_STREAMFS_RegisterTxCallback (uintptr_t fs_id, pios_com_callback tx_out_cb, uintptr_t context)
 
static void PIOS_STREAMFS_TxStart (uintptr_t fs_id, uint16_t tx_bytes_avail)
 
static uintptr_t streamfs_get_addr (const struct streamfs_state *streamfs, uint32_t arena_id, uint16_t arena_offset)
 Return the offset in flash of a particular slot within an arena. More...
 
enum arena_state __attribute__ ((packed))
 
static int32_t streamfs_erase_arena (const struct streamfs_state *streamfs, uint32_t arena_id)
 Erases all sectors within the given arena and sets arena to erased state. More...
 
static int32_t streamfs_erase_all_arenas (const struct streamfs_state *streamfs)
 Erases all arenas available to this filesystem instance. More...
 
static bool streamfs_validate (const struct streamfs_state *streamfs)
 
static struct streamfs_statestreamfs_alloc (void)
 
static int32_t streamfs_new_sector (struct streamfs_state *streamfs)
 
static int32_t streamfs_close_sector (struct streamfs_state *streamfs)
 
static int32_t streamfs_find_first_arena (struct streamfs_state *streamfs, int32_t file_id)
 
static int32_t streamfs_find_last_arena (struct streamfs_state *streamfs, int32_t file_id)
 
static int32_t streamfs_find_new_sector (struct streamfs_state *streamfs)
 
static int32_t streamfs_append_to_file (struct streamfs_state *streamfs, uint8_t *data, uint32_t len)
 
static int32_t streamfs_read_from_file (struct streamfs_state *streamfs, uint8_t *data, uint32_t len)
 
static int32_t streamfs_scan_filesystem (struct streamfs_state *streamfs)
 
static void PIOS_STREAMFS_Task (void *parameters)
 
int32_t PIOS_STREAMFS_Init (uintptr_t *fs_id, const struct streamfs_cfg *cfg, enum pios_flash_partition_labels partition_label)
 Initialize the flash object setting FS. More...
 
int32_t PIOS_STREAMFS_Format (uintptr_t fs_id)
 Erases all filesystem arenas and activate the first arena. More...
 
int32_t PIOS_STREAMFS_OpenWrite (uintptr_t fs_id)
 
int32_t PIOS_STREAMFS_OpenRead (uintptr_t fs_id, uint32_t file_id)
 
int32_t PIOS_STREAMFS_MinFileId (uintptr_t fs_id)
 
int32_t PIOS_STREAMFS_MaxFileId (uintptr_t fs_id)
 
int32_t PIOS_STREAMFS_Close (uintptr_t fs_id)
 
int32_t PIOS_STREAMFS_Read (uintptr_t fs_id, uint8_t *data, uint32_t len)
 
int32_t PIOS_STREAMFS_Testing_Write (uintptr_t fs_id, uint8_t *data, uint32_t len)
 

Variables

const struct pios_com_driver pios_streamfs_com_driver
 
uint32_t magic
 
uint32_t written_bytes
 
uint32_t file_id
 
uint16_t file_segment
 

Variable Documentation

uint32_t file_id

Definition at line 121 of file pios_streamfs.c.

uint16_t file_segment

Definition at line 122 of file pios_streamfs.c.

uint32_t magic

Definition at line 119 of file pios_streamfs.c.

uint32_t written_bytes

Definition at line 120 of file pios_streamfs.c.