33#ifndef __OPENCORE_I2C_H__
34#define __OPENCORE_I2C_H__
37#define OC_I2C_PRESCALE_LO_REG 0x00
38#define OC_I2C_PRESCALE_HI_REG 0x01
39#define OC_I2C_CTRL_REG 0x02
40#define OC_I2C_TRANSMIT_REG 0x03
41#define OC_I2C_RECV_REG 0x03
42#define OC_I2C_DATA_REG 0x03
43#define OC_I2C_CMD_REG 0x04
44#define OC_I2C_STATUS_REG 0x04
46#define XLP_I2C_CLKFREQ 133333333
47#define XLP_I2C_FREQ 100000
48#define I2C_TIMEOUT 500000
55#define OC_PRESCALER_LO 0
56#define OC_PRESCALER_HI 1
59#define OC_CONTROL_EN 0x80
60#define OC_CONTROL_IEN 0x40
65#define OC_COMMAND_START 0x90
66#define OC_COMMAND_STOP 0x40
67#define OC_COMMAND_READ 0x20
68#define OC_COMMAND_WRITE 0x10
69#define OC_COMMAND_RDACK 0x20
70#define OC_COMMAND_RDNACK 0x28
71#define OC_COMMAND_IACK 0x01
74#define OC_STATUS_NACK 0x80
75#define OC_STATUS_BUSY 0x40
76#define OC_STATUS_AL 0x20
77#define OC_STATUS_TIP 0x02
78#define OC_STATUS_IF 0x01
devclass_t iicoc_devclass
int iicoc_iicbus_write(device_t dev, const char *buf, int len, int *sent, int timeout)
int iicoc_iicbus_stop(device_t dev)
int iicoc_iicbus_reset(device_t dev, u_char speed, u_char addr, u_char *oldadr)
int iicoc_iicbus_repeated_start(device_t dev, u_char slave, int timeout)
int iicoc_init(device_t dev)
int iicoc_iicbus_start(device_t dev, u_char slave, int timeout)
int iicoc_iicbus_read(device_t dev, char *buf, int len, int *read, int last, int delay)
struct resource * mem_res