Project

General

Profile

Download (787 Bytes) Statistics
| Branch: | Tag: | Revision:
1 f1202753 (no author)
#ifndef _FIFO_H
2
#define _FIFO_H
3
4 caf50003 (no author)
#include <sys/types.h>
5 8aaa856c (no author)
6
#define FIFO_SIZE	1024
7
8 f1202753 (no author)
struct fifo {
9 373c172a Harald Welte
	uint16_t size;		/* actual FIFO size, can be smaller than 'data' */
10
	uint16_t producer;	/* index of producer */
11
	uint16_t consumer;	/* index of consumer */
12
	uint16_t watermark;
13
	uint8_t irq;
14
	uint8_t irq_en;
15
	uint8_t status;
16
	void (*callback)(struct fifo *fifo, uint8_t event, void *data);
17 f1202753 (no author)
	void *cb_data;
18 373c172a Harald Welte
	uint8_t data[FIFO_SIZE];
19 f1202753 (no author)
};
20
21
22 373c172a Harald Welte
extern int fifo_init(struct fifo *fifo, uint16_t size, 
23
		     void (*callback)(struct fifo *fifo, uint8_t event, void *data), void *cb_data);
24
extern uint16_t fifo_data_get(struct fifo *fifo, uint16_t len, uint8_t *data);
25
extern uint16_t fifo_data_put(struct fifo *fifo, uint16_t len, uint8_t *data);
26 f1202753 (no author)
extern int fifo_available(struct fifo *fifo);
27
28
#endif
Add picture from clipboard (Maximum size: 48.8 MB)