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 */
14
15/*
16 * Please refer to Documentation/MIPS/time.README.
17 */
18
19#ifndef _ASM_TIME_H
20#define _ASM_TIME_H
21
22#include <linux/ptrace.h>               /* for struct pt_regs */
23#include <linux/linkage.h>              /* for asmlinkage */
24#include <linux/rtc.h>                  /* for struct rtc_time */
25
26/*
27 * RTC ops.  By default, they point a no-RTC functions.
28 *	rtc_get_time - mktime(year, mon, day, hour, min, sec) in seconds.
29 *	rtc_set_time - reverse the above translation and set time to RTC.
30 */
31extern unsigned long (*rtc_get_time)(void);
32extern int (*rtc_set_time)(unsigned long);
33
34/*
35 * to_tm() converts system time back to (year, mon, day, hour, min, sec).
36 * It is intended to help implement rtc_set_time() functions.
37 * Copied from PPC implementation.
38 */
39extern void to_tm(unsigned long tim, struct rtc_time * tm);
40
41/*
42 * do_gettimeoffset(). By default, this func pointer points to
43 * do_null_gettimeoffset(), which leads to the same resolution as HZ.
44 * Higher resolution versions are vailable, which gives ~1us resolution.
45 */
46extern unsigned long (*do_gettimeoffset)(void);
47
48extern unsigned long null_gettimeoffset(void);
49extern unsigned long fixed_rate_gettimeoffset(void);
50extern unsigned long calibrate_div32_gettimeoffset(void);
51extern unsigned long calibrate_div64_gettimeoffset(void);
52
53/*
54 * high-level timer interrupt routines.
55 */
56extern void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs);
57
58/*
59 * the corresponding low-level timer interrupt routine.
60 */
61asmlinkage void ll_timer_interrupt(int irq, struct pt_regs *regs);
62
63/*
64 * profiling and process accouting is done separately in local_timer_interrupt
65 */
66void local_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs);
67asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs);
68
69/*
70 * board specific routines required by time_init().
71 * board_time_init is defaulted to NULL and can remains so.
72 * board_timer_setup must be setup properly in machine setup routine.
73 */
74struct irqaction;
75extern void (*board_time_init)(void);
76extern void (*board_timer_setup)(struct irqaction *irq);
77
78/*
79 * mips_counter_frequency - must be set if you intend to use
80 * counter as timer interrupt source or use fixed_rate_gettimeoffset.
81 */
82extern unsigned int mips_counter_frequency;
83
84#endif /* _ASM_TIME_H */
85