MK48TXX(4FREEBSD) - Linux man page online | Special files

Mostek time-of-day clock driver.

December 25, 2009
MK48TXX(4) BSD Kernel Interfaces 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 configura‐ tion 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; }; sc_res The bus resource used for accessing the chip's non-volatile memory (including the clock registers), which must be supplied by the front-end when using the default access methods (see below). Otherwise this member is optional. sc_mtx The hardware mutex used when accessing the chip's non-volatile memory (including the clock registers), which must be initialized with MTX_DEF by the front-end. sc_wet The event handler tag for the watchdog functionality, which is registered by the mk48txx_attach() function if supported by the chip and specified as part of the machine-dependent features (see below). sc_model The chip model which this instance should serve. This member must be set to one of “mk48t02”, “mk48t08”, “mk48t18”, or “mk48t59” by the front-end. sc_nvramsz The size of the non-volatile RAM in the Mostek chip, which is set by the mk48txx_attach() function. sc_clkoffset The offset into the control registers of the Mostek chip, which is set by the mk48txx_attach() function. sc_year0 The year offset to be used with the ‘year’ counter of the clock, which must be set by the front-end. This value is generally dependent on the system configuration in which the clock device is mounted. For instance, on Sun Microsystems machines the convention is to have clock's two-digit year represent the year since 1968. sc_flag This flag is used to specify machine-dependent features. The following flags are supported: MK48TXX_NO_CENT_ADJUST If the resulting date retrieved with the “clock_gettime() method” would be earlier than January 1, 1970, the driver will assume that the chip's year counter actually repre‐ sents 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 When this flag is set, the mk48txx driver will register as a watchdog via the interface defined in watchdog(9) if sup‐ ported by the specific chip model. MK48TXX_WDOG_ENABLE_WDS When this flag is set, the 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). sc_nvread sc_nvwrite These members specify the access methods for reading respectively writing clock device registers. The default, when 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: Mostek MK48T02 Mostek MK48T08 Mostek MK48T18 Mostek MK48T59


intro(4), watchdog(9)


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 <>. It was ported to FreeBSD by Thomas Moestl <> and later on improved by Marius Strobl <>.
BSD December 25, 2009 BSD
This manual Reference Other manuals
mk48txx(4freebsd) referred by
refer to intro(4) | watchdog(9freebsd)
Download raw manual
Main page BSD Kernel Interfaces Manual (+773) BSD (+3984) № 4 (+981)
Go top