00001 #ifndef _DEV_AT24C_H_ 00002 #define _DEV_AT24C_H_ 00003 00004 #include <sys/types.h> 00005 #include <stdint.h> 00006 #include <cfg/eeprom.h> 00007 00008 #ifndef NUT_CONFIG_AT24_ADR 00009 #define NUT_CONFIG_AT24_ADR 0x50 00010 #endif 00011 00012 struct at24c{ 00013 uint8_t SlaveAddress; /*< Slave address on the bus */ 00014 uint8_t IAddrW; /*< With of slaves address register in bytes */ 00015 uint8_t PageSize; /*< Size of pages that can be written at once */ 00016 uint32_t EepromSize; /*< Size of the eeprom memory in total */ 00017 uint8_t Timeout; /*< Timeout of internal programming in ms*/ 00018 #ifdef AT24C_BLOCK_ADDR 00019 uint8_t BlInSla; /*< Block in slave address (lower 3 bits used 00020 for internal high byte of address) */ 00021 #endif 00022 HANDLE ee_mutex; /*< Mutex to avoid concurrent access to same EEPROM */ 00023 // unsigned int EepromName; 00024 }; 00025 00026 extern int At24cWrite( struct at24c *at24cs, uint8_t *buffer, uint16_t len, uint16_t addr); 00027 extern int At24cRead( struct at24c *at24cs, uint8_t *buffer, uint16_t len, uint16_t addr ); 00028 00029 #endif