dol: initial dol commit
[jump.git] / dol / src / dol / visitor / cell / lib / spu / proc_wrapper.h
1 /*
2  * proc_wrapper.h
3  *
4  *  Created on: Feb 24, 2009
5  *      Author: lschor
6  */
7
8 #ifndef PROC_WRAPPER_H_
9 #define PROC_WRAPPER_H_
10
11 #include <spu_intrinsics.h>
12 #include <spu_mfcio.h>
13
14 #include <string.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17
18 //CBE Macros
19 #define waittag(tag_id) mfc_write_tag_mask(1<<tag_id); \
20         mfc_read_tag_status_all();
21
22 #include "../dol.h"
23
24 /**
25  * Wrapper for a SPE Process
26  */
27 class proc_wrapper {
28 public:
29     proc_wrapper();
30     virtual ~proc_wrapper();
31
32     virtual void init();
33     virtual int fire();
34     virtual bool isDetached() { return _isDetached; }
35     virtual void detach();
36     virtual int getIndex(unsigned indexNumber) const;
37
38     //for FIFO access --> current position you are while blocking
39     unsigned int readPos;
40     unsigned int writePos;
41
42 protected:
43     char* name;
44     DOLProcess _process;
45     bool _isDetached;
46     int _iteratorIndex[4];
47
48     uint32_t* port_id;
49     uint32_t* port_queue_id;
50     uint32_t number_of_ports;
51     virtual int getIndex(const char* string, char* tokens,
52             int indexNumber);
53 };
54
55 #endif /* PROC_WRAPPER_H_ */