Nanokernel timer uses new driver initialization
Update nanokernel systems to use the new driver initialization model on the timer driver. Change-Id: I22d8619f56052f094482d73ab34c9d610492d8c0 Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
parent
6e95fe0356
commit
27e01a060a
3 changed files with 50 additions and 16 deletions
|
@ -9,3 +9,5 @@ obj-$(CONFIG_ARCV2_TIMER) += arcv2_timer0.o
|
|||
_CORTEX_M_TIMER_AND_GDB_INFO_yy = y
|
||||
obj-$(CONFIG_CORTEX_M_TIMER) += cortex_m_timer.o
|
||||
obj-$(_CORTEX_M_TIMER_AND_GDB_INFO_$(CONFIG_CORTEX_M_TIMER)$(CONFIG_GDB_INFO)) += cortex_m_timer_gdb.o
|
||||
|
||||
obj-$(CONFIG_SYS_CLOCK_EXISTS) += sys_clock_init.o
|
||||
|
|
48
drivers/timer/sys_clock_init.c
Normal file
48
drivers/timer/sys_clock_init.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* initialize system clock driver */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015 Wind River Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1) Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2) Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3) Neither the name of Wind River Systems nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Initializing the timer driver is done in this module to reduce code duplication.
|
||||
*/
|
||||
|
||||
#include <nanokernel.h>
|
||||
#include <init.h>
|
||||
#include <drivers/system_timer.h>
|
||||
|
||||
#ifdef CONFIG_NANOKERNEL
|
||||
|
||||
DECLARE_DEVICE_INIT_CONFIG(sys_clock, "sys_clock",
|
||||
_sys_clock_driver_init, NULL);
|
||||
pure_init(sys_clock, NULL);
|
||||
|
||||
#endif
|
|
@ -52,22 +52,6 @@ int sys_clock_hw_cycles_per_tick;
|
|||
|
||||
/* updated by timer driver for tickless, stays at 1 for non-tickless */
|
||||
uint32_t _sys_idle_elapsed_ticks = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Constructor that initializes nanokernel time tracking system
|
||||
*
|
||||
* @return N/A
|
||||
*
|
||||
*/
|
||||
|
||||
void nano_time_init(void)
|
||||
{
|
||||
_sys_clock_driver_init(NULL);
|
||||
}
|
||||
|
||||
SYS_PREKERNEL_INIT(nano_time_init, 250);
|
||||
|
||||
#endif /* CONFIG_NANOKERNEL */
|
||||
|
||||
int64_t _nano_ticks = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue