According to the BSP_HOWTO manual, the clock-driven framework is primarily implemented in the c/src/lib/libbsp/shared/clockdrv_shell.h file
Clock initialization
The clock-driven initialization function is clock_initialize (), where is the function called?
The clock_driver_table_entry is defined in the cpukit/include/rtems/clockdrv.h
#define Clock_driver_table_entry \
The clock_driver_table_entry is then placed in the IO driver list, which should be called when it is initialized.
The Clock_initialize () function is defined in c/src/lib/libbsp/shared/clockdrv_shell.h and calls the 2 functions provided by the BSP:
CLOCK_DRIVER_SUPPORT_INSTALL_ISR () = Install interrupt handling function CLOCK_ISR
Clock_driver_support_initialize_hardware () = Initialize hardware
Then look at Clock_isr (), called Clock_driver_support_at_tick () at the end of the interrupt processing, which can be used to notify the hardware that the interrupt response has been completed.
The C_user manual describes the CLOCK_ISR () function that should be called Rtems_clock_tick (), which is done in Clock_isr () =>clock_driver_timecounter_tick (), however, Now call the updated version of Rtems_timecounter_tick (), the more modern clock driver needs a precise clock, each tick interrupt, to read this precise clock, so that can improve the accuracy of the timing.
The Clock_driver_support_shutdown_hardware () called in the Clock_exit () function is also a function that the BSP can provide to stop the clock from running.
Beagle
Look at the Beagle BSP code, in the c/src/lib/libbsp/arm/beagle/clock.c , straight to the end of the line to see it.
#defineClock_driver_support_at_tick () Beagle_clock_at_tick ()#defineClock_driver_support_initialize_hardware () beagle_clock_initialize ()#defineCLOCK_DRIVER_SUPPORT_INSTALL_ISR (ISR, OLD_ISR) Do{Beagle_clock_handler_install (ISR); OLD_ISR=NULL; } while(0) #defineClock_driver_support_shutdown_hardware () Beagle_clock_cleanup ()/*Include Shared Source Clock driver code*/#include".. /.. /shared/clockdrv_shell.h"
Beagle_clock_initialize () uses two clocks, a nonstop run, used as the precision clock (running at the highest frequency), and the other only to generate tick interrupts
Rtems 4.11 Clock driver (arm, beagle)