Mercurial > hg > Game > Cerium
comparison TaskManager/kernel/ppe/TaskManagerImpl.cc @ 58:7492eb28b577
*** empty log message ***
author | gongo |
---|---|
date | Sat, 16 Feb 2008 19:40:20 +0900 |
parents | 90523ccc4dff |
children | 54355e641172 |
comparison
equal
deleted
inserted
replaced
57:1f8a23cdeec3 | 58:7492eb28b577 |
---|---|
12 | 12 |
13 TaskManagerImpl::~TaskManagerImpl(void) | 13 TaskManagerImpl::~TaskManagerImpl(void) |
14 { | 14 { |
15 delete mailManager; | 15 delete mailManager; |
16 delete scheduler; | 16 delete scheduler; |
17 delete taskInfo; | 17 delete bufferManager; |
18 } | 18 } |
19 | 19 |
20 void | 20 void |
21 TaskManagerImpl::init(void) | 21 TaskManagerImpl::init(void) |
22 { | 22 { |
32 TaskManagerImpl::create_task(int cmd, int size, DmaBuffer *in_addr, | 32 TaskManagerImpl::create_task(int cmd, int size, DmaBuffer *in_addr, |
33 DmaBuffer *out_addr, void (*func)(void)) | 33 DmaBuffer *out_addr, void (*func)(void)) |
34 { | 34 { |
35 HTaskPtr new_task; | 35 HTaskPtr new_task; |
36 | 36 |
37 new_task = taskInfo->create_task(cmd, size, in_addr, out_addr); | 37 new_task = bufferManager->create_task(cmd, size, in_addr, out_addr); |
38 | 38 |
39 if (func == NULL) { | 39 if (func == NULL) { |
40 new_task->post_func = noaction; | 40 new_task->post_func = noaction; |
41 } else { | 41 } else { |
42 new_task->post_func = func; | 42 new_task->post_func = func; |
52 void | 52 void |
53 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave) | 53 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave) |
54 { | 54 { |
55 TaskQueuePtr m, s; | 55 TaskQueuePtr m, s; |
56 | 56 |
57 m = taskInfo->create_taskQueue(master); | 57 m = bufferManager->create_taskQueue(master); |
58 s = taskInfo->create_taskQueue(slave); | 58 s = bufferManager->create_taskQueue(slave); |
59 | 59 |
60 master->wait_me = TaskQueueInfo::append(master->wait_me, s); | 60 master->wait_me = TaskQueueInfo::append(master->wait_me, s); |
61 slave->wait_i = TaskQueueInfo::append(slave->wait_i, m); | 61 slave->wait_i = TaskQueueInfo::append(slave->wait_i, m); |
62 } | 62 } |
63 | 63 |
64 void | 64 void |
65 TaskManagerImpl::spawn_task(HTaskPtr task) | 65 TaskManagerImpl::spawn_task(HTaskPtr task) |
66 { | 66 { |
67 if (task->wait_i == NULL) { | 67 if (task->wait_i == NULL) { |
68 taskInfo->append_activeTask(task); | 68 bufferManager->append_activeTask(task); |
69 } else { | 69 } else { |
70 taskInfo->append_waitTask(task); | 70 bufferManager->append_waitTask(task); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 TaskListPtr | 74 TaskListPtr |
75 TaskManagerImpl::set_task(void) | 75 TaskManagerImpl::set_task(void) |
79 TaskQueuePtr queue; | 79 TaskQueuePtr queue; |
80 TaskQueuePtr d; | 80 TaskQueuePtr d; |
81 HTaskPtr htask; | 81 HTaskPtr htask; |
82 TaskPtr task; | 82 TaskPtr task; |
83 | 83 |
84 queue = taskInfo->activeTaskQueue; | 84 queue = bufferManager->activeTaskQueue; |
85 if (queue == NULL) { | 85 if (queue == NULL) { |
86 return NULL; | 86 return NULL; |
87 } | 87 } |
88 | 88 |
89 taskInfo->clear_taskList(); | 89 bufferManager->clear_taskList(); |
90 | 90 |
91 while (queue) { | 91 while (queue) { |
92 list = taskInfo->get_available_taskList(); | 92 list = bufferManager->get_available_taskList(); |
93 htask = queue->task; | 93 htask = queue->task; |
94 d = queue; | 94 d = queue; |
95 queue = queue->next; | 95 queue = queue->next; |
96 | 96 |
97 task = &list->tasks[list->length++]; | 97 task = &list->tasks[list->length++]; |
114 task->out_addr = 0; | 114 task->out_addr = 0; |
115 } | 115 } |
116 task->in_size = htask->in_size; | 116 task->in_size = htask->in_size; |
117 task->self = htask; | 117 task->self = htask; |
118 | 118 |
119 taskInfo->free_taskQueue(d); | 119 bufferManager->free_taskQueue(d); |
120 } | 120 } |
121 | 121 |
122 taskInfo->activeTaskQueue = NULL; | 122 bufferManager->activeTaskQueue = NULL; |
123 | 123 |
124 return list; | 124 return list; |
125 } | 125 } |
126 | 126 |
127 void | 127 void |
174 d = mailManager->create((unsigned int)next_list); | 174 d = mailManager->create((unsigned int)next_list); |
175 ret = MailManager::append_mailQueue(ret, d); | 175 ret = MailManager::append_mailQueue(ret, d); |
176 } | 176 } |
177 } else { | 177 } else { |
178 __debug_ppe("[PPE] recv from : 0x%x\n", data); | 178 __debug_ppe("[PPE] recv from : 0x%x\n", data); |
179 taskInfo->check_task_finish((HTaskPtr)data); | 179 bufferManager->check_task_finish((HTaskPtr)data); |
180 } | 180 } |
181 | 181 |
182 d = q; | 182 d = q; |
183 q = q->next; | 183 q = q->next; |
184 | 184 |