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: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Andy Ross 2022-01-24 14:17:40 -08:00 committed by Carles Cufí
commit fb3b434438
2 changed files with 9 additions and 5 deletions

View file

@ -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 */

View file

@ -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