eeprom.c File Reference
Driver for the 24xx16 and 24xx256 I2C EEPROMS (implementation). More...
#include "eeprom.h"
#include <cfg/macros.h>
#include <cfg/debug.h>
#include <cfg/module.h>
#include <cpu/attr.h>
#include <drv/i2c.h>
#include <drv/wdt.h>
#include <cpu/byteorder.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 | |
| static size_t | eeprom_writeRaw (struct KFile *_fd, const void *buf, size_t size) |
| Copy size bytes from buffer buf to eeprom. | |
| static size_t | eeprom_writeVerify (struct KFile *_fd, const void *_buf, size_t size) |
| Copy size bytes from buffer _buf to eeprom. | |
| static size_t | eeprom_read (struct KFile *_fd, void *_buf, size_t size) |
| Copy size bytes from eeprom to RAM to buffer _buf. | |
| bool | eeprom_verify (Eeprom *fd, const void *buf, size_t count) |
| Check that the contents of an EEPROM range match with a provided data buffer. | |
| bool | eeprom_erase (Eeprom *fd, e2addr_t addr, e2_size_t count) |
| Erase specified part of eeprom, writing 0xFF. | |
| void | eeprom_init (Eeprom *fd, 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).
- Version:
- Id
- eeprom.c 2887 2009-09-07 14:38:31Z batt
Definition in file eeprom.c.
Function Documentation
| void eeprom_init | ( | Eeprom * | fd, | |
| EepromType | type, | |||
| e2dev_addr_t | addr, | |||
| bool | verify | |||
| ) |
Initialize EEPROM module.
fd is the Kfile context. type is the eeprom device we want to initialize (
- See also:
- EepromType) addr is the i2c devide address (usually pins A0, A1, A2). verify is true if you want that every write operation will be verified.
| static size_t eeprom_read | ( | struct KFile * | _fd, | |
| void * | _buf, | |||
| size_t | size | |||
| ) | [static] |
| bool eeprom_verify | ( | Eeprom * | fd, | |
| const void * | buf, | |||
| size_t | count | |||
| ) |
| static size_t eeprom_writeVerify | ( | struct KFile * | _fd, | |
| const void * | _buf, | |||
| size_t | size | |||
| ) | [static] |
