]> rtime.felk.cvut.cz Git - rtems-pluggable-edf.git/blobdiff - src/edf/scheduler_edf.c
First front-end API for deadline handling added.
[rtems-pluggable-edf.git] / src / edf / scheduler_edf.c
index 5568009aa8f107769fd258eecd8cbbdacd8c1ca0..51f76529eb6b5177e72cf0f5eedac2a5755a2a93 100644 (file)
 #include <stdint.h>
 
 
-/** 
- * The threads wanted to be served on a priority base will be assigned the very 
- * longest deadlines.
- */ 
-// inline void edf_initial_priority_shift(Priority_Control *prio) {
-//     prio += EDF_ABS_DEADLINE_MAX + 1;
-// }
-
-void edf_next_period(Thread_Control *the_thread) {
+void edf_next_period(void) {
+       Thread_Control *the_thread = _Per_CPU_Information.executing;    
        RBT_Node *node = (RBT_Node*)the_thread->scheduler_info; 
        the_thread->real_priority = the_thread->current_priority = (_Watchdog_Ticks_since_boot + node->rel_deadline) % EDF_HYBRID_MASK;
-       node->abs_deadline = the_thread->current_priority;      
+       _Scheduler_edf_Update(the_thread);
 }
 
+void edf_deadline_init(uint32_t __rel_deadline__) {
+       Thread_Control *the_thread = _Per_CPU_Information.executing;
+       RBT_Node *node = (RBT_Node*)the_thread->scheduler_info; 
+       node->rel_deadline = __rel_deadline__;
+}
+
+void edf_deadline_cancel(void) {
+       Thread_Control *the_thread = _Per_CPU_Information.executing;
+       the_thread->real_priority = the_thread->Start.initial_priority + EDF_HYBRID_MASK;
+       the_thread->current_priority = the_thread->real_priority;
+       _Scheduler_edf_Update(the_thread);
+}
 
+//=======================================================================================
 
 int _Scheduler_edf_Priority_compare (Priority_Control p1, Priority_Control p2) {
        uint32_t time = _Watchdog_Ticks_since_boot;