/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* tod driver module for Mostek M48T59 part
*/
#include <sys/sysmacros.h>
#include <sys/autoconf.h>
#include <sys/todmostek.h>
static timestruc_t todm_get(void);
static void todm_set(timestruc_t);
static uint_t todm_clear_watchdog_timer(void);
static void todm_set_power_alarm(timestruc_t);
static void todm_clear_power_alarm(void);
static uint64_t todm_get_cpufrequency(void);
/*
* Module linkage information for the kernel.
*/
&mod_miscops, "tod module for Mostek M48T59"
};
};
int
_init(void)
{
/*
* check if hardware watchdog timer is available and user
* enabled it.
*/
if (watchdog_enable) {
if (!watchdog_available) {
"Hardware watchdog unavailable");
" [debugger]");
}
}
}
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (EBUSY);
else
return (mod_remove(&modlinkage));
}
int
{
}
/*
* Read the current time from the clock chip and convert to UNIX form.
* Assumes that the year in the clock chip is valid.
* Must be called with tod_lock held.
*/
static timestruc_t
todm_get(void)
{
int s;
s = splhi();
splx(s);
/*
* Apparently the m48t59 doesn't quite do what the spec sheet says.
* The spec says reading WRD will reset the timer but that doesn't work.
* So we need to reload timeout each time we want to reset the timer.
*/
return (ts);
}
/*
* Write the specified time into the clock chip.
* Must be called with tod_lock held.
*/
/* ARGSUSED */
static void
{
}
/*
* Program the watchdog timer shadow register with the specified value.
* Setting the timer to zero value means no watchdog timeout.
*/
static uint_t
{
if (watchdog_enable == 0 || watchdog_available == 0 ||
return (0);
watchdog_activated = 1;
return (timeoutval);
}
/*
* Clear the hardware timer register. Also zero out the watchdog timer
* shadow register.
*/
static uint_t
{
if (watchdog_activated == 0)
return (0);
CLOCK->clk_watchdog = 0;
watchdog_bits = 0;
watchdog_activated = 0;
return (watchdog_timeout);
}
/*
* program the tod registers for alarm to go off at the specified time
*/
static void
{
uchar_t c;
#ifdef lint
#endif
}
/*
* clear alarm interrupt
*/
static void
{
uchar_t c;
#ifdef lint
#endif
}
/*
* Determine the cpu frequency by watching the TOD chip rollover twice.
* Cpu clock rate is determined by computing the ticks added (in tick register)
* during one second interval on TOD.
*/
todm_get_cpufrequency(void)
{
}