libdragon
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
76int eepfs_init(const eepfs_entry_t * entries, size_t count);
77int eepfs_close(void);
78
79int eepfs_read(const char * path, void * dest, size_t size);
80int eepfs_write(const char * path, const void * src, size_t size);
81int eepfs_erase(const char * path);
82
83bool eepfs_verify_signature(void);
84void eepfs_wipe(void);
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif
bool eepfs_verify_signature(void)
Validates the first block of EEPROM.
Definition: eepromfs.c:475
int eepfs_read(const char *path, void *dest, size_t size)
Reads an entire file from the EEPROM filesystem.
Definition: eepromfs.c:351
int eepfs_close(void)
De-initializes the EEPROM filesystem.
Definition: eepromfs.c:322
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:237
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:388
int eepfs_erase(const char *path)
Erases a file in the EEPROM filesystem.
Definition: eepromfs.c:426
void eepfs_wipe(void)
Erases all blocks in EEPROM and sets a new signature.
Definition: eepromfs.c:506
EEPROM filesystem configuration file entry.
Definition: eepromfs.h:42