The unified diff between revisions [dea51752..] and [9142f333..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'i2c.h'
# # old_revision [dea51752ff3061ddca80de6685b04dac53ac77e1] # new_revision [9142f3330490a5aa00c1686475633b620c2ef5e7] # # patch "i2c.h" # from [383d50d6e5547f52b22d5a878835d6c21926f031] # to [2712fc89825bdda63fbe762367461fcd3919ce39] # ============================================================ --- i2c.h 383d50d6e5547f52b22d5a878835d6c21926f031 +++ i2c.h 2712fc89825bdda63fbe762367461fcd3919ce39 @@ -2,16 +2,27 @@ #define __I2C_H #include "types.h" + +#define I2C_IN_PROGRESS 0 +#define I2C_SUCCESS 1 +#define I2C_FAIL 2 + +typedef int i2c_result; + +struct i2c_transaction { + int address; /* i2c first byte, including address and r/w flag */ + int bytes; /* number of bytes to read or write */ + unsigned char *data; /* pointer to the data */ + i2c_result *result; /* pointer to store the result */ + unsigned int event; /* Which event to set when complete */ + struct i2c_transaction *next; /* NULL or next transaction */ +}; + + void init_i2c(void); -extern int i2cstat; -int i2c_wait(void); -void i2c_go(void); int i2c_conreg(void); int i2c_statreg(void); -bool i2c_send_start(void); -bool i2c_send_address(int addr, bool write); -bool i2c_send_data(unsigned int data); -bool i2c_receive_data(unsigned int *data, bool last); -void i2c_send_stop(void); +bool i2c_start_transaction(struct i2c_transaction *t); +bool i2c_busy(void); #endif /* __I2C_H */