]> rtime.felk.cvut.cz Git - rtems-pluggable-edf.git/commitdiff
First front-end API for deadline handling added.
authorPetr Benes <benesp16@fel.cvut.cz>
Wed, 13 Apr 2011 15:08:15 +0000 (17:08 +0200)
committerPetr Benes <benesp16@fel.cvut.cz>
Wed, 13 Apr 2011 15:08:15 +0000 (17:08 +0200)
src/edf/scheduler_edf.c
src/edf/scheduler_edf.h

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;
index f67140a99e4f3857d684b18112b713baf7b59845..4b253f8a8f95b5bad456bfa54b8643c0a646bbc0 100644 (file)
 // keeps the ready queue for EDF
 EDF_Chain_Control _Thread_Ready_EDF_chain;
 
-/**
- * This routine shifts a deadline for the next period of a periodical task execution.
- */
-void edf_next_period(Thread_Control *the_thread);
+/// This routine is called when a task starts to execute a new period or
+/// a first period.
+void edf_next_period(void);
+
+/// Changes scheduling policy from priorities to deadlines
+void edf_deadline_init(uint32_t __rel_deadline__);
+
+/// Changes scheduling policy from deadlines to priorities
+void edf_deadline_cancel(void);
+
+
 
 
 /// Pluggable scheduler callback functions