- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
- /*
- * arch/m68k/sun3/intersil.c
- *
- * basic routines for accessing the intersil clock within the sun3 machines
- *
- * started 11/12/1999 Sam Creasey
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file COPYING in the main directory of this archive
- * for more details.
- */
- #include <linux/kernel.h>
- #include <linux/rtc.h>
- #include <asm/system.h>
- #include <asm/rtc.h>
- #include <asm/intersil.h>
- /* bits to set for start/run of the intersil */
- #define STOP_VAL (INTERSIL_STOP | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE)
- #define START_VAL (INTERSIL_RUN | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE)
- /* does this need to be implemented? */
- unsigned long sun3_gettimeoffset(void)
- {
- return 1;
- }
- void sun3_gettod (int *yearp, int *monp, int *dayp,
- int *hourp, int *minp, int *secp)
- {
- unsigned char wday;
- volatile struct intersil_dt* todintersil;
- unsigned long flags;
- todintersil = (struct intersil_dt *) &intersil_clock->counter;
- save_and_cli(flags);
- intersil_clock->cmd_reg = STOP_VAL;
- *secp = todintersil->csec;
- *hourp = todintersil->hour;
- *minp = todintersil->minute;
- *secp = todintersil->second;
- *monp = todintersil->month;
- *dayp = todintersil->day;
- *yearp = todintersil->year+68; /* The base year for sun3 is 1968 */
- wday = todintersil->weekday;
- intersil_clock->cmd_reg = START_VAL;
- restore_flags(flags);
- }
- /* get/set hwclock */
- int sun3_hwclk(int set, struct rtc_time *t)
- {
- volatile struct intersil_dt *todintersil;
- unsigned long flags;
- todintersil = (struct intersil_dt *) &intersil_clock->counter;
- save_and_cli(flags);
- intersil_clock->cmd_reg = STOP_VAL;
- /* set or read the clock */
- if(set) {
- todintersil->csec = 0;
- todintersil->hour = t->tm_hour;
- todintersil->minute = t->tm_min;
- todintersil->second = t->tm_sec;
- todintersil->month = t->tm_mon;
- todintersil->day = t->tm_mday;
- todintersil->year = t->tm_year - 68;
- todintersil->weekday = t->tm_wday;
- } else {
- /* read clock */
- t->tm_sec = todintersil->csec;
- t->tm_hour = todintersil->hour;
- t->tm_min = todintersil->minute;
- t->tm_sec = todintersil->second;
- t->tm_mon = todintersil->month;
- t->tm_mday = todintersil->day;
- t->tm_year = todintersil->year + 68;
- t->tm_wday = todintersil->weekday;
- }
- intersil_clock->cmd_reg = START_VAL;
- restore_flags(flags);
- return 0;
- }