makefile changes in kernel/sched/modsched
authorRené Sechting <sechting@mailbox.tu-berlin.de>
Fri, 13 Dec 2013 14:24:10 +0000 (15:24 +0100)
committerRené Sechting <sechting@mailbox.tu-berlin.de>
Fri, 13 Dec 2013 14:24:10 +0000 (15:24 +0100)
just made it work again. but the current kernel isnt starting in qemu!

24 files changed:
framework/Debug/makefile [deleted file]
framework/Debug/objects.mk [deleted file]
framework/Debug/sources.mk [deleted file]
framework/Debug/subdir.mk [deleted file]
framework/Makefile [deleted file]
framework/fw_list.c [deleted file]
framework/fw_list.h [deleted file]
framework/fw_task.c [deleted file]
framework/fw_task.h [deleted file]
framework/modules/mod_sched_framework.h [deleted file]
framework/modules/rr_module.c [deleted file]
framework/os/linux/Makefile [deleted file]
framework/os/linux/fw_task_linux.c [deleted file]
framework/os/linux/mod_sched_defines.h [deleted file]
framework/os/linux/mod_sched_framework.c [deleted file]
framework/os/simulated/Makefile [deleted file]
framework/os/simulated/fw_task_sim.c [deleted file]
framework/os/simulated/main.c [deleted file]
framework/os/simulated/mod_sched_defines.h [deleted file]
framework/os/simulated/mod_sched_framework.c [deleted file]
framework/pub_sub.c [deleted file]
framework/pub_sub.h [deleted file]
kernel/sched/modsched/Makefile
kernel/sched/modsched/core.c

diff --git a/framework/Debug/makefile b/framework/Debug/makefile
deleted file mode 100644 (file)
index 4ba13c5..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
--include ../makefile.init
-
-RM := rm -rf
-
-# All of the sources participating in the build are defined here
--include sources.mk
--include modules/subdir.mk
--include subdir.mk
--include objects.mk
-
-ifneq ($(MAKECMDGOALS),clean)
-ifneq ($(strip $(C_DEPS)),)
--include $(C_DEPS)
-endif
-endif
-
--include ../makefile.defs
-
-# Add inputs and outputs from these tool invocations to the build variables 
-
-# All Target
-all: framework
-
-# Tool invocations
-framework: $(OBJS) $(USER_OBJS)
-       @echo 'Building target: $@'
-       @echo 'Invoking: GCC C Linker'
-       gcc  -o "framework" $(OBJS) $(USER_OBJS) $(LIBS)
-       @echo 'Finished building target: $@'
-       @echo ' '
-
-# Other Targets
-clean:
-       -$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) framework
-       -@echo ' '
-
-.PHONY: all clean dependents
-.SECONDARY:
-
--include ../makefile.targets
diff --git a/framework/Debug/objects.mk b/framework/Debug/objects.mk
deleted file mode 100644 (file)
index 742c2da..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-USER_OBJS :=
-
-LIBS :=
-
diff --git a/framework/Debug/sources.mk b/framework/Debug/sources.mk
deleted file mode 100644 (file)
index a0991d8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-O_SRCS := 
-C_SRCS := 
-S_UPPER_SRCS := 
-OBJ_SRCS := 
-ASM_SRCS := 
-OBJS := 
-C_DEPS := 
-EXECUTABLES := 
-
-# Every subdirectory with source files must be described here
-SUBDIRS := \
-. \
-modules \
-
diff --git a/framework/Debug/subdir.mk b/framework/Debug/subdir.mk
deleted file mode 100644 (file)
index b8cdf7e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-################################################################################
-# Automatically-generated file. Do not edit!
-################################################################################
-
-# Add inputs and outputs from these tool invocations to the build variables 
-O_SRCS += \
-../pub_sub.o 
-
-C_SRCS += \
-../pub_sub.c 
-
-OBJS += \
-./pub_sub.o 
-
-C_DEPS += \
-./pub_sub.d 
-
-
-# Each subdirectory must supply rules for building sources it contributes
-%.o: ../%.c
-       @echo 'Building file: $<'
-       @echo 'Invoking: GCC C Compiler'
-       gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
-       @echo 'Finished building: $<'
-       @echo ' '
-
-
diff --git a/framework/Makefile b/framework/Makefile
deleted file mode 100644 (file)
index 30d79e4..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-MOD_SCHED_DIR?=$(PWD)
-OBJ=$(MOD_SCHED_DIR)/pub_sub.o $(MOD_SCHED_DIR)/fw_task.o $(MOD_SCHED_DIR)/modules/rr_module.o 
-OBJ += $(MOD_SCHED_DIR)/fw_list.o
-LINUX_DIR?=$(PWD)/../
-
-ifeq ($(OS),linux)
-$(info ===COMPILING FOR LINUX===)
-include $(MOD_SCHED_DIR)/os/linux/Makefile
-else ifeq ($(OS),freebsd)
-else
-$(info ===COMPILING FOR SIMULATED OS===)
-include $(MOD_SCHED_DIR)/os/simulated/Makefile
-endif
-
-all: mod_sched_build
-
-linux:
-       cd $(LINUX_DIR); \
-       rm -f $(LINUX_DIR)/build/kernel/sched.new/mod_sched.o; \
-       make V=1 O=$(LINUX_DIR)/build/ -j1 all
diff --git a/framework/fw_list.c b/framework/fw_list.c
deleted file mode 100644 (file)
index 4d4e339..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#include"fw_list.h"
-
-/*
- *     ALL LIST FUNCTIONALITIES
- */
-
-int list_fw_empty(const struct list_fw_head *head)
-{
-       return head->next == head;
-}
-
-int list_fw_length(const struct list_fw_head *head)
-{
-       int length;
-       struct list_fw_head* start;
-
-       if(list_fw_empty(head)){
-               return 0;
-       }
-       length = 0;
-       start = head->next;
-       while(start != head){
-               start = start->next;
-               length++;
-       }
-       return length;
-}
-
-void __list_fw_add(struct list_fw_head *_new,
-                             struct list_fw_head *prev,
-                             struct list_fw_head *next)
-{
-       next->prev = _new;
-       _new->next = next;
-       _new->prev = prev;
-       prev->next = _new;
-}
-
-void list_fw_add_tail(struct list_fw_head *_new, struct list_fw_head *head)
-{
-       __list_fw_add(_new, head->prev, head);
-}
-
-void list_fw_add_first(struct list_fw_head *_new, struct list_fw_head *head)
-{
-       __list_fw_add(_new, head, head->next);
-}
-
-void list_fw_add_at_pos(struct list_fw_head *_new, struct list_fw_head *head, int pos)
-{
-       if(pos<=list_fw_length(head) && pos>=0 ){
-               while(pos-- > 0){
-                       head=head->next;
-               }
-               __list_fw_add(_new, head, head->next);
-       }else{
-       //TODO: was is wenn pos >list_fw_length ist? hinten einfügen?
-               list_fw_add_tail(_new, head);
-       }
-}
-
-void __list_fw_del(struct list_fw_head * prev, struct list_fw_head * next)
-{
-       next->prev = prev;
-       prev->next = next;
-}
-
-void __list_fw_del_entry(struct list_fw_head *entry)
-{
-       __list_fw_del(entry->prev, entry->next);
-}
-
-void list_fw_del(struct list_fw_head *entry)
-{
-       if(entry->next!=LIST_POISON1 && entry->prev!=LIST_POISON2)
-       {
-               __list_fw_del(entry->prev, entry->next);
-               entry->next = LIST_POISON1;
-               entry->prev = LIST_POISON2;
-       }
-       entry->next = entry->prev = entry;
-}
-
-struct list_fw_head *__list_fw_pop(struct list_fw_head *head)
-{
-       struct list_fw_head *ret = head->next;
-       if(list_fw_empty(head)){
-               return NULL;
-       }
-       list_fw_del(ret);
-       return ret;
-}
diff --git a/framework/fw_list.h b/framework/fw_list.h
deleted file mode 100644 (file)
index be9a5d6..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-#ifndef _FW_LIST_H
-#define _FW_LIST_H
-
-#include<mod_sched_defines.h>
-
-/*
- * Copied and heavily modified from Linux implementation.
- *  Created on:23.07.2013
- *     Authors: Christian René Sechting, Daniel Roehrig
- *
- */
-
-#undef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-
-/**
- * fw_container_of - cast a member of a structure out to the containing structure
- * @ptr:        the pointer to the member.
- * @type:       the type of the container struct this is embedded in.
- * @member:     the name of the member within the struct.
- *
- */
-#define fw_container_of(ptr, type, member) ({                      \
-       const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-       (type *)( (char *)__mptr - offsetof(type,member) );})
-
-
-struct list_fw_head {
-       struct list_fw_head *next, *prev;
-};
-
-/**
- * Initializing the list
- * @name: the head for your list.
- */
-#define LIST_FW_INIT(name)     name.next = name.prev = &(name)
-
-/**
- * These Initializations are not used at the moment but we'll keep them here
- * in case we might need them later
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
-       struct list_fw_head name = LIST_HEAD_INIT(name)
-*/
-
-/**
- * list_fw_entry - get the struct for this entry
- * @ptr:       the &struct list_head pointer.
- * @type:      the type of the struct this is embedded in.
- * @member:    the name of the list_struct within the struct.
- */
-#define list_fw_entry(ptr, type, member) \
-       fw_container_of(ptr, type, member)
-
-/**
- * list_for_each_entry -       iterate over list of given type
- * @pos:       the type * to use as a loop cursor.
- * @head:      the head for your list.
- * @member:    the name of the list_struct within the struct.
- */
-#define fw_list_for_each_entry(pos, head, member)                              \
-       for (pos = list_fw_entry((head)->next, typeof(*pos), member);   \
-            &pos->member != (head);    \
-            pos = list_fw_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-int list_fw_empty(const struct list_fw_head *head);
-
-/**
- * list_fw_length - returns the number of entries in a list.
- * @head: the &struct list_fw_head pointer.
- */
-int list_fw_length(const struct list_fw_head *head);
-
-/*
- * Insert a new entry between two known consecutive entries.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-void __list_fw_add(struct list_fw_head *_new,
-                             struct list_fw_head *prev,
-                             struct list_fw_head *next);
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-void list_fw_add_tail(struct list_fw_head *_new, struct list_fw_head *head);
-
-/**
- * list_fw_add_first - add a new entry at the beginning of the list
- * @new: new entry to be added
- * @head: list head to add it after
- */
-void list_fw_add_first(struct list_fw_head *_new, struct list_fw_head *head);
-
-/**
- * list_fw_add_at_pos - add a new entry at this position (starting with 0);
- * @new: new entry to be added
- * @head: list head to add it after
- * @pos: position where to insert the element at
- */
-void list_fw_add_at_pos(struct list_fw_head *_new, struct list_fw_head *head, int pos);
-
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-void __list_fw_del(struct list_fw_head * prev, struct list_fw_head * next);
-
-void __list_fw_del_entry(struct list_fw_head *entry);
-
-/**
- * list_fw_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty() on entry does not return true after this, the entry is
- * in an undefined state.
- */
-void list_fw_del(struct list_fw_head *entry);
-
-/*
- * pop functionality to remove the first element of the list an return it
- */
-struct list_fw_head *__list_fw_pop(struct list_fw_head *head);
-
-/*
- * use the define here to pop of the list to get the entry and not only the list element
- */
-#define list_fw_pop(head,type,member) list_fw_entry(__list_fw_pop(head),type,member)
-
-#endif
diff --git a/framework/fw_task.c b/framework/fw_task.c
deleted file mode 100644 (file)
index 3c3687a..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * fw_task.c
- *
- *  Created on: 29.07.2013
- *      Author: daniel, rene
- */
-#include"fw_task.h"
-#include<mod_sched_defines.h>
-#include"fw_list.h"
-
-void * mallocfw(int size);
-
-unsigned long task_struct_padding;
-
-struct fw_task *fw_idle_task;
-
-/*struct task_list{
-       struct fw_task *task;
-       struct list_fw_head list;
-};*/
-
-//struct list_fw_head tl_head;
-
-void printfw(const char* formatstring, ...);
-
-void init_fw_tasks(void){
-       printfw("*** Tasks Initialized ***\n");
-       task_struct_padding=0;
-       //LIST_FW_INIT(tl_head);
-
-}
-
-/**
- * Registering a new set of fields for the task struct
- * @return: position of the taskpointer that can be casted to the corresponding task struct
- */
-int register_ts(int size)
-{
-       int former_position = task_struct_padding;
-       task_struct_padding += size;
-       printfw("Old Task Size: %d New Task Size: %d\n", former_position, task_struct_padding);
-       return former_position+sizeof(struct fw_task);
-}
-
-struct fw_task *register_task(void *real_task)
-{
-//lets try something faster
-       struct fw_task *new_task;
-       if(fw_task_is_registered(real_task)){
-               new_task = find_fw_task(real_task);
-       }else{
-               new_task = (struct fw_task *)mallocfw(sizeof(struct fw_task)+task_struct_padding);
-               insert_fw_task(new_task, real_task);
-       }
-               return new_task;
-/*
-       //create list elem for the all tasks list
-       struct task_list *new_elem = (struct task_list *)mallocfw(sizeof(struct task_list));
-       //create the fw_task structure and let it point to the real task
-       struct fw_task *new_task = (struct fw_task *)mallocfw(sizeof(struct fw_task)+task_struct_padding);
-       new_task->real_task = real_task;
-       new_elem->task = new_task;
-       list_fw_add_tail(&new_elem->list, &tl_head);
-       //done, lets give back the fw_task!
-       return new_task;
-*/
-}
-
-/* put this into os dependent part
-struct fw_task *find_fw_task(void *task)
-{
-       //go through the list of tasks and find the corresponding fw_task
-       struct task_list *pos;
-       fw_list_for_each_entry(pos, &tl_head, list){
-               if(pos->task->real_task == task)
-                       return pos->task;
-       }
-       return NULL;
-}*/
-
-void *find_real_task(struct fw_task *task)
-{
-//this goes faster
-       if(task == NULL) 
-               return NULL;
-       else
-               return task->real_task;
-/*
-       struct task_list *pos;
-       fw_list_for_each_entry(pos, &tl_head, list){
-               if(pos->task == task)
-                       return pos->task->real_task;
-       }
-       return NULL;
-*/
-}
-
-void set_idle_task(struct fw_task *idle)
-{
-       fw_idle_task = idle;
-}
-
-struct fw_task *get_idle_task()
-{
-       return fw_idle_task;
-}
diff --git a/framework/fw_task.h b/framework/fw_task.h
deleted file mode 100644 (file)
index 3bc06d3..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * fw_task.h
- *
- *  Created on: 29.07.2013
- *      Author: daniel, rene
- */
-
-#ifndef FW_TASK_H_
-#define FW_TASK_H_
-
-struct fw_task{
-       void *real_task;
-};
-
-/*
- *  initialize the task_struct_padding with 0 and 
- *  creates a list for all tasks
- */
-void init_fw_tasks(void);
-
-/*
- *  TODO: check if needed
- *  every scheduler module can demand individual
- *  fields in the task_struct and this is the
- *  overall counter of all extra memory that needs
- *  to be allocated from the framework per task
- */
-extern unsigned long task_struct_padding;
-
-/*
- * returns the fw_task equivalent of the given os task
- */
-struct fw_task *find_fw_task(void *real_task);
-
-/*
- *  returns the os task equivalent of the given fw_task
- */
-void *find_real_task(struct fw_task *task);
-
-/*
- *  creates a fw_task equivalent for the given os task
- *  or returns the fw_task if already there.
- */
-struct fw_task *register_task(void *real_task);
-
-int fw_task_is_registered(void *tsk);
-void insert_fw_task(struct fw_task *new, void *tsk);
-
-void set_idle_task(struct fw_task *idle);
-struct fw_task *get_idle_task(void);
-
-int fw_get_state(struct fw_task *task);
-int fw_get_pid(struct fw_task *task);
-
-#endif /* FW_TASK_H_ */
diff --git a/framework/modules/mod_sched_framework.h b/framework/modules/mod_sched_framework.h
deleted file mode 100644 (file)
index d125a19..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * mod_sched_framework.h
- *
- * API to be used by the module developers.
- *
- *  Created on: 11.07.2013
- *      Author: Daniel Roehrig, Christian Rene Sechting
- */
-
-#ifndef MOD_SCHED_FRAMEWORK_H_
-#define MOD_SCHED_FRAMEWORK_H_
-
-#include<mod_sched_defines.h>
-
-//TODO: This should be the enums from pub_sub.h
-#define WAKE_UP_TASK 0
-#define NEW_TASK 1
-#define TASK_FINISHED 2 
-#define TICK 3
-#define TASK_YIELD 4
-
-
-//      SOME STANDARD FUNCTIONALITIES
-
-void printfw(const char* formatstring, ...);
-
-void *mallocfw(size_t size);
-
-void freefw(void*);
-
-
-//     EVERYTHING NEEDED FOR TASKS
-
-struct fw_task{
-       void *real_task;
-};
-
-/*
- * schedule the given fw_task
- */
-void schedulefw(struct fw_task *task);
-
-/**
- * Use the pub-sub system to subscribe to a topic
- */
-int subscribe_to_topic(int topic_id, void* callback);
-
-/**
- * TODO: sis schudd not bie dann bei se modjul putt it intuh se linux
- * INIT FUNCTION!
- * This one needs to be called before anything else is done
- *
-*/
-void init_modsched_framework(void* task);
-
-/**
- * Register a new custom task stuct expansion, return the former value
- */
-int register_ts(int size);
-
-/*
- * get information about the task
- */
-struct fw_task *get_idle_task(void);
-
-int fw_get_state(struct fw_task *task);
-
-int fw_get_pid(struct fw_task *task);
-
-int fw_get_flags(struct fw_task *task);
-
-
-//     ALL THE STUFF NEEDED FOR USING LISTS
-
-struct list_fw_head {
-       struct list_fw_head *next, *prev;
-};
-
-/*
- * Copied and heavily modified from Linux implementation.
- *  Created on:23.07.2013
- *     Authors: Christian René Sechting, Daniel Roehrig
- *
- */
-
-#undef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-
-/**
- * fw_container_of - cast a member of a structure out to the containing structure
- * @ptr:        the pointer to the member.
- * @type:       the type of the container struct this is embedded in.
- * @member:     the name of the member within the struct.
- *
- */
-#define fw_container_of(ptr, type, member) ({                      \
-       const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-       (type *)( (char *)__mptr - offsetof(type,member) );})
-
-/**
- * Initializing the list
- * @name: the head for your list.
- */
-#define LIST_FW_INIT(name)     name.next = name.prev = &(name)
-
-/**
- * list_fw_entry - get the struct for this entry
- * @ptr:       the &struct list_head pointer.
- * @type:      the type of the struct this is embedded in.
- * @member:    the name of the list_struct within the struct.
- */
-#define list_fw_entry(ptr, type, member) \
-       fw_container_of(ptr, type, member)
-
-/**
- * list_for_each_entry -       iterate over list of given type
- * @pos:       the type * to use as a loop cursor.
- * @head:      the head for your list.
- * @member:    the name of the list_struct within the struct.
- */
-#define fw_list_for_each_entry(pos, head, member)                              \
-       for (pos = list_fw_entry((head)->next, typeof(*pos), member);   \
-            &pos->member != (head);    \
-            pos = list_fw_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-int list_fw_empty(const struct list_fw_head *head);
-
-/**
- * list_fw_length - returns the number of entries in a list.
- * @head: the &struct list_fw_head pointer.
- */
-int list_fw_length(const struct list_fw_head *head);
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-void list_fw_add_tail(struct list_fw_head *_new, struct list_fw_head *head);
-
-/**
- * list_fw_add_first - add a new entry at the beginning of the list
- * @new: new entry to be added
- * @head: list head to add it after
- */
-void list_fw_add_first(struct list_fw_head *_new, struct list_fw_head *head);
-
-/**
- * list_fw_add_at_pos - add a new entry at this position (starting with 0);
- * @new: new entry to be added
- * @head: list head to add it after
- * @pos: position where to insert the element at
- */
-void list_fw_add_at_pos(struct list_fw_head *_new, struct list_fw_head *head, int pos);
-
-/**
- * list_fw_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty() on entry does not return true after this, the entry is
- * in an undefined state.
- */
-void list_fw_del(struct list_fw_head *entry);
-//dont use __list_fw_pop
-struct list_fw_head *__list_fw_pop(struct list_fw_head *head);
-/*
- * use the define here to pop of the list to get the entry and not only the list element
- */
-#define list_fw_pop(head,type,member) list_fw_entry(__list_fw_pop(head),type,member)
-#endif /* MOD_SCHED_FRAMEWORK_H_ */
diff --git a/framework/modules/rr_module.c b/framework/modules/rr_module.c
deleted file mode 100644 (file)
index 587339d..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * rr_module.c
- *     a simple round robin scheduler
- *
- *  Created on: 14.06.2013
- *      Author: Rene Sechting
- */
-
-#include "mod_sched_framework.h"
-
-struct rq{
-       struct list_fw_head     queue;
-       struct fw_task          *curr;
-       struct fw_task          *idle;
-};
-
-struct rr_info{
-       struct list_fw_head head;
-       int on_rq;
-};
-
-static unsigned long offset;
-static struct rq *rr_rq;
-static struct fw_task *idle;
-
-static struct fw_task *task_received(struct fw_task *task)
-{
-       struct rr_info *rq_ele;
-//     if(system_state == SYSTEM_RUNNING)
-//             printfw("new task %d\n", fw_get_pid(task));
-       rq_ele = (struct rr_info*)((unsigned long)task+offset);
-       list_fw_add_tail(&rq_ele->head, &rr_rq->queue);
-       rq_ele->on_rq = 1;
-
-       return NULL;
-}
-
-static struct fw_task *task_finished(struct fw_task *finished)
-{
-       struct rr_info *next_elem;
-       struct fw_task *task;
-//     printfw("task finished %d\n",fw_get_pid(finished));
-
-//     next_elem = (struct rr_info *)((unsigned long)finished+offset);
-//     next_elem->on_rq = 0;
-       if(!list_fw_empty(&rr_rq->queue)){
-               //get the next task running!
-               next_elem = (struct rr_info *)__list_fw_pop(&(rr_rq->queue));
-               task = (struct fw_task*)((unsigned long)next_elem-offset);
-               rr_rq->curr = task;
-               return task;
-       }else{
-               //every task is done, go to idle mode
-               rr_rq->curr = idle;
-               return idle;
-       }
-}
-
-static struct fw_task *tick_received(void)
-{
-       struct fw_task *task = rr_rq->curr;
-       struct rr_info *next_elem;
-//     if(system_state == SYSTEM_RUNNING)
-//             printfw(".");
-       if(list_fw_empty(&rr_rq->queue))
-               return NULL;
-
-       if((task == idle)&&!list_fw_empty(&rr_rq->queue)){
-               next_elem = (struct rr_info *)__list_fw_pop(&(rr_rq->queue));
-               task = (struct fw_task*)((unsigned long)next_elem-offset);
-               rr_rq->curr = task;
-               return task;
-       }else if(!list_fw_empty(&rr_rq->queue)){
-               if(task!=idle){
-                       //insert curr task to queue
-                       next_elem = (struct rr_info*)((unsigned long)task+offset);
-                       list_fw_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 *)__list_fw_pop(&(rr_rq->queue));
-               task = (struct fw_task*)((unsigned long)next_elem-offset);
-               next_elem->on_rq = 0;
-               rr_rq->curr = task;
-               return task;
-       }
-       return idle;
-}
-
-static struct fw_task *task_yielded(struct fw_task *yielded)
-{
-
-//     printfw("yield-state: %d",fw_get_state(yielded));
-       struct rr_info *next_elem;
-       struct rr_info *pos;
-       struct fw_task *task;
-//     printfw("task has yielded %d\n",fw_get_pid(yielded));
-       next_elem = (struct rr_info *) ((unsigned long)yielded + offset);
-       next_elem->on_rq = 0;
-       next_elem = NULL;
-       if(!list_fw_empty(&rr_rq->queue)){
-               next_elem = (struct rr_info *)__list_fw_pop(&(rr_rq->queue));
-/*             if(system_state == SYSTEM_RUNNING){
-                       printfw("tasklist: ");
-                       fw_list_for_each_entry(pos, &rr_rq->queue, head){
-                               task = (struct fw_task*)((unsigned long)pos-offset);
-                               printfw("%d ",fw_get_pid(task));
-                               printfw("hallo");
-                       }
-                       printfw("\n");
-               }
-*/
-               next_elem->on_rq = 0;
-               task = (struct fw_task*)((unsigned long)next_elem-offset);
-               rr_rq->curr = task;
-               return task;
-       }else{
-               rr_rq->curr = idle;
-               return idle;
-       }
-}
-
-static struct fw_task *wake_up_task(struct fw_task *wake_up)
-{
-//     if(system_state == SYSTEM_RUNNING)
-//             printfw("aufwachen!!! %d\n",fw_get_pid(wake_up));
-       struct rr_info *to_wake_up = (struct rr_info*)((unsigned long)wake_up+offset);
-       if(!to_wake_up->on_rq){
-               list_fw_add_tail(&to_wake_up->head,&(rr_rq->queue));
-               to_wake_up->on_rq = 1;
-       }
-       return NULL;
-}
-
-//__init_module(init_sched_rr_module)
-struct fw_task *get_idle_task(void);
-int init_sched_rr_module(void)
-{
-       printfw("ROUND_ROBIN_MODULE INITIALIZING\n");
-//     offset = register_ts(sizeof(struct list_fw_head));
-       offset = register_ts(sizeof(struct rr_info));
-       rr_rq = (struct rq*)mallocfw(sizeof(struct rq));
-       idle = get_idle_task();
-       rr_rq->idle = idle;
-       rr_rq->curr = idle;
-       LIST_FW_INIT(rr_rq->queue);
-       subscribe_to_topic(NEW_TASK, &task_received);
-       subscribe_to_topic(TASK_FINISHED, &task_finished);
-       subscribe_to_topic(TICK, &tick_received);
-       subscribe_to_topic(TASK_YIELD, &task_yielded);
-       subscribe_to_topic(WAKE_UP_TASK,&wake_up_task);
-       printfw("SCHEDULER INITIALIZED!\n");
-
-       return 0;
-}
-
-
-//__main(init_sched_rr_module);
diff --git a/framework/os/linux/Makefile b/framework/os/linux/Makefile
deleted file mode 100644 (file)
index b4a4d89..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-MOD_NAME=mod_sched
-FLAGS=$(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR($(MOD_NAME))"  -D"KBUILD_MODNAME=KBUILD_STR($(MOD_NAME))" -c
-
-OBJ+=$(MOD_SCHED_DIR)/os/linux/mod_sched_framework.o
-OBJ+=$(MOD_SCHED_DIR)/os/linux/fw_task_linux.o
-#OBJ=$(MOD_SCHED_DIR)/pub_sub.o $(MOD_SCHED_DIR)/fallback_module.o
-
-## Compile the framework and the modules to one object mod_sched.o
-mod_sched_build: $(OBJ)
-       @echo "--- Scheduler-Module Linking... ---"
-       $(LD) -o kernel/sched.new/mod_sched.o $(OBJ) -r
-       @echo "--- Scheduler-Module Linked! ---"                
-       
-%.o: %.c
-       @echo "--- Scheduler-Module $@ Compiling... "
-       $(CC) $(LINUXINCLUDE) -I$(MOD_SCHED_DIR)/os/linux $(FLAGS) $< -o $@
-       
-.PHONY: clean
-clean:
-       @echo "--- Removing Old Scheduler Modules ---"
-       rm -f $(MOD_SCHED_DIR)/*.o $(MOD_SCHED_DIR)/modules/*.o $(MOD_SCHED_DIR)/os/linux/*.o
diff --git a/framework/os/linux/fw_task_linux.c b/framework/os/linux/fw_task_linux.c
deleted file mode 100644 (file)
index 9dec82f..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * fw_task_linux.c
- *
- *     author: rene
- */
-
-
-#include<linux/sched.h>
-#include"../../fw_task.h"
-
-struct fw_task *find_fw_task(void *tsk)
-{
-       struct task_struct *ptr = (struct task_struct *)tsk;
-       return ptr->fw_task;
-}
-
-int fw_task_is_registered(void *tsk)
-{
-       struct task_struct *ptr = (struct task_struct *)tsk;
-       if(ptr->fw_task != NULL){
-               return 1;
-       }else{
-               return 0;
-       }
-}
-
-void insert_fw_task(struct fw_task *new, void *tsk)
-{
-       struct task_struct *ptr = (struct task_struct *)tsk;
-       ptr->fw_task = new;
-       new->real_task = tsk;
-}
-
-int fw_get_pid(struct fw_task *task)
-{
-       struct task_struct *ptr = task->real_task;
-       return (int)ptr->pid;
-//     return 0;
-}
-
-//TODO: lock se shizzle aut off se tasks wenn juh äksess se task wälljuhs
-int fw_get_state(struct fw_task *task)
-{
-//     struct task_struct *ptr = task->real_task;
-//     return ptr->state;
-       return 0;
-}
-
-
-
-int fw_get_flags(struct fw_task *task)
-{
-//     struct task_struct *ptr = task->real_task;
-//     return ptr->flags;
-       return 0;
-}
diff --git a/framework/os/linux/mod_sched_defines.h b/framework/os/linux/mod_sched_defines.h
deleted file mode 100644 (file)
index e02a2d9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * mod_sched_defines.h
- *   Created on:12.07.2013
- *     Authors: Christian René Sechting
- */
-#ifndef _MOD_SCHED_DEFINES_H_
-#define _MOD_SCHED_DEFINES_H_
-
-#include<linux/kernel.h>
-#include<linux/slab.h>
-#include<linux/poison.h>
-
-#define __main(func) __initcall(func)
-//#define init_sched_pubsub(void) static int __init init_sched_pub_sub(void)
-#define __init_module(func) static int __init func(void)
-
-#endif
diff --git a/framework/os/linux/mod_sched_framework.c b/framework/os/linux/mod_sched_framework.c
deleted file mode 100644 (file)
index fcb9976..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * mod_sched_framework.c
- *
- *  Created on: 11.07.2013
- *      Author: Daniel Röhrig, Christian René Sechting
- */
-#include<mod_sched_defines.h>
-#include"../../fw_task.h"
-
-void printfw(const char* formatstring, ...)
-{
-       va_list list;
-       va_start(list, formatstring);
-       vprintk(formatstring, list);
-       va_end(list);
-}
-
-void *mallocfw(size_t size)
-{
-       return kmalloc(size,GFP_KERNEL);
-}
-
-void schedulefw(struct fw_task *task)
-{
-       //TODO: innwohk ä kontextswitsch
-       return;
-}
-
-//Function declaration
-void init_fw_tasks(void);
-int init_sched_pub_sub(void);
-int init_sched_rr_module(void);
-
-extern struct fw_task *fw_idle_task;
-
-void init_modsched_framework(void* idletask){
-       //initialize the idletask
-       struct fw_task *idle;
-       init_fw_tasks();
-       idle = register_task(idletask);
-       fw_idle_task = idle;
-       init_sched_pub_sub();
-       init_sched_rr_module();
-}
diff --git a/framework/os/simulated/Makefile b/framework/os/simulated/Makefile
deleted file mode 100644 (file)
index f44d0b2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#MOD_NAME=mod_sched
-#FLAGS=$(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR($(MOD_NAME))"  -D"KBUILD_MODNAME=KBUILD_STR($(MOD_NAME))" -c
-
-OBJ+=$(MOD_SCHED_DIR)/os/simulated/mod_sched_framework.o
-OBJ+=$(MOD_SCHED_DIR)/os/simulated/fw_task_sim.o
-#OBJ+=$(MOD_SCHED_DIR)/os/simulated/main.o
-
-## Compile the framework and the modules to one object mod_sched.o
-mod_sched_build: $(OBJ) main
-       #@echo "--- Scheduler-Module compiling... ---"
-       #ld  $(OBJ) -g -o test
-       @echo "--- Scheduler-Module compiled! ---"              
-       
-%.o: %.c
-       gcc -I$(MOD_SCHED_DIR)/os/simulated $< -g -o $@ -c
-       
-main:
-       gcc -I$(MOD_SCHED_DIR)/os/simulated $(MOD_SCHED_DIR)/os/simulated/main.c $(OBJ) -g -o test
-.PHONY: clean
-clean:
-       rm -f $(MOD_SCHED_DIR)/*.o $(MOD_SCHED_DIR)/modules/*.o $(MOD_SCHED_DIR)/test $(MOD_SCHED_DIR)/os/simulated/*.o
diff --git a/framework/os/simulated/fw_task_sim.c b/framework/os/simulated/fw_task_sim.c
deleted file mode 100644 (file)
index f7cf0a3..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *     fw_task_sim.c
- *
- *     author: rene
- */
-
-
-#include"../../fw_task.h"
-
-struct task_struct{
-       int pid;
-       int state;
-       int flags;
-};
-
-int fw_get_state(struct fw_task *task)
-{
-       struct task_struct *ptr = task->real_task;
-       return ptr->state;
-}
-
-int fw_get_pid(struct fw_task *task)
-{
-       struct task_struct *ptr = task->real_task;
-       return ptr->pid;
-}
-
-int fw_get_flags(struct fw_task *task)
-{
-       struct task_struct *ptr = task->real_task;
-       return ptr->flags;
-}
diff --git a/framework/os/simulated/main.c b/framework/os/simulated/main.c
deleted file mode 100644 (file)
index 502b33a..0000000
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * A Simulation for Testing. Creating a simple executable.
- *   Created on:12.07.2013
- *     Authors: Christian René Sechting, Daniel Roehrig
- */
-
-#include<mod_sched_defines.h>
-#include"../../modules/mod_sched_framework.h"
-//#include"../../fw_list.h"
-//#include"../../fw_task.h"
-
-extern int init_module(void);
-
-struct task_struct{
-       int pid;
-       int state;
-       int flags;
-};
-
-typedef struct taskcounter tc;
-struct taskcounter{
-       int                     hitpoints;
-       struct task_struct      *task;
-       struct list_fw_head     list;
-};
-
-tc *currtc;
-tc *head;
-tc *idle_hitpoints;
-
-/**
- * Prints a nice overview of all our testsuites
- */
-void print_help(void){
-       printfw("Usage: test <testsuite>\n"
-                       "Testsuites:"
-                       "\n\t0: Simple FIFO Scheduler"
-                       "\n\t1: List Functions"
-                       "\n\t2: PubSub-System"
-                       "\n");
-}
-
-/**
- * Print all the PIDs of a given tasklist
- */
-void print_tasks(struct list_fw_head* head){
-       tc* pos;
-       fw_list_for_each_entry(pos, head, list){
-               printfw("PID %d |",pos->task->pid);
-       }
-       printf("\n");
-}
-
-void schedulefw(struct fw_task *task)
-{
-       if(task==idle_task){
-               printfw("idle_task was scheduled!\n");
-               currtc = idle_hitpoints;
-               return;
-       }
-
-       printfw("scheduled task %d\n", fw_get_pid(task));
-       tc *curr;
-       fw_list_for_each_entry(curr, &head->list, list){
-               if(curr->task == task->real_task){
-                       currtc = curr; 
-               }
-       }
-       return;
-}
-
-void new_task(struct task_struct *task){
-       send_to_topic(NEW_TASK,task);
-}
-
-void task_finished(struct task_struct *finished){
-       send_to_topic(TASK_FINISHED,finished);
-}
-
-int main(int argc, char *argv[])
-{
-       //initialise some tasks to schedule
-       struct task_struct *task_one;
-       task_one = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_one->pid = 1;
-       struct task_struct *task_two;
-       task_two = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_two->pid = 2;
-       struct task_struct *task_three;
-       task_three = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_three->pid = 3;
-       struct task_struct *task_four;
-       task_four = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_four->pid = 4;
-       struct task_struct *task_five;
-       task_five = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_five->pid = 5;
-       struct task_struct *task_six;
-       task_six = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_six->pid = 6;
-       struct task_struct *task_seven;
-       task_seven = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_seven->pid = 7;
-       struct task_struct *task_eight;
-       task_eight = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_eight->pid = 8;
-       struct task_struct *task_nine;
-       task_nine = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_nine->pid = 9;
-       struct task_struct *task_ten;
-       task_ten = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       task_ten->pid = 10;
-
-       //control structures so we can play a little game with the tasks
-       tc *tc_one;
-       tc *tc_two;
-       tc *tc_three;
-       tc *tc_four;
-       tc *tc_five;
-       tc *tc_six;
-       tc *tc_seven;
-       tc *tc_eight;
-       tc *tc_nine;
-       tc *tc_ten;
-       tc_one = (tc *)mallocfw(sizeof(tc));
-       tc_two = (tc *)mallocfw(sizeof(tc));
-       tc_three = (tc *)mallocfw(sizeof(tc));
-       tc_four = (tc *)mallocfw(sizeof(tc));
-       tc_five = (tc *)mallocfw(sizeof(tc));
-       tc_six = (tc *)mallocfw(sizeof(tc));
-       tc_seven = (tc *)mallocfw(sizeof(tc));
-       tc_eight = (tc *)mallocfw(sizeof(tc));
-       tc_nine = (tc *)mallocfw(sizeof(tc));
-       tc_ten = (tc *)mallocfw(sizeof(tc));
-
-       //Initialize list of tasks
-       head = (tc *)malloc(sizeof(tc));
-       LIST_FW_INIT(head->list);
-       list_fw_add_tail(&tc_one->list,&head->list);
-       list_fw_add_tail(&tc_two->list,&head->list);
-       list_fw_add_tail(&tc_three->list,&head->list);
-       list_fw_add_tail(&tc_four->list,&head->list);
-       list_fw_add_tail(&tc_five->list,&head->list);
-       list_fw_add_tail(&tc_six->list,&head->list);
-       list_fw_add_tail(&tc_seven->list,&head->list);
-       list_fw_add_tail(&tc_eight->list,&head->list);
-       list_fw_add_tail(&tc_nine->list,&head->list);
-       list_fw_add_tail(&tc_ten->list,&head->list);
-       
-       //let el lísto know about los taskos
-       tc_one->task = task_one;
-       tc_two->task = task_two;
-       tc_three->task = task_three;
-       tc_four->task = task_four;
-       tc_five->task = task_five;
-       tc_six->task = task_six;
-       tc_seven->task = task_seven;
-       tc_eight->task = task_eight;
-       tc_nine->task = task_nine;
-       tc_ten->task = task_ten;
-       
-       //weirdest shit ever, never ever ask me why!
-       idle_hitpoints = (tc *)mallocfw(sizeof(tc));
-       idle_hitpoints->hitpoints = 0xFFFFFFF;
-       struct task_struct *idle_task;
-       idle_task = (struct task_struct *)mallocfw(sizeof(struct task_struct));
-       idle_hitpoints->task = idle_task;
-       idle_task->pid = 0;
-       currtc = idle_hitpoints;
-
-       init_modsched_framework(idle_task);//Initialize the whole framework
-       init_sched_rr_module();
-       //init_sched_fifo_module();
-       if(argc <= 1){
-               print_help();
-               return 0;
-       }else{
-               int testcase = atoi(argv[1]);
-               switch(testcase){
-                       case 0:
-                       {
-
-                               //give les tasks some hitpoints
-                               tc_one->hitpoints = 123;
-                               tc_two->hitpoints = 560;
-                               tc_three->hitpoints = 341;
-                               tc_four->hitpoints = 468;
-                               tc_five->hitpoints = 90;
-                               tc_six->hitpoints = 807;
-                               tc_seven->hitpoints = 333;
-                               tc_eight->hitpoints = 711;
-                               tc_nine->hitpoints = 84;
-                               tc_ten->hitpoints = 290;
-
-
-                               //let the tests begin
-                               int counter = 0;
-                               int lebenspunkte = 5000;
-                               while(lebenspunkte--){
-                                       counter++;
-                                       printfw(".");
-                                       if(counter == 1){
-                                               printfw("---->task one\n");
-                                               new_task(task_one);
-                                       }else if(counter == 13){
-                                               printfw("---->task two\n");
-                                               new_task(task_two);
-                                       }else if(counter == 20){
-                                               printfw("---->task three\n");
-                                               new_task(task_three);
-                                       }else if(counter == 22){
-                                               printfw("---->task four\n");
-                                               new_task(task_four);
-                                       }else if(counter == 30){
-                                               printfw("---->task five\n");
-                                               new_task(task_five);
-                                       }else if(counter == 40){
-                                               printfw("---->task six\n");
-                                               new_task(task_six);
-                                       }else if(counter == 48){
-                                               printfw("---->task seven\n");
-                                               new_task(task_seven);
-                                       }else if(counter == 55){
-                                               printfw("---->task eight\n");
-                                               new_task(task_eight);
-                                       }else if(counter == 67){
-                                               printfw("---->task nine\n");
-                                               new_task(task_nine);
-                                       }else if(counter == 80){
-                                               printfw("---->task ten\n");
-                                               new_task(task_ten);
-                                       }
-                                       //kill a hitpoint from da task
-                                       currtc->hitpoints--;
-                                       if(currtc->hitpoints <=0){
-                                               printfw("-");
-                                               task_finished(currtc->task);
-                                       }else if((counter%20)==0){
-                                       //TICK
-                                               printfw("/");
-                                               send_to_topic(3);
-                                       }else if(((counter%73)==0)&&currtc!=idle_hitpoints){
-                                       //yield
-                                               printfw(";");
-                                               send_to_topic(4,currtc->task);
-                                       }
-                               }
-
-                               break;
-                       }
-                       case 1:
-                       {
-                               //Test List Functions
-                               //Count Elements
-                               printfw("Head has %d elements.\n",list_fw_length(&head->list));
-                               //Delete the fourth Element
-                               list_fw_del(&tc_four->list);
-                               printfw("Head has %d elements.\n",list_fw_length(&head->list));
-                               print_tasks(&head->list);
-                               //list_fw_add_first(&tc_four->list,&head->list);
-                               list_fw_add_at_pos(&tc_four->list,&head->list,9);
-                               print_tasks(&head->list);
-                               break;
-                       }
-                       case 2:{
-                               send_to_topic(0,"hallo");
-                               send_to_topic(0,"welt");
-                               break;
-                       }
-                       default:
-                               break;
-               }
-
-       }
-       return 0;
-}
diff --git a/framework/os/simulated/mod_sched_defines.h b/framework/os/simulated/mod_sched_defines.h
deleted file mode 100644 (file)
index e54fc6f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * mod_sched_defines.h
- *   Created on:12.07.2013
- *     Authors: Christian René Sechting
- */
-#ifndef _MOD_SCHED_DEFINES_H_
-#define _MOD_SCHED_DEFINES_H_
-
-#include<stdlib.h>
-#include<stdio.h>
-#include<stdarg.h>
-
-#define __main(func)
-#define init_sched_pubsub(void) int init_sched_pubsub(void)
-#define __init_module(func) int func(void)
-
-//Mark a List Entry as invalid/deleted
-#define LIST_POISON1  ((void *) 0x00100100)
-#define LIST_POISON2  ((void *) 0x00200200)
-
-#endif
diff --git a/framework/os/simulated/mod_sched_framework.c b/framework/os/simulated/mod_sched_framework.c
deleted file mode 100644 (file)
index baeaf82..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * mod_sched_framework.c
- *   Created on:12.07.2013 
- *     Authors: Christian René Sechting
- */
-
-#include<mod_sched_defines.h>
-#include<stdio.h>
-#include<stdlib.h>
-#include<stdarg.h>
-#include"../../fw_task.h"
-
- void printfw(const char* formatstring, ...)
- {
-       va_list list;
-       va_start(list, formatstring);
-       vprintf(formatstring, list);
-       va_end(list);
-       fflush(0);
-}
-
-void *mallocfw(size_t size)
-{
-       return malloc(size);
-}
-
-void freefw(void *ptr)
-{
-       free(ptr);
-}
-
-void init_modsched_framework(void* idletask){
-       init_sched_pub_sub();
-       init_fw_tasks();
-}
diff --git a/framework/pub_sub.c b/framework/pub_sub.c
deleted file mode 100644 (file)
index 06e1c2a..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * pub_sub.c
- *
- * Initializes a simple Publish/Subscribe mechanism
- * for the Scheduler Framework.
- *
- * Topics are identified by positive integers that are mapped
- * to an array and cannot have gaps between them. The amount
- * of topics is defined in the preprocessor directive TOPICS.
- *
- * Messages are limited to being just plain strings.
- *
- *
- *  Created on: 14.06.2013
- *      Author: Daniel Roehrig, Christian Rene Sechting
- */
-#include "pub_sub.h"
-#include<mod_sched_defines.h>
-
-#define TOPICS 5//Number of Topics
-
-topic_list topic_arr[TOPICS];//May be confused with topic_t
-int initialized = 0;//Preventing Kernel Panic since 2013
-
-
-void printfw(const char* formatstring, ...);
-void *mallocfw(size_t size);
-
-/**
- * Initialize the array that contains the topics.
- */
-
-int init_sched_pub_sub(void)
-{
-       int i = 0;
-
-       //Initialize the different topics
-       for (i = 0; i < TOPICS; i++) {
-               LIST_FW_INIT(topic_arr[i].head);
-       }
-
-       printfw("++++++++++++++++Scheduler Pub/Sub System Initialized+++++++++++++++++++++++\n");
-       initialized=1;//The Pub/Sub-System can now be used
-       return 0;
-}
-
-/**
- * Return a topic(list) by its id
- * @param topic_id An integer corresponding to the needed topic
- * @return topic that was requested or null if topic does not exist
- */
-static topic_list* get_topic_by_id(int topic_id) {
-       if (topic_id >= TOPICS || topic_id < 0) {
-               return NULL ;
-       }
-       return &topic_arr[topic_id]; //Aus Testgr�nden haben wir nur eins
-}
-
-/**
- * Register a callback function for a topic
- *
- * Each topic has a list of callback-functions that is being called
- * whenever a new message for that topic arrives.
- * @param topic_id
- * @param callback
- * @return
- */
-int subscribe_to_topic(int topic_id, void* callback) {
-       topic_list* topic_header;
-       if(initialized==0){//Force initialization when first needed
-               init_sched_pub_sub();
-       }
-       topic_header = get_topic_by_id(topic_id);
-       if (topic_header == NULL ) {
-               printfw("Subscribe to Topic Failed: No topic with id %d found!",topic_id);
-               return 1;
-       } else {
-               topic_list* new_topic_elem;
-               new_topic_elem = mallocfw(sizeof(topic_list));
-               new_topic_elem->callback = callback;
-               list_fw_add_tail(&new_topic_elem->head,&topic_header->head);
-               printfw("+++ Subscribed to Topic %d +++\n", topic_id);
-       }
-       return 0;
-}
-
-/**
- * Deregister a callback function from a topic
- * WARNING! This does NOT Work in Kernel Mode! Throws a Kernel Panic that we cannot explain.
- */
-int unsubscribe_from_topic(int topic_id, void* callback){
-       topic_list* topic_header;
-       if(initialized==0){//Force initialization when first needed
-               init_sched_pub_sub();
-       }
-       topic_header = get_topic_by_id(topic_id);
-               if (topic_header == NULL ) {
-                       printfw("Unsubscribe from Topic Failed: No topic with id %d found!",topic_id);
-                       return 1;
-               } else {
-                       topic_list* pos=topic_header;
-                       fw_list_for_each_entry(pos, &topic_header->head, head){
-                               if(pos->callback==callback){
-                                       printfw("Found Topic To Unsubscribe!\n");
-                                       list_fw_del(&pos->head);
-                                       return 0;
-                               }
-                       }
-                       printfw("Cannot Unsubscribe from Topic %d. Cannot find the given callback function.\n", topic_id);
-               }
-               return 0;
-}
-
-/**
- * Send a string to a topic
- *
- * @topic_id: subject id
- * @message: string that is to be delivered to the module
- */
-void *send_to_topic(int topic_id, ...) {
-       void *to_schedule = NULL;
-       struct fw_task *ret = NULL;
-       topic_list* topic_header = get_topic_by_id(topic_id);
-       if(initialized==0){//Force initialization when first needed
-               init_sched_pub_sub();
-       }
-       if (topic_header == NULL) {
-               printfw("Send To Channel Failed: No topic with id %d found!",topic_id);
-               return NULL;
-       } else {
-                       if(!list_fw_empty(&topic_header->head)){
-                               va_list list;
-                               topic_list *pos;
-                               va_start(list, topic_id);
-                               pos=topic_header;
-                               switch(topic_id){
-                                       case 0://OS demands to wake up the following task
-                                       {
-                                               void *native_task = va_arg(list, void*);
-                                               struct fw_task *wake_up = register_task(native_task);
-                                               fw_list_for_each_entry(pos, &topic_header->head, head){
-                                                       topic_0_callback* cb = (topic_0_callback*) pos->callback;
-                                                       ret = cb(wake_up);
-                                               }
-                                               break;
-                                       }
-                                       case 1://new task has arrived
-                                               {
-                                                       void *new_task_real = va_arg(list, void *);
-                                                       struct fw_task *new_task = register_task(new_task_real);
-                       
-                                                       fw_list_for_each_entry(pos, &topic_header->head, head){
-                                                               topic_1_callback* cb = (topic_1_callback*) pos->callback;
-                                                               ret = cb(new_task);
-                                                       }
-                                                       break;
-                                               }
-                                       case 2://task finished 
-                                               {
-                                                       void *finished_real = va_arg(list, void *);
-                                                       struct fw_task *finished = find_fw_task(finished_real);
-                                                       fw_list_for_each_entry(pos, &topic_header->head, head){
-                                                               topic_2_callback* cb = (topic_2_callback*) pos->callback;
-                                                               ret = cb(finished);
-                                                       }
-                                                       break;
-                                               }
-                                       case 3://tick 
-                                               {
-                                                       fw_list_for_each_entry(pos, &topic_header->head, head){
-                                                               topic_3_callback* cb = (topic_3_callback*) pos->callback;
-                                                               ret = cb();
-                                                       }
-                                                       break;
-                                               }
-                                       case 4://task yield
-                                               {
-                                                       void *yielded_real = va_arg(list, void *);
-                                                       struct fw_task *yielded = find_fw_task(yielded_real);
-                                                       fw_list_for_each_entry(pos, &topic_header->head, head){
-                                                               topic_4_callback* cb = (topic_4_callback*) pos->callback;
-                                                               ret = cb(yielded);
-                                                       }
-                                                       break;
-                                               }
-                                       default:
-                                               break;
-
-                               }
-                               va_end(list);
-                       }
-                       if(ret)
-                               to_schedule = find_real_task(ret);
-       }
-       return to_schedule;
-}
diff --git a/framework/pub_sub.h b/framework/pub_sub.h
deleted file mode 100644 (file)
index 215e484..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * pub_sub.h
- *
- * Initializes a simple Publish/Subscribe mechanism
- * for the Scheduler Framework.
- *
- *  Created on: 14.06.2013
- *      Author: Daniel R�hrig, Christian Ren� Sechting
- */
-
-#ifndef PUB_SUB_H_
-#define PUB_SUB_H_
-
-#include "fw_list.h"
-#include "fw_task.h"
-
-/* List implementation similar to the linux lists */
-typedef struct topic topic_list;
-struct topic{
-       struct list_fw_head head;
-       void* callback;
-};
-/*
- * 0: Task Activated
- * 1: Task Deactivated
- * 2: ?
- * 3: ?
- */
-typedef enum {ACTIVATED, DEACTIVATED, COMING, SOON} topic_t;
-
-/**
- * Callbacks for the pubsub system
- */
-
-typedef void *topic_0_callback(struct fw_task *wake_up);
-typedef void *topic_1_callback(struct fw_task *task);
-typedef void *topic_2_callback(struct fw_task *finished);
-typedef void *topic_3_callback(void);
-typedef void *topic_4_callback(struct fw_task *yielded);
-
-int init_sched_pub_sub(void);
-
-//TODO: topic_id should be topic_t
-int subscribe_to_topic(int topic_id, void* callback);
-
-//TODO: topic_id should be topic_t
-void *send_to_topic(int topic_id, ...);
-
-//TODO: topic_id should be topic_t
-int unsubscribe_from_topic(int topic_id, void* callback);
-
-#endif /* PUB_SUB_H_ */
index dc0abb6..8ae5956 100644 (file)
@@ -1,6 +1,8 @@
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_clock.o = -pg
 endif
+KBUILD_CFLAGS += -DFW_OS_LINUX
+KBUILD_CFLAGS += -Ikernel/sched/modsched/framework/include
 
 ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
 # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
@@ -13,4 +15,4 @@ endif
 
 obj-y += core.o clock.o cputime.o
 
-obj-y += framework/
+obj-y += framework/os/linux/
index b809e92..66d77ef 100644 (file)
 #include "../workqueue_internal.h"
 #include "../smpboot.h"
 
-/*
- * FRAMEWORK STUFF
- */
-void init_modsched_framework(void* idletask);
-void *send_to_topic(int topic_id, ...);
+#include <fw.h>
 
 //
 // Variables
@@ -313,7 +309,7 @@ void sched_init(void)
 //     init_sched_fair_class();
 
        //TODO: FRAMEORK
-       init_modsched_framework(current);
+       fw_init();
 
 
        scheduler_running = 1;
@@ -1336,7 +1332,7 @@ void wake_up_new_task(struct task_struct *p)
 //     int cpu = 255;
 
 //     TODO: FRAMEWORK ZEUGS
-       send_to_topic(1,p);
+       fw_notify(FW_ADMIT,p->fw_task);
 
        raw_spin_lock_irqsave(&p->pi_lock, flags);
 
@@ -1435,7 +1431,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
                goto stat;
 
 //     TODO:framework zeugs
-       send_to_topic(0,p);
+       fw_notify(FW_EVENT_OCCURS,p->fw_task);
 
 #ifdef CONFIG_SMP
        /*
@@ -1663,11 +1659,13 @@ need_resched:
 //     }else
        if(prev->state && !(preempt_count() & PREEMPT_ACTIVE)){
                //yield
-               next = (struct task_struct *)send_to_topic(4,prev);
+//             next = (struct task_struct *)send_to_topic(4,prev);
+               fw_notify(FW_EVENT_WAIT,prev->fw_task);
        }else{
                //tick
                //printk("tick on cpu: %d\n",cpu);
-               next = (struct task_struct *)send_to_topic(3);
+//             next = (struct task_struct *)send_to_topic(3);
+               fw_notify(FW_TIMEOUT,prev->fw_task);
        }
 
        pre_schedule(rq, prev);