1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-11-29 11:24:14 +01:00
rpi-vk-driver/driver/fifo.h

41 lines
715 B
C
Raw Normal View History

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