p To tie an instance of this device to the system, use the .Fn mk48txx_attach function and the mk48txx_softc structure defined as follows:
p .Ft "void" .Fn mk48txx_attach "struct mk48txx_softc *"
p d -literal typedef uint8_t (*mk48txx_nvrd_t)(struct mk48txx_softc *, int off); typedef void (*mk48txx_nvwr_t)(struct mk48txx_softc *, int off, uint8_t datum); .Ed d -literal struct mk48txx_softc { struct device sc_dev; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; struct todr_chip_handle sc_handle; 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; }; .Ed
p l -tag -width Dv -offset indent t Fa sc_bst t Fa sc_bsh Specify bus space access to the chip's non-volatile memory
q including the clock registers . t Fa sc_handle TODR handle passed to the .Fn todr_attach function to register .Xr todr 9 interface. t Fa sc_model The chip model which this instance should serve. Must be one of .Dq mk48t02 , .Dq mk48t08 , .Dq mk48t18 , or .Dq mk48t59 . t Fa sc_nvramsz Size of non-volatile RAM in the .Tn Mostek chip. This value is set by .Fn mk48txx_attach . t Fa sc_clkoffset Offset into the control registers of the .Tn Mostek chip. This value is set by .Fn mk48txx_attach . t Fa sc_year0 The actual year represented by the clock's .Sq year counter. This is generally dependent on the system configuration in which the clock device is mounted. For instance, on .Tn Sun Microsystems machines the convention is to have clock's two-digit year represent the year 1968. t Fa sc_flag This flag is used to specify machine-dependent features. t Fa sc_nvread t Fa sc_nvwrite Specify alternate access methods for reading resp. writing clock device registers. The default, when .Dv NULL is passed as an access method, is to access the chip memory
q and clock registers as if they were direct-mapped with using the specified bus space.
p Otherwise, the driver will call the respective function to perform the access, passing it the specified bus space and the offset .Va off of the chip memory
q or clock register location to be read from or written to, respectively. .El
p Note that if the resulting date retrieved with the todr_gettime() method is earlier that January 1, 1970, the driver will assume that the chip's year counter actually represents a year in the 21st century. This behaviour can be overridden by setting the .Va MK48TXX_NO_CENT_ADJUST flag in .Fa sc_flag . .Sh HARDWARE The following models are supported:
p l -tag -width indent -offset indent -compact t Tn Mostek MK48T02 t Tn Mostek MK48T08 t Tn Mostek MK48T18 t Tn Mostek MK48T59 .El .Sh SEE ALSO .Xr intro 4 , .Xr todr 9 .Sh HISTORY The .Nm mk48txx driver first appeared in .Nx 1.5 . .Sh AUTHORS The .Nm driver was written by .An Paul Kranenburg .Aq pk (at] NetBSD.org .