MK48TXX(4) | Device Drivers Manual | MK48TXX(4) |
mk48txx
— Mostek
time-of-day clock driver
#include
<sys/eventhandler.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include
<dev/mk48txx/mk48txxvar.h>
To compile this driver into the kernel, place the following line in your kernel configuration file:
device mk48txx
The mk48txx
driver is a back-end for
several models of Mostek time-of-day clock chips. It provides access methods
to retrieve and set date and time for use with the
“clock
” KOBJ interface.
To tie an instance of this device to the
system, use the
mk48txx_attach
()
function and the mk48txx_softc structure defined as follows:
int
mk48txx_attach
(device_t
dev)
typedef uint8_t (*mk48txx_nvrd_t)(device_t dev, int off); typedef void (*mk48txx_nvwr_t)(device_t dev, int off, uint8_t v);
struct mk48txx_softc { struct resource sc_res; struct mtx sc_mtx; eventhandler_tag sc_wet; const char *sc_model; bus_size_t sc_nvramsz; bus_size_t sc_clkoffset; u_int sc_year0; u_int sc_flag; mk48txx_nvrd_t sc_nvrd; mk48txx_nvwr_t sc_nvwr; };
MTX_DEF
by the front-end.mk48txx_attach
() function if supported by
the chip and specified as part of the machine-dependent features (see
below).mk48txx_attach
() function.mk48txx_attach
() function.MK48TXX_NO_CENT_ADJUST
clock_gettime() method
” would
be earlier than January 1, 1970, the driver will assume that the
chip's year counter actually represents a year in the 21st century.
This behavior can be overridden by setting this flag, which causes the
mk48txx
driver to respect the clock's century
bit instead.MK48TXX_WDOG_REGISTER
mk48txx
driver will
register as a watchdog via the interface defined in
watchdog(9) if supported by the specific chip
model.MK48TXX_WDOG_ENABLE_WDS
mk48txx
driver will
set the watchdog steering (WDS) bit when enabling the watchdog
functionality of the chip. enabled (see the chip documentation for
further information regarding the WDS bit).NULL
is
passed as an access method, is to access the chip memory (and clock
registers) as if they were direct-mapped using the specified bus resource.
Otherwise, the driver will call the respective function supplied by the front-end to perform the access, passing it the offset off of the chip memory (or clock register) location to be read from or written to, respectively.
The following models are supported:
The mk48txx
driver appeared in
NetBSD 1.5. The first
FreeBSD version to include it was
FreeBSD 5.0.
The mk48txx
driver was written for
NetBSD by Paul Kranenburg
<pk@NetBSD.org>. It was
ported to FreeBSD by Thomas
Moestl
<tmm@FreeBSD.org> and
later on improved by Marius Strobl
<marius@FreeBSD.org>.
December 25, 2009 | Debian |