Mercurial > hg > Members > kono > Cerium
annotate example/mainMem/spe/Hello.cc @ 313:c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
author | kono@localhost.localdomain |
---|---|
date | Tue, 09 Jun 2009 00:10:36 +0900 |
parents | 57530cb7f7d1 |
children | 2ddf79a7c5fb |
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 | |
11 int | |
12 Hello::run(void *rbuf, void *wbuf) | |
13 { | |
14 int task_id = 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); | |
33 smanager->dma_store(ptr, (uint32)next, | |
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 | |
313
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
38 fprintf(stderr,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); |
c9f8cfcdc5c2
fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents:
312
diff
changeset
|
39 fprintf(stderr,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); |
312 | 40 |
41 return 0; | |
42 } |