libdragon
Loading...
Searching...
No Matches
eepromfs.h
Go to the documentation of this file.
1
6#ifndef __LIBDRAGON_EEPROMFS_H
7#define __LIBDRAGON_EEPROMFS_H
8
9#include <stddef.h>
10#include <stdint.h>
11#include <stdbool.h>
12
18#define EEPFS_ESUCCESS 0
20#define EEPFS_EBADINPUT -1
22#define EEPFS_ENOFILE -2
24#define EEPFS_EBADFS -3
26#define EEPFS_ENOMEM -4
28#define EEPFS_EBADHANDLE -5
30#define EEPFS_ECONFLICT -6
33#ifdef __cplusplus
34extern "C" {
35#endif
36
41typedef struct eepfs_entry_t
42{
57 const char * path;
73 size_t size;
75
106int eepfs_init(const eepfs_entry_t * entries, size_t count);
107
117int eepfs_close(void);
118
119
132int eepfs_read(const char * path, void * dest, size_t size);
133
149int eepfs_write(const char * path, const void * src, size_t size);
150
167int eepfs_erase(const char * path);
168
169
193bool eepfs_verify_signature(void);
194
212void eepfs_wipe(void);
213
214#ifdef __cplusplus
215}
216#endif
217
218#endif
bool eepfs_verify_signature(void)
Validates the first block of EEPROM.
Definition eepromfs.c:371
int eepfs_read(const char *path, void *dest, size_t size)
Reads an entire file from the EEPROM filesystem.
Definition eepromfs.c:301
int eepfs_close(void)
De-initializes the EEPROM filesystem.
Definition eepromfs.c:284
const char * path
File path.
Definition eepromfs.h:57
int eepfs_init(const eepfs_entry_t *entries, size_t count)
Initializes the EEPROM filesystem.
Definition eepromfs.c:208
size_t size
File size in bytes.
Definition eepromfs.h:73
int eepfs_write(const char *path, const void *src, size_t size)
Writes an entire file to the EEPROM filesystem.
Definition eepromfs.c:323
int eepfs_erase(const char *path)
Erases a file in the EEPROM filesystem.
Definition eepromfs.c:345
void eepfs_wipe(void)
Erases all blocks in EEPROM and sets a new signature.
Definition eepromfs.c:385
EEPROM filesystem configuration file entry.
Definition eepromfs.h:42