sys_clock/microkernel: do not announce ticks until microkernel is up

This is a prologue to reverting:

	commit 3c66686
	Author: Benjamin Walsh <benjamin.walsh@windriver.com>
	Date:   Tue Feb 9 17:34:02 2016 -0500

		sys_clock: start the microkernel ticker in the MICROKERNEL init level

to allow the devices initializing in pre-MICROKERNEL init levels to poll
the hi-res clock (sys_cycle_get_32()), which relies on the system clock
having been started.

This change allows starting the system clock in the NANOKERNEL init
level by delaying announcing the ticks until the MICROKERNEL init level.

Change-Id: I43d54bb5e2f182d4edd880da0124a0817f911943
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-02-11 15:56:48 -05:00
parent 974c88513c
commit 038790a945
2 changed files with 23 additions and 1 deletions

View file

@ -60,8 +60,9 @@ extern uint32_t _nano_get_earliest_deadline(void);
extern void _nano_sys_clock_tick_announce(int32_t ticks);
#ifdef CONFIG_MICROKERNEL
extern void (*_do_sys_clock_tick_announce)(kevent_t);
#define _sys_clock_tick_announce() \
isr_event_send(TICK_EVENT)
_do_sys_clock_tick_announce(TICK_EVENT)
#else
extern int32_t _sys_idle_elapsed_ticks;
#define _sys_clock_tick_announce() \

View file

@ -30,6 +30,7 @@
#include <microkernel/ticks.h>
#include <toolchain.h>
#include <sections.h>
#include <init.h>
#ifdef CONFIG_TIMESLICING
static int32_t slice_count = (int32_t)0;
@ -146,6 +147,26 @@ int _k_ticker(int event)
return 1;
}
#ifdef CONFIG_SYS_CLOCK_EXISTS
static void _sys_clock_tick_announce_pre_micro_nop(kevent_t e)
{
ARG_UNUSED(e);
/* do nothing */
}
void (*_do_sys_clock_tick_announce)(kevent_t) =
_sys_clock_tick_announce_pre_micro_nop;
static int _sys_clock_tick_announce_install(struct device *dev)
{
ARG_UNUSED(dev);
_do_sys_clock_tick_announce = isr_event_send;
return 0;
}
SYS_INIT(_sys_clock_tick_announce_install, MICROKERNEL, 0);
#endif /* CONFIG_SYS_CLOCK_EXISTS */
#ifdef CONFIG_TIMESLICING
void sys_scheduler_time_slice_set(int32_t t, kpriority_t p)