X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=drv%2Feeprom.h;h=e23cd138371da8bda3a624a5fc7061cd041bfb2c;hb=9c6545aacf8bb77445e7c19e41117d2318d752cc;hp=c41519d7244cc0427c5c6394d8d8cb0a2c7762d7;hpb=bcf38f772b397e7a8ba781a69aacb9380e54b32a;p=bertos.git diff --git a/drv/eeprom.h b/drv/eeprom.h old mode 100755 new mode 100644 index c41519d7..e23cd138 --- a/drv/eeprom.h +++ b/drv/eeprom.h @@ -1,8 +1,33 @@ /** * \file * * * \version $Id$ @@ -15,6 +40,9 @@ /*#* *#* $Log$ + *#* Revision 1.10 2006/09/13 18:29:54 bernie + *#* e2addr(): New macro. + *#* *#* Revision 1.9 2006/07/19 12:56:25 bernie *#* Convert to new Doxygen style. *#* @@ -70,6 +98,17 @@ /// Type for EEPROM addresses typedef uint16_t e2addr_t; +/** + * Macro for E2Layout offset calculation + * + * \note We can't just use offsetof() here because we could use + * non-constant expressions to access array elements. + * + * \note E2Layout is a structure that must be defined in user files. + */ +#define e2addr(x) ((e2addr_t)&(((struct E2Layout *)0)->x)) + + bool eeprom_write(e2addr_t addr, const void *buf, size_t count); bool eeprom_read(e2addr_t addr, void *buf, size_t count); bool eeprom_write_char(e2addr_t addr, char c);