6b750e0f8bc8805ac29dd4eca68cb43ae72fc967
[linux-flexiantxendom0-3.2.10.git] / include / asm-mips64 / time.h
1 /*
2  * Copyright (C) 2001, 2002, MontaVista Software Inc.
3  * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4  *
5  * include/asm-mips/time.h
6  *     header file for the new style time.c file and time services.
7  *
8  * This program is free software; you can redistribute  it and/or modify it
9  * under  the terms of  the GNU General  Public License as published by the
10  * Free Software Foundation;  either version 2 of the  License, or (at your
11  * option) any later version.
12  *
13  * Please refer to Documentation/mips/time.README.
14  */
15 #ifndef _ASM_TIME_H
16 #define _ASM_TIME_H
17
18 #include <linux/interrupt.h>
19 #include <linux/linkage.h>
20 #include <linux/ptrace.h>
21 #include <linux/rtc.h>
22
23 /*
24  * RTC ops.  By default, they point a no-RTC functions.
25  *      rtc_get_time - mktime(year, mon, day, hour, min, sec) in seconds.
26  *      rtc_set_time - reverse the above translation and set time to RTC.
27  */
28 extern unsigned long (*rtc_get_time)(void);
29 extern int (*rtc_set_time)(unsigned long);
30
31 /*
32  * to_tm() converts system time back to (year, mon, day, hour, min, sec).
33  * It is intended to help implement rtc_set_time() functions.
34  * Copied from PPC implementation.
35  */
36 extern void to_tm(unsigned long tim, struct rtc_time * tm);
37
38 /*
39  * do_gettimeoffset(). By default, this func pointer points to
40  * do_null_gettimeoffset(), which leads to the same resolution as HZ.
41  * Higher resolution versions are vailable, which gives ~1us resolution.
42  */
43 extern unsigned long (*do_gettimeoffset)(void);
44
45 extern unsigned long null_gettimeoffset(void);
46 extern unsigned long fixed_rate_gettimeoffset(void);
47 extern unsigned long calibrate_div32_gettimeoffset(void);
48 extern unsigned long calibrate_div64_gettimeoffset(void);
49
50 /*
51  * high-level timer interrupt routines.
52  */
53 extern irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs);
54
55 /*
56  * the corresponding low-level timer interrupt routine.
57  */
58 asmlinkage void ll_timer_interrupt(int irq, struct pt_regs *regs);
59
60 /*
61  * profiling and process accouting is done separately in local_timer_interrupt
62  */
63 void local_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs);
64 asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs);
65
66 /*
67  * board specific routines required by time_init().
68  * board_time_init is defaulted to NULL and can remains so.
69  * board_timer_setup must be setup properly in machine setup routine.
70  */
71 struct irqaction;
72 extern void (*board_time_init)(void);
73 extern void (*board_timer_setup)(struct irqaction *irq);
74
75 /*
76  * mips_counter_frequency - must be set if you intend to use
77  * counter as timer interrupt source or use fixed_rate_gettimeoffset.
78  */
79 extern unsigned int mips_counter_frequency;
80
81 #endif /* _ASM_TIME_H */