dol: initial dol commit
[jump.git] / dol / src / dol / visitor / cbe / lib / common.h
1 /**************************************************************** \r
2  *      COMMON.H\r
3  *      Creator: lschor, 2008-10-30\r
4  *      Description: Specifies some structs and Constants for the CBE-DOL-Implementation\r
5  *      \r
6  *      Revision: \r
7  *      - 2008-10-30: Created\r
8  */\r
9 \r
10 #ifndef _COMMON_H_\r
11 #define _COMMON_H_\r
12 \r
13 #include "dol.h"\r
14 #include "lib/constant.h"\r
15 \r
16 #define SPE_WRITE_DEMAND 0\r
17 #define SPE_READ_DEMAND 1\r
18 #define SPE_WRITE_SUC 2\r
19 #define SPE_READ_SUC 3\r
20 #define SPE_DETACH 4\r
21 \r
22 // the context that PPE forward to SPE\r
23 typedef struct{\r
24         uint64_t port_id;\r
25         uint64_t port_queue_id; \r
26 \r
27         uint64_t processName;   // Address for the name of the process\r
28         uint64_t processNameLen;  // Len of the process Name\r
29 \r
30         uint32_t number_of_ports; \r
31         uint32_t is_detached; \r
32         uint32_t padd[2]; // dummy - for alignment --> It always has to be a multiple of 128 bit! \r
33 } parm_context; // aligned to 16B \r
34 \r
35 typedef struct{\r
36         uint32_t d; \r
37         uint32_t padd[31]; //padd to cache line\r
38 } status_s;\r
39 \r
40 \r
41 // Round a number ot the right DMA number --> Is used for DMA transfers\r
42 uint32_t roundDMA(uint32_t number)\r
43 {\r
44         if (number > 16)\r
45                 return number + 16 - (number % 16);\r
46         else if (number > 8)\r
47                 return 16; \r
48         else if (number > 4)\r
49                 return 8; \r
50         else if (number > 2)\r
51                 return 4; \r
52         else if (number > 1)\r
53                 return 2; \r
54         else \r
55                 return 1; \r
56 }\r
57 \r
58 #endif // _COMMON_H_ \r
59 \r