diff --git a/sched/Kconfig b/sched/Kconfig index d5226e9673..a7d3efa887 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -718,9 +718,8 @@ config SCHED_IRQMONITOR config SCHED_IRQMONITOR_GETTIME bool "Custom Platform-specific Timer" - default y if SCHED_CRITMONITOR - default n if !SCHED_CRITMONITOR - depends on SCHED_IRQMONITOR && SCHED_TICKLESS + default n + depends on SCHED_IRQMONITOR && SCHED_TICKLESS && !SCHED_CRITMONITOR ---help--- If CONFIG_SCHED_TICKLESS is enabled, then the high resolution Tickless timer will be used by default. Otherwise, a platform- diff --git a/sched/irq/irq_dispatch.c b/sched/irq/irq_dispatch.c index c09773a34d..13ce6bd9ae 100644 --- a/sched/irq/irq_dispatch.c +++ b/sched/irq/irq_dispatch.c @@ -81,25 +81,16 @@ * request */ +#undef HAVE_PLATFORM_GETTIME +#if defined(CONFIG_SCHED_IRQMONITOR) && \ + (!defined(CONFIG_SCHED_TICKLESS) || \ + defined(CONFIG_SCHED_CRITMONITOR) || \ + defined(CONFIG_SCHED_IRQMONITOR_GETTIME)) +# define HAVE_PLATFORM_GETTIME 1 +#endif + #ifdef CONFIG_SCHED_IRQMONITOR -#if defined(CONFIG_SCHED_TICKLESS) && !defined(CONFIG_SCHED_IRQMONITOR_GETTIME) -# define CALL_VECTOR(ndx, vector, irq, context, arg) \ - do \ - { \ - struct timespec start; \ - struct timespec end; \ - struct timespec delta; \ - clock_systimespec(&start); \ - vector(irq, context, arg); \ - clock_systimespec(&end); \ - clock_timespec_subtract(&end, &start, &delta); \ - if (delta.tv_nsec > g_irqvector[ndx].time) \ - { \ - g_irqvector[ndx].time = delta.tv_nsec; \ - } \ - } \ - while (0) -#else +#ifdef HAVE_PLATFORM_GETTIME # define CALL_VECTOR(ndx, vector, irq, context, arg) \ do \ { \ @@ -116,7 +107,24 @@ } \ } \ while (0) -#endif /* CONFIGSCHED_TICKLESS */ +#else +# define CALL_VECTOR(ndx, vector, irq, context, arg) \ + do \ + { \ + struct timespec start; \ + struct timespec end; \ + struct timespec delta; \ + clock_systimespec(&start); \ + vector(irq, context, arg); \ + clock_systimespec(&end); \ + clock_timespec_subtract(&end, &start, &delta); \ + if (delta.tv_nsec > g_irqvector[ndx].time) \ + { \ + g_irqvector[ndx].time = delta.tv_nsec; \ + } \ + } \ + while (0) +#endif /* HAVE_PLATFORM_GETTIME */ #else # define CALL_VECTOR(ndx, vector, irq, context, arg) \ vector(irq, context, arg) @@ -126,7 +134,7 @@ * External Function Prototypes ****************************************************************************/ -#ifndef CONFIG_SCHED_TICKLESS +#ifdef HAVE_PLATFORM_GETTIME /* If CONFIG_SCHED_TICKLESS is enabled, then the high resolution Tickless * timer will be used. Otherwise, the platform specific logic must provide * the following in order to support high resolution timing: @@ -149,7 +157,7 @@ void up_critmon_convert(uint32_t elapsed, FAR struct timespec *ts); * The second interface simple converts an elapsed time into well known * units. */ -#endif +#endif /* HAVE_PLATFORM_GETTIME */ /**************************************************************************** * Public Functions