41 #define FLAG_FILE_CLOSED 0
42 #define FLAG_FILE_OPEN 1
43 eeprom_addr_t fileptr;
44 eeprom_addr_t filesize;
47 static struct filestate file;
49 #ifdef CFS_EEPROM_CONF_OFFSET
50 #define CFS_EEPROM_OFFSET CFS_EEPROM_CONF_OFFSET
52 #define CFS_EEPROM_OFFSET 0
59 if(file.flag == FLAG_FILE_CLOSED) {
60 file.flag = FLAG_FILE_OPEN;
66 file.fileptr = file.filesize;
81 file.flag = FLAG_FILE_CLOSED;
85 cfs_read(
int f,
void *buf,
unsigned int len)
88 eeprom_read(CFS_EEPROM_OFFSET + file.fileptr, buf, len);
97 cfs_write(
int f,
const void *buf,
unsigned int len)
100 eeprom_write(CFS_EEPROM_OFFSET + file.fileptr, (
unsigned char *)buf, len);