Example #1
0
int main(void)
{
	irq_init();
	irq_disable();

#ifdef CONFIG_FPU
	*SCB_CPACR |= (SCB_CPACR_CP10_FULL | SCB_CPACR_CP11_FULL);
#endif

#ifdef CONFIG_DEBUG
	dbg_device_init();
	dbg_layer = DL_KDB;
#endif
	__l4_printf("%s", banner);
	run_init_hook(INIT_LEVEL_PLATFORM);

#ifdef CONFIG_SYMMAP
	ksym_init();
#endif
	sched_init();
	memory_init();
	syscall_init();
	thread_init_subsys();
	ktimer_event_init();

#ifdef CONFIG_KPROBES
	kprobe_init();
#endif /* CONFIG_KPROBES */

#ifdef CONFIG_KDB
	softirq_register(KDB_SOFTIRQ, debug_kdb_handler);
	dbg_puts("Press '?' to print KDB menu\n");
#endif
	run_init_hook(INIT_LEVEL_KERNEL);

	/* Not creating kernel thread here because it corrupts current stack
	 */
	create_idle_thread();
	create_root_thread();

	ktimer_event_create(64, ipc_deliver, NULL);

	mpu_enable(MPU_ENABLED);

	run_init_hook(INIT_LEVEL_LAST);

	switch_to_kernel();

	/* Not reached */
	return 0;
}
Example #2
0
static void sys_ipc_timeout(uint32_t timeout)
{
	ktimer_event_t *kevent;
	ipc_time_t t = { .raw = timeout };
	uint32_t ticks;

	/* millisec to ticks */
	ticks = (t.period.m << t.period.e) /
	        ((1000000)/(CORE_CLOCK/CONFIG_KTIMER_HEARTBEAT));

	kevent = ktimer_event_create(ticks, ipc_timeout, caller);

	caller->timeout_event = (uint32_t)kevent;
}