dol: initial dol commit
[jump.git] / dol / src / dol / visitor / cell / lib / spu / Fifo.h
diff --git a/dol/src/dol/visitor/cell/lib/spu/Fifo.h b/dol/src/dol/visitor/cell/lib/spu/Fifo.h
new file mode 100644 (file)
index 0000000..798e7dd
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef _FIFO_H_
+#define _FIFO_H_
+
+#include <stdio.h>
+#include <string.h>
+
+#include "../constant.h"
+
+#include "../lib/malloc_align.h"
+#include "../lib/free_align.h"
+
+class Fifo {
+    public:
+        Fifo(unsigned size);
+        virtual ~Fifo();
+
+               // Read / Write
+        virtual unsigned read(void *destination, unsigned len);
+        virtual unsigned write(const void *source, unsigned len);
+        
+               // Buffer functions
+               virtual unsigned used() const;
+        virtual unsigned unused() const;
+        virtual unsigned size() const;
+        
+               // DMA functions
+        virtual char *getQueuePointer();
+        virtual void dmaRead(unsigned len);
+        virtual unsigned dmaStart();
+        virtual bool dmaAllowed();
+                               
+           // Global Variables
+        unsigned _inTail;
+
+    protected:
+        char *_buffer;         // Buffer pointer
+
+        unsigned _tail;        // Pointer to the tail
+        
+               unsigned _pos;         // Amount used
+        unsigned _size;        // Size of the buffer
+        
+               unsigned _blocked;     // Number of blocking necessary
+        bool _activeDMA;       // Active DMA?
+};
+
+#endif