1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/openwsn/patches/scheduler.c.patch

169 lines
4.7 KiB
Diff
Raw Normal View History

*** stock_iot-lab_M3/openwsn/scheduler.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/scheduler.c Thu Apr 24 16:55:54 2014
***************
*** 6,38 ****
#include "openwsn.h"
#include "scheduler.h"
! #include "board.h"
#include "debugpins.h"
! #include "leds.h"
! //=========================== variables =======================================
! typedef struct task_llist_t {
! task_cbt cb;
! task_prio_t prio;
! void* next;
! } taskList_item_t;
!
! typedef struct {
! taskList_item_t taskBuf[TASK_LIST_DEPTH];
! taskList_item_t* task_list;
! uint8_t numTasksCur;
! uint8_t numTasksMax;
! } scheduler_vars_t;
scheduler_vars_t scheduler_vars;
!
! typedef struct {
! uint8_t numTasksCur;
! uint8_t numTasksMax;
! } scheduler_dbg_t;
!
! scheduler_dbg_t scheduler_dbg;
//=========================== prototypes ======================================
--- 6,24 ----
#include "openwsn.h"
#include "scheduler.h"
! #include "board_ow.h"
#include "debugpins.h"
! #include "leds_ow.h"
! #include "arch/hwtimer_arch.h"
! #include "thread.h"
! #define ENABLE_DEBUG (0)
! #include "debug.h"
! //=========================== variables =======================================
scheduler_vars_t scheduler_vars;
! scheduler_dbg_t scheduler_dbg;
//=========================== prototypes ======================================
***************
*** 41,56 ****
//=========================== public ==========================================
void scheduler_init() {
-
// initialization module variables
memset(&scheduler_vars,0,sizeof(scheduler_vars_t));
memset(&scheduler_dbg,0,sizeof(scheduler_dbg_t));
// enable the scheduler's interrupt so SW can wake up the scheduler
! SCHEDULER_ENABLE_INTERRUPT();
}
void scheduler_start() {
taskList_item_t* pThisTask;
while (1) {
while(scheduler_vars.task_list!=NULL) {
--- 27,44 ----
//=========================== public ==========================================
void scheduler_init() {
// initialization module variables
memset(&scheduler_vars,0,sizeof(scheduler_vars_t));
memset(&scheduler_dbg,0,sizeof(scheduler_dbg_t));
// enable the scheduler's interrupt so SW can wake up the scheduler
! //SCHEDULER_ENABLE_INTERRUPT();
!
! DEBUG("%s\n",__PRETTY_FUNCTION__);
}
void scheduler_start() {
+ DEBUG("%s\n",__PRETTY_FUNCTION__);
taskList_item_t* pThisTask;
while (1) {
while(scheduler_vars.task_list!=NULL) {
***************
*** 58,64 ****
// the task to execute is the one at the head of the queue
pThisTask = scheduler_vars.task_list;
!
// shift the queue by one task
scheduler_vars.task_list = pThisTask->next;
--- 46,52 ----
// the task to execute is the one at the head of the queue
pThisTask = scheduler_vars.task_list;
! DEBUG("run task %p with prio %d\n", pThisTask->cb, pThisTask->prio);
// shift the queue by one task
scheduler_vars.task_list = pThisTask->next;
***************
*** 71,87 ****
pThisTask->next = NULL;
scheduler_dbg.numTasksCur--;
}
! debugpins_task_clr();
! board_sleep();
! debugpins_task_set(); // IAR should halt here if nothing to do
}
}
void scheduler_push_task(task_cbt cb, task_prio_t prio) {
taskList_item_t* taskContainer;
taskList_item_t** taskListWalker;
INTERRUPT_DECLARATION();
!
DISABLE_INTERRUPTS();
// find an empty task container
--- 59,79 ----
pThisTask->next = NULL;
scheduler_dbg.numTasksCur--;
}
! //DEBUG("no do...\n");
! //debugpins_task_clr();
! // board_sleep();
! //debugpins_task_set(); // IAR should halt here if nothing to do
! thread_yield();
}
+ DEBUG("leaving... WTF?!\n");
}
void scheduler_push_task(task_cbt cb, task_prio_t prio) {
+ DEBUG("%s\n",__PRETTY_FUNCTION__);
taskList_item_t* taskContainer;
taskList_item_t** taskListWalker;
INTERRUPT_DECLARATION();
!
DISABLE_INTERRUPTS();
// find an empty task container
***************
*** 117,124 ****
if (scheduler_dbg.numTasksCur>scheduler_dbg.numTasksMax) {
scheduler_dbg.numTasksMax = scheduler_dbg.numTasksCur;
}
-
ENABLE_INTERRUPTS();
! }
!
! //=========================== private =========================================
--- 109,113 ----
if (scheduler_dbg.numTasksCur>scheduler_dbg.numTasksMax) {
scheduler_dbg.numTasksMax = scheduler_dbg.numTasksCur;
}
ENABLE_INTERRUPTS();
! }