2005-06-24 13:01:26 +08:00
|
|
|
/*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
2013-10-17 06:42:26 +08:00
|
|
|
* Copyright (C) 2001 - 2013 Tensilica Inc.
|
2005-06-24 13:01:26 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _XTENSA_TIMEX_H
|
|
|
|
#define _XTENSA_TIMEX_H
|
|
|
|
|
|
|
|
#include <asm/processor.h>
|
|
|
|
|
2013-03-10 16:07:14 +08:00
|
|
|
#if XCHAL_NUM_TIMERS > 0 && \
|
2015-12-21 19:12:08 +08:00
|
|
|
XTENSA_INT_LEVEL(XCHAL_TIMER0_INTERRUPT) <= XCHAL_EXCM_LEVEL
|
2005-06-24 13:01:26 +08:00
|
|
|
# define LINUX_TIMER 0
|
2006-12-10 18:18:48 +08:00
|
|
|
# define LINUX_TIMER_INT XCHAL_TIMER0_INTERRUPT
|
2013-03-10 16:07:14 +08:00
|
|
|
#elif XCHAL_NUM_TIMERS > 1 && \
|
2015-12-21 19:12:08 +08:00
|
|
|
XTENSA_INT_LEVEL(XCHAL_TIMER1_INTERRUPT) <= XCHAL_EXCM_LEVEL
|
2005-06-24 13:01:26 +08:00
|
|
|
# define LINUX_TIMER 1
|
2006-12-10 18:18:48 +08:00
|
|
|
# define LINUX_TIMER_INT XCHAL_TIMER1_INTERRUPT
|
2013-03-10 16:07:14 +08:00
|
|
|
#elif XCHAL_NUM_TIMERS > 2 && \
|
2015-12-21 19:12:08 +08:00
|
|
|
XTENSA_INT_LEVEL(XCHAL_TIMER2_INTERRUPT) <= XCHAL_EXCM_LEVEL
|
2005-06-24 13:01:26 +08:00
|
|
|
# define LINUX_TIMER 2
|
2006-12-10 18:18:48 +08:00
|
|
|
# define LINUX_TIMER_INT XCHAL_TIMER2_INTERRUPT
|
2005-06-24 13:01:26 +08:00
|
|
|
#else
|
|
|
|
# error "Bad timer number for Linux configurations!"
|
|
|
|
#endif
|
|
|
|
|
2013-06-17 16:29:43 +08:00
|
|
|
extern unsigned long ccount_freq;
|
2005-06-24 13:01:26 +08:00
|
|
|
|
|
|
|
typedef unsigned long long cycles_t;
|
|
|
|
|
|
|
|
#define get_cycles() (0)
|
|
|
|
|
2013-10-17 06:42:26 +08:00
|
|
|
void local_timer_setup(unsigned cpu);
|
2005-06-24 13:01:26 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Register access.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline unsigned long get_ccount (void)
|
|
|
|
{
|
2018-11-28 08:27:47 +08:00
|
|
|
return xtensa_get_sr(ccount);
|
2005-06-24 13:01:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void set_ccount (unsigned long ccount)
|
|
|
|
{
|
2018-11-28 08:27:47 +08:00
|
|
|
xtensa_set_sr(ccount, ccount);
|
2005-06-24 13:01:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned long get_linux_timer (void)
|
|
|
|
{
|
2018-11-28 08:27:47 +08:00
|
|
|
return xtensa_get_sr(SREG_CCOMPARE + LINUX_TIMER);
|
2005-06-24 13:01:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void set_linux_timer (unsigned long ccompare)
|
|
|
|
{
|
2018-11-28 08:27:47 +08:00
|
|
|
xtensa_set_sr(ccompare, SREG_CCOMPARE + LINUX_TIMER);
|
2005-06-24 13:01:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _XTENSA_TIMEX_H */
|