Mercurial > hg > Members > kono > Cerium
diff example/mainMem/spe/Hello.cc @ 312:57530cb7f7d1
memMain tester
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Jun 2009 23:19:11 +0900 |
parents | |
children | c9f8cfcdc5c2 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/mainMem/spe/Hello.cc Mon Jun 08 23:19:11 2009 +0900 @@ -0,0 +1,35 @@ +#include <stdio.h> +#include "Hello.h" +#include "Func.h" + +/* これは必須 */ +SchedDefineTask(Hello); + +#define PP_STORE 3 +#define SIZE (4096*sizeof(int)) + +int +Hello::run(void *rbuf, void *wbuf) +{ + int task_id = get_param(0); + int *ptr = smanager->allocate(SIZE); + + smanager->mainMem_alloc(0, sizeof(PolygonPack)); + + int i; + for(i=0;i<4096;i++) { + ptr[i] = i; + } + + smanager->mainMem_wait(); + void *next = (void *)smanager->mainMem_get(0); + + smanager->dma_wait(PP_STORE); + smanager->dma_store(ptr, (uint32)next, + SIZE, PP_STORE); + + + printf("[%d] Main Mem %0x len %d\n", task_id, (int*)next,SIZE); + + return 0; +}