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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
1 #include "TaskManager.h"
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
2 #include "Scheduler.h"
700
ef08dd70eafb fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
3 #include "HTask.h"
ef08dd70eafb fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
4 #include "Task.h"
ef08dd70eafb fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
5 #include "SysFunc.h"
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
6
229
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 220
diff changeset
7 TaskManager::TaskManager(int num) : machineNum(num)
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 220
diff changeset
8 {
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 220
diff changeset
9 }
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
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
gongo@localhost.localdomain
parents: 109
diff changeset
12 {
gongo@localhost.localdomain
parents: 109
diff changeset
13 delete m_impl;
gongo@localhost.localdomain
parents: 109
diff changeset
14 }
gongo@localhost.localdomain
parents: 109
diff changeset
15
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
16 /**
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
17 * create_impl(int);
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
18 *
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
19 * [cell版] ../../Cell/CellTaskManagerImpl.cpp
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
20 * [fifo版] ../../Fifo/FifoTaskManagerImpl.cpp
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
21 * で定義されています。コンパイル時に
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
22 *
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
23 * % make cell ってすると cell 版が、
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
24 * % make fifo ってすると fifo 版 がリンクされるようにしているので
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
25 * それに応じて create_impl が返す値を変えています。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
26 * cell だったら CellManagerImpl, fifo だったら FifoManagerImpl です。
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
27 *
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
28 * 今までは ifdef CELL とか書いてましたわ。どっちがいいかね
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
29 *
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
30 * てか、普通に TaskManagerImpl に関数持たせた方が早いか・・・?
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
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
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
33
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
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
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
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
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
39 m_impl->systask_init();
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
40 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
41
20
31a7ff27ee20 *** empty log message ***
gongo
parents: 18
diff changeset
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
31a7ff27ee20 *** empty log message ***
gongo
parents: 18
diff changeset
44 {
31a7ff27ee20 *** empty log message ***
gongo
parents: 18
diff changeset
45 delete m_impl;
31a7ff27ee20 *** empty log message ***
gongo
parents: 18
diff changeset
46 }
31a7ff27ee20 *** empty log message ***
gongo
parents: 18
diff changeset
47
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
48 /**
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
49 * @param [command] Task executes method number
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
50 *
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
51 * @return this task
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
52 */
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
53 HTaskPtr
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 105
diff changeset
54 TaskManager::create_task(int cmd)
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
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
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
57 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
58
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
59 HTaskPtr
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
60 TaskManager::create_task(int cmd, memaddr r, long rs, memaddr w, long ws)
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
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
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
63 }
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
64
700
ef08dd70eafb fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
65 HTaskPtr
ef08dd70eafb fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
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
ef08dd70eafb fix fix ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
68 }
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
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
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
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
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
81 {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
82 m_impl->run();
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
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
gongo@localhost.localdomain
parents: 216
diff changeset
89
gongo@localhost.localdomain
parents: 216
diff changeset
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
gongo@localhost.localdomain
parents: 216
diff changeset
92 {
gongo@localhost.localdomain
parents: 216
diff changeset
93 return machineNum;
gongo@localhost.localdomain
parents: 216
diff changeset
94 }
229
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 220
diff changeset
95
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 220
diff changeset
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
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 220
diff changeset
98 {
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
99 return random();
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
100 }
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
101
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
102 MemList*
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
103 TaskManager::createMemList(int size, int count)
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
104 {
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
105 return get_scheduler()->createMemList(size, count);
229
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 220
diff changeset
106 }
368
1a80a2aa696c change TaskManager
aaa
parents: 229
diff changeset
107
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 370
diff changeset
108 Scheduler*
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 370
diff changeset
109 TaskManager::get_scheduler() {
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 370
diff changeset
110 return m_impl->get_scheduler();
368
1a80a2aa696c change TaskManager
aaa
parents: 229
diff changeset
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 */