MK48TXX(4)
π NAME π
mk48txx β Mostek time-of-day clock driver
okay so bestie, welcome to mk48txx(4) from the Kernel Interfaces Manual β¨ this is the page for the Mostek time-of-day clock driver, and it's lowkey iconic in a very specific kernel-dev way. no cap.
β¨ SYNOPSIS β¨
First things first, the includes, fr fr:
#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
πΈ DESCRIPTION πΈ
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;
};
Now let's go member by member, because every field is a main character:
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 withMTX_DEFby the front-end.
bestie, that MTX_DEF part is not optional. periodt.
sc_wetβ The event handler tag for the watchdog functionality, which is registered by themk48txx_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 themk48txx_attach()function.sc_clkoffsetβ The offset into the control registers of the Mostek chip, which is set by themk48txx_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 since1968.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 thanJanuary 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 themk48txxdriver to respect the clock's century bit instead.MK48TXX_WDOG_REGISTERβ When this flag is set, themk48txxdriver will register as a watchdog via the interface defined inwatchdog(9)if supported by the specific chip model.MK48TXX_WDOG_ENABLE_WDSβ When this flag is set, themk48txxdriver 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_nvreadsc_nvwriteβ These members specify the access methods for reading respectively writing clock device registers. The default, whenNULLis 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.
π¦ HARDWARE π¦
The following models are supported:
Mostek MK48T02Mostek MK48T08Mostek MK48T18Mostek MK48T59
π SEE ALSO π
π HISTORY π
The mk48txx driver appeared in NetBSD 1.5. The first FreeBSD version to include it was FreeBSD 5.0.
π AUTHORS π
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>.
xoxo bestie, this page is from Debian, dated December 25, 2009, and it's the MK48TXX(4) manual. periodt π β¨π«Ά
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2000, 2002 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms