Commit fb3b4344 authored by Andy Ross's avatar Andy Ross Committed by Carles Cufi
Browse files

drivers: timer: update TIMER_IRQ for tests/kernel/context



This test has gotten out of control.  It has a giant #if cascade
enumerating every timer driver in the Zephyr tree and extracting its
interrupt number.  Which means that every driver needs to somehow
expose that interrupt in its platform headers or some other API.

Make it a simple integer variable exported by the timer driver for the
benefit of this one test.

Signed-off-by: default avatarAndy Ross <andrew.j.ross@intel.com>
Signed-off-by: default avatarAnas Nashif <anas.nashif@intel.com>
parent df319627
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ BUILD_ASSERT(COMPARATOR_IDX >= 0 && COMPARATOR_IDX <= 1);
static struct k_spinlock lock;
static uint64_t last_count;

const int32_t z_sys_timer_irq_for_test = TIMER_IRQ; /* See tests/kernel/context */

static void set_compare(uint64_t time)
{
	/* Disarm the comparator to prevent spurious triggers */
+7 −5
Original line number Diff line number Diff line
@@ -56,9 +56,6 @@
#elif defined(CONFIG_XTENSA_TIMER)
#define TICK_IRQ UTIL_CAT(XCHAL_TIMER,		\
			  UTIL_CAT(CONFIG_XTENSA_TIMER_ID, _INTERRUPT))

#elif defined(CONFIG_CAVS_TIMER)
#define TICK_IRQ DSP_WCT_IRQ(0)
#elif defined(CONFIG_ALTERA_AVALON_TIMER)
#define TICK_IRQ TIMER_0_IRQ
#elif defined(CONFIG_ARCV2_TIMER)
@@ -94,8 +91,13 @@
 */
#endif /* defined(CONFIG_ARCH_POSIX) */
#else
/* generate an error */
#error Timer type is not defined for this platform

/* Ooooooph.  All that is a mess.  Here's the new API to be portably
 * supported by timer drivers:
 */
extern int32_t z_sys_timer_irq_for_test;
#define TICK_IRQ (z_sys_timer_irq_for_test)

#endif

/* Cortex-M1, Nios II, and RISCV without CONFIG_RISCV_HAS_CPU_IDLE