blob: 5816ad1569d66762413fe7cf1748a5ff001ab391 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 1999, 2003 by Ralf Baechle
7 */
8#ifndef _ASM_TIMEX_H
9#define _ASM_TIMEX_H
10
Atsushi Nemoto8f9a2b32006-09-07 01:00:22 +090011#ifdef __KERNEL__
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <asm/mipsregs.h>
14
15/*
Ralf Baechle72fc19f2007-11-01 15:45:37 +000016 * This is the clock rate of the i8253 PIT. A MIPS system may not have
17 * a PIT by the symbol is used all over the kernel including some APIs.
18 * So keeping it defined to the number for the PIT is the only sane thing
19 * for now.
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 */
Ralf Baechle72fc19f2007-11-01 15:45:37 +000021#define CLOCK_TICK_RATE 1193182
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
23/*
24 * Standard way to access the cycle counter.
25 * Currently only used on SMP for scheduling.
26 *
27 * Only the low 32 bits are available as a continuously counting entity.
28 * But this only means we'll force a reschedule every 8 seconds or so,
29 * which isn't an evil thing.
30 *
31 * We know that all SMP capable CPUs have cycle counters.
32 */
33
34typedef unsigned int cycles_t;
35
Ralf Baechle49a89ef2007-10-11 23:46:15 +010036static inline cycles_t get_cycles(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037{
38 return read_c0_count();
39}
40
Atsushi Nemoto8f9a2b32006-09-07 01:00:22 +090041#endif /* __KERNEL__ */
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#endif /* _ASM_TIMEX_H */