57
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3 #include "CellBufferManager.h"
|
|
4 #include "CellTaskListInfo.h"
|
|
5
|
|
6 void
|
60
|
7 CellBufferManager::init(void)
|
57
|
8 {
|
65
|
9 BufferManager::init();
|
57
|
10
|
63
|
11 cellTaskListImpl = new CellTaskListInfo;
|
|
12 machineTaskList = new TaskListPtr[machineNum];
|
57
|
13
|
|
14 for (int i = 0; i < machineNum; i++) {
|
63
|
15 machineTaskList[i] = cellTaskListImpl->create();
|
57
|
16 }
|
|
17 }
|
|
18
|
65
|
19 /**
|
|
20 * task の cpu type によって
|
|
21 * それぞれの cpu に対応する active queue に task を追加する。
|
|
22 */
|
57
|
23 void
|
60
|
24 CellBufferManager::append_activeTask(HTaskPtr task)
|
57
|
25 {
|
|
26 TaskQueuePtr q;
|
|
27
|
63
|
28 q = taskQueueImpl->create(task);
|
65
|
29 if (task->cpu_type == CPU_PPE) {
|
|
30 activeTaskQueue = TaskQueueInfo::append(activeTaskQueue, q);
|
|
31 } else {
|
|
32 speActiveTaskQueue = TaskQueueInfo::append(speActiveTaskQueue, q);
|
|
33 }
|
57
|
34 }
|
|
35
|
65
|
36 #if 0 // 継承するかもしれないので保存
|
57
|
37 void
|
60
|
38 CellBufferManager::append_waitTask(HTaskPtr task)
|
57
|
39 {
|
|
40 TaskQueuePtr q;
|
|
41
|
63
|
42 q = taskQueueImpl->create(task);
|
|
43 waitTaskQueue = taskQueueImpl->append(waitTaskQueue, q);
|
57
|
44 }
|
|
45
|
|
46 TaskListPtr
|
60
|
47 CellBufferManager::get_available_taskList(void)
|
57
|
48 {
|
|
49 TaskListPtr list, q;
|
|
50
|
|
51 list = machineTaskList[0];
|
|
52
|
|
53 while (list->next) list = list->next;
|
|
54
|
|
55 if (list->length < TASK_MAX_SIZE) {
|
|
56 return list;
|
|
57 } else {
|
63
|
58 q = cellTaskListImpl->create();
|
|
59 machineTaskList[0] = cellTaskListImpl->append(machineTaskList[0], q);
|
57
|
60 return q;
|
|
61 }
|
|
62 }
|
|
63
|
|
64 void
|
60
|
65 CellBufferManager::clear_taskList(void)
|
57
|
66 {
|
|
67 TaskListPtr p, p1;
|
|
68
|
|
69 machineTaskList[0]->length = 0;
|
|
70
|
|
71 p = machineTaskList[0]->next;
|
|
72 while (p) {
|
|
73 p1 = p;
|
|
74 p = p->next;
|
63
|
75 cellTaskListImpl->free(p1);
|
57
|
76 }
|
|
77 }
|
|
78 #endif
|