Mercurial > hg > Game > Cerium
view example/mainMem/spe/Hello.cc @ 313:25dfa7499162 draft
fix ppu mail box waiting (mainMem allocate)
author | kono@localhost.localdomain |
---|---|
date | Tue, 09 Jun 2009 00:10:36 +0900 |
parents | 1db2b3dc6a5a |
children | 1d170c909c09 |
line wrap: on
line source
#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 = 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,"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; }