FreeBSD kernel IICBUS device code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
#include "iicbus_if.h"
Go to the source code of this file.
Functions | |
__FBSDID ("$FreeBSD$") | |
int | errno2iic (int errno) |
int | iic2errno (int iic_status) |
void | iicbus_intr (device_t bus, int event, char *buf) |
static int | iicbus_poll (struct iicbus_softc *sc, int how) |
int | iicbus_request_bus (device_t bus, device_t dev, int how) |
int | iicbus_release_bus (device_t bus, device_t dev) |
int | iicbus_started (device_t bus) |
int | iicbus_start (device_t bus, u_char slave, int timeout) |
int | iicbus_repeated_start (device_t bus, u_char slave, int timeout) |
int | iicbus_stop (device_t bus) |
int | iicbus_write (device_t bus, const char *buf, int len, int *sent, int timeout) |
int | iicbus_read (device_t bus, char *buf, int len, int *read, int last, int delay) |
int | iicbus_write_byte (device_t bus, char byte, int timeout) |
int | iicbus_read_byte (device_t bus, char *byte, int timeout) |
int | iicbus_block_write (device_t bus, u_char slave, char *buf, int len, int *sent) |
int | iicbus_block_read (device_t bus, u_char slave, char *buf, int len, int *read) |
int | iicbus_transfer (device_t bus, struct iic_msg *msgs, uint32_t nmsgs) |
int | iicbus_transfer_excl (device_t dev, struct iic_msg *msgs, uint32_t nmsgs, int how) |
int | iicbus_transfer_gen (device_t dev, 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) |
__FBSDID | ( | "$FreeBSD$" | ) |
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().
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().
|
static |
Definition at line 109 of file iiconf.c.
References errno2iic(), IIC_EBUSBSY, IIC_INTR, IIC_INTRWAIT, IIC_NOINTR, IIC_WAIT, IICBUS_ASSERT_LOCKED, IICPRI, and iicbus_softc::lock.
Referenced by iicbus_request_bus().
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 | dev, |
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 | dev, |
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().