1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-12-14 02:23:55 +01:00
rpi-vk-driver/driver/fifo.h
2020-06-02 22:06:55 +01:00

41 lines
715 B
C

#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);
uint32_t fifoRemove(Fifo* f, void* data);
void* fifoGetLast(Fifo* f);
void* fifoGetFirst(Fifo* f);
void debugPrintFifo(Fifo* f);
#if defined (__cplusplus)
}
#endif