FreeBSD kernel IICBUS device code
|
#include <sys/cdefs.h>
#include "opt_platform.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/sysctl.h>
#include <sys/uio.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
#include <dev/smbus/smbconf.h>
#include "iicbus_if.h"
#include "iicbb_if.h"
Go to the source code of this file.
Data Structures | |
struct | iicbb_softc |
Macros | |
#define | DEFAULT_SCL_LOW_TIMEOUT (25 * 1000) |
#define | IICBB_DEBUG |
#define | I2C_DEBUG(x) |
#define | I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) |
#define | I2C_SETSDA(dev, x) (IICBB_SETSDA(device_get_parent(dev), x)) |
#define | I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) |
#define | I2C_SETSCL(dev, x) (IICBB_SETSCL(device_get_parent(dev), x)) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | iicbb_attach (device_t) |
static void | iicbb_child_detached (device_t, device_t) |
static int | iicbb_detach (device_t) |
static int | iicbb_print_child (device_t, device_t) |
static int | iicbb_probe (device_t) |
static int | iicbb_callback (device_t, int, caddr_t) |
static int | iicbb_start (device_t, u_char, int) |
static int | iicbb_repstart (device_t, u_char, int) |
static int | iicbb_stop (device_t) |
static int | iicbb_write (device_t, const char *, int, int *, int) |
static int | iicbb_read (device_t, char *, int, int *, int, int) |
static int | iicbb_reset (device_t, u_char, u_char, u_char *) |
static int | iicbb_transfer (device_t dev, struct iic_msg *msgs, uint32_t nmsgs) |
static void | iicbb_set_speed (struct iicbb_softc *sc, u_char) |
SYSCTL_DECL (_hw_i2c) | |
SYSCTL_INT (_hw_i2c, OID_AUTO, iicbb_debug, CTLFLAG_RWTUN, &i2c_debug, 0, "Enable i2c bit-banging driver debug") | |
static int | iicbb_waitforscl (device_t dev) |
static int | iicbb_clockin (device_t dev, int sda) |
static void | iicbb_clockout (device_t dev) |
static int | iicbb_sendbit (device_t dev, int bit) |
static int | iicbb_getack (device_t dev) |
static int | iicbb_sendbyte (device_t dev, uint8_t data) |
static int | iicbb_readbyte (device_t dev, bool last, uint8_t *data) |
static int | iicbb_start_impl (device_t dev, u_char slave, bool repstart) |
DRIVER_MODULE (iicbus, iicbb, iicbus_driver, iicbus_devclass, 0, 0) | |
MODULE_DEPEND (iicbb, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER) | |
MODULE_VERSION (iicbb, IICBB_MODVER) | |
Variables | |
static device_method_t | iicbb_methods [] |
driver_t | iicbb_driver |
devclass_t | iicbb_devclass |
static int | i2c_debug = 0 |
#define I2C_DEBUG | ( | x | ) |
__FBSDID | ( | "$FreeBSD$" | ) |
DRIVER_MODULE | ( | iicbus | , |
iicbb | , | ||
iicbus_driver | , | ||
iicbus_devclass | , | ||
0 | , | ||
0 | |||
) |
|
static |
Definition at line 146 of file iicbb.c.
References DEFAULT_SCL_LOW_TIMEOUT, dev, iicbb_softc::iicbus, iicbb_softc::io_latency, iicbb_softc::scl_low_timeout, and iicbb_softc::udelay.
|
static |
|
static |
Definition at line 195 of file iicbb.c.
References dev, and iicbb_softc::iicbus.
|
static |
Definition at line 277 of file iicbb.c.
References dev, I2C_SETSCL, I2C_SETSDA, and iicbb_waitforscl().
Referenced by iicbb_getack(), iicbb_sendbit(), iicbb_start_impl(), and iicbb_stop().
|
static |
Definition at line 301 of file iicbb.c.
References dev, I2C_SETSCL, and iicbb_softc::udelay.
Referenced by iicbb_getack(), iicbb_readbyte(), iicbb_sendbit(), and iicbb_start_impl().
|
static |
|
static |
Definition at line 343 of file iicbb.c.
References dev, I2C_DEBUG, I2C_GETSDA, IIC_ENOACK, iicbb_clockin(), iicbb_clockout(), and iicbb_softc::udelay.
Referenced by iicbb_start_impl(), and iicbb_write().
|
static |
Definition at line 204 of file iicbb.c.
References dev, IIC_ENOADDR, IIC_FASTEST, and oldaddr.
|
static |
|
static |
|
static |
Definition at line 388 of file iicbb.c.
References data, dev, I2C_DEBUG, I2C_GETSDA, I2C_SETSCL, I2C_SETSDA, iicbb_clockout(), iicbb_sendbit(), iicbb_waitforscl(), last, and iicbb_softc::udelay.
Referenced by iicbb_read().
|
static |
Definition at line 498 of file iicbb.c.
References dev, iicbb_start_impl(), and slave.
|
static |
|
static |
Definition at line 315 of file iicbb.c.
References dev, iicbb_clockin(), iicbb_clockout(), and iicbb_softc::udelay.
Referenced by iicbb_readbyte(), and iicbb_sendbyte().
|
static |
Definition at line 372 of file iicbb.c.
References data, dev, I2C_DEBUG, and iicbb_sendbit().
Referenced by iicbb_start_impl(), and iicbb_write().
|
static |
Definition at line 584 of file iicbb.c.
References iicbb_softc::iicbus, iicbb_softc::io_latency, speed, and iicbb_softc::udelay.
Referenced by iicbb_reset().
|
static |
Definition at line 491 of file iicbb.c.
References dev, iicbb_start_impl(), and slave.
|
static |
Definition at line 437 of file iicbb.c.
References dev, I2C_DEBUG, I2C_GETSDA, I2C_SETSDA, IIC_EBUSERR, iicbb_clockin(), iicbb_clockout(), iicbb_getack(), iicbb_sendbyte(), iicbb_stop(), iicbb_waitforscl(), slave, and iicbb_softc::udelay.
Referenced by iicbb_repstart(), and iicbb_start().
|
static |
Definition at line 504 of file iicbb.c.
References dev, I2C_DEBUG, I2C_SETSDA, iicbb_clockin(), and iicbb_softc::udelay.
Referenced by iicbb_start_impl().
|
static |
|
static |
Definition at line 248 of file iicbb.c.
References dev, I2C_DEBUG, I2C_GETSCL, IIC_ETIMEOUT, iicbb_softc::scl_low_timeout, and timeout.
Referenced by iicbb_clockin(), iicbb_readbyte(), and iicbb_start_impl().
|
static |
Definition at line 526 of file iicbb.c.
References buf, bytes, dev, iicbb_getack(), iicbb_sendbyte(), and len.
MODULE_DEPEND | ( | iicbb | , |
iicbus | , | ||
IICBUS_MINVER | , | ||
IICBUS_PREFVER | , | ||
IICBUS_MAXVER | |||
) |
MODULE_VERSION | ( | iicbb | , |
IICBB_MODVER | |||
) |
SYSCTL_DECL | ( | _hw_i2c | ) |
SYSCTL_INT | ( | _hw_i2c | , |
OID_AUTO | , | ||
iicbb_debug | , | ||
CTLFLAG_RWTUN | , | ||
& | i2c_debug, | ||
0 | , | ||
"Enable i2c bit-banging driver debug" | |||
) |
driver_t iicbb_driver |
|
static |