annotate example/get_segment/ppe/Hello1.cc @ 1615:2c6e9ed9db3b draft

merge
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 14 May 2013 13:38:17 +0900
parents 74fd8d2a7b9d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
440
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "Hello1.h"
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "Func.h"
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 /* これは必須 */
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 SchedDefineTask(Hello1);
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 #define PP_STORE 3
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 #define SIZE (4096*sizeof(int))
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
464
0d64bdb63005 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 440
diff changeset
10 static int
0d64bdb63005 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 440
diff changeset
11 run(SchedTask *smanager, void *rbuf, void *wbuf)
440
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 {
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 466
diff changeset
13 long task_id = (long)smanager->get_param(0);
440
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 int *ptr = 0;
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 #if 1
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 ptr = (int*)smanager->allocate(SIZE);
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 smanager->mainMem_alloc(0, SIZE);
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 int i;
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 for(i=0;i<4096;i++) {
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 ptr[i] = i;
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 }
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #endif
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 void *next = 0;
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 #if 1
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 smanager->mainMem_wait();
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 next = (void *)smanager->mainMem_get(0);
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 smanager->dma_wait(PP_STORE);
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 466
diff changeset
32 smanager->dma_store(ptr, (memaddr)next, SIZE, PP_STORE);
440
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 #endif
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35
836
74fd8d2a7b9d example fix 50%
tkaito
parents: 625
diff changeset
36 //smanager->fprintf(smanager->stderr_,"Hello1 sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*));
74fd8d2a7b9d example fix 50%
tkaito
parents: 625
diff changeset
37 //smanager->fprintf(smanager->stderr_,"[%d] Main Mem %0lx len %d\n", task_id, (unsigned long)next,(int)SIZE);
74fd8d2a7b9d example fix 50%
tkaito
parents: 625
diff changeset
38 smanager->printf("Hello1 sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*));
74fd8d2a7b9d example fix 50%
tkaito
parents: 625
diff changeset
39 smanager->printf("[%d] Main Mem %0lx len %d\n", task_id, (unsigned long)next,(int)SIZE);
440
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 return 0;
a1c670e29cde fix get_segment exaple PPE task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 }