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/endian.h>
#include <sys/kernel.h>
#include <sys/libkern.h>
#include <sys/module.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iiconf.h>
#include "clock_if.h"
#include "iicbus_if.h"
Go to the source code of this file.
Data Structures | |
struct | time_regs |
struct | ds13rtc_softc |
struct | ds13_compat_data |
Macros | |
#define | DS13xx_ADDR 0xd0 |
#define | DS13xx_R_NONE 0xff /* Placeholder */ |
#define | DS130x_R_CONTROL 0x07 |
#define | DS133x_R_CONTROL 0x0e |
#define | DS1340_R_CONTROL 0x07 |
#define | DS1341_R_CONTROL 0x0e |
#define | DS1371_R_CONTROL 0x07 |
#define | DS1372_R_CONTROL 0x07 |
#define | DS1374_R_CONTROL 0x07 |
#define | DS1375_R_CONTROL 0x0e |
#define | DS1388_R_CONTROL 0x0c |
#define | DS13xx_R_SECOND 0x00 |
#define | DS1388_R_SECOND 0x01 |
#define | DS130x_R_STATUS DS13xx_R_NONE |
#define | DS133x_R_STATUS 0x0f |
#define | DS1340_R_STATUS 0x09 |
#define | DS137x_R_STATUS 0x08 |
#define | DS1388_R_STATUS 0x0b |
#define | DS13xx_B_STATUS_OSF 0x80 /* OSF is 1<<7 in status and sec regs */ |
#define | DS13xx_B_HOUR_AMPM 0x40 /* AMPM mode is bit 1<<6 */ |
#define | DS13xx_B_HOUR_PM 0x20 /* PM hours indicated by 1<<5 */ |
#define | DS13xx_B_MONTH_CENTURY 0x80 /* 21st century indicated by 1<<7 */ |
#define | DS13xx_M_SECOND 0x7f /* Masks for all BCD time regs... */ |
#define | DS13xx_M_MINUTE 0x7f |
#define | DS13xx_M_12HOUR 0x1f |
#define | DS13xx_M_24HOUR 0x3f |
#define | DS13xx_M_DAY 0x3f |
#define | DS13xx_M_MONTH 0x1f |
#define | DS13xx_M_YEAR 0xff |
Enumerations | |
enum | { TYPE_NONE , TYPE_DS1307 , TYPE_DS1308 , TYPE_DS1337 , TYPE_DS1338 , TYPE_DS1339 , TYPE_DS1340 , TYPE_DS1341 , TYPE_DS1342 , TYPE_DS1371 , TYPE_DS1372 , TYPE_DS1374 , TYPE_DS1375 , TYPE_DS1388 , TYPE_COUNT } |
Functions | |
__FBSDID ("$FreeBSD$") | |
CTASSERT (nitems(desc_strings)==TYPE_COUNT) | |
static int | read_reg (struct ds13rtc_softc *sc, uint8_t reg, uint8_t *val) |
static int | write_reg (struct ds13rtc_softc *sc, uint8_t reg, uint8_t val) |
static int | read_timeregs (struct ds13rtc_softc *sc, struct time_regs *tregs) |
static int | write_timeregs (struct ds13rtc_softc *sc, struct time_regs *tregs) |
static int | read_timeword (struct ds13rtc_softc *sc, time_t *secs) |
static int | write_timeword (struct ds13rtc_softc *sc, time_t secs) |
static void | ds13rtc_start (void *arg) |
static int | ds13rtc_gettime (device_t dev, struct timespec *ts) |
static int | ds13rtc_settime (device_t dev, struct timespec *ts) |
static int | ds13rtc_get_chiptype (device_t dev) |
static int | ds13rtc_probe (device_t dev) |
static int | ds13rtc_attach (device_t dev) |
static int | ds13rtc_detach (device_t dev) |
DRIVER_MODULE (ds13rtc, iicbus, ds13rtc_driver, ds13rtc_devclass, NULL, NULL) | |
MODULE_VERSION (ds13rtc, 1) | |
MODULE_DEPEND (ds13rtc, iicbus, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER) | |
IICBUS_FDT_PNP_INFO (compat_data) | |
Variables | |
static const char * | desc_strings [] |
static ds13_compat_data | compat_data [] |
static device_method_t | ds13rtc_methods [] |
static driver_t | ds13rtc_driver |
static devclass_t | ds13rtc_devclass |
#define DS130x_R_STATUS DS13xx_R_NONE |
#define DS13xx_B_HOUR_AMPM 0x40 /* AMPM mode is bit 1<<6 */ |
#define DS13xx_B_HOUR_PM 0x20 /* PM hours indicated by 1<<5 */ |
#define DS13xx_B_MONTH_CENTURY 0x80 /* 21st century indicated by 1<<7 */ |
#define DS13xx_B_STATUS_OSF 0x80 /* OSF is 1<<7 in status and sec regs */ |
#define DS13xx_M_SECOND 0x7f /* Masks for all BCD time regs... */ |
anonymous enum |
__FBSDID | ( | "$FreeBSD$" | ) |
CTASSERT | ( | nitems(desc_strings) | = =TYPE_COUNT | ) |
DRIVER_MODULE | ( | ds13rtc | , |
iicbus | , | ||
ds13rtc_driver | , | ||
ds13rtc_devclass | , | ||
NULL | , | ||
NULL | |||
) |
|
static |
Definition at line 526 of file ds13rtc.c.
References ds13rtc_softc::busdev, ds13rtc_softc::chiptype, ds13rtc_softc::dev, dev, DS133x_R_STATUS, DS1340_R_STATUS, DS137x_R_STATUS, DS1388_R_SECOND, DS1388_R_STATUS, ds13rtc_get_chiptype(), ds13rtc_start(), DS13xx_R_SECOND, ds13rtc_softc::is_binary_counter, ds13rtc_softc::osfaddr, ds13rtc_softc::secaddr, TYPE_DS1307, TYPE_DS1308, TYPE_DS1337, TYPE_DS1338, TYPE_DS1339, TYPE_DS1340, TYPE_DS1341, TYPE_DS1342, TYPE_DS1371, TYPE_DS1372, TYPE_DS1374, TYPE_DS1375, TYPE_DS1388, TYPE_NONE, and ds13rtc_softc::use_century.
|
static |
|
static |
Definition at line 476 of file ds13rtc.c.
References compat_data, dev, ds13_compat_data::ocd_data, ds13_compat_data::ocd_str, and TYPE_NONE.
Referenced by ds13rtc_attach(), and ds13rtc_probe().
|
static |
Definition at line 347 of file ds13rtc.c.
References time_regs::day, ds13rtc_softc::dev, dev, DS13xx_B_HOUR_PM, DS13xx_B_MONTH_CENTURY, DS13xx_B_STATUS_OSF, DS13xx_M_12HOUR, DS13xx_M_24HOUR, DS13xx_M_DAY, DS13xx_M_MINUTE, DS13xx_M_MONTH, DS13xx_M_SECOND, DS13xx_M_YEAR, time_regs::hour, ds13rtc_softc::is_binary_counter, time_regs::min, time_regs::month, ds13rtc_softc::osfaddr, read_reg(), read_timeregs(), read_timeword(), time_regs::sec, ds13rtc_softc::use_ampm, ds13rtc_softc::use_century, and time_regs::year.
|
static |
Definition at line 505 of file ds13rtc.c.
References ds13rtc_softc::chiptype, desc_strings, dev, ds13rtc_get_chiptype(), and TYPE_NONE.
|
static |
Definition at line 406 of file ds13rtc.c.
References time_regs::day, ds13rtc_softc::dev, dev, DS13xx_B_HOUR_AMPM, DS13xx_B_HOUR_PM, DS13xx_B_MONTH_CENTURY, DS13xx_B_STATUS_OSF, time_regs::hour, ds13rtc_softc::is_binary_counter, time_regs::min, time_regs::month, ds13rtc_softc::osfaddr, read_reg(), time_regs::sec, ds13rtc_softc::secaddr, ds13rtc_softc::use_ampm, ds13rtc_softc::use_century, time_regs::wday, write_reg(), write_timeregs(), write_timeword(), and time_regs::year.
|
static |
Definition at line 263 of file ds13rtc.c.
References ds13rtc_softc::chiptype, ds13rtc_softc::dev, DS130x_R_CONTROL, DS133x_R_CONTROL, DS1341_R_CONTROL, DS1388_R_CONTROL, DS13xx_B_HOUR_AMPM, DS13xx_B_STATUS_OSF, DS13xx_R_NONE, ds13rtc_softc::is_binary_counter, ds13rtc_softc::osfaddr, read_reg(), ds13rtc_softc::secaddr, TYPE_DS1307, TYPE_DS1308, TYPE_DS1337, TYPE_DS1338, TYPE_DS1339, TYPE_DS1340, TYPE_DS1341, TYPE_DS1342, TYPE_DS1371, TYPE_DS1372, TYPE_DS1374, TYPE_DS1375, TYPE_DS1388, ds13rtc_softc::use_ampm, and write_reg().
Referenced by ds13rtc_attach().
IICBUS_FDT_PNP_INFO | ( | compat_data | ) |
MODULE_DEPEND | ( | ds13rtc | , |
iicbus | , | ||
IICBB_MINVER | , | ||
IICBB_PREFVER | , | ||
IICBB_MAXVER | |||
) |
MODULE_VERSION | ( | ds13rtc | , |
1 | |||
) |
|
static |
Definition at line 206 of file ds13rtc.c.
References ds13rtc_softc::dev, IIC_WAIT, iicdev_readfrom(), and val.
Referenced by ds13rtc_gettime(), ds13rtc_settime(), and ds13rtc_start().
|
static |
Definition at line 220 of file ds13rtc.c.
References ds13rtc_softc::dev, IIC_WAIT, iicdev_readfrom(), and ds13rtc_softc::secaddr.
Referenced by ds13rtc_gettime().
|
static |
Definition at line 240 of file ds13rtc.c.
References buf, ds13rtc_softc::dev, IIC_WAIT, iicdev_readfrom(), and ds13rtc_softc::secaddr.
Referenced by ds13rtc_gettime().
|
static |
Definition at line 213 of file ds13rtc.c.
References ds13rtc_softc::dev, IIC_WAIT, iicdev_writeto(), and val.
Referenced by ds13rtc_settime(), and ds13rtc_start().
|
static |
Definition at line 232 of file ds13rtc.c.
References ds13rtc_softc::dev, IIC_WAIT, iicdev_writeto(), and ds13rtc_softc::secaddr.
Referenced by ds13rtc_settime().
|
static |
Definition at line 253 of file ds13rtc.c.
References buf, ds13rtc_softc::dev, IIC_WAIT, iicdev_writeto(), and ds13rtc_softc::secaddr.
Referenced by ds13rtc_settime().
|
static |
Definition at line 187 of file ds13rtc.c.
Referenced by ads111x_find_chipinfo(), ds13rtc_get_chiptype(), gpiomux_probe(), htu21_probe(), hym8563_probe(), icee_init(), icee_probe(), isl12xx_probe(), ltc430x_find_chiptype(), max44009_probe(), pca954x_find_chip(), pcf8574_probe(), pcf8591_probe(), and rtc8583_probe().
|
static |
Definition at line 138 of file ds13rtc.c.
Referenced by ds13rtc_probe().
|
static |
|
static |