#include <sys/param.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/sx.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/errno.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iic.h>
#include "iicbus_if.h"
Go to the source code of this file.
|
#define | IIC_LOCK(cdp) sx_xlock(&(cdp)->lock) |
|
#define | IIC_UNLOCK(cdp) sx_xunlock(&(cdp)->lock) |
|
|
static | MALLOC_DEFINE (M_IIC, "iic", "I2C device data") |
|
static int | iic_probe (device_t) |
|
static int | iic_attach (device_t) |
|
static int | iic_detach (device_t) |
|
static void | iic_identify (driver_t *driver, device_t parent) |
|
static void | iicdtor (void *data) |
|
static int | iicuio_move (struct iic_cdevpriv *priv, struct uio *uio, int last) |
|
static int | iicuio (struct cdev *dev, struct uio *uio, int ioflag) |
|
static int | iicrdwr (struct iic_cdevpriv *priv, struct iic_rdwr_data *d, int flags) |
|
static int | iicopen (struct cdev *dev, int flags, int fmt, struct thread *td) |
|
static int | iicioctl (struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) |
|
| DRIVER_MODULE (iic, iicbus, iic_driver, iic_devclass, 0, 0) |
|
| MODULE_DEPEND (iic, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER) |
|
| MODULE_VERSION (iic, 1) |
|
◆ IIC_LOCK
#define IIC_LOCK |
( |
|
cdp | ) |
sx_xlock(&(cdp)->lock) |
Definition at line 63 of file iic.c.
◆ IIC_UNLOCK
#define IIC_UNLOCK |
( |
|
cdp | ) |
sx_xunlock(&(cdp)->lock) |
Definition at line 64 of file iic.c.
◆ DRIVER_MODULE()
◆ iic_attach()
static int iic_attach |
( |
device_t |
dev | ) |
|
|
static |
◆ iic_detach()
static int iic_detach |
( |
device_t |
dev | ) |
|
|
static |
◆ iic_identify()
static void iic_identify |
( |
driver_t * |
driver, |
|
|
device_t |
parent |
|
) |
| |
|
static |
◆ iic_probe()
static int iic_probe |
( |
device_t |
dev | ) |
|
|
static |
◆ iicdtor()
static void iicdtor |
( |
void * |
data | ) |
|
|
static |
◆ iicioctl()
static int iicioctl |
( |
struct cdev * |
dev, |
|
|
u_long |
cmd, |
|
|
caddr_t |
data, |
|
|
int |
flags, |
|
|
struct thread * |
td |
|
) |
| |
|
static |
Definition at line 360 of file iic.c.
References iic_cdevpriv::addr, iiccmd::buf, iiccmd::count, data, I2CRDWR, I2CREAD, I2CRPTSTART, I2CRSTCARD, I2CSADDR, I2CSTART, I2CSTOP, I2CWRITE, IIC_DONTWAIT, IIC_ENOADDR, IIC_INTR, IIC_LOCK, IIC_UNKNOWN, IIC_UNLOCK, IIC_WAIT, iicbus_release_bus(), iicbus_repeated_start(), iicbus_request_bus(), iicbus_reset, iicbus_start(), iicbus_stop(), iicrdwr(), iicuio_move(), iiccmd::last, iic_cdevpriv::sc, iic_softc::sc_dev, iiccmd::slave, and iic_cdevpriv::started.
◆ iicopen()
static int iicopen |
( |
struct cdev * |
dev, |
|
|
int |
flags, |
|
|
int |
fmt, |
|
|
struct thread * |
td |
|
) |
| |
|
static |
◆ iicrdwr()
Definition at line 293 of file iic.c.
References iic_msg::buf, buf, iic_msg::flags, IIC_DONTWAIT, IIC_INTR, IIC_M_RD, IIC_RDRW_MAX_MSGS, IIC_WAIT, iicbus_release_bus(), iicbus_request_bus(), iicbus_transfer(), iic_msg::len, iic_rdwr_data::msgs, iic_rdwr_data::nmsgs, iic_cdevpriv::sc, and iic_softc::sc_dev.
Referenced by iicioctl().
◆ iicuio()
static int iicuio |
( |
struct cdev * |
dev, |
|
|
struct uio * |
uio, |
|
|
int |
ioflag |
|
) |
| |
|
static |
Definition at line 243 of file iic.c.
References iic_cdevpriv::addr, addr, IIC_DONTWAIT, IIC_INTR, IIC_LAST_READ, IIC_LOCK, IIC_UNLOCK, IIC_WAIT, iicbus_release_bus(), iicbus_request_bus(), iicbus_start(), iicbus_stop(), iicuio_move(), LSB, iic_cdevpriv::sc, iic_softc::sc_dev, and iic_cdevpriv::started.
◆ iicuio_move()
static int iicuio_move |
( |
struct iic_cdevpriv * |
priv, |
|
|
struct uio * |
uio, |
|
|
int |
last |
|
) |
| |
|
static |
◆ MALLOC_DEFINE()
static MALLOC_DEFINE |
( |
M_IIC |
, |
|
|
"iic" |
, |
|
|
"I2C device data" |
|
|
) |
| |
|
static |
◆ MODULE_DEPEND()
◆ MODULE_VERSION()
MODULE_VERSION |
( |
iic |
, |
|
|
1 |
|
|
) |
| |
◆ iic_cdevsw
Initial value:= {
.d_version = D_VERSION,
.d_name = "iic",
}
static int iicuio(struct cdev *dev, struct uio *uio, int ioflag)
static d_ioctl_t iicioctl
Definition at line 101 of file iic.c.
Referenced by iic_attach().
◆ iic_devclass
Definition at line 77 of file iic.c.
◆ iic_driver
Initial value:= {
"iic",
}
static device_method_t iic_methods[]
Definition at line 92 of file iic.c.
◆ iic_methods
device_method_t iic_methods[] |
|
static |
Initial value:= {
{ 0, 0 }
}
static int iic_attach(device_t)
static int iic_probe(device_t)
static void iic_identify(driver_t *driver, device_t parent)
static int iic_detach(device_t)
int iicbus_generic_intr(device_t dev, int event, char *buf)
void iicbus_intr(device_t bus, int event, char *buf)
Definition at line 79 of file iic.c.
◆ iicioctl
Definition at line 99 of file iic.c.
◆ iicopen
Definition at line 98 of file iic.c.