Subversion Repositories NaviCtrl

Rev

Rev 41 | Rev 238 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 41 Rev 153
Line 5... Line 5...
5
#include "91x_lib.h"
5
#include "91x_lib.h"
Line 6... Line 6...
6
 
6
 
7
// the fifo object
7
// the fifo object
8
typedef struct
8
typedef struct
9
{
9
{
10
        u8 *buffer;                              // pointrer to start of the ringbuffer
10
        u8 *buffer;                              // pointer to start of the ringbuffer
11
        u8 count;                        // number of characters in FIFO
11
        u8 count;                        // number of characters in FIFO
12
        u8 size;                 // buffer size
12
        u16 size;                // buffer size
13
        u8 *pread;               // read pointer
13
        u8 *pread;               // read pointer
14
        u8 *pwrite;              // write pointer
14
        u8 *pwrite;              // write pointer
Line 15... Line 15...
15
} fifo_t;
15
} fifo_t;
16
 
16
 
17
/*
17
/*
18
The initialization of the FIFO sets the read/write pointers etc..
18
The initialization of the FIFO sets the read/write pointers etc..
19
The FIFO uses the buffer 'buf' which byte length must 'size'.
19
The FIFO uses the buffer 'buf' which byte length must 'size'.
20
Returns 1 on success ans 0 in case of an error.
20
Returns 1 on success ans 0 in case of an error.
Line 21... Line 21...
21
*/
21
*/
22
u8 fifo_init (fifo_t* f, u8* buf, const u8 size);
22
u8 fifo_init (fifo_t* f, u8* buf, const u16 size);
23
 
23
 
24
/*
24
/*
Line 25... Line 25...
25
Puts a byte into the FIFO. Returns 1 on success and 0 in case of FIFO overflow.
25
Puts a byte into the FIFO. Returns 1 on success and 0 in case of FIFO overflow.
26
*/
26
*/
27
u8 fifo_put (fifo_t* f, const u8 data);
27
u8 fifo_put (fifo_t* f, const u8 data);
28
 
28
 
Line 29... Line 29...
29
/*
29
/*
30
Get the next byte from the FIFO as int. Returns 0 if the FIFO is empty.
30
Get the next byte from the FIFO. Returns 0 if the FIFO is empty.
31
*/
31
*/
32
u8 fifo_get (fifo_t* f, u8* pdata);
32
u8 fifo_get (fifo_t* f, u8* pdata);
33
 
33
 
Line 34... Line 34...
34
/*
34
/*
-
 
35
Get the next byte out of the FIFO. If the FIFO is empty the function blocks
35
Get the next byte out of the FIFO. If the FIFO is empty the function blocks
36
until the next byte is put into the FIFO.
36
until the next byte is put into the FIFO.
-
 
37
*/
-
 
-
 
37
*/
Line 38... Line 38...
38
u8 fifo_get_wait (fifo_t* f, u8* pdata);
38
u8 fifo_get_wait (fifo_t* f, u8* pdata);