diff options
author | (no author) <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2006-09-09 01:08:38 +0000 |
---|---|---|
committer | (no author) <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2006-09-09 01:08:38 +0000 |
commit | 520784c7ba6a8325e413a293ab11840d982ba87d (patch) | |
tree | 44ee93d44102d47014c6ff696ebc93e8de402e01 /openpcd/firmware/src/os/fifo.h | |
parent | b0317c72667378333e1008c49559e974f3e7c15d (diff) |
- major reorganization, split source tree in
- os: core "operating system"
- pcd: PCD (reader) side
- picc: PICC (transponder) side
- rewrite linker script almost from scratch (for correct DFU operation)
git-svn-id: https://svn.openpcd.org:2342/trunk@142 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpcd/firmware/src/os/fifo.h')
-rw-r--r-- | openpcd/firmware/src/os/fifo.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/openpcd/firmware/src/os/fifo.h b/openpcd/firmware/src/os/fifo.h new file mode 100644 index 0000000..d91c6c2 --- /dev/null +++ b/openpcd/firmware/src/os/fifo.h @@ -0,0 +1,28 @@ +#ifndef _FIFO_H +#define _FIFO_H + +#include <sys/types.h> + +#define FIFO_SIZE 1024 + +struct fifo { + u_int16_t size; /* actual FIFO size, can be smaller than 'data' */ + u_int16_t producer; /* index of producer */ + u_int16_t consumer; /* index of consumer */ + u_int16_t watermark; + u_int8_t irq; + u_int8_t irq_en; + u_int8_t status; + void (*callback)(struct fifo *fifo, u_int8_t event, void *data); + void *cb_data; + u_int8_t data[FIFO_SIZE]; +}; + + +extern int fifo_init(struct fifo *fifo, u_int16_t size, + void (*callback)(struct fifo *fifo, u_int8_t event, void *data), void *cb_data); +extern u_int16_t fifo_data_get(struct fifo *fifo, u_int16_t len, u_int8_t *data); +extern u_int16_t fifo_data_put(struct fifo *fifo, u_int16_t len, u_int8_t *data); +extern int fifo_available(struct fifo *fifo); + +#endif |