diff options
author | Roman Yeryomin <roman@advem.lv> | 2012-09-13 00:40:35 +0300 |
---|---|---|
committer | Roman Yeryomin <roman@advem.lv> | 2012-12-03 00:13:21 +0200 |
commit | 5deb3317cb51ac52de922bb55f8492624018906d (patch) | |
tree | c2fbe6346699d9bb0f2100490c3029519bb8fde8 /target/linux/realtek/files/drivers/serial/i2c.h | |
parent | 0239d37124f9184b478a42de8a7fa1bc85a6a6fe (diff) |
Add realtek target files
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Diffstat (limited to 'target/linux/realtek/files/drivers/serial/i2c.h')
-rw-r--r-- | target/linux/realtek/files/drivers/serial/i2c.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/target/linux/realtek/files/drivers/serial/i2c.h b/target/linux/realtek/files/drivers/serial/i2c.h new file mode 100644 index 000000000..f4bdcd99a --- /dev/null +++ b/target/linux/realtek/files/drivers/serial/i2c.h @@ -0,0 +1,42 @@ +#ifndef __BASE_I2C_CORE_H__ +#define __BASE_I2C_CORE_H__ + + +/*********************** I2C data struct ********************************************/ +typedef struct i2c_dev_s +{ + //unsigned int i2c_reset; //output + unsigned int sclk; //output + unsigned int sdio; //input or output + unsigned int irq; // interrupt (optional) + unsigned int reset; // reset (optional) +} i2c_dev_t; + +extern i2c_dev_t i2c_dev; + +/*********************** I2C API for base_ic2_xxx ********************************************/ + +// read / write +extern void i2c_serial_write(i2c_dev_t* pI2C_Dev, unsigned char *data); +extern void i2c_serial_write_byte(i2c_dev_t* pI2C_Dev, unsigned char data); + +extern unsigned char i2c_ACK(i2c_dev_t* pI2C_Dev); + +extern void i2c_ACK_w(i2c_dev_t* pI2C_Dev, unsigned char data); + +extern void i2c_serial_read(i2c_dev_t* pI2C_Dev, unsigned short int *data); + +// start / stop condition +extern void i2c_start_condition(i2c_dev_t* pI2C_Dev); + +extern void i2c_stop_condition(i2c_dev_t* pI2C_Dev); + +// GPIO pins manipulation +extern void i2c_init_SCL_SDA(i2c_dev_t* pI2C_Dev); + +extern void i2c_enable_irq(i2c_dev_t* pI2C_Dev); + +extern void i2c_reset(i2c_dev_t* pI2C_Dev); + +#endif /* __BASE_I2C_CORE_H__ */ + |