/* * Initialize the given processor for the cpu * indicated by cpu_id, and assign to the * specified processor set. */ void processor_init( processor_t processor, int cpu_id, processor_set_t pset) { run_queue_init(&processor->runq); processor->state = PROCESSOR_OFF_LINE; processor->active_thread = processor->next_thread = processor->idle_thread = THREAD_NULL; processor->processor_set = pset; processor->current_pri = MINPRI; processor->cpu_id = cpu_id; timer_call_setup(&processor->quantum_timer, thread_quantum_expire, processor); processor->deadline = UINT64_MAX; processor->timeslice = 0; processor->processor_meta = PROCESSOR_META_NULL; processor->processor_self = IP_NULL; processor_data_init(processor); processor->processor_list = NULL; simple_lock(&processor_list_lock); if (processor_list == NULL) processor_list = processor; else processor_list_tail->processor_list = processor; processor_list_tail = processor; processor_count++; simple_unlock(&processor_list_lock); }
static void sched_traditional_pset_init(processor_set_t pset) { if (sched_traditional_use_pset_runqueue) { run_queue_init(&pset->pset_runq); } pset->pset_runq_bound_count = 0; }
static void sched_traditional_processor_init(processor_t processor) { if (!sched_traditional_use_pset_runqueue) { run_queue_init(&processor->runq); } processor->runq_bound_count = 0; }
/* ************************************************************************************************************************ * Init raw os * * Description: This function is called to init raw os. * * Arguments :None * ----- * * * * Returns RAW_U16: RAW_SUCCESS. * * Note(s) * * ************************************************************************************************************************ */ RAW_U16 raw_os_init(void) { TRACE_INIT(); raw_os_active = RAW_OS_STOPPED; run_queue_init(&raw_ready_queue); /*Init the tick heart system*/ tick_list_init(); #if (RAW_SYSTEM_CHECK > 0) /*Init the task head list*/ list_init(&(system_debug.task_head)); #endif #if (CONFIG_RAW_USER_HOOK > 0) raw_os_init_hook(); #endif /*Start the first idle task*/ raw_task_create(&raw_idle_obj, (RAW_U8 *)"idle_task", 0, IDLE_PRIORITY, 0, idle_stack, IDLE_STACK_SIZE, raw_idle_task, 1); #if (CONFIG_RAW_TIMER > 0) raw_timer_init(); #endif #if (CONFIG_RAW_TASK_0 > 0) raw_task_0_init(); #endif #if (CONFIG_RAW_TICK_TASK > 0) tick_task_start(); #endif #if (RAW_CONFIG_CPU_TASK > 0) cpu_task_start(); #endif return RAW_SUCCESS; }
/* ************************************************************************************************************************ * Init raw os * * Description: This function is called to init raw os. * * Arguments :None * ----- * * * * Returns RAW_U16: RAW_SUCCESS. * * Note(s) * * ************************************************************************************************************************ */ RAW_OS_ERROR raw_os_init(void) { TRACE_INIT(); raw_os_active = RAW_OS_STOPPED; run_queue_init(&raw_ready_queue); /*Init the tick heart system*/ tick_list_init(); /*Init the task debug head list*/ list_init(&(raw_task_debug.task_head)); #if (CONFIG_RAW_USER_HOOK > 0) raw_os_init_hook(); #endif /*Start the first idle task*/ raw_task_create(&raw_idle_obj, (RAW_U8 *)"idle_task", 0, IDLE_PRIORITY, 0, idle_stack, IDLE_STACK_SIZE, raw_idle_task, 1); /*The timer module need mutex*/ #if (CONFIG_RAW_TIMER > 0) raw_timer_init(); raw_mutex_create(&timer_mutex, (RAW_U8 *)"timer_mutex", RAW_MUTEX_INHERIT_POLICY, 0); #endif /*tick task to reduce interrupt time*/ #if (CONFIG_RAW_TICK_TASK > 0) tick_task_start(); #endif /*For statistic*/ #if (RAW_CONFIG_CPU_TASK > 0) cpu_task_start(); #endif return RAW_SUCCESS; }