Esempio n. 1
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;
}
Esempio n. 2
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;
}