patch-2.1.79 linux/arch/ppc/kernel/time.h
Next file: linux/arch/ppc/kernel/traps.c
Previous file: linux/arch/ppc/kernel/time.c
Back to the patch index
Back to the overall index
- Lines: 86
- Date:
Mon Jan 12 15:18:13 1998
- Orig file:
v2.1.78/linux/arch/ppc/kernel/time.h
- Orig date:
Thu Sep 4 17:07:29 1997
diff -u --recursive --new-file v2.1.78/linux/arch/ppc/kernel/time.h linux/arch/ppc/kernel/time.h
@@ -1,5 +1,5 @@
/*
- * $Id: time.h,v 1.5 1997/08/27 22:06:58 cort Exp $
+ * $Id: time.h,v 1.7 1997/12/28 22:47:24 paulus Exp $
* Common time prototypes and such for all ppc machines.
*
* Written by Cort Dougan (cort@cs.nmt.edu) to merge
@@ -9,17 +9,16 @@
#include <linux/mc146818rtc.h>
/* time.c */
-__inline__ unsigned long get_dec(void);
-__inline__ void set_dec(int val);
void prep_calibrate_decr_handler(int, void *,struct pt_regs *);
void prep_calibrate_decr(void);
void pmac_calibrate_decr(void);
-void chrp_calibrate_decr(void);
extern unsigned decrementer_count;
extern unsigned count_period_num;
extern unsigned count_period_den;
extern unsigned long mktime(unsigned int, unsigned int,unsigned int,
- unsigned int, unsigned int, unsigned int);
+ unsigned int, unsigned int, unsigned int);
+extern void to_tm(int tim, struct rtc_time * tm);
+extern unsigned long last_rtc_update;
/* pmac/prep/chrp_time.c */
unsigned long prep_get_rtc_time(void);
@@ -29,46 +28,19 @@
int pmac_set_rtc_time(unsigned long nowtime);
int chrp_set_rtc_time(unsigned long nowtime);
void pmac_read_rtc_time(void);
+void chrp_calibrate_decr(void);
+void chrp_time_init(void);
-#define TICK_SIZE tick
-#define FEBRUARY 2
-#define STARTOFTIME 1970
-#define SECDAY 86400L
-#define SECYR (SECDAY * 365)
-#define leapyear(year) ((year) % 4 == 0)
-#define days_in_year(a) (leapyear(a) ? 366 : 365)
-#define days_in_month(a) (month_days[(a) - 1])
-
-static int month_days[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-extern void inline to_tm(int tim, struct rtc_time * tm)
+/* Accessor functions for the decrementer register. */
+static __inline__ unsigned int get_dec(void)
{
- register int i;
- register long hms, day;
+ unsigned int ret;
- day = tim / SECDAY;
- hms = tim % SECDAY;
+ asm volatile("mfspr %0,22" : "=r" (ret) :);
+ return ret;
+}
- /* Hours, minutes, seconds are easy */
- tm->tm_hour = hms / 3600;
- tm->tm_min = (hms % 3600) / 60;
- tm->tm_sec = (hms % 3600) % 60;
-
- /* Number of years in days */
- for (i = STARTOFTIME; day >= days_in_year(i); i++)
- day -= days_in_year(i);
- tm->tm_year = i;
-
- /* Number of months in days left */
- if (leapyear(tm->tm_year))
- days_in_month(FEBRUARY) = 29;
- for (i = 1; day >= days_in_month(i); i++)
- day -= days_in_month(i);
- days_in_month(FEBRUARY) = 28;
- tm->tm_mon = i;
-
- /* Days are what is left over (+1) from all that. */
- tm->tm_mday = day + 1;
+static __inline__ void set_dec(unsigned int val)
+{
+ asm volatile("mtspr 22,%0" : : "r" (val));
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov