File: timex.h

package info (click to toggle)
kernel-source-sparc-2.2.1 2.2.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 62,800 kB
  • ctags: 188,320
  • sloc: ansic: 1,114,164; asm: 49,922; makefile: 8,272; sh: 1,831; perl: 1,584; tcl: 409; lisp: 218; cpp: 186; awk: 133; sed: 72
file content (39 lines) | stat: -rw-r--r-- 914 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * linux/include/asm-ppc/timex.h
 *
 * ppc architecture timex specifications
 */
#ifndef _ASMppc_TIMEX_H
#define _ASMppc_TIMEX_H

#define CLOCK_TICK_RATE	1193180 /* Underlying HZ */
#define CLOCK_TICK_FACTOR	20	/* Factor of both 1000000 and CLOCK_TICK_RATE */
#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
	(1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
		<< (SHIFT_SCALE-SHIFT_HZ)) / HZ)

typedef unsigned long cycles_t;

/*
 * For the "cycle" counter we use the timebase lower half.
 * Currently only used on SMP.
 *
 * Since SMP kernels won't run on the PPC601 CPU (which doesn't have
 * the timebase register) anyway, we don't bother checking the CPU version.
 */

extern cycles_t cacheflush_time;

static inline cycles_t get_cycles(void)
{
#ifdef __SMP__
	cycles_t ret;

	__asm__("mftb %0" : "=r" (ret) : );
	return ret;
#else
	return 0;
#endif
}

#endif