18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * linux/include/asm-alpha/timex.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * ALPHA architecture timex specifications
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef _ASMALPHA_TIMEX_H
88c2ecf20Sopenharmony_ci#define _ASMALPHA_TIMEX_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* With only one or two oddballs, we use the RTC as the ticker, selecting
118c2ecf20Sopenharmony_ci   the 32.768kHz reference clock, which nicely divides down to our HZ.  */
128c2ecf20Sopenharmony_ci#define CLOCK_TICK_RATE	32768
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * Standard way to access the cycle counter.
168c2ecf20Sopenharmony_ci * Currently only used on SMP for scheduling.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci * Only the low 32 bits are available as a continuously counting entity.
198c2ecf20Sopenharmony_ci * But this only means we'll force a reschedule every 8 seconds or so,
208c2ecf20Sopenharmony_ci * which isn't an evil thing.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_citypedef unsigned int cycles_t;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistatic inline cycles_t get_cycles (void)
268c2ecf20Sopenharmony_ci{
278c2ecf20Sopenharmony_ci	cycles_t ret;
288c2ecf20Sopenharmony_ci	__asm__ __volatile__ ("rpcc %0" : "=r"(ret));
298c2ecf20Sopenharmony_ci	return ret;
308c2ecf20Sopenharmony_ci}
318c2ecf20Sopenharmony_ci#define get_cycles get_cycles
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#endif
34