BeRTOS
Defines | Functions | Variables
eeprom.c File Reference

Driver for the 24xx16 and 24xx256 I2C EEPROMS (implementation) More...

#include "eeprom.h"
#include "cfg/cfg_i2c.h"
#include "cfg/cfg_eeprom.h"
#include <cfg/log.h>
#include <cfg/debug.h>
#include <cfg/macros.h>
#include <cpu/attr.h>
#include <drv/i2c.h>
#include <string.h>

Go to the source code of this file.

Defines

#define EEPROM_ID   0xA0
 EEPROM ID code.
#define EEPROM_ADDR(x)   (EEPROM_ID | (((uint8_t)((x) & 0x07)) << 1))
 This macros form the correct slave address for EEPROMs.

Functions

bool eeprom_erase (Eeprom *eep, e2addr_t addr, e2_size_t size)
 Erase EEPROM.
bool eeprom_verify (Eeprom *eep, e2addr_t addr, const void *buf, size_t size)
 Verify EEPROM.
void eeprom_init_5 (Eeprom *eep, I2c *i2c, EepromType type, e2dev_addr_t addr, bool verify)
 Initialize EEPROM module.

Variables

static const EepromInfo mem_info []
 Array used to describe EEPROM memory devices currently supported.

Detailed Description

Driver for the 24xx16 and 24xx256 I2C EEPROMS (implementation)

Author:
Stefano Fedrigo <aleph@develer.com>
Bernie Innocenti <bernie@codewiz.org>

Definition in file eeprom.c.


Function Documentation

bool eeprom_erase ( Eeprom eep,
e2addr_t  addr,
e2_size_t  size 
)

Erase EEPROM.

Parameters:
eepis the Kblock context.
addreeprom address where start to erase
sizenumber of byte to erase

Definition at line 117 of file eeprom.c.

void eeprom_init_5 ( Eeprom eep,
I2c *  i2c,
EepromType  type,
e2dev_addr_t  addr,
bool  verify 
)

Initialize EEPROM module.

Parameters:
eepis the Kblock context.
typeis the eeprom device we want to initialize (
See also:
EepromType)
Parameters:
i2ccontext for i2c channel
addris the i2c devide address (usually pins A0, A1, A2).
verifyenable the write check.

Definition at line 334 of file eeprom.c.

bool eeprom_verify ( Eeprom eep,
e2addr_t  addr,
const void *  buf,
size_t  size 
)

Verify EEPROM.

Parameters:
eepis the Kblock context.
addreeprom address where start to verify.
bufbuffer of data to compare with eeprom data read.
sizenumber of byte to verify.

Definition at line 143 of file eeprom.c.