sam7fc/include/fifo.h
2008-06-23 15:14:55 +02:00

35 lines
871 B
C

#ifndef FIFO_H_
#define FIFO_H_
#include <stdint.h>
struct fifo {
uint32_t in;
uint32_t out;
uint16_t pdc_tx;
uint16_t pdc_rx;
uint32_t size;
char buf[0];
};
uint32_t fifo_put(struct fifo *fifo, char *buf, uint32_t len);
uint32_t fifo_get(struct fifo *fifo, char *buf, uint32_t len);
uint32_t fifo_peek(struct fifo *fifo, char *buf, uint32_t len);
uint32_t fifo_remove(struct fifo *fifo, uint32_t len);
uint32_t fifo_rxpdc(struct fifo *fifo, AT91S_PDC *pdc, uint16_t maxsize);
uint32_t fifo_txpdc(struct fifo *fifo, AT91S_PDC *pdc, uint16_t maxsize);
uint32_t fifo_txudp(struct fifo *fifo, uint32_t ep, uint32_t maxsize);
uint32_t fifo_rxudp(struct fifo *fifo, uint32_t ep, uint32_t maxsize);
uint32_t fifo_putbyte(struct fifo *fifo, char c);
uint32_t fifo_getbyte(struct fifo *fifo, char *p);
struct fifo * fifo_alloc(uint32_t size);
#endif /*FIFO_H_*/