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 with MTX_DEF by 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 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 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 β€” When this flag is set, the 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 β€” 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.


πŸ¦‹ HARDWARE πŸ¦‹

The following models are supported:

  • Mostek MK48T02
  • Mostek MK48T08
  • Mostek MK48T18
  • Mostek 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