root/i2c-tools/trunk/eepromer/24cXX.h

Revision 4495, 2.0 kB (checked in by khali, 1 year ago)

Fix the inclusion path to i2c-dev.h to make things build again.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /***************************************************************************
2     copyright            : (C) by 2002-2003 Stefano Barbato
3     email                : stefano@codesink.org
4
5     $Id$
6  ***************************************************************************/
7
8 /***************************************************************************
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  ***************************************************************************/
16 #ifndef _24CXX_H_
17 #define _24CXX_H_
18 #include <linux/i2c-dev.h>
19
20 #define EEPROM_TYPE_UNKNOWN     0
21 #define EEPROM_TYPE_8BIT_ADDR   1
22 #define EEPROM_TYPE_16BIT_ADDR  2
23
24 struct eeprom
25 {
26         char *dev;      // device file i.e. /dev/i2c-N
27         int addr;       // i2c address
28         int fd;         // file descriptor
29         int type;       // eeprom type
30 };
31
32 /*
33  * opens the eeprom device at [dev_fqn] (i.e. /dev/i2c-N) whose address is
34  * [addr] and set the eeprom_24c32 [e]
35  */
36 int eeprom_open(char *dev_fqn, int addr, int type, struct eeprom*);
37 /*
38  * closees the eeprom device [e]
39  */
40 int eeprom_close(struct eeprom *e);
41 /*
42  * read and returns the eeprom byte at memory address [mem_addr]
43  * Note: eeprom must have been selected by ioctl(fd,I2C_SLAVE,address)
44  */
45 int eeprom_read_byte(struct eeprom* e, __u16 mem_addr);
46 /*
47  * read the current byte
48  * Note: eeprom must have been selected by ioctl(fd,I2C_SLAVE,address)
49  */
50 int eeprom_read_current_byte(struct eeprom *e);
51 /*
52  * writes [data] at memory address [mem_addr]
53  * Note: eeprom must have been selected by ioctl(fd,I2C_SLAVE,address)
54  */
55 int eeprom_write_byte(struct eeprom *e, __u16 mem_addr, __u8 data);
56
57 #endif
58
Note: See TracBrowser for help on using the browser.