Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/ppe/TaskManager.cc @ 1531:4443d59a8210 draft
SDL.h in main.cc
author | yuhi@cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 07 Dec 2012 15:46:27 +0900 |
parents | 163220e54cc0 |
children | 9ccfdc408d51 |
rev | line source |
---|---|
3 | 1 #include "TaskManager.h" |
619 | 2 #include "Scheduler.h" |
700 | 3 #include "HTask.h" |
4 #include "Task.h" | |
5 #include "SysFunc.h" | |
3 | 6 |
229 | 7 TaskManager::TaskManager(int num) : machineNum(num) |
8 { | |
9 } | |
3 | 10 |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
373
diff
changeset
|
11 TaskManager::~TaskManager() |
194 | 12 { |
13 delete m_impl; | |
14 } | |
15 | |
3 | 16 /** |
17 * create_impl(int); | |
18 * | |
109 | 19 * [cell版] ../../Cell/CellTaskManagerImpl.cpp |
20 * [fifo版] ../../Fifo/FifoTaskManagerImpl.cpp | |
21 * で定義されています。コンパイル時に | |
3 | 22 * |
109 | 23 * % make cell ってすると cell 版が、 |
24 * % make fifo ってすると fifo 版 がリンクされるようにしているので | |
25 * それに応じて create_impl が返す値を変えています。 | |
26 * cell だったら CellManagerImpl, fifo だったら FifoManagerImpl です。 | |
3 | 27 * |
109 | 28 * 今までは ifdef CELL とか書いてましたわ。どっちがいいかね |
3 | 29 * |
109 | 30 * てか、普通に TaskManagerImpl に関数持たせた方が早いか・・・? |
3 | 31 */ |
1229
424c1f16e704
add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
1057
diff
changeset
|
32 extern TaskManagerImpl* create_impl(int,int); |
3 | 33 |
34 void | |
1479
163220e54cc0
remove hard code for TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
1229
diff
changeset
|
35 TaskManager::init(int spuIdle, int export_task_log, int useRefDma=0) |
3 | 36 { |
1229
424c1f16e704
add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents:
1057
diff
changeset
|
37 m_impl = create_impl(machineNum,useRefDma); |
1479
163220e54cc0
remove hard code for TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
1229
diff
changeset
|
38 m_impl->init(spuIdle, useRefDma, export_task_log); |
109 | 39 m_impl->systask_init(); |
3 | 40 } |
41 | |
20 | 42 void |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
373
diff
changeset
|
43 TaskManager::finish() |
20 | 44 { |
45 delete m_impl; | |
46 } | |
47 | |
3 | 48 /** |
109 | 49 * @param [command] Task executes method number |
3 | 50 * |
51 * @return this task | |
52 */ | |
53 HTaskPtr | |
109 | 54 TaskManager::create_task(int cmd) |
3 | 55 { |
897
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
804
diff
changeset
|
56 return m_impl->create_task(cmd,__builtin_return_address(0)); |
3 | 57 } |
58 | |
634 | 59 HTaskPtr |
60 TaskManager::create_task(int cmd, memaddr r, long rs, memaddr w, long ws) | |
61 { | |
897
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
804
diff
changeset
|
62 return m_impl->create_task(cmd,r,rs,w,ws,__builtin_return_address(0)); |
634 | 63 } |
64 | |
700 | 65 HTaskPtr |
66 TaskManager::create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData) { | |
897
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
804
diff
changeset
|
67 return m_impl->create_task_array(id, num_task, num_param, num_inData, num_outData,__builtin_return_address(0)) ; |
700 | 68 } |
634 | 69 |
216
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
70 /** |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
71 * TaskManaer 終了時に実行される関数の設定 |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
72 */ |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
73 void |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
373
diff
changeset
|
74 TaskManager::set_TMend(void (*endf)(TaskManager *manager)) |
216
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
75 { |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
76 tm_end = endf; |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
77 } |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
78 |
3 | 79 void |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
373
diff
changeset
|
80 TaskManager::run() |
3 | 81 { |
82 m_impl->run(); | |
83 } | |
216
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
84 |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
85 void* |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
86 TaskManager::allocate(int size) { |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
87 return m_impl->allocate(size); |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
194
diff
changeset
|
88 } |
220 | 89 |
90 int | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
373
diff
changeset
|
91 TaskManager::get_cpuNum() |
220 | 92 { |
93 return machineNum; | |
94 } | |
229 | 95 |
96 int | |
397
ce86b0186a4a
delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents:
373
diff
changeset
|
97 TaskManager::get_random() |
229 | 98 { |
619 | 99 return random(); |
100 } | |
101 | |
102 MemList* | |
103 TaskManager::createMemList(int size, int count) | |
104 { | |
105 return get_scheduler()->createMemList(size, count); | |
229 | 106 } |
368 | 107 |
373 | 108 Scheduler* |
109 TaskManager::get_scheduler() { | |
110 return m_impl->get_scheduler(); | |
368 | 111 } |
480
75e4afa40da2
TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
397
diff
changeset
|
112 |
75e4afa40da2
TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
397
diff
changeset
|
113 /* end */ |