Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_fifo.h
1 #ifndef _BC_FIFO_H
2 #define _BC_FIFO_H
3 
4 #include <bc_common.h>
5 
9 
11 
12 typedef struct
13 {
15  void *buffer;
16 
18  size_t size;
19 
21  size_t head;
22 
24  size_t tail;
25 
26 } bc_fifo_t;
27 
32 
33 void bc_fifo_init(bc_fifo_t *fifo, void *buffer, size_t size);
34 
37 
38 void bc_fifo_purge(bc_fifo_t *fifo);
39 
45 
46 size_t bc_fifo_write(bc_fifo_t *fifo, const void *buffer, size_t length);
47 
53 
54 size_t bc_fifo_read(bc_fifo_t *fifo, void *buffer, size_t length);
55 
61 
62 size_t bc_fifo_irq_write(bc_fifo_t *fifo, const void *buffer, size_t length);
63 
69 
70 size_t bc_fifo_irq_read(bc_fifo_t *fifo, void *buffer, size_t length);
71 
76 
77 bool bc_fifo_is_empty(bc_fifo_t *fifo);
78 
80 
81 #endif // _BC_FIFO_H
size_t bc_fifo_irq_read(bc_fifo_t *fifo, void *buffer, size_t length)
Read data from FIFO from interrupt.
Definition: bc_fifo.c:133
Structure of FIFO instance.
Definition: bc_fifo.h:12
size_t tail
Position of FIFO's tail.
Definition: bc_fifo.h:24
void * buffer
Pointer to buffer where FIFO holds data.
Definition: bc_fifo.h:15
size_t bc_fifo_irq_write(bc_fifo_t *fifo, const void *buffer, size_t length)
Write data to FIFO from interrupt.
Definition: bc_fifo.c:101
size_t head
Position of FIFO's head.
Definition: bc_fifo.h:21
void bc_fifo_init(bc_fifo_t *fifo, void *buffer, size_t size)
Initialize FIFO buffer.
Definition: bc_fifo.c:4
void bc_fifo_purge(bc_fifo_t *fifo)
Purge FIFO buffer.
Definition: bc_fifo.c:12
size_t bc_fifo_write(bc_fifo_t *fifo, const void *buffer, size_t length)
Write data to FIFO.
Definition: bc_fifo.c:18
size_t bc_fifo_read(bc_fifo_t *fifo, void *buffer, size_t length)
Read data from FIFO.
Definition: bc_fifo.c:63
bool bc_fifo_is_empty(bc_fifo_t *fifo)
Is empty.
Definition: bc_fifo.c:161
size_t size
Size of buffer where FIFO holds data.
Definition: bc_fifo.h:18