/*
 * fifo.h
 *
 * Created: 20.02.2019 20:35:48
 *  Author: jens
 */ 


#ifndef FIFO_H_
#define FIFO_H_

#include <stdlib.h>
#include <avr/interrupt.h>

typedef struct _sFifo
{
	uint8_t **ppData;
	size_t capacity;
	size_t itemSize;
	size_t volatile fill;
	size_t volatile wi;
	size_t volatile ri;
	const char *pName;
} Fifo;

void fifo_init(Fifo *pObj, size_t capacity, size_t itemSize, const char *pName);
void fifo_free(Fifo *pObj);
int fifo_push(Fifo *pObj, void *pItem);
int fifo_pop(Fifo *pObj, void *pItem);
int fifo_isEmpty(Fifo *pObj);

void enterCritical();
void exitCritial();

#endif /* FIFO_H_ */