dol: initial dol commit
[jump.git] / dol / src / dol / visitor / cell / lib / spu / proc_wrapper.h
diff --git a/dol/src/dol/visitor/cell/lib/spu/proc_wrapper.h b/dol/src/dol/visitor/cell/lib/spu/proc_wrapper.h
new file mode 100644 (file)
index 0000000..656fcdb
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * proc_wrapper.h
+ *
+ *  Created on: Feb 24, 2009
+ *      Author: lschor
+ */
+
+#ifndef PROC_WRAPPER_H_
+#define PROC_WRAPPER_H_
+
+#include <spu_intrinsics.h>
+#include <spu_mfcio.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+//CBE Macros
+#define waittag(tag_id) mfc_write_tag_mask(1<<tag_id); \
+        mfc_read_tag_status_all();
+
+#include "../dol.h"
+
+/**
+ * Wrapper for a SPE Process
+ */
+class proc_wrapper {
+public:
+    proc_wrapper();
+    virtual ~proc_wrapper();
+
+    virtual void init();
+    virtual int fire();
+    virtual bool isDetached() { return _isDetached; }
+    virtual void detach();
+    virtual int getIndex(unsigned indexNumber) const;
+
+    //for FIFO access --> current position you are while blocking
+    unsigned int readPos;
+    unsigned int writePos;
+
+protected:
+    char* name;
+    DOLProcess _process;
+    bool _isDetached;
+    int _iteratorIndex[4];
+
+    uint32_t* port_id;
+    uint32_t* port_queue_id;
+    uint32_t number_of_ports;
+    virtual int getIndex(const char* string, char* tokens,
+            int indexNumber);
+};
+
+#endif /* PROC_WRAPPER_H_ */