Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.11-rc6 91 lines 2.2 kB view raw
1/* 2 * include/asm-xtensa/timex.h 3 * 4 * This file is subject to the terms and conditions of the GNU General Public 5 * License. See the file "COPYING" in the main directory of this archive 6 * for more details. 7 * 8 * Copyright (C) 2001 - 2008 Tensilica Inc. 9 */ 10 11#ifndef _XTENSA_TIMEX_H 12#define _XTENSA_TIMEX_H 13 14#ifdef __KERNEL__ 15 16#include <asm/processor.h> 17#include <linux/stringify.h> 18 19#define _INTLEVEL(x) XCHAL_INT ## x ## _LEVEL 20#define INTLEVEL(x) _INTLEVEL(x) 21 22#if XCHAL_NUM_TIMERS > 0 && \ 23 INTLEVEL(XCHAL_TIMER0_INTERRUPT) <= XCHAL_EXCM_LEVEL 24# define LINUX_TIMER 0 25# define LINUX_TIMER_INT XCHAL_TIMER0_INTERRUPT 26#elif XCHAL_NUM_TIMERS > 1 && \ 27 INTLEVEL(XCHAL_TIMER1_INTERRUPT) <= XCHAL_EXCM_LEVEL 28# define LINUX_TIMER 1 29# define LINUX_TIMER_INT XCHAL_TIMER1_INTERRUPT 30#elif XCHAL_NUM_TIMERS > 2 && \ 31 INTLEVEL(XCHAL_TIMER2_INTERRUPT) <= XCHAL_EXCM_LEVEL 32# define LINUX_TIMER 2 33# define LINUX_TIMER_INT XCHAL_TIMER2_INTERRUPT 34#else 35# error "Bad timer number for Linux configurations!" 36#endif 37 38#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 39extern unsigned long ccount_freq; 40#define CCOUNT_PER_JIFFY (ccount_freq / HZ) 41#else 42#define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ)) 43#endif 44 45 46typedef unsigned long long cycles_t; 47 48/* 49 * Only used for SMP. 50 */ 51 52extern cycles_t cacheflush_time; 53 54#define get_cycles() (0) 55 56 57/* 58 * Register access. 59 */ 60 61#define WSR_CCOUNT(r) asm volatile ("wsr %0, ccount" :: "a" (r)) 62#define RSR_CCOUNT(r) asm volatile ("rsr %0, ccount" : "=a" (r)) 63#define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) :: "a"(r)) 64#define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) : "=a"(r)) 65 66static inline unsigned long get_ccount (void) 67{ 68 unsigned long ccount; 69 RSR_CCOUNT(ccount); 70 return ccount; 71} 72 73static inline void set_ccount (unsigned long ccount) 74{ 75 WSR_CCOUNT(ccount); 76} 77 78static inline unsigned long get_linux_timer (void) 79{ 80 unsigned ccompare; 81 RSR_CCOMPARE(LINUX_TIMER, ccompare); 82 return ccompare; 83} 84 85static inline void set_linux_timer (unsigned long ccompare) 86{ 87 WSR_CCOMPARE(LINUX_TIMER, ccompare); 88} 89 90#endif /* __KERNEL__ */ 91#endif /* _XTENSA_TIMEX_H */