59#ifdef Clock_driver_nanoseconds_since_last_tick
60#error "Update driver to use the timecounter instead of nanoseconds extension"
63#if CLOCK_DRIVER_USE_FAST_IDLE && CLOCK_DRIVER_ISRS_PER_TICK
64#error "Fast Idle PLUS n ISRs per tick is not supported"
67#if defined(BSP_FEATURE_IRQ_EXTENSION) || \
68 (CPU_SIMPLE_VECTORED_INTERRUPTS != TRUE)
69typedef void * Clock_isr_argument;
77#ifndef Clock_driver_support_install_isr
78 #define Clock_driver_support_install_isr(isr)
84#ifndef Clock_driver_support_find_timer
85 #define Clock_driver_support_find_timer()
91#ifndef Clock_driver_support_at_tick
92 #define Clock_driver_support_at_tick( arg ) do { (void) arg; } while (0)
98#ifndef Clock_driver_support_set_interrupt_affinity
99 #define Clock_driver_support_set_interrupt_affinity(online_processors)
106#ifndef Clock_driver_timecounter_tick
107static void Clock_driver_timecounter_tick( Clock_isr_argument arg )
110#if defined(CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER)
112#elif defined(RTEMS_SMP) && defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
116 cpu_max = _SMP_Get_processor_maximum();
118 for ( cpu_index = 0 ; cpu_index < cpu_max ; ++cpu_index ) {
121 cpu = _Per_CPU_Get_by_index( cpu_index );
123 if ( _Per_CPU_Is_boot_processor( cpu ) ) {
124 rtems_timecounter_tick();
125 }
else if ( _Processor_mask_Is_set( _SMP_Get_online_processors(), cpu_index ) ) {
130 rtems_timecounter_tick();
138#if CLOCK_DRIVER_ISRS_PER_TICK
139 volatile uint32_t Clock_driver_isrs;
145volatile uint32_t Clock_driver_ticks;
147#ifdef Clock_driver_support_shutdown_hardware
148#error "Clock_driver_support_shutdown_hardware() is no longer supported"
151#if CLOCK_DRIVER_USE_FAST_IDLE
157 if (_Watchdog_Header_first(&cpu->Watchdog.Header[i]) != NULL) {
173void Clock_isr( Clock_isr_argument arg );
174void Clock_isr( Clock_isr_argument arg )
179 Clock_driver_ticks += 1;
181 #if CLOCK_DRIVER_USE_FAST_IDLE
183 Clock_driver_timecounter_tick( arg );
185 if (_SMP_Get_processor_maximum() == 1) {
187 uint64_t us_per_tick;
191 cpu_self = _Per_CPU_Get();
194 interval = (uint32_t) ((tc->tc_frequency * us_per_tick) / 1000000);
200 && _Clock_Has_watchdogs(cpu_self)
207 (*tc->tc_get_timecount)(tc),
213 Clock_driver_support_at_tick( arg );
221 Clock_driver_support_at_tick( arg );
223 #if CLOCK_DRIVER_ISRS_PER_TICK
227 if ( !Clock_driver_isrs ) {
228 Clock_driver_timecounter_tick( arg );
230 Clock_driver_isrs = CLOCK_DRIVER_ISRS_PER_TICK_VALUE;
237 Clock_driver_timecounter_tick( arg );
244 Clock_driver_ticks = 0;
249 Clock_driver_support_find_timer();
254 Clock_driver_support_install_isr( Clock_isr );
257 Clock_driver_support_set_interrupt_affinity(
258 _SMP_Get_online_processors()
265 Clock_driver_support_initialize_hardware();
270 #if CLOCK_DRIVER_ISRS_PER_TICK
271 Clock_driver_isrs = CLOCK_DRIVER_ISRS_PER_TICK_VALUE;
This header file defines the Clock Driver API.
rtems_status_code rtems_clock_tick(void)
Announces a clock tick.
Definition clocktick.c:46
#define RTEMS_ARRAY_SIZE(_array)
Gets the element count of the array.
Definition basedefs.h:244
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition intr.h:102
#define rtems_configuration_get_microseconds_per_tick()
Gets the number of microseconds per clock tick configured for this application.
Definition config.h:527
void _Clock_Initialize(void)
Initialize the clock driver.
Definition clock.c:56
void _Timecounter_Tick_simple(uint32_t delta, uint32_t offset, ISR_lock_Context *lock_context)
Performs a simple timecounter tick.
#define _Timecounter_Acquire(lock_context)
Acquires the timecounter lock.
Definition timecounter.h:217
struct timecounter * _Timecounter
The current timecounter.
void _Watchdog_Tick(struct Per_CPU_Control *cpu)
Performs a watchdog tick.
Definition watchdogtick.c:76
This header file provides the interfaces of the Processor Mask.
This header file provides the interfaces of the Per-CPU Information.
This header file provides interfaces of the Thread Handler which are used by the implementation and t...
This header file provides interfaces of the Timecounter Handler which are used by the implementation ...
This header file provides interfaces of the SMP Support which are only used by the implementation.
Local ISR lock context for acquire and release pairs.
Definition isrlock.h:94
Per CPU Core Structure.
Definition percpu.h:384
struct _Thread_Control * heir
This is the heir thread for this processor.
Definition percpu.h:473
volatile uint32_t thread_dispatch_disable_level
The thread dispatch critical section nesting counter which is used to prevent context switches at ino...
Definition percpu.h:422
struct _Thread_Control * executing
This is the thread executing on this processor.
Definition percpu.h:457
uint32_t isr_nest_level
Definition percpu.h:406
bool is_idle
Definition thread.h:908
This header file provides interfaces of the Watchdog Handler which are only used by the implementatio...