5fd2a262e389c38a1e620d772183ff3d7073eada
[jump.git] / dol / src / dol / visitor / cbe / lib / ppu_main.h
1 /**************************************************************** \r
2  *      Header for the main function\r
3  *      Creator: lschor, 2008-11-21\r
4  *      Description: Header file for the main function of the PPU\r
5  *      \r
6  *      Revision: \r
7  *      - 2008-11-21: Created\r
8  */\r
9 \r
10 #ifndef __PPU_MAIN_H__\r
11 #define __PPU_MAIN_H__\r
12 \r
13 // System includes\r
14 #include <stdio.h>\r
15 #include <stddef.h>\r
16 #include <stdint.h>\r
17 #include <string.h>\r
18 #include <ctype.h>\r
19 #include <stdlib.h>\r
20 #include <libspe2.h>\r
21 #include <pthread.h>\r
22 #include <sys/time.h>\r
23 \r
24 // Local includes\r
25 #include "lib/malloc_align.h"\r
26 #include "lib/free_align.h"\r
27 #include "common.h"\r
28 #include "lib/estimation.h"\r
29 #include "common_ppu.h"\r
30 #include "cbe_mfc.h"\r
31 \r
32 // Handler for the SPE\r
33 extern spe_program_handle_t spu;\r
34 \r
35 // Program context for the SPEs\r
36 volatile parm_context ctx[NUM_SPES] __attribute__ ((aligned(16)));\r
37 \r
38 // The SPE-program-handler\r
39 spe_program_handle_t *program[NUM_SPES];\r
40 \r
41 // data structure for running SPE thread \r
42 typedef struct spu_data {\r
43         spe_context_ptr_t spe_ctx;\r
44         pthread_t pthread;\r
45         void *argp;\r
46 } spu_data_t;\r
47 \r
48 // Data for the SPEs\r
49 spu_data_t data[NUM_SPES];\r
50 \r
51 // Struct which stores a fifo entry temporary\r
52 struct fifoEntry {\r
53         uint64_t ea; \r
54         int length;\r
55         int queue;\r
56 };\r
57 \r
58 // Two temporary store elements\r
59 struct fifoEntry tmpFifoEntryRead[NUM_SPES]; \r
60 struct fifoEntry tmpFifoEntryWrite[NUM_SPES]; \r
61 \r
62 // Initialize the fifo, we use\r
63 const int MAXELEMENT = 262144;\r
64 char *locBuf[NUM_FIFO];\r
65 int locBufCount[NUM_FIFO]; \r
66 int locBufStart[NUM_FIFO]; \r
67 \r
68 // Mutex-variables for the read/write process of the Queues\r
69 pthread_mutex_t mutex [NUM_FIFO];\r
70 pthread_mutex_t mutexProcessNr = PTHREAD_MUTEX_INITIALIZER;\r
71 \r
72 // Number of process that have been finished\r
73 int processFinished = 0; \r
74 \r
75 \r
76 #endif\r