Mercurial > hg > Game > Cerium
annotate TaskManager/include/types.h @ 647:7ba4ad4538b1 draft
MailManager rewrite. not yet worked.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 21 Nov 2009 16:18:47 +0900 |
parents | 30dd8a3deb4a |
children | 08ed5e750d78 |
rev | line source |
---|---|
46 | 1 #ifndef INCLUDED_TYPES |
2 #define INCLUDED_TYPES | |
3 | |
109 | 4 #include <stdint.h> |
5 | |
387
b6fce69839b5
no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
367
diff
changeset
|
6 typedef uint16_t uint16; |
109 | 7 typedef uint32_t uint32; |
8 typedef uint64_t uint64; | |
395 | 9 |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
10 // HOST main memory address |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
11 // SPU's (void *) is always 32bit (actually 18bit (256kbyte)) |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
12 // memaddr is different from (void *) in SPU. |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
13 // |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
14 #ifdef __SPU__ |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
15 #if ABIBIT>32 |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
16 typedef uint64_t memaddr; |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
17 #else |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
18 typedef uint32_t memaddr; |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
19 #endif |
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
20 #else |
625
94d82f2c842f
64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
604
diff
changeset
|
21 typedef char* memaddr; |
631
30dd8a3deb4a
Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
22 #endif |
395 | 23 |
24 | |
647
7ba4ad4538b1
MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
631
diff
changeset
|
25 #define New(Type,Count) ((Type *)malloc(sizeof(Type)*Count)) |
7ba4ad4538b1
MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
631
diff
changeset
|
26 #define ReAlloc(Pointer,Type,Count) ((Type *)realloc((void*)Pointer,sizeof(Type)*Count)) |
7ba4ad4538b1
MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
631
diff
changeset
|
27 |
7ba4ad4538b1
MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
631
diff
changeset
|
28 |
46 | 29 #define SPE_ALIGNMENT 16 |
30 #define SPE_ALIGNMENT_FULL 128 | |
31 #define SPE_ALIGN __attribute__((aligned(SPE_ALIGNMENT))) | |
32 #define SPE_ALIGN_FULL __attribute__((aligned(SPE_ALIGNMENT_FULL)) | |
33 #define ROUND_UP_ALIGN(value, alignment) \ | |
34 (((value) + ((alignment) - 1))&(~((alignment)-1))) | |
35 #define DEFAULT_ALIGNMENT SPE_ALIGNMENT | |
109 | 36 //#define DEFAULT_ALIGNMENT SPE_ALIGNMENT_FULL |
46 | 37 |
58 | 38 #define DMA_MAX_SIZE 16384 |
39 | |
88 | 40 #define round_up16(value) ROUND_UP_ALIGN(value, 16) |
41 #define round_up128(value) ROUND_UP_ALIGN(value, 128) | |
42 | |
298 | 43 // ここも typedef しとくか? |
46 | 44 enum { |
298 | 45 // どの方向かで enum 分けるだろjk... |
109 | 46 // PPE -> SPE |
47 MY_SPE_NOP = 0, | |
46 | 48 MY_SPE_COMMAND_EXIT, |
49 MY_SPE_COMMAND_GO, | |
50 | |
109 | 51 // SPE -> PPE |
46 | 52 MY_SPE_STATUS_BUSY, |
109 | 53 MY_SPE_STATUS_READY, |
54 MY_SPE_COMMAND_MALLOC, | |
46 | 55 }; |
56 | |
109 | 57 #define MAX_USE_SPE_NUM 6 |
58 | |
65 | 59 typedef enum { |
109 | 60 CPU_PPE = 0, // default |
61 CPU_SPE = 1, | |
62 SPE_ANY = CPU_SPE, | |
63 SPE_0 = 2, | |
64 SPE_1 = 3, | |
65 SPE_2 = 4, | |
66 SPE_3 = 5, | |
67 SPE_4 = 6, | |
68 SPE_5 = 7, | |
65 | 69 } CPU_TYPE; |
70 | |
46 | 71 #endif |