root/arch/sparc/kernel/time.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. timer_interrupt
  2. time_init
  3. do_gettimeofday
  4. do_settimeofday
  5. set_rtc_mmss

   1 /* $Id: time.c,v 1.3 1995/11/25 00:58:45 davem Exp $
   2  * linux/arch/sparc/kernel/time.c
   3  *
   4  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   5  *
   6  * This file handles the Sparc specific time handling details.
   7  */
   8 #include <linux/errno.h>
   9 #include <linux/sched.h>
  10 #include <linux/kernel.h>
  11 #include <linux/param.h>
  12 #include <linux/string.h>
  13 #include <linux/mm.h>
  14 #include <linux/timex.h>
  15 
  16 #include <asm/segment.h>
  17 #include <asm/timer.h>
  18 
  19 #define TIMER_IRQ  10    /* Also at level 14, but we ignore that one. */
  20 
  21 static int set_rtc_mmss(unsigned long);
  22 
  23 /*
  24  * timer_interrupt() needs to keep up the real-time clock,
  25  * as well as call the "do_timer()" routine every clocktick
  26  */
  27 void timer_interrupt(int irq, struct pt_regs * regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  28 {
  29         /* last time the cmos clock got updated */
  30         static long last_rtc_update=0;
  31         volatile unsigned int clear_intr;
  32 
  33         /* First, clear the interrupt. */
  34         clear_intr = *master_l10_limit;
  35 
  36         do_timer(regs);
  37 
  38         /* XXX I don't know if this is right for the Sparc yet. XXX */
  39         if (time_state != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 &&
  40             xtime.tv_usec > 500000 - (tick >> 1) &&
  41             xtime.tv_usec < 500000 + (tick >> 1))
  42           if (set_rtc_mmss(xtime.tv_sec) == 0)
  43             last_rtc_update = xtime.tv_sec;
  44           else
  45             last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
  46 }
  47 
  48 void time_init(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  49 {
  50         request_irq(TIMER_IRQ, timer_interrupt, SA_INTERRUPT, "timer");
  51         return;
  52 }
  53 /* Nothing fancy on the Sparc yet. */
  54 void do_gettimeofday(struct timeval *tv)
     /* [previous][next][first][last][top][bottom][index][help] */
  55 {
  56         unsigned long flags;
  57 
  58         save_flags(flags);
  59         cli();
  60         *tv = xtime;
  61         restore_flags(flags);
  62 }
  63 
  64 void do_settimeofday(struct timeval *tv)
     /* [previous][next][first][last][top][bottom][index][help] */
  65 {
  66         cli();
  67         xtime = *tv;
  68         time_state = TIME_BAD;
  69         time_maxerror = 0x70000000;
  70         time_esterror = 0x70000000;
  71         sti();
  72 }
  73 
  74 /* XXX Mostek RTC code needs to be written XXX */
  75 static int set_rtc_mmss(unsigned long nowtime)
     /* [previous][next][first][last][top][bottom][index][help] */
  76 {
  77         /* Just say we succeeded for now. */
  78         return 0;
  79 }

/* [previous][next][first][last][top][bottom][index][help] */