annotate example/share_task/spe/Load.cc @ 467:44c0bce54dcf

fix all examples. test_render is not working now.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 01 Oct 2009 19:25:25 +0900
parents 58fd16298954
children ab866bc8a624
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include <stdio.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include <string.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 #include "Load.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 #include "Func.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
6 /* これは必須 */
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 SchedDefineTask(Load);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
8
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
9 static int
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
10 run(SchedTask *s, void *rbuf, void *wbuf)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11 {
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
12 int *idata = (int*)s->get_input(rbuf, 0);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13 int *odata;
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
14 int length = s->get_param(0);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
15
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
16 // SPU LS 内に領域確保し、データをコピー
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
17 odata = (int*)s->global_alloc(DATA_ID, sizeof(int)*length);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18 memcpy(odata, idata, sizeof(int)*length);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
20 s->printf("[TASK_LOAD] ");
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 for (int i = 0; i < length; i++) {
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
22 s->printf("%03d ", odata[i]);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23 }
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
24 s->printf("\n");
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
25
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26 return 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
27 }