comparison TaskManager/Cell/spe/SchedTask.cc @ 88:504899860e66

*** empty log message ***
author gongo
date Wed, 27 Feb 2008 17:16:29 +0900
parents b03a4d3565c0
children 5c194c71eca8
comparison
equal deleted inserted replaced
87:265fb700dd4c 88:504899860e66
3 #include "SchedNop2Ready.h" 3 #include "SchedNop2Ready.h"
4 #include "DmaManager.h" 4 #include "DmaManager.h"
5 #include "error.h" 5 #include "error.h"
6 #include "TaskManager.h" 6 #include "TaskManager.h"
7 7
8 //extern int (*func_list[16])(void*, void*); 8 extern SchedTask::TaskObject task_list[16];
9
10 SchedTask*
11 CreateSchedTask(TaskListPtr taskList, void *readbuf, void *writebuf,
12 DmaManager* dma)
13 {
14 TaskPtr task = &taskList->tasks[--taskList->length];
15
16 return task_list[task->command](taskList, task, readbuf, writebuf, dma);
17 }
18
9 19
10 SchedTask::SchedTask(TaskListPtr _list, TaskPtr _task, void *rbuf, void *wbuf, 20 SchedTask::SchedTask(TaskListPtr _list, TaskPtr _task, void *rbuf, void *wbuf,
11 DmaManager* cn) 21 DmaManager* cn)
12 { 22 : list(_list), task(_task), readbuf(rbuf), writebuf(wbuf), connector(cn) {}
13 list = _list;
14 task = _task;
15 readbuf = rbuf;
16 writebuf = wbuf;
17 connector = cn;
18 }
19 23
20 void 24 void
21 SchedTask::read(void) 25 SchedTask::read(void)
22 { 26 {
23 __debug("[SchedTask:%s]\n", __FUNCTION__); 27 __debug("[SchedTask:%s]\n", __FUNCTION__);
24 28
25 //task = &list->tasks[--list->length];
26 connector->dma_load(readbuf, task->in_addr, task->in_size, DMA_READ); 29 connector->dma_load(readbuf, task->in_addr, task->in_size, DMA_READ);
27 } 30 }
28 31
29 void 32 void
30 SchedTask::exec(void) 33 SchedTask::exec(void)
38 __debug(" task->in_addr = 0x%x\n", task->in_addr); 41 __debug(" task->in_addr = 0x%x\n", task->in_addr);
39 __debug(" task->out_addr = 0x%x\n", task->out_addr); 42 __debug(" task->out_addr = 0x%x\n", task->out_addr);
40 __debug(" list->next = 0x%x\n", (unsigned int)list->next); 43 __debug(" list->next = 0x%x\n", (unsigned int)list->next);
41 __debug(" list->length = 0x%x\n", (unsigned int)list->length); 44 __debug(" list->length = 0x%x\n", (unsigned int)list->length);
42 45
43 //task->in_size = func_list[task->command](readbuf, writebuf);
44 task->in_size = run(readbuf, writebuf); 46 task->in_size = run(readbuf, writebuf);
45 connector->dma_store(writebuf, task->out_addr, task->in_size, DMA_WRITE); 47 connector->dma_store(writebuf, task->out_addr, task->in_size, DMA_WRITE);
46 } 48 }
47 49
48 void 50 void
69 } else { 71 } else {
70 return new SchedTaskList((unsigned int)list->next, 72 return new SchedTaskList((unsigned int)list->next,
71 m->get_curListBuf(), connector); 73 m->get_curListBuf(), connector);
72 } 74 }
73 } else { 75 } else {
74 //return new SchedTask(list, m->get_curReadBuf(), 76 return CreateSchedTask(list, m->get_curReadBuf(), m->get_curWriteBuf(),
75 //m->get_curWriteBuf(), connector); 77 connector);
76
77 // 本当は、ここで task->command に対応する、
78 // SchedTask を継承する class を作ればいい。。。はず
79 return new SchedTask(list, &list->tasks[--list->length],
80 m->get_curReadBuf(), m->get_curWriteBuf(),
81 connector);
82 } 78 }
83 } 79 }
84
85 extern SchedTask* (*task_list[16])(TaskListPtr, TaskPtr, void*, void*,
86 DmaManager*);
87
88 SchedTask*
89 CreateSchedTask(TaskListPtr taskList, void *readbuf, void *writebuf,
90 DmaManager* dma)
91 {
92 TaskPtr task = &taskList->tasks[--taskList->length];
93
94 return task_list[task->command](taskList, task, readbuf, writebuf, dma);
95 }