Mercurial > hg > Members > kono > Cerium
annotate example/mainMem/spe/Hello.cc @ 717:4c12f679a0fa
TaskList load timing...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Dec 2009 12:17:31 +0900 |
parents | ab866bc8a624 |
children | da49d9e458dc |
rev | line source |
---|---|
312 | 1 #include <stdio.h> |
2 #include "Hello.h" | |
3 #include "Func.h" | |
4 | |
5 /* これは必須 */ | |
6 SchedDefineTask(Hello); | |
7 | |
8 #define PP_STORE 3 | |
9 #define SIZE (4096*sizeof(int)) | |
10 | |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
314
diff
changeset
|
11 static int |
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
314
diff
changeset
|
12 run(SchedTask *smanager, void *rbuf, void *wbuf) |
312 | 13 { |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
14 int task_id = (long)smanager->get_param(0); |
313
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
15 int *ptr = 0; |
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
16 #if 1 |
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
17 ptr = (int*)smanager->allocate(SIZE); |
312 | 18 |
313
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
19 smanager->mainMem_alloc(0, SIZE); |
312 | 20 |
21 int i; | |
22 for(i=0;i<4096;i++) { | |
23 ptr[i] = i; | |
24 } | |
313
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
25 #endif |
312 | 26 |
313
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
27 void *next = 0; |
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
28 #if 1 |
312 | 29 smanager->mainMem_wait(); |
313
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
30 next = (void *)smanager->mainMem_get(0); |
312 | 31 |
32 smanager->dma_wait(PP_STORE); | |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
467
diff
changeset
|
33 smanager->dma_store(ptr, (memaddr)next, |
312 | 34 SIZE, PP_STORE); |
313
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
35 #endif |
312 | 36 |
37 | |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
314
diff
changeset
|
38 smanager->fprintf(smanager->stderr_,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); |
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
314
diff
changeset
|
39 smanager->fprintf(smanager->stderr_,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); |
312 | 40 |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
314
diff
changeset
|
41 smanager->free_(ptr); |
312 | 42 return 0; |
43 } |