}
// if cmp_time is 0, no CBS is used, only pure EDF
-void edf_deadline_init(uint32_t __rel_deadline__, uint32_t __cmp_time__, rtems_asr_entry *budget_overrun_handler) {
+void edf_deadline_init(uint32_t __rel_deadline__, uint32_t __cmp_time__, rtems_asr_entry budget_overrun_handler) {
Thread_Control *the_thread = _Per_CPU_Information.executing;
RBT_Node *node = (RBT_Node*)the_thread->scheduler_info;
node->rel_deadline = __rel_deadline__;
if (__cmp_time__) {
- rtems_signal_catch(*budget_overrun_handler, RTEMS_DEFAULT_MODES);
+ rtems_signal_catch(budget_overrun_handler, RTEMS_DEFAULT_MODES);
node->cmp_time = __cmp_time__;
the_thread->is_preemptible = true;
the_thread->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT;
Thread_CPU_budget_algorithm_callout edf_budget_overrun_callout() {
Thread_Control *the_thread = _Per_CPU_Information.executing;
RBT_Node *node = (RBT_Node*)the_thread->scheduler_info;
- rtems_signal_send(the_thread->Object.id, RTEMS_SIGNAL_18);
- _Thread_Suspend (the_thread);
- //wait until next period to enable the task again
- uint32_t ticks = node->abs_deadline - _Watchdog_Ticks_since_boot;
+ rtems_signal_send(the_thread->Object.id, RTEMS_SIGNAL_15);
+ _Thread_Suspend (the_thread); //TODO: make options on suspension
+ uint32_t ticks = node->abs_deadline - _Watchdog_Ticks_since_boot; //FIXME: wrong calc
rtems_timer_fire_after(node->timer_id, ticks, (void *) edf_budget_overrun_reenable, the_thread);
return 0;
}
rtems_timer_service_routine_entry edf_budget_overrun_reenable(Thread_Control *the_thread) {
_Thread_Resume(the_thread, false);
+ printf("Come back\n"); //FIXME: Continue here
return 0;
}
_Thread_Ready_EDF_chain.first = NULL;
_Thread_Heir = NULL;
_Thread_Executing = NULL;
+ _Signal_Manager_initialization();
}
void _Scheduler_edf_Block( Thread_Control *the_thread ) {
/// Changes scheduling policy from priorities to deadlines
/// @param __rel_deadline__ in ticks required
-void edf_deadline_init(uint32_t __rel_deadline__, uint32_t __cmp_time__, rtems_asr_entry *budget_overrun_handler);
+void edf_deadline_init(uint32_t __rel_deadline__, uint32_t __cmp_time__, rtems_asr_entry budget_overrun_handler);
/// Changes scheduling policy from deadlines to priorities
void edf_deadline_cancel(void);