X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fcell%2Flib%2Fppu%2FWindowedFifo.h;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fcell%2Flib%2Fppu%2FWindowedFifo.h;h=2e94c46bbeff315037206fc0a189e4eeab7c5394;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/cell/lib/ppu/WindowedFifo.h b/dol/src/dol/visitor/cell/lib/ppu/WindowedFifo.h new file mode 100644 index 0000000..2e94c46 --- /dev/null +++ b/dol/src/dol/visitor/cell/lib/ppu/WindowedFifo.h @@ -0,0 +1,61 @@ +#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(void** destination, unsigned len); + virtual void release(); + + // Read + virtual unsigned capture(void** destination, unsigned len); + virtual void consume(); + + // General FIFO 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; + + unsigned _head; + unsigned _tail; + unsigned _headRoom; + unsigned _tailRoom; + + unsigned _size; + unsigned _use; + + unsigned _writeReserve; + unsigned _readReserve; + + bool _isHeadReserved; + bool _isTailReserved; + + unsigned _blocked; // Blocked number the request has to wait + bool _activeDMA; // Is there an active DMA on this buffer + +}; + +#endif