41 #include PLATFORM_HEADER
46 #define EE_HW_ADDRESS 0xA0
47 #define EE_PAGESIZE 32
48 #define EE_PAGEMASK 0x1F
49 #define EE_MAX_TRIALS 300
68 i2c_write(EE_HW_ADDRESS | 0x0);
71 if(trials++ == EE_MAX_TRIALS) {
75 }
while((SC2_STAT(SC_TWIRXNAK)) == SC_TWIRXNAK);
100 unsigned int curaddr;
103 for(i = 0; i < size; i++) {
106 if(i == 0 || (curaddr & EE_PAGEMASK) == 0) {
109 i2c_write(EE_HW_ADDRESS | 0x0);
112 i2c_write((curaddr & 0xFF00) >> 8);
113 i2c_write(curaddr & 0xFF);
117 i2c_write(buf[i] & 0xFF);
121 if(i == size - 1 || (curaddr & EE_PAGEMASK) == EE_PAGEMASK) {
144 i2c_write(EE_HW_ADDRESS | 0x0);
147 i2c_write((addr & 0xFF00) >> 8);
148 i2c_write(addr & 0xFF);
153 i2c_write(EE_HW_ADDRESS | 0x1);
155 for(i = 0; i < size; i++) {
static uip_ds6_addr_t * addr
Pointer to a router list entry.
void eeprom_read(eeprom_addr_t addr, unsigned char *buf, int size)
Read data from the EEPROM.
void eeprom_init(void)
Initialize the EEPROM module.
void eeprom_write(eeprom_addr_t addr, unsigned char *buf, int size)
Write a buffer into EEPROM.
uint8_t i2c_read(int ack)
Read a byte from I2C bus.