eeprom.h
Go to the documentation of this file.00001
00041 #ifndef DRV_EEPROM_H
00042 #define DRV_EEPROM_H
00043
00044 #include <cfg/compiler.h>
00045 #include <appconfig.h>
00046
00051 #define EEPROM_24XX16 1
00052 #define EEPROM_24XX256 2
00053
00054
00055 #if CONFIG_EEPROM_TYPE == EEPROM_24XX16
00056 #define EEPROM_BLKSIZE 0x10
00057 #define EEPROM_SIZE 0x800
00058 #elif CONFIG_EEPROM_TYPE == EEPROM_24XX256
00059 #define EEPROM_BLKSIZE 0x40
00060 #define EEPROM_SIZE 0x8000
00061 #else
00062 #error Unsupported EEPROM type.
00063 #endif
00064
00066 typedef uint16_t e2addr_t;
00067
00077 #define e2addr(type, field) ((e2addr_t)&(((type *)0)->field))
00078
00079
00080 bool eeprom_write(e2addr_t addr, const void *buf, size_t count);
00081 bool eeprom_read(e2addr_t addr, void *buf, size_t count);
00082 bool eeprom_write_char(e2addr_t addr, char c);
00083 int eeprom_read_char(e2addr_t addr);
00084 void eeprom_erase(e2addr_t addr, size_t count);
00085 void eeprom_init(void);
00086 void eeprom_test(void);
00087
00088 #endif