X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fcell%2Flib%2Fspu%2FWindowedFifo.h;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fcell%2Flib%2Fspu%2FWindowedFifo.h;h=5ef97d9d7a3cad4fd6d59b7225486e4d54ea7e6e;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/cell/lib/spu/WindowedFifo.h b/dol/src/dol/visitor/cell/lib/spu/WindowedFifo.h new file mode 100644 index 0000000..5ef97d9 --- /dev/null +++ b/dol/src/dol/visitor/cell/lib/spu/WindowedFifo.h @@ -0,0 +1,60 @@ +#ifndef _WINDOWEDFIFO_H_ +#define _WINDOWEDFIFO_H_ + +#include +#include + +#include "../constant.h" + +#include "../lib/malloc_align.h" +#include "../lib/free_align.h" + +class WindowedFifo { + public: + WindowedFifo(unsigned size); + virtual ~WindowedFifo(); + + // Write + virtual unsigned reserve(char** destination, unsigned len); + virtual void release(); + + // Read + virtual unsigned capture(char** destination, unsigned len); + virtual void consume(); + + // General 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(); + virtual unsigned dmaWrite(const void *source, unsigned len); + + // Global variables + unsigned _inTail; + + protected: + char *_buffer; // Pointer to the buffer + + unsigned _head; // Current position of the head + unsigned _tail; // Current position of the tail + unsigned _headRoom; // HeadRoom pointer + unsigned _tailRoom; // Tailroom pointer + + unsigned _size; // Total space of the buffer + unsigned _use; // How many data are used in the buffer + unsigned _writeReserve; // Number of tokens one is writing + unsigned _readReserve; // Number of tokens one is reading + + bool _isHeadReserved; // Head reserved? + bool _isTailReserved; // Tail reserved? + + unsigned _blocked; // Blocked number the request has to wait + bool _activeDMA; // Is there an active DMA on this buffer +}; + +#endif