blob: 96c6db7dd0e1928e25b96e9b0e87fb64c7f113ce [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/include/asm-arm/mach/time.h
3 *
4 * Copyright (C) 2004 MontaVista Software, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_MACH_TIME_H
11#define __ASM_ARM_MACH_TIME_H
12
13#include <linux/sysdev.h>
14
15/*
16 * This is our kernel timer structure.
17 *
18 * - init
19 * Initialise the kernels jiffy timer source, claim interrupt
20 * using setup_irq. This is called early on during initialisation
21 * while interrupts are still disabled on the local CPU.
22 * - suspend
23 * Suspend the kernel jiffy timer source, if necessary. This
24 * is called with interrupts disabled, after all normal devices
25 * have been suspended. If no action is required, set this to
26 * NULL.
27 * - resume
28 * Resume the kernel jiffy timer source, if necessary. This
29 * is called with interrupts disabled before any normal devices
30 * are resumed. If no action is required, set this to NULL.
31 * - offset
32 * Return the timer offset in microseconds since the last timer
33 * interrupt. Note: this must take account of any unprocessed
34 * timer interrupt which may be pending.
35 */
36struct sys_timer {
37 struct sys_device dev;
38 void (*init)(void);
39 void (*suspend)(void);
40 void (*resume)(void);
41 unsigned long (*offset)(void);
Russell King8749af62005-06-25 19:39:45 +010042
43#ifdef CONFIG_NO_IDLE_HZ
44 struct dyn_tick_timer *dyn_tick;
45#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070046};
47
Russell King8749af62005-06-25 19:39:45 +010048#ifdef CONFIG_NO_IDLE_HZ
49
Russell King8749af62005-06-25 19:39:45 +010050#define DYN_TICK_ENABLED (1 << 1)
Russell King8749af62005-06-25 19:39:45 +010051
52struct dyn_tick_timer {
53 unsigned int state; /* Current state */
54 int (*enable)(void); /* Enables dynamic tick */
55 int (*disable)(void); /* Disables dynamic tick */
56 void (*reprogram)(unsigned long); /* Reprograms the timer */
57 int (*handler)(int, void *, struct pt_regs *);
58};
59
60void timer_dyn_reprogram(void);
Russell King2ea83392005-06-27 14:04:05 +010061#else
62#define timer_dyn_reprogram() do { } while (0)
Russell King8749af62005-06-25 19:39:45 +010063#endif
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065extern struct sys_timer *system_timer;
66extern void timer_tick(struct pt_regs *);
67
68/*
69 * Kernel time keeping support.
70 */
71extern int (*set_rtc)(void);
72extern void save_time_delta(struct timespec *delta, struct timespec *rtc);
73extern void restore_time_delta(struct timespec *delta, struct timespec *rtc);
74
75#endif