Mercurial > hg > Game > Cerium
view example/get_segment/spe/Hello.cc @ 354:cfd20d609ace draft
add example/get_segment and change spe/DrawSpan.cpp
author | koba |
---|---|
date | Wed, 15 Jul 2009 17:39:51 +0900 |
parents | |
children | 208ba3551474 |
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); smanager->dma_wait(PP_STORE); uint32 wait_id = smanager->get_segment(next, SIZE); void* cur = smanager->wait_segment(wait_id); //smanager->put_segment(wait_id); //comparePtr *next; #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); free(ptr); return 0; }