Mercurial > hg > Game > Cerium
diff example/get_segment/ppe/Hello1.cc @ 440:a1c670e29cde draft
fix get_segment exaple PPE task
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 25 Sep 2009 01:47:03 +0900 |
parents | |
children | 0d64bdb63005 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/ppe/Hello1.cc Fri Sep 25 01:47:03 2009 +0900 @@ -0,0 +1,42 @@ +#include <stdio.h> +#include "Hello1.h" +#include "Func.h" + +/* これは必須 */ +SchedDefineTask(Hello1); + +#define PP_STORE 3 +#define SIZE (4096*sizeof(int)) + +int +Hello1::run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + int task_id = get_param(0); + int *ptr = 0; +#if 1 + ptr = (int*)smanager->allocate(SIZE); + + smanager->mainMem_alloc(0, SIZE); + + int i; + for(i=0;i<4096;i++) { + ptr[i] = i; + } +#endif + + void *next = 0; +#if 1 + smanager->mainMem_wait(); + next = (void *)smanager->mainMem_get(0); + + smanager->dma_wait(PP_STORE); + smanager->dma_store(ptr, (uint32)next, + SIZE, PP_STORE); +#endif + + + fprintf(stderr,"Hello1 sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); + fprintf(stderr,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); + + return 0; +}