libdragon
Loading...
Searching...
No Matches
eepromfs.h
Go to the documentation of this file.
1
8#ifndef __LIBDRAGON_EEPROMFS_H
9#define __LIBDRAGON_EEPROMFS_H
10
11#include <stddef.h>
12#include <stdint.h>
13#include <stdbool.h>
14
20#define EEPFS_ESUCCESS 0
22#define EEPFS_EBADINPUT -1
24#define EEPFS_ENOFILE -2
26#define EEPFS_EBADFS -3
28#define EEPFS_ENOMEM -4
30#define EEPFS_EBADHANDLE -5
32#define EEPFS_ECONFLICT -6
35#ifdef __cplusplus
36extern "C" {
37#endif
38
43typedef struct eepfs_entry_t
44{
59 const char * path;
75 size_t size;
77
108int eepfs_init(const eepfs_entry_t * entries, size_t count);
109
119int eepfs_close(void);
120
121
134int eepfs_read(const char * path, void * dest, size_t size);
135
151int eepfs_write(const char * path, const void * src, size_t size);
152
169int eepfs_erase(const char * path);
170
171
195bool eepfs_verify_signature(void);
196
214void eepfs_wipe(void);
215
216#ifdef __cplusplus
217}
218#endif
219
220#endif
bool eepfs_verify_signature(void)
Validates the first block of EEPROM.
Definition eepromfs.c:372
int eepfs_read(const char *path, void *dest, size_t size)
Reads an entire file from the EEPROM filesystem.
Definition eepromfs.c:302
int eepfs_close(void)
De-initializes the EEPROM filesystem.
Definition eepromfs.c:285
const char * path
File path.
Definition eepromfs.h:59
int eepfs_init(const eepfs_entry_t *entries, size_t count)
Initializes the EEPROM filesystem.
Definition eepromfs.c:209
size_t size
File size in bytes.
Definition eepromfs.h:75
int eepfs_write(const char *path, const void *src, size_t size)
Writes an entire file to the EEPROM filesystem.
Definition eepromfs.c:324
int eepfs_erase(const char *path)
Erases a file in the EEPROM filesystem.
Definition eepromfs.c:346
void eepfs_wipe(void)
Erases all blocks in EEPROM and sets a new signature.
Definition eepromfs.c:386
EEPROM filesystem configuration file entry.
Definition eepromfs.h:44