FreeBSD kernel IICBUS device code
|
#include <sys/cdefs.h>
#include "opt_platform.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/sx.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
#include "clock_if.h"
#include "iicbus_if.h"
Go to the source code of this file.
Data Structures | |
struct | time_regs |
struct | isl12xx_softc |
Macros | |
#define | ISL12XX_SC_REG 0x00 /* RTC Seconds */ |
#define | ISL12XX_SR_REG 0x07 /* Status */ |
#define | ISL12XX_SR_ARST (1u << 7) /* Auto-reset on status read */ |
#define | ISL12XX_SR_XTOSCB (1u << 5) /* Osc disable (use ext osc) */ |
#define | ISL12XX_SR_WRTC (1u << 4) /* Write RTC enable */ |
#define | ISL12XX_SR_EVT (1u << 3) /* Event occurred (w0c) */ |
#define | ISL12XX_SR_ALM (1u << 2) /* Alarm occurred (w0c) */ |
#define | ISL12XX_SR_BAT (1u << 1) /* Running on battery (w0c) */ |
#define | ISL12XX_SR_RTCF (1u << 0) /* RTC fail (power loss) */ |
#define | ISL12XX_SR_W0C_BITS (ISL12XX_SR_BAT | ISL12XX_SR_ALM | ISL12XX_SR_EVT) |
#define | ISL12XX_INT_REG 0x08 /* Interrupts */ |
#define | ISL12XX_INT_IM (1u << 7) /* Alarm interrupt mode */ |
#define | ISL12XX_INT_ALME (1u << 6) /* Alarm enable */ |
#define | ISL12XX_INT_LPMODE (1u << 5) /* Low Power mode */ |
#define | ISL12XX_INT_FOBATB (1u << 4) /* Fout/IRQ disabled on bat */ |
#define | ISL12XX_INT_FO_SHIFT 0 /* Frequency output select */ |
#define | ISL12XX_INT_FO_MASK 0x0f /* shift and mask. */ |
#define | ISL12XX_EV_REG 0x09 /* Event */ |
#define | ISL12XX_EV_EVIENB (1u << 7) /* Disable internal pullup */ |
#define | ISL12XX_EV_EVBATB (1u << 6) /* Disable ev detect on bat */ |
#define | ISL12XX_EV_RTCHLT (1u << 5) /* Halt RTC on event */ |
#define | ISL12XX_EV_EVEN (1u << 4) /* Event detect enable */ |
#define | ISL12XX_EV_EHYS_SHIFT 2 /* Event input hysteresis */ |
#define | ISL12XX_EV_EHYS_MASK 0x03 /* selection; see datasheet */ |
#define | ISL12XX_EV_ESMP_SHIFT 0 /* Event input sample rate */ |
#define | ISL12XX_EV_ESMP_MASK 0x03 /* selection; see datasheet */ |
#define | ISL12XX_ATR_REG 0x0a /* Analog trim (osc adjust) */ |
#define | ISL12XX_DTR_REG 0x0b /* Digital trim (osc adjust) */ |
#define | ISL12XX_SCA_REG 0x0c /* Alarm seconds */ |
#define | ISL12XX_USR1_REG 0x12 /* User byte 1 */ |
#define | ISL12XX_USR2_REG 0x13 /* User byte 2 */ |
#define | ISL12XX_SCT_REG 0x14 /* Timestamp (event) seconds */ |
#define | ISL12XX_24HR_FLAG (1u << 7) /* Hours register 24-hr mode */ |
#define | ISL12XX_PM_FLAG (1u << 5) /* Hours register PM flag */ |
#define | ISL12xx_12HR_MASK 0x1f /* Hours mask in AM/PM mode */ |
#define | ISL12xx_24HR_MASK 0x3f /* Hours mask in 24-hr mode */ |
#define | WAITFLAGS (IIC_WAIT | IIC_RECURSIVE) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | isl12xx_read1 (struct isl12xx_softc *sc, uint8_t reg, uint8_t *data) |
static int | isl12xx_write1 (struct isl12xx_softc *sc, uint8_t reg, uint8_t val) |
static void | isl12xx_init (void *arg) |
static int | isl12xx_probe (device_t dev) |
static int | isl12xx_attach (device_t dev) |
static int | isl12xx_detach (device_t dev) |
static int | isl12xx_gettime (device_t dev, struct timespec *ts) |
static int | isl12xx_settime (device_t dev, struct timespec *ts) |
DRIVER_MODULE (isl12xx, iicbus, isl12xx_driver, isl12xx_devclass, NULL, NULL) | |
MODULE_VERSION (isl12xx, 1) | |
MODULE_DEPEND (isl12xx, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER) | |
IICBUS_FDT_PNP_INFO (compat_data) | |
Variables | |
static device_method_t | isl12xx_methods [] |
static driver_t | isl12xx_driver |
static devclass_t | isl12xx_devclass |
#define ISL12xx_12HR_MASK 0x1f /* Hours mask in AM/PM mode */ |
#define ISL12XX_24HR_FLAG (1u << 7) /* Hours register 24-hr mode */ |
#define ISL12xx_24HR_MASK 0x3f /* Hours mask in 24-hr mode */ |
#define ISL12XX_ATR_REG 0x0a /* Analog trim (osc adjust) */ |
#define ISL12XX_DTR_REG 0x0b /* Digital trim (osc adjust) */ |
#define ISL12XX_EV_EHYS_MASK 0x03 /* selection; see datasheet */ |
#define ISL12XX_EV_EHYS_SHIFT 2 /* Event input hysteresis */ |
#define ISL12XX_EV_ESMP_MASK 0x03 /* selection; see datasheet */ |
#define ISL12XX_EV_ESMP_SHIFT 0 /* Event input sample rate */ |
#define ISL12XX_EV_EVBATB (1u << 6) /* Disable ev detect on bat */ |
#define ISL12XX_EV_EVEN (1u << 4) /* Event detect enable */ |
#define ISL12XX_EV_EVIENB (1u << 7) /* Disable internal pullup */ |
#define ISL12XX_EV_RTCHLT (1u << 5) /* Halt RTC on event */ |
#define ISL12XX_INT_FO_SHIFT 0 /* Frequency output select */ |
#define ISL12XX_INT_FOBATB (1u << 4) /* Fout/IRQ disabled on bat */ |
#define ISL12XX_INT_IM (1u << 7) /* Alarm interrupt mode */ |
#define ISL12XX_PM_FLAG (1u << 5) /* Hours register PM flag */ |
#define ISL12XX_SCT_REG 0x14 /* Timestamp (event) seconds */ |
#define ISL12XX_SR_ALM (1u << 2) /* Alarm occurred (w0c) */ |
#define ISL12XX_SR_BAT (1u << 1) /* Running on battery (w0c) */ |
#define ISL12XX_SR_EVT (1u << 3) /* Event occurred (w0c) */ |
#define ISL12XX_SR_RTCF (1u << 0) /* RTC fail (power loss) */ |
#define ISL12XX_SR_W0C_BITS (ISL12XX_SR_BAT | ISL12XX_SR_ALM | ISL12XX_SR_EVT) |
#define ISL12XX_SR_XTOSCB (1u << 5) /* Osc disable (use ext osc) */ |
#define WAITFLAGS (IIC_WAIT | IIC_RECURSIVE) |
__FBSDID | ( | "$FreeBSD$" | ) |
DRIVER_MODULE | ( | isl12xx | , |
iicbus | , | ||
isl12xx_driver | , | ||
isl12xx_devclass | , | ||
NULL | , | ||
NULL | |||
) |
IICBUS_FDT_PNP_INFO | ( | compat_data | ) |
|
static |
Definition at line 207 of file isl12xx.c.
References isl12xx_softc::busdev, isl12xx_softc::dev, dev, isl12xx_softc::init_hook, and isl12xx_init().
|
static |
|
static |
Definition at line 235 of file isl12xx.c.
References isl12xx_softc::busdev, time_regs::day, isl12xx_softc::dev, dev, time_regs::hour, IIC_WAIT, iicbus_release_bus(), iicbus_request_bus(), iicdev_readfrom(), ISL12xx_12HR_MASK, ISL12XX_24HR_FLAG, ISL12xx_24HR_MASK, ISL12XX_PM_FLAG, isl12xx_read1(), ISL12XX_SC_REG, ISL12XX_SR_REG, ISL12XX_SR_RTCF, time_regs::min, time_regs::month, time_regs::sec, isl12xx_softc::use_ampm, WAITFLAGS, and time_regs::year.
|
static |
Definition at line 166 of file isl12xx.c.
References isl12xx_softc::dev, isl12xx_softc::init_hook, isl12xx_read1(), ISL12XX_SR_REG, and ISL12XX_SR_RTCF.
Referenced by isl12xx_attach().
|
static |
Definition at line 191 of file isl12xx.c.
References compat_data, and dev.
|
inlinestatic |
Definition at line 152 of file isl12xx.c.
References data, isl12xx_softc::dev, iicdev_readfrom(), and WAITFLAGS.
Referenced by isl12xx_gettime(), isl12xx_init(), and isl12xx_settime().
|
static |
Definition at line 282 of file isl12xx.c.
References isl12xx_softc::busdev, time_regs::day, isl12xx_softc::dev, dev, time_regs::hour, IIC_WAIT, iicbus_release_bus(), iicbus_request_bus(), iicdev_writeto(), ISL12XX_24HR_FLAG, ISL12XX_PM_FLAG, isl12xx_read1(), ISL12XX_SC_REG, ISL12XX_SR_REG, ISL12XX_SR_W0C_BITS, ISL12XX_SR_WRTC, isl12xx_write1(), time_regs::min, time_regs::month, time_regs::sec, isl12xx_softc::use_ampm, WAITFLAGS, and time_regs::year.
|
inlinestatic |
Definition at line 159 of file isl12xx.c.
References isl12xx_softc::dev, iicdev_writeto(), val, and WAITFLAGS.
Referenced by isl12xx_settime().
MODULE_DEPEND | ( | isl12xx | , |
iicbus | , | ||
IICBUS_MINVER | , | ||
IICBUS_PREFVER | , | ||
IICBUS_MAXVER | |||
) |
MODULE_VERSION | ( | isl12xx | , |
1 | |||
) |
|
static |
|
static |