FreeBSD kernel IICBUS device code
iiconf.h File Reference
#include <sys/queue.h>
#include <dev/iicbus/iic.h>
Include dependency graph for iiconf.h:

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
 

Macro Definition Documentation

◆ IIC_DONTWAIT

#define IIC_DONTWAIT   0

Definition at line 44 of file iiconf.h.

◆ IIC_EBUSBSY

#define IIC_EBUSBSY   0x4 /* bus busy (reserved by another client) */

Definition at line 111 of file iiconf.h.

◆ IIC_EBUSERR

#define IIC_EBUSERR   0x1 /* bus error (hardware not in expected state) */

Definition at line 108 of file iiconf.h.

◆ IIC_ENOACK

#define IIC_ENOACK   0x2 /* ack not received until timeout */

Definition at line 109 of file iiconf.h.

◆ IIC_ENOADDR

#define IIC_ENOADDR   0x9 /* no address assigned to the interface */

Definition at line 116 of file iiconf.h.

◆ IIC_ENOTSUPP

#define IIC_ENOTSUPP   0x8 /* request not supported */

Definition at line 115 of file iiconf.h.

◆ IIC_EOVERFLOW

#define IIC_EOVERFLOW   0x7 /* too much data */

Definition at line 114 of file iiconf.h.

◆ IIC_ERESOURCE

#define IIC_ERESOURCE   0xa /* resources (memory, whatever) unavailable */

Definition at line 117 of file iiconf.h.

◆ IIC_ERRNO

#define IIC_ERRNO   __INT_MIN /* marker bit: errno is in low-order bits */

Definition at line 118 of file iiconf.h.

◆ IIC_ESTATUS

#define IIC_ESTATUS   0x5 /* status error */

Definition at line 112 of file iiconf.h.

◆ IIC_ETIMEOUT

#define IIC_ETIMEOUT   0x3 /* timeout */

Definition at line 110 of file iiconf.h.

◆ IIC_EUNDERFLOW

#define IIC_EUNDERFLOW   0x6 /* slave ready for more data */

Definition at line 113 of file iiconf.h.

◆ IIC_FAST

#define IIC_FAST   0x2

Definition at line 82 of file iiconf.h.

◆ IIC_FASTEST

#define IIC_FASTEST   0x3

Definition at line 83 of file iiconf.h.

◆ IIC_INTR

#define IIC_INTR   0x2

Definition at line 47 of file iiconf.h.

◆ IIC_INTRWAIT

#define IIC_INTRWAIT   (IIC_INTR | IIC_WAIT)

Definition at line 48 of file iiconf.h.

◆ IIC_LAST_READ

#define IIC_LAST_READ   0x1

Definition at line 85 of file iiconf.h.

◆ IIC_MASTER

#define IIC_MASTER   0x1

Definition at line 73 of file iiconf.h.

◆ IIC_NOERR

#define IIC_NOERR   0x0 /* no error occurred */

Definition at line 107 of file iiconf.h.

◆ IIC_NOINTR

#define IIC_NOINTR   0

Definition at line 45 of file iiconf.h.

◆ IIC_POLLED

#define IIC_POLLED   0x4

Definition at line 75 of file iiconf.h.

◆ IIC_RECURSIVE

#define IIC_RECURSIVE   0x4

Definition at line 49 of file iiconf.h.

◆ IIC_RELEASE_BUS

#define IIC_RELEASE_BUS   0x2

Definition at line 91 of file iiconf.h.

◆ IIC_REQBUS_DEV

#define IIC_REQBUS_DEV   0x8 /* See struct iic_reqbus_data, below. */

Definition at line 50 of file iiconf.h.

◆ IIC_REQUEST_BUS

#define IIC_REQUEST_BUS   0x1

Definition at line 90 of file iiconf.h.

◆ IIC_SLAVE

#define IIC_SLAVE   0x2

Definition at line 74 of file iiconf.h.

◆ IIC_SLOW

#define IIC_SLOW   0x1

Definition at line 81 of file iiconf.h.

◆ IIC_UNKNOWN

#define IIC_UNKNOWN   0x0

Definition at line 80 of file iiconf.h.

◆ IIC_WAIT

#define IIC_WAIT   0x1

Definition at line 46 of file iiconf.h.

◆ IICBB_MAXVER

#define IICBB_MAXVER   1

Definition at line 180 of file iiconf.h.

◆ IICBB_MINVER

#define IICBB_MINVER   1

Definition at line 179 of file iiconf.h.

◆ IICBB_MODVER

#define IICBB_MODVER   1

Definition at line 178 of file iiconf.h.

◆ IICBB_PREFVER

#define IICBB_PREFVER   IICBB_MODVER

Definition at line 181 of file iiconf.h.

◆ IICBUS_MAXVER

#define IICBUS_MAXVER   1

Definition at line 172 of file iiconf.h.

◆ IICBUS_MINVER

#define IICBUS_MINVER   1

Definition at line 171 of file iiconf.h.

◆ IICBUS_MODVER

#define IICBUS_MODVER   1

Definition at line 170 of file iiconf.h.

◆ IICBUS_PREFVER

#define IICBUS_PREFVER   IICBUS_MODVER

Definition at line 173 of file iiconf.h.

◆ iicbus_reset

#define iicbus_reset (   bus,
  speed,
  addr,
  oldaddr 
)     (IICBUS_RESET(device_get_parent(bus), speed, addr, oldaddr))

Definition at line 135 of file iiconf.h.

◆ IICPRI

#define IICPRI   (PZERO+8) /* XXX sleep/wakeup queue priority */

Definition at line 37 of file iiconf.h.

◆ INTR_ERROR

#define INTR_ERROR   0x6 /* error */

Definition at line 101 of file iiconf.h.

◆ INTR_GENERAL

#define INTR_GENERAL   0x1 /* general call received */

Definition at line 96 of file iiconf.h.

◆ INTR_NOACK

#define INTR_NOACK   0x7 /* no ack from master receiver */

Definition at line 102 of file iiconf.h.

◆ INTR_RECEIVE

#define INTR_RECEIVE   0x4 /* character received */

Definition at line 99 of file iiconf.h.

◆ INTR_START

#define INTR_START   0x2 /* the I2C interface is addressed */

Definition at line 97 of file iiconf.h.

◆ INTR_STOP

#define INTR_STOP   0x3 /* stop condition received */

Definition at line 98 of file iiconf.h.

◆ INTR_TRANSMIT

#define INTR_TRANSMIT   0x5 /* character to transmit */

Definition at line 100 of file iiconf.h.

◆ LSB

#define LSB   0x1

Definition at line 39 of file iiconf.h.

Function Documentation

◆ errno2iic()

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().

Here is the caller graph for this function:

◆ iic2errno()

◆ iicbus_alloc_bus()

device_t iicbus_alloc_bus ( device_t  )

◆ iicbus_block_read()

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.

Here is the call graph for this function:

◆ iicbus_block_write()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iicbus_intr()

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().

Here is the caller graph for this function:

◆ iicbus_null_callback()

int iicbus_null_callback ( device_t  dev,
int  index,
caddr_t  data 
)

Definition at line 287 of file iicbus.c.

◆ iicbus_null_repeated_start()

int iicbus_null_repeated_start ( device_t  dev,
u_char  addr 
)

Definition at line 294 of file iicbus.c.

References IIC_ENOTSUPP.

◆ iicbus_read()

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().

Here is the caller graph for this function:

◆ iicbus_read_byte()

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.

Here is the call graph for this function:

◆ iicbus_release_bus()

◆ iicbus_repeated_start()

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().

Here is the caller graph for this function:

◆ iicbus_request_bus()

◆ iicbus_start()

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().

Here is the caller graph for this function:

◆ iicbus_started()

int iicbus_started ( device_t  bus)

Definition at line 241 of file iiconf.c.

References iicbus_softc::started.

◆ iicbus_stop()

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().

Here is the caller graph for this function:

◆ iicbus_transfer()

◆ iicbus_transfer_excl()

◆ iicbus_transfer_gen()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iicbus_write()

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().

Here is the caller graph for this function:

◆ iicbus_write_byte()

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.

Here is the call graph for this function:

◆ iicdev_readfrom()

◆ iicdev_writeto()

int iicdev_writeto ( device_t  _slavedev,
uint8_t  _regaddr,
void *  _buffer,
uint16_t  _buflen,
int  _waithow 
)

Variable Documentation

◆ iicbb_devclass

devclass_t iicbb_devclass
extern

Definition at line 135 of file iicbb.c.

◆ iicbb_driver

driver_t iicbb_driver
extern

Definition at line 129 of file iicbb.c.