109
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3 #include <string.h>
|
81
|
4 #include "SchedTaskList.h"
|
|
5 #include "SchedTask.h"
|
|
6 #include "SchedNop2Ready.h"
|
|
7 #include "DmaManager.h"
|
|
8 #include "error.h"
|
|
9
|
109
|
10 SchedTaskList::SchedTaskList(unsigned int addr, Scheduler *sched)
|
81
|
11 {
|
|
12 params_addr = addr;
|
109
|
13 list = sched->get_curListBuf();
|
|
14 scheduler = sched;
|
|
15
|
|
16 flag_renewTaskList = 0;
|
81
|
17 }
|
|
18
|
109
|
19
|
81
|
20 void
|
|
21 SchedTaskList::read(void)
|
|
22 {
|
|
23 __debug("[SchedTaskList:%s]\n", __FUNCTION__);
|
|
24
|
109
|
25 if (flag_renewTaskList == 0) {
|
|
26 scheduler->dma_load(list,params_addr,sizeof(TaskList),DMA_READ_TASKLIST);
|
|
27 scheduler->dma_wait(DMA_READ_TASKLIST);
|
|
28 } else {
|
|
29 list = (TaskListPtr)params_addr;
|
|
30 }
|
|
31
|
|
32 scheduler->curIndex_taskList = 0;
|
|
33
|
|
34 scheduler->mainMem_wait();
|
81
|
35 }
|
|
36
|
|
37 SchedTaskBase*
|
|
38 SchedTaskList::next(Scheduler *m, SchedTaskBase *p)
|
|
39 {
|
|
40 __debug("[SchedTaskList:%s]\n", __FUNCTION__);
|
|
41
|
|
42 delete p;
|
|
43
|
|
44 if (list->length < 1) {
|
109
|
45 return new SchedNop2Ready(scheduler);
|
81
|
46 } else {
|
109
|
47 SchedTask* task = CreateSchedTask(list, m);
|
|
48 task->__flag_renewTask = this->flag_renewTaskList;
|
|
49 task->__init__();
|
|
50 return task;
|
81
|
51 }
|
|
52 }
|
|
53
|