eeprom.h File Reference
Driver for the 24xx16 and 24xx256 I2C EEPROMS. More...
#include <cfg/compiler.h>#include <kern/kfile.h>Go to the source code of this file.
Data Structures | |
| struct | Eeprom |
| Describe an EEPROM context, used by the driver to access the single device. More... | |
| struct | EepromInfo |
| Descrive all EEPROM informations needed by the driver. More... | |
Defines | |
| #define | KFT_EEPROM MAKE_ID('E', 'E', 'P', 'R') |
| ID for eeproms. | |
| #define | e2addr(type, field) ((e2addr_t)&(((type *)0)->field)) |
| Macro for E2Layout offset calculation. | |
Typedefs | |
| typedef enum EepromType | EepromType |
| Values for Eeprom types. | |
| typedef uint8_t | e2dev_addr_t |
| On the same I2C bus can live more than one EEPROM device. | |
| typedef struct Eeprom | Eeprom |
| Describe an EEPROM context, used by the driver to access the single device. | |
| typedef uint16_t | e2addr_t |
| Type for EEPROM addresses. | |
| typedef uint16_t | e2blk_size_t |
| Type for EEPROM block size. | |
| typedef uint32_t | e2_size_t |
| Type for accessing EEPROM whole size. | |
| typedef struct EepromInfo | EepromInfo |
| Descrive all EEPROM informations needed by the driver. | |
Enumerations | |
| enum | EepromType |
Values for Eeprom types. | |
Functions | |
| Eeprom * | EEPROM_CAST (KFile *fd) |
| Convert + ASSERT from generic KFile to Eeprom. | |
| bool | eeprom_erase (Eeprom *fd, e2addr_t addr, e2_size_t count) |
| Erase specified part of eeprom, writing 0xFF. | |
| 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. | |
| void | eeprom_init (Eeprom *fd, EepromType, e2dev_addr_t, bool verify) |
| Initialize EEPROM module. | |
Detailed Description
Driver for the 24xx16 and 24xx256 I2C EEPROMS.
Definition in file eeprom.h.
Define Documentation
| #define e2addr | ( | type, | |||
| field | ) | ((e2addr_t)&(((type *)0)->field)) |
Macro for E2Layout offset calculation.
- Note:
- We can't just use offsetof() here because we could use non-constant expressions to access array elements.
- 'type' is the structure type holding eeprom layout and must be defined in user files.
Typedef Documentation
| typedef uint8_t e2dev_addr_t |
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.
