#include <sys/cdefs.h>
#include "opt_platform.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
#include "iicbus_if.h"
Go to the source code of this file.
|
| __FBSDID ("$FreeBSD$") |
|
static int | ads111x_write_2 (struct ads111x_softc *sc, int reg, int val) |
|
static int | ads111x_read_2 (struct ads111x_softc *sc, int reg, int *val) |
|
static int | ads111x_sample_voltage (struct ads111x_softc *sc, int channum, int *voltage) |
|
static int | ads111x_sysctl_gainidx (SYSCTL_HANDLER_ARGS) |
|
static int | ads111x_sysctl_rateidx (SYSCTL_HANDLER_ARGS) |
|
static int | ads111x_sysctl_voltage (SYSCTL_HANDLER_ARGS) |
|
static int | ads111x_sysctl_config (SYSCTL_HANDLER_ARGS) |
|
static int | ads111x_sysctl_lothresh (SYSCTL_HANDLER_ARGS) |
|
static int | ads111x_sysctl_hithresh (SYSCTL_HANDLER_ARGS) |
|
static void | ads111x_setup_channel (struct ads111x_softc *sc, int chan, int gainidx, int rateidx) |
|
static void | ads111x_add_channels (struct ads111x_softc *sc) |
|
static const struct ads111x_chipinfo * | ads111x_find_chipinfo (device_t dev) |
|
static int | ads111x_probe (device_t dev) |
|
static int | ads111x_attach (device_t dev) |
|
static int | ads111x_detach (device_t dev) |
|
| DRIVER_MODULE (ads111x, iicbus, ads111x_driver, ads111x_devclass, NULL, NULL) |
|
| MODULE_VERSION (ads111x, 1) |
|
| MODULE_DEPEND (ads111x, iicbus, 1, 1, 1) |
|
|
static const u_int | fixedranges [8] |
|
static const u_int | gainranges [8] |
|
static const u_int | rates101x [8] = {128, 250, 490, 920, 1600, 2400, 3300, 3300} |
|
static const u_int | rates111x [8] = { 8, 16, 32, 64, 128, 250, 475, 860} |
|
static struct ads111x_chipinfo | ads111x_chip_infos [] |
|
static device_method_t | ads111x_methods [] |
|
static driver_t | ads111x_driver |
|
static devclass_t | ads111x_devclass |
|
◆ ADS101x_RANGEDIV
#define ADS101x_RANGEDIV ((1 << 15) - 15) |
◆ ADS111x_CONF
#define ADS111x_CONF 1 /* Reg 1: Config (rw) */ |
◆ ADS111x_CONF_COMP_DISABLE
#define ADS111x_CONF_COMP_DISABLE 3 /* Comparator disable */ |
◆ ADS111x_CONF_DEFAULT
◆ ADS111x_CONF_GAIN_SHIFT
#define ADS111x_CONF_GAIN_SHIFT 9 /* Programmable gain amp */ |
◆ ADS111x_CONF_IDLE
◆ ADS111x_CONF_MEASURE
◆ ADS111x_CONF_MODE_SHIFT
#define ADS111x_CONF_MODE_SHIFT 8 /* Operational mode */ |
◆ ADS111x_CONF_MUX_SHIFT
#define ADS111x_CONF_MUX_SHIFT 12 /* Input mux setting */ |
◆ ADS111x_CONF_OS_SHIFT
#define ADS111x_CONF_OS_SHIFT 15 /* Operational state */ |
◆ ADS111x_CONF_RATE_SHIFT
#define ADS111x_CONF_RATE_SHIFT 5 /* Sample rate */ |
◆ ADS111x_CONF_USERMASK
#define ADS111x_CONF_USERMASK 0x001f |
◆ ADS111x_CONV
#define ADS111x_CONV 0 /* Reg 0: Latest sample (ro) */ |
◆ ADS111x_HITHRESH
#define ADS111x_HITHRESH 3 /* Compare hi threshold (rw) */ |
◆ ADS111x_LOTHRESH
#define ADS111x_LOTHRESH 2 /* Compare lo threshold (rw) */ |
◆ ADS111x_MAX_CHANNELS
#define ADS111x_MAX_CHANNELS 8 |
◆ ADS111x_RANGEDIV
#define ADS111x_RANGEDIV ((1 << 15) - 1) |
◆ DEFAULT_GAINIDX
#define DEFAULT_GAINIDX 2 |
◆ DEFAULT_RATEIDX
#define DEFAULT_RATEIDX 4 |
◆ __FBSDID()
◆ ads111x_add_channels()
◆ ads111x_attach()
static int ads111x_attach |
( |
device_t |
dev | ) |
|
|
static |
Definition at line 539 of file ads111x.c.
References ads111x_softc::addr, ads111x_add_channels(), ADS111x_CONF, ADS111x_CONF_DEFAULT, ads111x_find_chipinfo(), ads111x_sysctl_config(), ads111x_sysctl_hithresh(), ads111x_sysctl_lothresh(), ads111x_write_2(), ads111x_softc::cfgword, ads111x_softc::chipinfo, ads111x_softc::dev, dev, and ads111x_softc::lock.
◆ ads111x_detach()
static int ads111x_detach |
( |
device_t |
dev | ) |
|
|
static |
◆ ads111x_find_chipinfo()
◆ ads111x_probe()
static int ads111x_probe |
( |
device_t |
dev | ) |
|
|
static |
◆ ads111x_read_2()
static int ads111x_read_2 |
( |
struct ads111x_softc * |
sc, |
|
|
int |
reg, |
|
|
int * |
val |
|
) |
| |
|
static |
◆ ads111x_sample_voltage()
static int ads111x_sample_voltage |
( |
struct ads111x_softc * |
sc, |
|
|
int |
channum, |
|
|
int * |
voltage |
|
) |
| |
|
static |
Definition at line 203 of file ads111x.c.
References ADS111x_CONF, ADS111x_CONF_GAIN_SHIFT, ADS111x_CONF_IDLE, ADS111x_CONF_MUX_SHIFT, ADS111x_CONF_OS_SHIFT, ADS111x_CONF_RATE_SHIFT, ADS111x_CONV, ads111x_read_2(), ads111x_write_2(), ads111x_softc::cfgword, ads111x_softc::channels, ads111x_softc::chipinfo, ads111x_channel::gainidx, ads111x_chipinfo::rangediv, ads111x_chipinfo::rangetab, ads111x_channel::rateidx, and ads111x_chipinfo::ratetab.
Referenced by ads111x_sysctl_voltage().
◆ ads111x_setup_channel()
static void ads111x_setup_channel |
( |
struct ads111x_softc * |
sc, |
|
|
int |
chan, |
|
|
int |
gainidx, |
|
|
int |
rateidx |
|
) |
| |
|
static |
◆ ads111x_sysctl_config()
static int ads111x_sysctl_config |
( |
SYSCTL_HANDLER_ARGS |
| ) |
|
|
static |
◆ ads111x_sysctl_gainidx()
static int ads111x_sysctl_gainidx |
( |
SYSCTL_HANDLER_ARGS |
| ) |
|
|
static |
◆ ads111x_sysctl_hithresh()
static int ads111x_sysctl_hithresh |
( |
SYSCTL_HANDLER_ARGS |
| ) |
|
|
static |
◆ ads111x_sysctl_lothresh()
static int ads111x_sysctl_lothresh |
( |
SYSCTL_HANDLER_ARGS |
| ) |
|
|
static |
◆ ads111x_sysctl_rateidx()
static int ads111x_sysctl_rateidx |
( |
SYSCTL_HANDLER_ARGS |
| ) |
|
|
static |
◆ ads111x_sysctl_voltage()
static int ads111x_sysctl_voltage |
( |
SYSCTL_HANDLER_ARGS |
| ) |
|
|
static |
◆ ads111x_write_2()
static int ads111x_write_2 |
( |
struct ads111x_softc * |
sc, |
|
|
int |
reg, |
|
|
int |
val |
|
) |
| |
|
static |
Definition at line 170 of file ads111x.c.
References iic_msg::buf, data, ads111x_softc::dev, iic_msg::flags, IIC_M_WR, IIC_WAIT, iicbus_transfer_excl(), iic_msg::len, msgs, iic_msg::slave, and val.
Referenced by ads111x_attach(), ads111x_sample_voltage(), ads111x_sysctl_config(), ads111x_sysctl_hithresh(), and ads111x_sysctl_lothresh().
◆ DRIVER_MODULE()
◆ MODULE_DEPEND()
MODULE_DEPEND |
( |
ads111x |
, |
|
|
iicbus |
, |
|
|
1 |
, |
|
|
1 |
, |
|
|
1 |
|
|
) |
| |
◆ MODULE_VERSION()
MODULE_VERSION |
( |
ads111x |
, |
|
|
1 |
|
|
) |
| |
◆ ads111x_chip_infos
Initial value:= {
}
static const u_int fixedranges[8]
static const u_int rates111x[8]
static const u_int rates101x[8]
static const u_int gainranges[8]
Definition at line 136 of file ads111x.c.
Referenced by ads111x_find_chipinfo().
◆ ads111x_devclass
devclass_t ads111x_devclass |
|
static |
◆ ads111x_driver
Initial value:= {
"ads111x",
}
static device_method_t ads111x_methods[]
Definition at line 604 of file ads111x.c.
◆ ads111x_methods
device_method_t ads111x_methods[] |
|
static |
Initial value:= {
DEVMETHOD_END,
}
static int ads111x_attach(device_t dev)
static int ads111x_detach(device_t dev)
static int ads111x_probe(device_t dev)
Definition at line 596 of file ads111x.c.
◆ fixedranges
const u_int fixedranges[8] |
|
static |
Initial value:= {
2048000, 2048000, 2048000, 2048000, 2048000, 2048000, 2048000, 2048000,
}
Definition at line 105 of file ads111x.c.
◆ gainranges
const u_int gainranges[8] |
|
static |
Initial value:= {
6144000, 4096000, 2048000, 1024000, 512000, 256000, 256000, 256000,
}
Definition at line 108 of file ads111x.c.
◆ rates101x
const u_int rates101x[8] = {128, 250, 490, 920, 1600, 2400, 3300, 3300} |
|
static |
◆ rates111x
const u_int rates111x[8] = { 8, 16, 32, 64, 128, 250, 475, 860} |
|
static |