Further code refactoring.
authorAnselm Busse <anselm.busse@tu-berlin.de>
Tue, 16 Feb 2016 19:38:41 +0000 (20:38 +0100)
committerAnselm Busse <anselm.busse@tu-berlin.de>
Tue, 16 Feb 2016 19:38:41 +0000 (20:38 +0100)
30 files changed:
framework/generated/topo_lb_rr_multi.c
framework/include/fw.h
framework/include/fw_helper.h
framework/include/fw_irq.h
framework/include/fw_platform.h [new file with mode: 0644]
framework/include/fw_task.h
framework/include/fw_types.h
framework/include/os.h
framework/include/os/helper.h [new file with mode: 0644]
framework/include/os/irq.h [moved from framework/include/os_irq.h with 92% similarity]
framework/include/os/lock.h [moved from framework/include/os_lock.h with 95% similarity]
framework/include/os/mem.h [new file with mode: 0644]
framework/include/os/platform.h [new file with mode: 0644]
framework/include/os/sched.h [moved from framework/include/os_sched.h with 95% similarity]
framework/include/os/target.h [moved from framework/include/os_target.h with 81% similarity]
framework/include/os/targets/bertos.h [moved from framework/include/os/bertos.h with 100% similarity]
framework/include/os/targets/bertos.lds [moved from framework/include/os/bertos.lds with 100% similarity]
framework/include/os/targets/fbsd.h [moved from framework/include/os/fbsd.h with 100% similarity]
framework/include/os/targets/linux.h [new file with mode: 0644]
framework/include/os/types.h [moved from framework/include/os_types.h with 95% similarity]
framework/include/os_kdb.h [deleted file]
framework/lib/fw_pipe.c
framework/lib/fw_platform.c [new file with mode: 0644]
framework/lib/fw_sched.c
framework/os/linux/Makefile
framework/os/linux/linux_sched.c
framework/os/linux/linux_sched.h [moved from framework/include/os/linux.h with 82% similarity]
framework/os/linux/os.c
framework/os/linux/os_kdb.c [deleted file]
framework/os/linux/os_sched.c

index c14a4a2..20e2b3e 100644 (file)
@@ -29,14 +29,14 @@ int fw_build_topo(void)
        int i, num_links;
        fw_pipe_t **temp;
 
-       num_links = fw_num_cpus * 2;
+       num_links = fw_num_cpus() * 2;
 
        if ((topo_pipes = fw_malloc(num_links * sizeof(fw_pipe_t *))) == NULL) {
                        fw_panic("failed to allocate memory for pipes\n");
                        /* never reached */;
        }
 
-       if ((fw_fw_dispatch_pipe = fw_malloc(fw_num_cpus * sizeof(fw_pipe_t *))) == NULL) {
+       if ((fw_fw_dispatch_pipe = fw_malloc(fw_num_cpus() * sizeof(fw_pipe_t *))) == NULL) {
                        fw_panic("failed to allocate memory for dispatching pipes\n");
                        /* never reached */;
        }
@@ -59,26 +59,26 @@ int fw_build_topo(void)
        }
 
        /* create default topo_links */
-       for (i=0; i<fw_num_cpus; i++)
+       for (i=0; i<fw_num_cpus(); i++)
                fw_fw_dispatch_pipe[i] = topo_pipes[i];
 
        /* link modules */
-       temp = fw_malloc((fw_num_cpus+1) * sizeof(fw_pipe_t*));
+       temp = fw_malloc((fw_num_cpus()+1) * sizeof(fw_pipe_t*));
 
        fw_printf("Creating a new Instance of %s...", fw_component_name(0x02));
        temp[0] = fw_fw_ready_pipe;
-       for (i=0; i<fw_num_cpus; i++)
-               temp[i+1] = topo_pipes[fw_num_cpus+i];
+       for (i=0; i<fw_num_cpus(); i++)
+               temp[i+1] = topo_pipes[fw_num_cpus()+i];
 
-       if (fw_component_new(0x02, 0, fw_num_cpus+1, temp) == NULL) {
+       if (fw_component_new(0x02, 0, fw_num_cpus()+1, temp) == NULL) {
                fw_panic("failed to allocate component\n");
                /* never reached */;
        }
        fw_printf("done!\n");
 
-       for (i=0;i<fw_num_cpus;i++) {
+       for (i=0;i<fw_num_cpus();i++) {
                fw_printf("Creating a new Instance of %s...", fw_component_name(0x01));
-               temp[0] = topo_pipes[fw_num_cpus+i];
+               temp[0] = topo_pipes[fw_num_cpus()+i];
                temp[1] = topo_pipes[i];
                if (fw_component_new(0x01, i+1, 2, temp) == NULL) {
                        fw_panic("failed to allocate component\n");
index ed3deaa..52d7888 100644 (file)
 #include <fw_lock.h>
 #include <fw_mem.h>
 #include <fw_pipe.h>
+#include <fw_platform.h>
 #include <fw_task.h>
 #include <fw_types.h>
 
+void fw_init(void);
+
 #endif /* FW_H_ */
index f3c53ea..e19e038 100644 (file)
  */
 #define fw_panic(fmt, ...) os_panic("CoBaS Panic: " fmt, ## __VA_ARGS__)
 
-/**
- * CPU information.
- */
-#define fw_num_cpus os_num_cpus
-#define fw_cpu_id os_cpu_id
-
-/**
- * Macros to access OS dependent task information.
- */
-#define FW_TASK_NAME(tsk) OS_TASK_NAME(tsk)
-#define FW_TASK_ID(tsk) OS_TASK_ID(tsk)
-#define FW_TASK_CPU(tsk) OS_TASK_CPU(tsk)
-#define FW_TASK_CPUMASK(tsk) OS_TASK_CPUMASK(tsk)
-#define FW_CPU_ISSET(tsk, cpu) OS_CPU_ISSET(tsk, cpu)
-#define FW_TASK_STATE(tsk) OS_TASK_STATE(tsk)
-
-#define FW_SMP_STARTED OS_SMP_STARTED
-
 #ifndef UNUSED
        #define UNUSED(x) do { (void)(x); } while (0)
 #endif
index 85d3687..6ba4a0b 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef _FW_IRQ_H_
 #define _FW_IRQ_H_
 
-#include <os_irq.h>
+#include <os/irq.h>
 
 /**
  * This type maps the generic CoBaS interrupt flags to the operating system
diff --git a/framework/include/fw_platform.h b/framework/include/fw_platform.h
new file mode 100644 (file)
index 0000000..c5af51e
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * @file fw_platform.h
+ * @author Anselm Busse
+ * @date 16 Feb 2015
+ *
+ * This file contains the interface definition to obtain information of the
+ * current platform. For now it only contains very basic information.
+ */
+#ifndef FW_PLAFORM_H_
+#define FW_PLAFORM_H_
+
+/*
+ * CPU information.
+ */
+
+/**
+ * \brief Obtains the current number of PE in the system.
+ *
+ * @return Current number of processing elements.
+ */
+int fw_num_cpus(void);
+
+/**
+ * \brief Obtains the id of the current PE.
+ *
+ * @return The id of the current PE.
+ */
+int fw_cpu_id(void);
+
+#endif /* FW_PLAFORM_H_ */
index 97221f0..a133e5a 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <fw_types.h>
 
+
 /**
  * Definition of task states in CoBaS.
  */
index 0c4aa81..ff8f483 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef FW_TYPES_H_
 #define FW_TYPES_H_
 
-#include <os_types.h>
+#include <os.h>
 
 #include <fw_limits.h>
 #include <fw_pipe_pcb.h>
index 13f1595..f2512f1 100644 (file)
@@ -9,68 +9,15 @@
 #ifndef OS_H_
 #define OS_H_
 
-//this must be included fist as it has multiple mappings to target OS related stuff
-#include <os_target.h>
-#include <os_irq.h>
-#include <os_lock.h>
-#include <os_sched.h>
+#include <os/helper.h>
+#include <os/irq.h>
+#include <os/lock.h>
+#include <os/mem.h>
+#include <os/platform.h>
+#include <os/sched.h>
+#include <os/target.h>
+#include <os/types.h>
 
-#include <os_kdb.h>
-
-#ifndef os_printf
-       #warning 'os_printf' not defined, debug output not available
-       #define os_printf(fmt, ...)
-#endif
-
-
-/*
- * CPU information.
- */
-#ifndef os_num_cpus
-       #warning 'os_num_cpus' not defined, assuming 1 (one!) core
-       #define os_num_cpus 1
-#endif
-#ifndef os_cpu_id
-       #define os_cpu_id() 0
-#endif
-
-/*
- * Macros to access OS dependent task information.
- */
-#ifndef OS_TASK_NAME
-       #define OS_TASK_NAME(tsk) NULL
-#endif
-#ifndef OS_TASK_ID
-       #define OS_TASK_ID(tsk) NULL
-#endif
-#ifndef OS_TASK_CPU
-       #define OS_TASK_CPU(tsk) NULL
-#endif
-#ifndef OS_TASK_CPUMASK
-       #define OS_TASK_CPUMASK(tsk) NULL
-#endif
-#ifndef OS_CPU_ISSET
-       #define OS_CPU_ISSET(tsk, cpu) NULL
-#endif
-
-#ifndef OS_SMP_STARTED
-       #define OS_SMP_STARTED 0
-#endif
-
-/**
- * \brief Dynamic allocation of memory.
- *
- * @param size The amount of memory to allocate.
- * @return A pointer to the allocated memory.
- */
-void *os_malloc(os_size_t size);
-
-/**
- * \brief Releases a dynamically allocated chunk of memory.
- *
- * @param ptr Memory region to release.
- */
-void os_free(void* addr);
 
 /**
  * \brief Initialization of the operating depended code.
diff --git a/framework/include/os/helper.h b/framework/include/os/helper.h
new file mode 100644 (file)
index 0000000..07970d4
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * helper.h
+ *
+ *  Created on: 16.02.2016
+ *      Author: abusse
+ */
+
+#ifndef OS_HELPER_H_
+#define OS_HELPER_H_
+
+#include <os/target.h>
+
+#ifndef os_printf
+       #warning 'os_printf' not defined, debug output not available
+       #define os_printf(fmt, ...)
+#endif
+
+
+#endif /* OS_HELPER_H_ */
similarity index 92%
rename from framework/include/os_irq.h
rename to framework/include/os/irq.h
index e10587f..38e6d27 100644 (file)
@@ -8,7 +8,8 @@
 #ifndef _OS_IRQ_H_
 #define _OS_IRQ_H_
 
-#include <os_target.h>
+#include <os/target.h>
+#include <os/types.h>
 
 #ifndef os_irq_flags
 #error os_irq_flags not defined
similarity index 95%
rename from framework/include/os_lock.h
rename to framework/include/os/lock.h
index 375b323..a93d640 100644 (file)
@@ -8,8 +8,8 @@
 #ifndef OS_LOCK_H_
 #define OS_LOCK_H_
 
-#include <os_irq.h>
-
+#include <os/target.h>
+#include <os/irq.h>
 
 
 #ifndef OS_DEFINE_SPINLOCK
diff --git a/framework/include/os/mem.h b/framework/include/os/mem.h
new file mode 100644 (file)
index 0000000..4a82015
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * mem.h
+ *
+ *  Created on: 16.02.2016
+ *      Author: abusse
+ */
+
+#ifndef OS_MEM_H_
+#define OS_MEM_H_
+
+#include <os/target.h>
+#include <os/types.h>
+
+/**
+ * \brief Dynamic allocation of memory.
+ *
+ * @param size The amount of memory to allocate.
+ * @return A pointer to the allocated memory.
+ */
+#ifndef os_malloc
+void *os_malloc(os_size_t size);
+#endif
+
+/**
+ * \brief Releases a dynamically allocated chunk of memory.
+ *
+ * @param ptr Memory region to release.
+ */
+#ifndef os_free
+void os_free(void* addr);
+#endif
+
+
+#endif /* OS_MEM_H_ */
diff --git a/framework/include/os/platform.h b/framework/include/os/platform.h
new file mode 100644 (file)
index 0000000..ebc0d2c
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * platform.h
+ *
+ *  Created on: 16.02.2016
+ *      Author: abusse
+ */
+
+#ifndef OS_PLATFORM_H_
+#define OS_PLATFORM_H_
+
+#include <os/target.h>
+
+/*
+ * CPU information.
+ */
+#ifndef os_num_cpus
+       #warning 'os_num_cpus' not defined, assuming 1 (one!) core
+       #define os_num_cpus 1
+#endif
+#ifndef os_cpu_id
+       #define os_cpu_id() 0
+#endif
+
+#endif /* OS_PLATFORM_H_ */
similarity index 95%
rename from framework/include/os_sched.h
rename to framework/include/os/sched.h
index 0a5fcb7..f4beaeb 100644 (file)
@@ -8,8 +8,10 @@
 #ifndef SCHED_H_
 #define SCHED_H_
 
-#include "fw_types.h"
-#include "fw_task.h"
+#include <os/target.h>
+
+typedef struct fw_task fw_task_t;
+
 
 /**
  * \brief Runs the given task on the given processing unit.
similarity index 81%
rename from framework/include/os_target.h
rename to framework/include/os/target.h
index e3d404a..ba56b58 100644 (file)
@@ -9,13 +9,13 @@
 #define _OS_TARGET_H_
 
 #if defined (FW_OS_LINUX)
-       #include <os/linux.h>
+       #include <os/targets/linux.h>
        #define FW_OS_TARGET_STRING "Linux"
 #elif defined (FW_OS_FREEBSD)
-       #include <os/fbsd.h>
+       #include <os/targets/fbsd.h>
        #define FW_OS_TARGET_STRING "Free BSD"
 #elif defined (FW_OS_BERTOS)
-       #include <os/bertos.h>
+       #include <os/targets/bertos.h>
        #define FW_OS_TARGET_STRING "BERTOS"
 #else
        #error No operating system specified.
diff --git a/framework/include/os/targets/linux.h b/framework/include/os/targets/linux.h
new file mode 100644 (file)
index 0000000..63af30a
--- /dev/null
@@ -0,0 +1,88 @@
+#ifndef LINUX_H_
+#define LINUX_H_
+
+#define FW_DEBUG 1
+
+#include <linux/sched.h>
+
+#include <linux/cpuidle.h>
+#include <linux/slab.h>
+
+#define FW_SMP CONFIG_SMP
+
+/*
+ * Number of existing CPUs.
+ */
+#define os_num_cpus() (nr_cpu_ids)
+#define os_cpu_id smp_processor_id
+
+
+
+#define os_malloc(size)        (kmalloc(size, GFP_ATOMIC))
+#define os_free(ptr)   (kfree(ptr))
+
+/*
+ * Redefinition of some variables.
+ */
+#define os_printf printk
+#define os_panic panic
+#define os_irq_flags unsigned long
+
+#define os_local_irq_disable()  do { local_irq_disable(); } while (0)
+#define os_local_irq_enable() do { local_irq_enable(); } while (0)
+#define os_local_irq_save local_irq_save
+#define os_local_irq_restore local_irq_restore
+
+#define os_size_t unsigned long
+#define __os_task_t struct task_struct
+#define os_task_context_t void
+
+#define os_spinlock_t spinlock_t
+
+#define os_spin_lock(lock) spin_lock(lock)
+#define os_spin_unlock(lock) spin_unlock(lock)
+#define os_spin_lock_irq(lock) spin_lock_irq(lock)
+#define os_spin_unlock_irq(lock) spin_unlock_irq(lock)
+#define os_spin_lock_irqsave(lock, flags) spin_lock_irqsave(lock, flags)
+#define os_spin_unlock_irqrestore(lock, flags) spin_unlock_irqrestore(lock, flags)
+
+#define os_spin_lock_init(lock) raw_spin_lock_init(&(lock)->rlock)
+
+#define OS_DEFINE_SPINLOCK(name) DEFINE_SPINLOCK(name)
+
+
+
+
+#define fw_cpumask cpumask
+#define fw_cpumask_t cpumask_t
+
+#define fw_cpumask_next cpumask_next
+#define fw_cpumask_next_and cpumask_next_and
+#define fw_cpumask_setall cpumask_setall
+
+#define fw_cpumask_set_cpu cpumask_set_cpu
+#define fw_cpumask_clear_cpu cpumask_clear_cpu
+
+
+#endif /* LINUX_H_ */
+
+
+///*
+// * Macros for locking.
+// */
+//#define OS_LOCK_ACQUIRE(lock) atomic_cmpset_acq_ptr((volatile u_long*)(&lock->raw_lock.slock), 0, 1)
+//#define OS_LOCK_RELEASE(lock) atomic_cmpset_rel_ptr((volatile u_long*)(&lock->raw_lock.slock), 1, 0)
+//#define OS_LOCK_ACQUIRE(lock) (cmpxchg(&lock->raw_lock.slock,0,1) == 0)
+//#define OS_LOCK_RELEASE(lock) (cmpxchg(&lock->raw_lock.slock,1,0) == 1)
+
+
+/*
+ * Macros to access thread struct specific OS dependent information.
+ */
+//#define OS_TASK(tsk) (tsk->os_task)
+//#define OS_TASK_NAME(tsk) (OS_TASK(tsk)->comm)
+//#define OS_TASK_ID(tsk) (OS_TASK(tsk)->pid)
+//#define OS_TASK_CPU(tsk) task_thread_info(OS_TASK(tsk))->cpu
+//#define OS_TASK_STATE(tsk) (OS_TASK(tsk)->state)
+//#define OS_TASK_CPUMASK(tsk) ((long)(OS_TASK(tsk)->cpus_allowed.bits[0]))
+//#define OS_CPU_ISSET(tsk, cpu) ((FW_TASK_CPUMASK(tsk) & (1 << cpu)))
similarity index 95%
rename from framework/include/os_types.h
rename to framework/include/os/types.h
index 6ab116e..b947704 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef INCLUDE_OS_TYPES_H_
 #define INCLUDE_OS_TYPES_H_
 
-#include <os_target.h>
+#include <os/target.h>
 
 #ifndef os_size_t
 #error "os_size_t not defined for target OS"
diff --git a/framework/include/os_kdb.h b/framework/include/os_kdb.h
deleted file mode 100644 (file)
index 0cc1209..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * os_kdb.h
- *
- *  Created on: 10.12.2013
- *      Author: jkrieg
- */
-
-#ifndef OS_KDB_H_
-#define OS_KDB_H_
-
-#include "fw_types.h"
-#include "fw_task.h"
-
-/**
- * \brief Writes the task name into the buffer.
- *
- * @param task Obtain information about that task.
- * @param buf The buffer that holds the taskname after invokation.
- * @param size The buffer size.
- * @return Bytes written to the buffer.
- */
-int os_task_name(fw_task_t *task, char *buf, fw_size_t size);
-
-const char *os_task_info(fw_task_t *task);
-
-#endif /* OS_KDB_H_ */
index 6026b9a..cfe428c 100644 (file)
@@ -17,6 +17,7 @@
 #include <fw_components.h>
 #include <fw_helper.h>
 #include <fw_mem.h>
+#include <fw_task.h>
 
 
 /**
diff --git a/framework/lib/fw_platform.c b/framework/lib/fw_platform.c
new file mode 100644 (file)
index 0000000..b5afb87
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+ * @file fw_platform.h
+ * @author Anselm Busse
+ * @date 16 Feb 2015
+ *
+ * This file contains the implementation to obtain informations about the
+ * current platform. For now it only gives very basic information.
+ */
+
+#include <os.h>
+
+int fw_num_cpus(void){
+       return os_num_cpus();
+}
+
+int fw_cpu_id(void){
+       return os_cpu_id();
+}
index 3efb3b7..57caacf 100644 (file)
@@ -13,6 +13,7 @@
 #include <fw_pipe.h>
 #include <fw_comm.h>
 #include <fw_components.h>
+#include <fw_task.h>
 
 #include <fw_debug.h>
 
index 5e75d64..4508fc1 100644 (file)
@@ -6,6 +6,7 @@ obj-y += ../../lib/fw_comm.o \
                 ../../lib/fw_irq.o \
                 ../../lib/fw_mem.o \
                 ../../lib/fw_pipe.o \
+                ../../lib/fw_platform.o \
                 ../../lib/fw_sched.o \
                 ../../lib/fw_task.o 
 
index c404962..5b78c39 100644 (file)
@@ -1,3 +1,5 @@
+#include "linux_sched.h"
+
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/cpumask.h>
 
 #include <fw_init.h>
+#include <fw_task.h>
 #include <fw_types.h>
 #include <fw_comm.h>
+#include <fw_platform.h>
 #include <fw_sched.h>
 #include <fw_helper.h>
-
 #include <topics/admit.h>
 #include <topics/affinity.h>
 #include <topics/block.h>
@@ -84,7 +87,7 @@ int sysctl_sched_rt_runtime = 950000;
  * /kernel/sched/core.c:6866
  *
  */
-struct task_group root_task_group;
+//struct task_group root_task_group;
 
 #ifdef CONFIG_SMP
 /*
@@ -2529,7 +2532,7 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 
        new_cpu = 0;
        j = 1;
-       for(i=0;i<fw_num_cpus;i++){
+       for(i=0;i<fw_num_cpus();i++){
                if(j& p->cpus_allowed.bits[0]){
                        break;
                }else{
similarity index 82%
rename from framework/include/os/linux.h
rename to framework/os/linux/linux_sched.h
index 0d52c42..54a7277 100644 (file)
@@ -1,89 +1,18 @@
-#ifndef LINUX_H_
-#define LINUX_H_
-
-#include <linux/sched.h>
-
-#include <linux/cpuidle.h>
-#include <linux/slab.h>
-
-struct task_group {
-};
-
-/*
- * SMP variables
- */
-extern unsigned int smp_started;
-#define FW_SMP CONFIG_SMP
-
-/*
- * Number of existing CPUs.
- */
-#define os_num_cpus nr_cpu_ids
-#define os_cpu_id smp_processor_id
-
-#define FW_DEBUG 1
-
-#define OS_SMP_STARTED smp_started
-
 /*
- * Redefinition of some variables.
- */
-#define os_printf printk
-#define os_panic panic
-#define os_irq_flags unsigned long
-
-#define os_local_irq_disable()  do { local_irq_disable(); } while (0)
-#define os_local_irq_enable() do { local_irq_enable(); } while (0)
-#define os_local_irq_save local_irq_save
-#define os_local_irq_restore local_irq_restore
-
-#define os_size_t unsigned long
-#define __os_task_t struct task_struct
-#define os_task_context_t void
-
-#define os_spinlock_t spinlock_t
-
-#define os_spin_lock(lock) spin_lock(lock)
-#define os_spin_unlock(lock) spin_unlock(lock)
-#define os_spin_lock_irq(lock) spin_lock_irq(lock)
-#define os_spin_unlock_irq(lock) spin_unlock_irq(lock)
-#define os_spin_lock_irqsave(lock, flags) spin_lock_irqsave(lock, flags)
-#define os_spin_unlock_irqrestore(lock, flags) spin_unlock_irqrestore(lock, flags)
-
-#define os_spin_lock_init(lock) raw_spin_lock_init(&(lock)->rlock)
-
-#define OS_DEFINE_SPINLOCK(name) DEFINE_SPINLOCK(name)
-
-///*
-// * Macros for locking.
-// */
-//#define OS_LOCK_ACQUIRE(lock) atomic_cmpset_acq_ptr((volatile u_long*)(&lock->raw_lock.slock), 0, 1)
-//#define OS_LOCK_RELEASE(lock) atomic_cmpset_rel_ptr((volatile u_long*)(&lock->raw_lock.slock), 1, 0)
-#define OS_LOCK_ACQUIRE(lock) (cmpxchg(&lock->raw_lock.slock,0,1) == 0)
-#define OS_LOCK_RELEASE(lock) (cmpxchg(&lock->raw_lock.slock,1,0) == 1)
-
-
-/*
- * Macros to access thread struct specific OS dependent information.
+ * linux_sched.h
+ *
+ *  Created on: 16.02.2016
+ *      Author: abusse
  */
-#define OS_TASK(tsk) (tsk->os_task)
-#define OS_TASK_NAME(tsk) (OS_TASK(tsk)->comm)
-#define OS_TASK_ID(tsk) (OS_TASK(tsk)->pid)
-#define OS_TASK_CPU(tsk) task_thread_info(OS_TASK(tsk))->cpu
-#define OS_TASK_STATE(tsk) (OS_TASK(tsk)->state)
-#define OS_TASK_CPUMASK(tsk) ((long)(OS_TASK(tsk)->cpus_allowed.bits[0]))
-#define OS_CPU_ISSET(tsk, cpu) ((FW_TASK_CPUMASK(tsk) & (1 << cpu)))
 
+#ifndef LINUX_SCHED_H_
+#define LINUX_SCHED_H_
 
-#define fw_cpumask cpumask
-#define fw_cpumask_t cpumask_t
+#include <linux/sched.h>
 
-#define fw_cpumask_next cpumask_next
-#define fw_cpumask_next_and cpumask_next_and
-#define fw_cpumask_setall cpumask_setall
+#include <linux/cpuidle.h>
+#include <linux/slab.h>
 
-#define fw_cpumask_set_cpu cpumask_set_cpu
-#define fw_cpumask_clear_cpu cpumask_clear_cpu
 
 /*
  * wake flags
@@ -509,4 +438,4 @@ static inline struct cpuidle_state *idle_get_state(struct rq *rq)
 #endif
 
 
-#endif /* LINUX_H_ */
+#endif /* LINUX_SCHED_H_ */
index b7d0281..2b69247 100644 (file)
@@ -8,24 +8,6 @@
 #include <os.h>
 #include <fw_types.h>
 
-
-/**
- * CPU dependent context switching routines.
- *
- * Saving and restoring the context on the stack is done by a CPU-dependent
- * support routine which usually needs to be written in assembly.
- */
-
-void *os_malloc(fw_size_t size)
-{
-       return kmalloc(size, GFP_ATOMIC);
-}
-
-void os_free(void* ptr)
-{
-       kfree(ptr);
-}
-
 int os_init_os()
 {
        return 0;
diff --git a/framework/os/linux/os_kdb.c b/framework/os/linux/os_kdb.c
deleted file mode 100644 (file)
index 0427ca6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * kdb.c
- *
- *  Created on: 10.12.2013
- *      Author: jkrieg
- */
-
-#include <os.h>
-
-int os_task_name(struct fw_task *task, char *buf, fw_size_t size)
-{
-       return strlcpy(buf, os_task_info(task), size);
-}
-
-const char *os_task_info(struct fw_task *task){
-       return 0;
-}
index a40fabd..a776a03 100644 (file)
@@ -5,8 +5,9 @@
  *      Author: jkrieg
  */
 
-#include <os.h>
+#include <fw.h>
 #include <fw_debug.h>
+#include <linux_sched.h>
 
 void os_schedule(struct fw_task *task, int pe)
 {
@@ -26,7 +27,7 @@ void os_schedule(struct fw_task *task, int pe)
                next = rq->idle;
        }
        else {
-               next = OS_TASK(task);
+               next = task->os_task;
        }
        rq->curr = next;
        if(next == prev){
@@ -53,16 +54,16 @@ void os_set_current_task(struct fw_task *task)
 
 void os_need_resched(struct fw_task *task)
 {
-       set_tsk_need_resched(OS_TASK(task));
+       set_tsk_need_resched(task->os_task);
 }
 
 #ifdef FW_SMP
 void os_set_task_cpu(struct fw_task *task, int cpu)
 {
-       struct task_struct *p = OS_TASK(task);
+       struct task_struct *p = task->os_task;
 
        raw_spin_lock(&p->pi_lock);
-       OS_TASK_CPU(task) = cpu;
+       task_thread_info(p)->cpu = cpu;
        raw_spin_unlock(&p->pi_lock);
 }