| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 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 | */ | 
|  | 36 | struct sys_timer { | 
|  | 37 | struct sys_device	dev; | 
|  | 38 | void			(*init)(void); | 
|  | 39 | void			(*suspend)(void); | 
|  | 40 | void			(*resume)(void); | 
| Kevin Hilman | 746140c | 2006-09-22 00:16:30 +0100 | [diff] [blame] | 41 | #ifndef CONFIG_GENERIC_TIME | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | unsigned long		(*offset)(void); | 
| Kevin Hilman | 746140c | 2006-09-22 00:16:30 +0100 | [diff] [blame] | 43 | #endif | 
| Russell King | 8749af6 | 2005-06-25 19:39:45 +0100 | [diff] [blame] | 44 |  | 
|  | 45 | #ifdef CONFIG_NO_IDLE_HZ | 
|  | 46 | struct dyn_tick_timer	*dyn_tick; | 
|  | 47 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | }; | 
|  | 49 |  | 
| Russell King | 8749af6 | 2005-06-25 19:39:45 +0100 | [diff] [blame] | 50 | #ifdef CONFIG_NO_IDLE_HZ | 
|  | 51 |  | 
| Russell King | 8749af6 | 2005-06-25 19:39:45 +0100 | [diff] [blame] | 52 | #define DYN_TICK_ENABLED	(1 << 1) | 
| Russell King | 8749af6 | 2005-06-25 19:39:45 +0100 | [diff] [blame] | 53 |  | 
|  | 54 | struct dyn_tick_timer { | 
| Tony Lindgren | ebc67da | 2006-06-18 16:26:58 +0100 | [diff] [blame] | 55 | spinlock_t	lock; | 
| Russell King | 8749af6 | 2005-06-25 19:39:45 +0100 | [diff] [blame] | 56 | unsigned int	state;			/* Current state */ | 
|  | 57 | int		(*enable)(void);	/* Enables dynamic tick */ | 
|  | 58 | int		(*disable)(void);	/* Disables dynamic tick */ | 
|  | 59 | void		(*reprogram)(unsigned long); /* Reprograms the timer */ | 
| Linus Torvalds | 0cd61b6 | 2006-10-06 10:53:39 -0700 | [diff] [blame] | 60 | int		(*handler)(int, void *); | 
| Russell King | 8749af6 | 2005-06-25 19:39:45 +0100 | [diff] [blame] | 61 | }; | 
|  | 62 |  | 
|  | 63 | void timer_dyn_reprogram(void); | 
| Russell King | 2ea8339 | 2005-06-27 14:04:05 +0100 | [diff] [blame] | 64 | #else | 
|  | 65 | #define timer_dyn_reprogram()	do { } while (0) | 
| Russell King | 8749af6 | 2005-06-25 19:39:45 +0100 | [diff] [blame] | 66 | #endif | 
|  | 67 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | extern struct sys_timer *system_timer; | 
| Linus Torvalds | 0cd61b6 | 2006-10-06 10:53:39 -0700 | [diff] [blame] | 69 | extern void timer_tick(void); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 |  | 
|  | 71 | /* | 
|  | 72 | * Kernel time keeping support. | 
|  | 73 | */ | 
| Thomas Gleixner | d061daa | 2006-07-03 02:18:48 +0200 | [diff] [blame] | 74 | struct timespec; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | extern int (*set_rtc)(void); | 
|  | 76 | extern void save_time_delta(struct timespec *delta, struct timespec *rtc); | 
|  | 77 | extern void restore_time_delta(struct timespec *delta, struct timespec *rtc); | 
|  | 78 |  | 
|  | 79 | #endif |