2020-06-01 23:52:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "CustomAssert.h"
|
|
|
|
|
|
|
|
#include "PoolAllocator.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct FifoElem
|
|
|
|
{
|
|
|
|
struct FifoElem* next;
|
|
|
|
struct FifoElem* prev;
|
|
|
|
void* data;
|
|
|
|
} FifoElem;
|
|
|
|
|
|
|
|
typedef struct Fifo
|
|
|
|
{
|
|
|
|
FifoElem* first;
|
|
|
|
FifoElem* last;
|
|
|
|
PoolAllocator dataBuf;
|
|
|
|
PoolAllocator fifoElemBuf;
|
|
|
|
uint32_t dataSize;
|
|
|
|
uint32_t maxElems;
|
|
|
|
} Fifo;
|
|
|
|
|
|
|
|
Fifo createFifo(void* dataMem, void* fifoElemMem, uint32_t maxElems, uint32_t dataSize);
|
|
|
|
void destroyFifo(Fifo* f);
|
|
|
|
uint32_t fifoAdd(Fifo* f, void* data);
|
2020-06-02 23:06:55 +02:00
|
|
|
uint32_t fifoRemove(Fifo* f, void* data);
|
|
|
|
void* fifoGetLast(Fifo* f);
|
|
|
|
void* fifoGetFirst(Fifo* f);
|
2020-06-01 23:52:36 +02:00
|
|
|
void debugPrintFifo(Fifo* f);
|
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|