Mercurial > hg > Members > e085722 > Cerium
comparison example/mainMem/ppe/Hello.cc @ 0:04e28d8d3c6f
first commit
author | Daiki KINJYO <e085722@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Nov 2010 01:23:25 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:04e28d8d3c6f |
---|---|
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 static int | |
12 run(SchedTask *smanager, void *rbuf, void *wbuf) | |
13 { | |
14 long task_id = (long)smanager->get_param(0); | |
15 int *ptr = 0; | |
16 #if 1 | |
17 ptr = (int*)smanager->allocate(SIZE); | |
18 | |
19 smanager->mainMem_alloc(0, SIZE); | |
20 | |
21 int i; | |
22 for(i=0;i<4096;i++) { | |
23 ptr[i] = i; | |
24 } | |
25 #endif | |
26 | |
27 void *next = 0; | |
28 #if 1 | |
29 smanager->mainMem_wait(); | |
30 next = (void *)smanager->mainMem_get(0); | |
31 | |
32 smanager->dma_wait(PP_STORE); | |
33 smanager->dma_store(ptr, (memaddr)next, | |
34 SIZE, PP_STORE); | |
35 #endif | |
36 | |
37 | |
38 //smanager->fprintf(smanager->stderr_,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); | |
39 //smanager->fprintf(smanager->stderr_,"[%d] Main Mem %0lx len %d\n", task_id, (unsigned long)next,(int)SIZE); | |
40 | |
41 smanager->printf("sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); | |
42 smanager->printf("[%d] Main Mem %0lx len %d\n", task_id, (unsigned long)next,(int)SIZE); | |
43 return 0; | |
44 } |