1 #ifndef _WINDOWEDFIFO_H_
2 #define _WINDOWEDFIFO_H_
7 #include "../constant.h"
9 #include "../lib/malloc_align.h"
10 #include "../lib/free_align.h"
14 WindowedFifo(unsigned size);
15 virtual ~WindowedFifo();
18 virtual unsigned reserve(char** destination, unsigned len);
19 virtual void release();
22 virtual unsigned capture(char** destination, unsigned len);
23 virtual void consume();
26 virtual unsigned used() const;
27 virtual unsigned unused() const;
28 virtual unsigned size() const;
31 virtual char *getQueuePointer();
32 virtual void dmaRead(unsigned len);
33 virtual unsigned dmaStart();
34 virtual bool dmaAllowed();
35 virtual unsigned dmaWrite(const void *source, unsigned len);
41 char *_buffer; // Pointer to the buffer
43 unsigned _head; // Current position of the head
44 unsigned _tail; // Current position of the tail
45 unsigned _headRoom; // HeadRoom pointer
46 unsigned _tailRoom; // Tailroom pointer
48 unsigned _size; // Total space of the buffer
49 unsigned _use; // How many data are used in the buffer
50 unsigned _writeReserve; // Number of tokens one is writing
51 unsigned _readReserve; // Number of tokens one is reading
53 bool _isHeadReserved; // Head reserved?
54 bool _isTailReserved; // Tail reserved?
56 unsigned _blocked; // Blocked number the request has to wait
57 bool _activeDMA; // Is there an active DMA on this buffer