Exemple #1
0
kstat_t krhino_init(void)
{
    g_sys_stat = RHINO_STOPPED;

#if (RHINO_CONFIG_USER_HOOK > 0)
    krhino_init_hook();
#endif

    runqueue_init(&g_ready_queue);

    tick_list_init();

#if (RHINO_CONFIG_SYSTEM_STATS > 0)
    kobj_list_init();
#endif

#if (RHINO_CONFIG_MM_TLF > 0)
    k_mm_init();
#endif

#if (RHINO_CONFIG_KOBJ_DYN_ALLOC > 0)
    klist_init(&g_res_list);
    krhino_sem_create(&g_res_sem, "res_sem", 0);
    dyn_mem_proc_task_start();
#endif

#if (RHINO_CONFIG_CPU_NUM > 1)
    for (uint8_t i = 0; i < RHINO_CONFIG_CPU_NUM; i++) {
        krhino_task_cpu_create(&g_idle_task[i], "idle_task", NULL, RHINO_IDLE_PRI, 0,
                               &g_idle_task_stack[i][0], RHINO_CONFIG_IDLE_TASK_STACK_SIZE,
                               idle_task, i, 1u);
    }
#else
    krhino_task_create(&g_idle_task[0], "idle_task", NULL, RHINO_IDLE_PRI, 0,
                       &g_idle_task_stack[0][0], RHINO_CONFIG_IDLE_TASK_STACK_SIZE,
                       idle_task, 1u);
#endif

#if (RHINO_CONFIG_WORKQUEUE > 0)
    workqueue_init();
#endif

#if (RHINO_CONFIG_TIMER > 0)
    ktimer_init();
#endif

#if (RHINO_CONFIG_CPU_USAGE_STATS > 0)
    cpu_usage_stats_start();
#endif

    rhino_stack_check_init();

    return RHINO_SUCCESS;
}
Exemple #2
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;
}
Exemple #3
0
/*
************************************************************************************************************************
*                                       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;
}