blob: 2e0e0c5f6bdc9eed4372b6b80517b3c01731cdf6
1 | #ifndef BLOB_E2PROM_H |
2 | #define BLOB_E2PROM_H |
3 | |
4 | #include "CBlobDevice.h" |
5 | |
6 | #define I2C_RETRIES 0x0701 /* number of times a device address |
7 | should be polled when not |
8 | acknowledging */ |
9 | #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ |
10 | |
11 | /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses |
12 | * are NOT supported! (due to code brokenness) |
13 | */ |
14 | #define I2C_SLAVE 0x0703 /* Use this slave address */ |
15 | #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it |
16 | is already in use by a driver! */ |
17 | #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ |
18 | #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ |
19 | #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ |
20 | #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ |
21 | #define I2C_SMBUS 0x0720 /* SMBus transfer */ |
22 | |
23 | struct i2c_msg { |
24 | unsigned short addr; /* slave address */ |
25 | unsigned short flags; |
26 | #define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ |
27 | #define I2C_M_WR 0x0000 /* write data, from master to slave */ |
28 | #define I2C_M_RD 0x0001 /* read data, from slave to master */ |
29 | #define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_PROTOCOL_MANGLING */ |
30 | #define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ |
31 | #define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ |
32 | #define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ |
33 | #define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ |
34 | |
35 | unsigned short len; /* msg length */ |
36 | unsigned char *buf; /* pointer to msg data */ |
37 | }; |
38 | |
39 | struct i2c_rdwr_ioctl_data { |
40 | struct i2c_msg *msgs; |
41 | unsigned int nmsgs; |
42 | }; |
43 | |
44 | // 24C64 eeprom |
45 | #define E2P_MSG_BUF_SIZE (34) |
46 | |
47 | class CBlobDeviceE2prom: public CBlobDevice { |
48 | |
49 | public: |
50 | CBlobDeviceE2prom(); |
51 | virtual ~CBlobDeviceE2prom(); |
52 | |
53 | virtual int WriteBytes(int offset, int size, unsigned char *buf); |
54 | virtual int ReadBytes(int offset, int size, unsigned char *buf); |
55 | virtual int EraseAllData(); |
56 | virtual int InitCheck(); |
57 | virtual int OpenDevice(); |
58 | virtual int CloseDevice(); |
59 | |
60 | private: |
61 | |
62 | private: |
63 | /*int E2P_DEV_TOTAL_SIZE; |
64 | int E2P_DEV_RW_START_OFFSET; |
65 | int E2P_DEV_RW_END_OFFSET; |
66 | int E2P_DEV_W_PAGE_SIZE; |
67 | int E2P_DEV_R_PAGE_SIZE; |
68 | int E2P_DEV_SLAVE_ADDR; |
69 | int E2P_DEV_RW_TEST_OFFSET; |
70 | int device_use_buffer; |
71 | unsigned char *device_buf; |
72 | char gFilePathBuf[CC_MAX_FILE_PATH];*/ |
73 | }; |
74 | |
75 | |
76 | #endif |
77 |