FreeBSD kernel IICBUS device code
|
Go to the source code of this file.
Data Structures | |
struct | iic_reqbus_data |
Macros | |
#define | IICPRI (PZERO+8) /* XXX sleep/wakeup queue priority */ |
#define | LSB 0x1 |
#define | IIC_DONTWAIT 0 |
#define | IIC_NOINTR 0 |
#define | IIC_WAIT 0x1 |
#define | IIC_INTR 0x2 |
#define | IIC_INTRWAIT (IIC_INTR | IIC_WAIT) |
#define | IIC_RECURSIVE 0x4 |
#define | IIC_REQBUS_DEV 0x8 /* See struct iic_reqbus_data, below. */ |
#define | IIC_MASTER 0x1 |
#define | IIC_SLAVE 0x2 |
#define | IIC_POLLED 0x4 |
#define | IIC_UNKNOWN 0x0 |
#define | IIC_SLOW 0x1 |
#define | IIC_FAST 0x2 |
#define | IIC_FASTEST 0x3 |
#define | IIC_LAST_READ 0x1 |
#define | IIC_REQUEST_BUS 0x1 |
#define | IIC_RELEASE_BUS 0x2 |
#define | INTR_GENERAL 0x1 /* general call received */ |
#define | INTR_START 0x2 /* the I2C interface is addressed */ |
#define | INTR_STOP 0x3 /* stop condition received */ |
#define | INTR_RECEIVE 0x4 /* character received */ |
#define | INTR_TRANSMIT 0x5 /* character to transmit */ |
#define | INTR_ERROR 0x6 /* error */ |
#define | INTR_NOACK 0x7 /* no ack from master receiver */ |
#define | IIC_NOERR 0x0 /* no error occurred */ |
#define | IIC_EBUSERR 0x1 /* bus error (hardware not in expected state) */ |
#define | IIC_ENOACK 0x2 /* ack not received until timeout */ |
#define | IIC_ETIMEOUT 0x3 /* timeout */ |
#define | IIC_EBUSBSY 0x4 /* bus busy (reserved by another client) */ |
#define | IIC_ESTATUS 0x5 /* status error */ |
#define | IIC_EUNDERFLOW 0x6 /* slave ready for more data */ |
#define | IIC_EOVERFLOW 0x7 /* too much data */ |
#define | IIC_ENOTSUPP 0x8 /* request not supported */ |
#define | IIC_ENOADDR 0x9 /* no address assigned to the interface */ |
#define | IIC_ERESOURCE 0xa /* resources (memory, whatever) unavailable */ |
#define | IIC_ERRNO __INT_MIN /* marker bit: errno is in low-order bits */ |
#define | iicbus_reset(bus, speed, addr, oldaddr) (IICBUS_RESET(device_get_parent(bus), speed, addr, oldaddr)) |
#define | IICBUS_MODVER 1 |
#define | IICBUS_MINVER 1 |
#define | IICBUS_MAXVER 1 |
#define | IICBUS_PREFVER IICBUS_MODVER |
#define | IICBB_MODVER 1 |
#define | IICBB_MINVER 1 |
#define | IICBB_MAXVER 1 |
#define | IICBB_PREFVER IICBB_MODVER |
Functions | |
int | iic2errno (int) |
int | errno2iic (int) |
int | iicbus_request_bus (device_t, device_t, int) |
int | iicbus_release_bus (device_t, device_t) |
device_t | iicbus_alloc_bus (device_t) |
void | iicbus_intr (device_t, int, char *) |
int | iicbus_null_repeated_start (device_t, u_char) |
int | iicbus_null_callback (device_t, int, caddr_t) |
int | iicbus_started (device_t) |
int | iicbus_start (device_t, u_char, int) |
int | iicbus_stop (device_t) |
int | iicbus_repeated_start (device_t, u_char, int) |
int | iicbus_write (device_t, const char *, int, int *, int) |
int | iicbus_read (device_t, char *, int, int *, int, int) |
int | iicbus_write_byte (device_t, char, int) |
int | iicbus_read_byte (device_t, char *, int) |
int | iicbus_block_write (device_t, u_char, char *, int, int *) |
int | iicbus_block_read (device_t, u_char, char *, int, int *) |
int | iicbus_transfer (device_t bus, struct iic_msg *msgs, uint32_t nmsgs) |
int | iicbus_transfer_excl (device_t bus, struct iic_msg *msgs, uint32_t nmsgs, int how) |
int | iicbus_transfer_gen (device_t bus, struct iic_msg *msgs, uint32_t nmsgs) |
int | iicdev_readfrom (device_t _slavedev, uint8_t _regaddr, void *_buffer, uint16_t _buflen, int _waithow) |
int | iicdev_writeto (device_t _slavedev, uint8_t _regaddr, void *_buffer, uint16_t _buflen, int _waithow) |
Variables | |
driver_t | iicbb_driver |
devclass_t | iicbb_devclass |
#define IIC_EBUSBSY 0x4 /* bus busy (reserved by another client) */ |
#define IIC_EBUSERR 0x1 /* bus error (hardware not in expected state) */ |
#define IIC_ENOACK 0x2 /* ack not received until timeout */ |
#define IIC_ENOADDR 0x9 /* no address assigned to the interface */ |
#define IIC_ERESOURCE 0xa /* resources (memory, whatever) unavailable */ |
#define IIC_ERRNO __INT_MIN /* marker bit: errno is in low-order bits */ |
#define IIC_REQBUS_DEV 0x8 /* See struct iic_reqbus_data, below. */ |
#define IICBB_PREFVER IICBB_MODVER |
#define IICBUS_PREFVER IICBUS_MODVER |
#define IICPRI (PZERO+8) /* XXX sleep/wakeup queue priority */ |
int errno2iic | ( | int | errno | ) |
Definition at line 51 of file iiconf.c.
References IIC_ERRNO.
Referenced by acpi_iicbus_bread(), acpi_iicbus_bwrite(), iicbus_poll(), and iicdev_writeto().
int iic2errno | ( | int | iic_status | ) |
Definition at line 60 of file iiconf.c.
References IIC_EBUSBSY, IIC_EBUSERR, IIC_ENOACK, IIC_ENOADDR, IIC_ENOTSUPP, IIC_EOVERFLOW, IIC_ERESOURCE, IIC_ERRNO, IIC_ESTATUS, IIC_ETIMEOUT, IIC_EUNDERFLOW, and IIC_NOERR.
Referenced by ads111x_read_2(), icee_read(), icee_write(), iichid_get_rdesc(), iichid_get_report(), iichid_ioctl(), iichid_read(), iichid_set_report(), iichid_write(), iicmux_callback(), pcf8574_read(), pcf8574_write(), tca6416_read(), and tca6416_write().
device_t iicbus_alloc_bus | ( | device_t | ) |
int iicbus_block_read | ( | device_t | bus, |
u_char | slave, | ||
char * | buf, | ||
int | len, | ||
int * | read | ||
) |
Definition at line 414 of file iiconf.c.
References addr, buf, IIC_LAST_READ, iicbus_read(), iicbus_start(), iicbus_stop(), len, LSB, read, and slave.
int iicbus_block_write | ( | device_t | bus, |
u_char | slave, | ||
char * | buf, | ||
int | len, | ||
int * | sent | ||
) |
Definition at line 393 of file iiconf.c.
References addr, buf, iicbus_start(), iicbus_stop(), iicbus_write(), len, and slave.
Referenced by icoutput().
void iicbus_intr | ( | device_t | bus, |
int | event, | ||
char * | buf | ||
) |
Definition at line 97 of file iiconf.c.
References buf, event, and iicbus_softc::owner.
Referenced by iicmux_intr().
int iicbus_null_callback | ( | device_t | dev, |
int | index, | ||
caddr_t | data | ||
) |
int iicbus_null_repeated_start | ( | device_t | dev, |
u_char | addr | ||
) |
Definition at line 294 of file iicbus.c.
References IIC_ENOTSUPP.
int iicbus_read | ( | device_t | bus, |
char * | buf, | ||
int | len, | ||
int * | read, | ||
int | last, | ||
int | delay | ||
) |
Definition at line 339 of file iiconf.c.
References buf, delay, IIC_ESTATUS, last, len, LSB, read, iicbus_softc::started, and iicbus_softc::strict.
Referenced by iicbus_block_read(), iicbus_read_byte(), iicbus_transfer_gen(), iicmux_read(), and iicuio_move().
int iicbus_read_byte | ( | device_t | bus, |
char * | byte, | ||
int | timeout | ||
) |
Definition at line 375 of file iiconf.c.
References IIC_ESTATUS, IIC_LAST_READ, iicbus_read(), LSB, read, iicbus_softc::started, iicbus_softc::strict, and timeout.
int iicbus_release_bus | ( | device_t | bus, |
device_t | dev | ||
) |
Definition at line 206 of file iiconf.c.
References iic_reqbus_data::bus, iicbus_softc::busydev, iic_reqbus_data::dev, dev, iic_reqbus_data::flags, IIC_EBUSBSY, IIC_RELEASE_BUS, IIC_REQBUS_DEV, IICBUS_LOCK, IICBUS_UNLOCK, iicbus_softc::owncount, and iicbus_softc::owner.
Referenced by acpi_iicbus_bread(), icioctl(), iicbus_transfer_excl(), iicdtor(), iichid_intr(), iichid_read(), iichid_set_power_state(), iicioctl(), iicmux_callback(), iicrdwr(), iicsmb_bread(), iicsmb_callback(), iicuio(), isl12xx_gettime(), isl12xx_settime(), nxprtc_gettime(), nxprtc_settime(), rtc8583_gettime(), and rtc8583_settime().
int iicbus_repeated_start | ( | device_t | bus, |
u_char | slave, | ||
int | timeout | ||
) |
Definition at line 276 of file iiconf.c.
References IIC_ESTATUS, slave, iicbus_softc::started, and timeout.
Referenced by iicbus_transfer_gen(), iicioctl(), and iicmux_repeated_start().
int iicbus_request_bus | ( | device_t | bus, |
device_t | dev, | ||
int | how | ||
) |
Definition at line 138 of file iiconf.c.
References iic_reqbus_data::bus, iicbus_softc::busydev, iic_reqbus_data::dev, dev, iic_reqbus_data::flags, IIC_RECURSIVE, IIC_REQBUS_DEV, IIC_REQUEST_BUS, IICBUS_LOCK, iicbus_poll(), IICBUS_UNLOCK, iicbus_softc::owncount, and iicbus_softc::owner.
Referenced by acpi_iicbus_bread(), icioctl(), iicbus_transfer_excl(), iichid_intr(), iichid_read(), iichid_set_power_state(), iicioctl(), iicmux_callback(), iicrdwr(), iicsmb_bread(), iicsmb_callback(), iicuio(), isl12xx_gettime(), isl12xx_settime(), nxprtc_gettime(), nxprtc_settime(), rtc8583_gettime(), and rtc8583_settime().
int iicbus_start | ( | device_t | bus, |
u_char | slave, | ||
int | timeout | ||
) |
Definition at line 254 of file iiconf.c.
References IIC_ESTATUS, slave, iicbus_softc::started, and timeout.
Referenced by iicbus_block_read(), iicbus_block_write(), iicbus_transfer_gen(), iicioctl(), iicmux_start(), and iicuio().
int iicbus_started | ( | device_t | bus | ) |
Definition at line 241 of file iiconf.c.
References iicbus_softc::started.
int iicbus_stop | ( | device_t | bus | ) |
Definition at line 298 of file iiconf.c.
References IIC_ESTATUS, and iicbus_softc::started.
Referenced by iicbus_block_read(), iicbus_block_write(), iicbus_transfer_gen(), iicdtor(), iicioctl(), iicmux_stop(), and iicuio().
int iicbus_transfer | ( | device_t | bus, |
struct iic_msg * | msgs, | ||
uint32_t | nmsgs | ||
) |
Definition at line 442 of file iiconf.c.
Referenced by acpi_iicbus_bread(), acpi_iicbus_bwrite(), acpi_iicbus_read(), acpi_iicbus_recvb(), acpi_iicbus_sendb(), acpi_iicbus_write(), ad7417_read_1(), ad7417_read_2(), ad7417_write(), ad7417_write_read(), ad7418_read_1(), ad7418_read_2(), ad7418_write_1(), adm1030_write_byte(), adt746x_read(), adt746x_write(), ds1631_read_1(), ds1631_read_2(), ds1631_write(), ds1672_read(), ds1672_write(), ds1775_read_2(), iichid_cmd_get_hid_desc(), iichid_cmd_get_report(), iichid_cmd_get_report_desc(), iichid_cmd_read(), iichid_cmd_set_report(), iichid_ioctl(), iicmux_transfer(), iicrdwr(), lm75_read(), lm75_write(), max6690_read(), pca954x_bus_select(), sy8106a_read(), and sy8106a_write().
int iicbus_transfer_excl | ( | device_t | bus, |
struct iic_msg * | msgs, | ||
uint32_t | nmsgs, | ||
int | how | ||
) |
Definition at line 449 of file iiconf.c.
References dev, iicbus_release_bus(), iicbus_request_bus(), msgs, and nmsgs.
Referenced by act8846_read(), act8846_read_buf(), act8846_write(), act8846_write_buf(), ads111x_write_2(), fan53555_read(), fan53555_write(), htu21_get_cfg(), htu21_get_measurement(), htu21_get_measurement_nohold(), htu21_get_serial(), htu21_set_cfg(), icee_read(), icee_write(), iicdev_readfrom(), iicdev_writeto(), max44009_get_reading(), nxprtc_readfrom(), pcf8574_read(), pcf8574_write(), pcf8591_get_reading(), pcf8591_set_config(), rtc8583_writeto(), s390rtc_read(), s390rtc_write(), tca6416_read(), and tca6416_write().
int iicbus_transfer_gen | ( | device_t | bus, |
struct iic_msg * | msgs, | ||
uint32_t | nmsgs | ||
) |
Definition at line 469 of file iiconf.c.
References addr, buf, dev, IIC_ENOTSUPP, IIC_ERESOURCE, IIC_LAST_READ, IIC_M_NOSTART, IIC_M_NOSTOP, IIC_M_RD, iicbus_read(), iicbus_repeated_start(), iicbus_start(), iicbus_stop(), iicbus_write(), len, LSB, msgs, nmsgs, iic_msg::slave, and iicbus_softc::started.
Referenced by iicbb_transfer(), and twsi_transfer().
int iicbus_write | ( | device_t | bus, |
const char * | buf, | ||
int | len, | ||
int * | sent, | ||
int | timeout | ||
) |
Definition at line 321 of file iiconf.c.
References buf, IIC_ESTATUS, len, LSB, iicbus_softc::started, iicbus_softc::strict, and timeout.
Referenced by iicbus_block_write(), iicbus_transfer_gen(), iicbus_write_byte(), iicmux_write(), and iicuio_move().
int iicbus_write_byte | ( | device_t | bus, |
char | byte, | ||
int | timeout | ||
) |
Definition at line 356 of file iiconf.c.
References data, IIC_ESTATUS, iicbus_write(), LSB, iicbus_softc::started, iicbus_softc::strict, and timeout.
int iicdev_readfrom | ( | device_t | _slavedev, |
uint8_t | _regaddr, | ||
void * | _buffer, | ||
uint16_t | _buflen, | ||
int | _waithow | ||
) |
Definition at line 524 of file iiconf.c.
References iic_msg::buf, iic_msg::flags, IIC_M_NOSTOP, IIC_M_RD, IIC_M_WR, iicbus_transfer_excl(), iic_msg::len, msgs, and iic_msg::slave.
Referenced by ads111x_read_2(), ds1307_gettime(), ds1307_read1(), ds3231_gettime(), ds3231_read1(), ds3231_temp_read(), hym8563_read_1(), hym8563_read_buf(), isl12xx_gettime(), isl12xx_read1(), pcf85063_check_status(), pcf85063_get_time(), pcf85063_set_time(), read_reg(), read_timeregs(), read_timeword(), rk8xx_read(), rtc8583_gettime(), rtc8583_read1(), rx8803_check_status(), rx8803_gettime(), rx8803_settime(), syr827_read(), tca6408_read1(), and tmp461_read_1().
int iicdev_writeto | ( | device_t | _slavedev, |
uint8_t | _regaddr, | ||
void * | _buffer, | ||
uint16_t | _buflen, | ||
int | _waithow | ||
) |
Definition at line 549 of file iiconf.c.
References iic_msg::buf, errno2iic(), iic_msg::flags, IIC_M_WR, IIC_WAIT, iicbus_transfer_excl(), iic_msg::len, and iic_msg::slave.
Referenced by ds1307_settime(), ds1307_write1(), ds3231_settime(), ds3231_write1(), hym8563_write_1(), hym8563_write_buf(), isl12xx_settime(), isl12xx_write1(), ltc430x_attach(), ltc430x_bus_select(), pca9547_bus_select(), pcf85063_set_time(), rk8xx_write(), rx8803_settime(), syr827_write(), tca6408_write1(), write_reg(), write_timeregs(), and write_timeword().