xref: /OK3568_Linux_fs/kernel/arch/alpha/include/asm/timex.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * linux/include/asm-alpha/timex.h
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * ALPHA architecture timex specifications
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun #ifndef _ASMALPHA_TIMEX_H
8*4882a593Smuzhiyun #define _ASMALPHA_TIMEX_H
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun /* With only one or two oddballs, we use the RTC as the ticker, selecting
11*4882a593Smuzhiyun    the 32.768kHz reference clock, which nicely divides down to our HZ.  */
12*4882a593Smuzhiyun #define CLOCK_TICK_RATE	32768
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /*
15*4882a593Smuzhiyun  * Standard way to access the cycle counter.
16*4882a593Smuzhiyun  * Currently only used on SMP for scheduling.
17*4882a593Smuzhiyun  *
18*4882a593Smuzhiyun  * Only the low 32 bits are available as a continuously counting entity.
19*4882a593Smuzhiyun  * But this only means we'll force a reschedule every 8 seconds or so,
20*4882a593Smuzhiyun  * which isn't an evil thing.
21*4882a593Smuzhiyun  */
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun typedef unsigned int cycles_t;
24*4882a593Smuzhiyun 
get_cycles(void)25*4882a593Smuzhiyun static inline cycles_t get_cycles (void)
26*4882a593Smuzhiyun {
27*4882a593Smuzhiyun 	cycles_t ret;
28*4882a593Smuzhiyun 	__asm__ __volatile__ ("rpcc %0" : "=r"(ret));
29*4882a593Smuzhiyun 	return ret;
30*4882a593Smuzhiyun }
31*4882a593Smuzhiyun #define get_cycles get_cycles
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun #endif
34