fw_comm instead of pub_sub
authorDaniel Röhrig <daniel.roehrig@mailbox.tu-berlin.de>
Thu, 21 Nov 2013 16:55:41 +0000 (17:55 +0100)
committerDaniel Röhrig <daniel.roehrig@mailbox.tu-berlin.de>
Thu, 21 Nov 2013 16:55:41 +0000 (17:55 +0100)
Anselms framework is being used. We should realy get rid of fw_task.c
register_task should also be killed.

framework/fw.c
framework/fw_comm.c
framework/fw_comm.h
framework/fw_task.c
framework/modules/rr_module.c
kernel/sched.new/core.c

index b4733fa..0dc2622 100644 (file)
@@ -46,6 +46,6 @@ void fw_init()
        os_init_os();
        init_sched_pub_sub();
 
-       //fw_init_comm();
+       fw_init_comm();
        fw_modules_init();
 }
index 8b2613f..ad02e85 100644 (file)
@@ -22,6 +22,12 @@ void fw_notify(topic_t topic, void *data)
 {
        struct fw_topic_element *iter;
 
+       //TODO: Kill this also
+       if(data!=NULL){
+               struct fw_task *task = register_task(data);
+               data = task;
+       }
+
        fw_list_for_each_entry(iter, &topics[topic], list)
                ((void (*)(void *))iter->callback)(data);
 }
index 7e5d498..29eea69 100644 (file)
@@ -11,7 +11,7 @@
  * RELEASE:            void (fw_task_t *task);
  *
  */
-typedef enum {FIRST, SCHEDULE, ADMIT, RELEASE, LAST} topic_t;
+typedef enum {FIRST, SCHEDULE, ADMIT, RELEASE, DISPATCH, TIME_OUT, EVENT_WAIT, EVENT_OCCURS, LAST} topic_t; //5 State Process Model, Stalings "Operating Systems" P 137
 
 void fw_subscribe(topic_t topic, void *callback);
 
index 0a54c6f..4d3aa63 100644 (file)
@@ -1,4 +1,5 @@
 /*
+ * TODO: KIll THIS! All OF THIS!! Kill It WITH FIRE!!
  * fw_task.c
  *
  *  Created on: 29.07.2013
index 750a877..290cc1a 100644 (file)
@@ -8,8 +8,8 @@
 
 //#include "mod_sched_framework.h"
 #include <fw.h>
-
-void subscribe_to_topic(int i,void *dingens);
+#include "../fw_comm.h"
+//void subscribe_to_topic(int i,void *dingens);
 
 struct rq{
        fw_list_head_t          queue;
@@ -23,7 +23,6 @@ struct rr_info{
        int on_rq;
 };
 
-static unsigned long offset;
 static struct rq *rr_rq;
 static struct fw_task *idle;
 
@@ -179,11 +178,16 @@ int init_sched_rr_module(void)
        rr_rq->idle = idle;
        rr_rq->curr = idle;
        FW_LIST_INIT(rr_rq->queue);
-       subscribe_to_topic(1, &task_received);
-       subscribe_to_topic(2, &task_finished);
-       subscribe_to_topic(3, &tick_received);
-       subscribe_to_topic(4, &task_yielded);
-       subscribe_to_topic(0, &wake_up_task);
+//     subscribe_to_topic(1, &task_received);
+       fw_subscribe(ADMIT, &task_received);
+//     subscribe_to_topic(2, &task_finished);
+       fw_subscribe(RELEASE, &task_finished);
+       //subscribe_to_topic(3, &tick_received);
+       fw_subscribe(TIME_OUT, &tick_received);
+       //subscribe_to_topic(4, &task_yielded);
+       fw_subscribe(EVENT_WAIT, &task_yielded);
+       //subscribe_to_topic(0, &wake_up_task);
+       fw_subscribe(EVENT_OCCURS, &wake_up_task);
        fw_printf("SCHEDULER INITIALIZED!\n");
 
        return 0;
index aa179c3..d6629be 100644 (file)
 #include "sched.h"
 #include "../workqueue_internal.h"
 #include "../smpboot.h"
-
-/*
- * FRAMEWORK STUFF
- */
-//void init_modsched_framework(void* idletask);
-void fw_init(void);
-void *send_to_topic(int topic_id, void *ptr);
-
-//
-// Variables
-//
+#include "../../framework/fw.h"
 
 /*
  * kernel/sched/rt.c:10
@@ -1333,7 +1323,8 @@ void wake_up_new_task(struct task_struct *p)
 //     int cpu = 255;
 
 //     TODO: FRAMEWORK ZEUGS
-       send_to_topic(1,p);
+       fw_notify(ADMIT,p);
+//     send_to_topic(1,p);
 
        raw_spin_lock_irqsave(&p->pi_lock, flags);
 
@@ -1432,7 +1423,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
                goto stat;
 
 //     TODO:framework zeugs
-       send_to_topic(0,p);
+//     send_to_topic(0,p);
+       fw_notify(EVENT_OCCURS, p);
 
 #ifdef CONFIG_SMP
        /*
@@ -1646,13 +1638,16 @@ need_resched:
        }
 
        if(prev->state & TASK_DEAD){
-               send_to_topic(2,prev);
+               //send_to_topic(2,prev);
+               fw_notify(RELEASE,prev);
        }else if(prev->state && !(preempt_count() & PREEMPT_ACTIVE)){
                //yield
-               send_to_topic(4,prev);
+               //send_to_topic(4,prev);
+               fw_notify(EVENT_WAIT,prev);
        }else{
                //tick
-               send_to_topic(3,NULL);
+               //send_to_topic(3,NULL);
+               fw_notify(TIME_OUT, NULL);
        }
 
        sched_preempt_enable_no_resched();