Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
886 killagreg 1
#include "fifo.h"
2
 
3
void fifo_init (fifo_t *f, uint8_t *buffer, const uint8_t size)
4
{
5
        f->count = 0;
6
        f->pread = f->pwrite = buffer;
7
        f->read2end = f->write2end = f->size = size;
8
}
9
 
10
uint8_t fifo_put (fifo_t *f, const uint8_t data)
11
{
12
        return _inline_fifo_put (f, data);
13
}
14
 
15
uint8_t fifo_get_wait (fifo_t *f)
16
{
17
        while (!f->count);
18
 
19
        return _inline_fifo_get (f);
20
}
21
 
22
int16_t fifo_get_nowait (fifo_t *f)
23
{
24
        if (!f->count)          return -1;
25
 
26
        return (int16_t) _inline_fifo_get (f);
27
}
28