FreeBSD kernel IICBUS device code
|
Go to the source code of this file.
Data Structures | |
struct | iicoc_softc |
Macros | |
#define | OC_I2C_PRESCALE_LO_REG 0x00 |
#define | OC_I2C_PRESCALE_HI_REG 0x01 |
#define | OC_I2C_CTRL_REG 0x02 |
#define | OC_I2C_TRANSMIT_REG 0x03 /* tx and rx - same reg */ |
#define | OC_I2C_RECV_REG 0x03 /* tx and rx - same reg */ |
#define | OC_I2C_DATA_REG 0x03 /* tx and rx - same reg */ |
#define | OC_I2C_CMD_REG 0x04 /* cmd and status - same reg */ |
#define | OC_I2C_STATUS_REG 0x04 /* cmd and status - same reg */ |
#define | XLP_I2C_CLKFREQ 133333333 /* XLP 133 MHz IO clock */ |
#define | XLP_I2C_FREQ 100000 /* default 100kHz */ |
#define | I2C_TIMEOUT 500000 |
#define | OC_PRESCALER_LO 0 |
#define | OC_PRESCALER_HI 1 |
#define | OC_CONTROL 2 |
#define | OC_CONTROL_EN 0x80 |
#define | OC_CONTROL_IEN 0x40 |
#define | OC_DATA 3 /* Data TX & RX Reg */ |
#define | OC_COMMAND 4 |
#define | OC_COMMAND_START 0x90 |
#define | OC_COMMAND_STOP 0x40 |
#define | OC_COMMAND_READ 0x20 |
#define | OC_COMMAND_WRITE 0x10 |
#define | OC_COMMAND_RDACK 0x20 |
#define | OC_COMMAND_RDNACK 0x28 |
#define | OC_COMMAND_IACK 0x01 /* Not used */ |
#define | OC_STATUS 4 /* Same as 'command' */ |
#define | OC_STATUS_NACK 0x80 /* Did not get an ACK */ |
#define | OC_STATUS_BUSY 0x40 |
#define | OC_STATUS_AL 0x20 /* Arbitration Lost */ |
#define | OC_STATUS_TIP 0x02 /* Transfer in Progress */ |
#define | OC_STATUS_IF 0x01 /* Intr. Pending Flag */ |
Functions | |
int | iicoc_iicbus_start (device_t dev, u_char slave, int timeout) |
int | iicoc_iicbus_stop (device_t dev) |
int | iicoc_iicbus_read (device_t dev, char *buf, int len, int *read, int last, int delay) |
int | iicoc_iicbus_write (device_t dev, const char *buf, int len, int *sent, int timeout) |
int | iicoc_iicbus_repeated_start (device_t dev, u_char slave, int timeout) |
int | iicoc_iicbus_reset (device_t dev, u_char speed, u_char addr, u_char *oldadr) |
int | iicoc_init (device_t dev) |
Variables | |
devclass_t | iicoc_devclass |
#define OC_I2C_STATUS_REG 0x04 /* cmd and status - same reg */ |
int iicoc_iicbus_read | ( | device_t | dev, |
char * | buf, | ||
int | len, | ||
int * | read, | ||
int | last, | ||
int | delay | ||
) |
Definition at line 248 of file iicoc.c.
References buf, data, dev, IIC_EBUSERR, IIC_NOERR, iicoc_rd_cmd(), len, OC_COMMAND_RDNACK, OC_COMMAND_READ, and read.
int iicoc_iicbus_repeated_start | ( | device_t | dev, |
u_char | slave, | ||
int | timeout | ||
) |
int iicoc_iicbus_reset | ( | device_t | dev, |
u_char | speed, | ||
u_char | addr, | ||
u_char * | oldadr | ||
) |
Definition at line 274 of file iicoc.c.
References dev, iicoc_init(), and iicoc_softc::sc_mtx.
int iicoc_iicbus_start | ( | device_t | dev, |
u_char | slave, | ||
int | timeout | ||
) |
int iicoc_iicbus_stop | ( | device_t | dev | ) |
Definition at line 204 of file iicoc.c.
References dev, iicoc_dev_write(), iicoc_wait_on_status(), OC_COMMAND_STOP, OC_I2C_CMD_REG, OC_STATUS_BUSY, and iicoc_softc::sc_mtx.
int iicoc_iicbus_write | ( | device_t | dev, |
const char * | buf, | ||
int | len, | ||
int * | sent, | ||
int | timeout | ||
) |
Definition at line 218 of file iicoc.c.
References buf, dev, IIC_EBUSERR, IIC_NOERR, iicoc_wr_ack_cmd(), iicoc_wr_cmd(), len, and OC_COMMAND_WRITE.
int iicoc_init | ( | device_t | dev | ) |
Definition at line 130 of file iicoc.c.
References iicoc_softc::clockfreq, dev, iicoc_softc::i2cfreq, iicoc_dev_read(), iicoc_dev_write(), OC_CONTROL_EN, OC_CONTROL_IEN, OC_I2C_CTRL_REG, OC_I2C_PRESCALE_HI_REG, and OC_I2C_PRESCALE_LO_REG.
Referenced by iicoc_attach(), and iicoc_iicbus_reset().