File: /usr/src/linux/include/asm-mips/timex.h

1     /* $Id: timex.h,v 1.1 1998/08/25 09:22:03 ralf Exp $
2      *
3      * This file is subject to the terms and conditions of the GNU General Public
4      * License.  See the file "COPYING" in the main directory of this archive
5      * for more details.
6      *
7      * Copyright (C) 1998, 1999 by Ralf Baechle
8      *
9      * FIXME: For some of the supported machines this is dead wrong.
10      */
11     #ifndef __ASM_MIPS_TIMEX_H
12     #define __ASM_MIPS_TIMEX_H
13     
14     #define CLOCK_TICK_RATE	1193180 /* Underlying HZ */
15     #define CLOCK_TICK_FACTOR	20	/* Factor of both 1000000 and CLOCK_TICK_RATE */
16     #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
17     	(1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
18     		<< (SHIFT_SCALE-SHIFT_HZ)) / HZ)
19     
20     #ifdef __KERNEL__
21     /*
22      * Standard way to access the cycle counter.
23      * Currently only used on SMP for scheduling.
24      *
25      * Only the low 32 bits are available as a continuously counting entity. 
26      * But this only means we'll force a reschedule every 8 seconds or so,
27      * which isn't an evil thing.
28      *
29      * We know that all SMP capable CPUs have cycle counters.
30      */
31     
32     typedef unsigned int cycles_t;
33     extern cycles_t cacheflush_time;
34     
35     static inline cycles_t get_cycles (void)
36     {
37     	return read_32bit_cp0_register(CP0_COUNT);
38     }
39     #endif /* __KERNEL__ */
40     
41     #endif /*  __ASM_MIPS_TIMEX_H */
42