1 #ifndef _ASMNIOS2NOMMU_TIMEX_H
2 #define _ASMNIOS2NOMMU_TIMEX_H
4 /*--------------------------------------------------------------------
6 * include/asm-nios2nommu/timex.h
10 * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
12 * Copyright (C) 2004 Microtronix Datacom Ltd
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
25 * Jan/20/2004 dgt NiosII
27 ---------------------------------------------------------------------*/
33 #define CLOCK_TICK_RATE nasys_clock_freq /* Underlying HZ */
35 #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
37 #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
38 (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
39 << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
41 typedef unsigned long cycles_t
;
43 static inline cycles_t
get_cycles(void)