drivers: timer: move initialization setup to drivers
The weak symbol sys_clock_driver_init has been removed, therefore moving the init responsability to the drivers themselves. As a result, the init function has now been made static on all drivers and moved to the bottom, following the convention used in other areas. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
7b1349cfe6
commit
b1ced75386
29 changed files with 724 additions and 648 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#define DT_DRV_COMPAT openisa_rv32m1_lptmr
|
||||
|
||||
#include <device.h>
|
||||
#include <zephyr.h>
|
||||
#include <sys/util.h>
|
||||
#include <drivers/timer/system_timer.h>
|
||||
|
@ -53,7 +54,20 @@ static void lptmr_irq_handler(const struct device *unused)
|
|||
sys_clock_announce(1); /* Poke the scheduler. */
|
||||
}
|
||||
|
||||
int sys_clock_driver_init(const struct device *unused)
|
||||
uint32_t sys_clock_cycle_get_32(void)
|
||||
{
|
||||
return cycle_count + SYSTEM_TIMER_INSTANCE->CNR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Since we're not tickless, this is identically zero.
|
||||
*/
|
||||
uint32_t sys_clock_elapsed(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sys_clock_driver_init(const struct device *unused)
|
||||
{
|
||||
uint32_t csr, psr, sircdiv; /* LPTMR registers */
|
||||
|
||||
|
@ -131,15 +145,5 @@ int sys_clock_driver_init(const struct device *unused)
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t sys_clock_cycle_get_32(void)
|
||||
{
|
||||
return cycle_count + SYSTEM_TIMER_INSTANCE->CNR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Since we're not tickless, this is identically zero.
|
||||
*/
|
||||
uint32_t sys_clock_elapsed(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
SYS_INIT(sys_clock_driver_init, PRE_KERNEL_2,
|
||||
CONFIG_SYSTEM_CLOCK_INIT_PRIORITY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue