Exemple #1
0
int init_sched(void)
{
	schedule_t *s = LOCAL_SCHED;
	unsigned int cpu_id = rtl_getcpuid();
	rtl_irqstate_t interrupt_state;

	memset(rtl_scheduler,0,sizeof(struct rtl_sched_cpu_struct));
	rtl_spin_lock_init (&s->rtl_tasks_lock);

	rtl_idle_task.next = 0;
	rtl_idle_task.sched_param.sched_priority = sched_get_priority_min(0);
	rtl_idle_task.pending = 0;
	rtl_idle_task.blocked = 0;
	rtl_idle_task.uses_fp = 0;
	rtl_idle_task.top_of_stack = 0x100; // dummy value initialized randomly to 0x100
	rtl_idle_task.fpu_initialized = 0;
#ifdef CONFIG_RTL_SCHED_EDF
	rtl_idle_task.sched_param.sched_deadline = HRTIME_INFINITY;
	rtl_idle_task.current_deadline = HRTIME_INFINITY;
#endif

	rtl_sigemptyset(&rtl_idle_task.pending);
	rtl_sigaddset (&rtl_idle_task.pending, RTL_SIGNAL_READY);
	s->rtl_current = &rtl_idle_task;
	s->rtl_tasks = &rtl_idle_task;
	s->sched_flags = 0;
#if CONFIG_RTL_FP_SUPPORT
	s->rtl_task_fpu_owner = 0;
#endif  

	return 0;
}
void cleanup_module(void)
{
	printk ("Removing module on CPU %d\n", rtl_getcpuid());
	pthread_delete_np (thread);
	rt_com_setup(0, -1, 0, 0, 0, 0);
}