register_task obsolete
authorDaniel Röhrig <daniel.roehrig@mailbox.tu-berlin.de>
Fri, 22 Nov 2013 14:51:08 +0000 (15:51 +0100)
committerDaniel Röhrig <daniel.roehrig@mailbox.tu-berlin.de>
Fri, 22 Nov 2013 14:51:08 +0000 (15:51 +0100)
Also some cleaning up.

framework/fw.c
framework/fw_comm.c
framework/fw_task.c
framework/modules/rr_module.c
framework/os/linux/fw_task_linux.c
framework/os/linux/os.c
kernel/sched.new/core.c

index 0dc2622..02b22b7 100644 (file)
@@ -1,4 +1,6 @@
 #include "fw.h"
+struct fw_task *fw_idle_task;
+
 
 void *fw_malloc(fw_size_t size)
 {
index ad02e85..b628ed5 100644 (file)
@@ -23,10 +23,10 @@ void fw_notify(topic_t topic, void *data)
        struct fw_topic_element *iter;
 
        //TODO: Kill this also
-       if(data!=NULL){
+       /*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 4d3aa63..1157c10 100644 (file)
@@ -10,7 +10,7 @@
 #include <fw_types.h>
 #include <fw.h>
 
-struct fw_task *fw_idle_task;
+
 
 void * fw_malloc(fw_size_t size);
 
index 290cc1a..fc29d45 100644 (file)
@@ -81,9 +81,9 @@ static struct fw_task *task_finished(struct fw_task *finished)
        }
 }
 
-static struct fw_task *tick_received(void)
+static struct fw_task *tick_received(struct fw_task *preempted)
 {
-       struct fw_task *task = rr_rq->curr;
+       struct fw_task *task;
        struct rr_info *next_elem;
 //     if(system_state == SYSTEM_RUNNING)
 //             fw_printf(".");
@@ -92,25 +92,23 @@ static struct fw_task *tick_received(void)
 
        if(fw_list_empty(&rr_rq->queue)){
 //             fw_printf("kein kontextwechsel\n");
-               fw_dispatch(task);
+               fw_dispatch(preempted);
                return NULL;
        }
 
-       if((task == idle)&&!fw_list_empty(&rr_rq->queue)){
+       if((preempted == idle)){
                next_elem = (struct rr_info *)__fw_list_pop(&(rr_rq->queue));
 //             task = (struct fw_task*)((unsigned long)next_elem-offset);
                task = next_elem->task;
                rr_rq->curr = task;
                fw_dispatch(task);
                return task;
-       }else if(!fw_list_empty(&rr_rq->queue)){
-               if(task!=idle){
-                       //insert curr task to queue
-                       next_elem = (struct rr_info*)task->module_data[module_id];
+       }else{
+               //insert curr task to queue
+               next_elem = (struct rr_info*)preempted->module_data[module_id];
 //                     next_elem = (struct rr_info*)((unsigned long)task+offset);
-                       fw_list_add_tail(&next_elem->head,&rr_rq->queue);
-                       next_elem->on_rq = 1;
-               }
+               fw_list_add_tail(&next_elem->head,&rr_rq->queue);
+               next_elem->on_rq = 1;
                //get the new task out of da queue and schedule the hell out of it
 //             next_elem = NULL;
                next_elem = (struct rr_info *)__fw_list_pop(&(rr_rq->queue));
index 642833a..a112c9b 100644 (file)
@@ -2,6 +2,7 @@
  * fw_task_linux.c
  *
  * Framework Tasks implementation for linux
+ * TODO: IS this being used AT ALL?!?
  *
  *  Created on: 05.11.2013
  *      Author: Daniel Roehrig, Christian Rene Sechting
index 2ba7c93..5488b57 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 //TODO This avoids copying the sched.h into the folder
 #include "../../../kernel/sched.new/sched.h"
+#include <fw.h>
 
 
 extern struct fw_task *fw_idle_task;
@@ -65,9 +66,13 @@ void os_dispatch(fw_task_t *task)
        os_dispatch_mp(task, cpu);
 }
 
-void os_init_os(void)
+int os_init_os(void)
 {
        struct task_struct* ptr = current;
-       fw_idle_task = register_task(ptr);
-       return;
+       //fw_idle_task = register_task(ptr);
+       fw_idle_task = (struct fw_task *)fw_malloc(sizeof(struct fw_task));
+       //insert_fw_task(new_task, real_task);
+       ptr->fw_task = fw_idle_task;
+       fw_idle_task->real_task = ptr;
+       return 0;
 }
index d6629be..2d0572e 100644 (file)
@@ -1322,8 +1322,11 @@ void wake_up_new_task(struct task_struct *p)
        struct rq *rq;
 //     int cpu = 255;
 
-//     TODO: FRAMEWORK ZEUGS
-       fw_notify(ADMIT,p);
+       struct fw_task *new_task = (struct fw_task *)fw_malloc(sizeof(struct fw_task));
+       p->fw_task = new_task;
+       new_task->real_task = p;
+
+       fw_notify(ADMIT,new_task);
 //     send_to_topic(1,p);
 
        raw_spin_lock_irqsave(&p->pi_lock, flags);
@@ -1424,7 +1427,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 
 //     TODO:framework zeugs
 //     send_to_topic(0,p);
-       fw_notify(EVENT_OCCURS, p);
+       fw_notify(EVENT_OCCURS, p->fw_task);
 
 #ifdef CONFIG_SMP
        /*
@@ -1639,15 +1642,15 @@ need_resched:
 
        if(prev->state & TASK_DEAD){
                //send_to_topic(2,prev);
-               fw_notify(RELEASE,prev);
+               fw_notify(RELEASE,prev->fw_task);
        }else if(prev->state && !(preempt_count() & PREEMPT_ACTIVE)){
                //yield
                //send_to_topic(4,prev);
-               fw_notify(EVENT_WAIT,prev);
+               fw_notify(EVENT_WAIT,prev->fw_task);
        }else{
                //tick
                //send_to_topic(3,NULL);
-               fw_notify(TIME_OUT, NULL);
+               fw_notify(TIME_OUT, prev->fw_task);
        }
 
        sched_preempt_enable_no_resched();