/** * * @brief Mainline for kernel's background task * * This routine completes kernel initialization by invoking the remaining * init functions, then invokes application's main() routine. * * @return N/A */ static void _main(void *unused1, void *unused2, void *unused3) { ARG_UNUSED(unused1); ARG_UNUSED(unused2); ARG_UNUSED(unused3); _sys_device_do_config_level(_SYS_INIT_LEVEL_POST_KERNEL); /* Final init level before app starts */ _sys_device_do_config_level(_SYS_INIT_LEVEL_APPLICATION); #ifdef CONFIG_CPLUSPLUS /* Process the .ctors and .init_array sections */ extern void __do_global_ctors_aux(void); extern void __do_init_array_aux(void); __do_global_ctors_aux(); __do_init_array_aux(); #endif _init_static_threads(); #ifdef CONFIG_BOOT_TIME_MEASUREMENT /* record timestamp for kernel's _main() function */ extern u64_t __main_tsc; __main_tsc = _tsc_read(); #endif extern void main(void); main(); /* Terminate thread normally since it has no more work to do */ _main_thread->base.user_options &= ~K_ESSENTIAL; }
void idle(void *unused1, void *unused2, void *unused3) { ARG_UNUSED(unused1); ARG_UNUSED(unused2); ARG_UNUSED(unused3); #ifdef CONFIG_BOOT_TIME_MEASUREMENT /* record timestamp when idling begins */ extern uint64_t __idle_tsc; __idle_tsc = _tsc_read(); #endif for (;;) { (void)irq_lock(); _sys_power_save_idle(_get_next_timeout_expiry()); IDLE_YIELD_IF_COOP(); } }