Subversion Repositories NaviCtrl

Rev

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

Rev 153 Rev 244
Line 1... Line 1...
1
#ifndef _FIFO_H_
1
#ifndef _FIFO_H_
2
#define _FIFO_H_
2
#define _FIFO_H_
Line 3... Line 3...
3
 
3
 
4
#include <stdio.h>
4
#include <stdio.h>
-
 
5
#include "91x_lib.h"
Line 5... Line 6...
5
#include "91x_lib.h"
6
#define NO_ITLine 0xFFFF
6
 
7
 
7
// the fifo object
8
// the fifo object
8
typedef struct
9
typedef struct
9
{
10
{
10
        u8 *buffer;                              // pointer to start of the ringbuffer
11
        u8 *buffer;                             // pointer to start of the ringbuffer
11
        u8 count;                        // number of characters in FIFO
12
        u16 count;                              // number of bytes in FIFO
12
        u16 size;                // buffer size
13
        u16 size;                               // buffer size
-
 
14
        u8 *pread;                              // read pointer
-
 
15
        u8 *pwrite;                             // write pointer
13
        u8 *pread;               // read pointer
16
        u16 putvicsource;               // IRQ source to block, during put
Line 14... Line 17...
14
        u8 *pwrite;              // write pointer
17
        u16 getvicsource;               // IRQ source to block, during get
15
} fifo_t;
18
} fifo_t;
16
 
19
 
17
/*
20
/*
18
The initialization of the FIFO sets the read/write pointers etc..
21
The initialization of the FIFO sets the read/write pointers etc..
19
The FIFO uses the buffer 'buf' which byte length must 'size'.
22
The FIFO uses the buffer 'buf' which byte length must 'size'.
Line 20... Line 23...
20
Returns 1 on success ans 0 in case of an error.
23
Returns 1 on success ans 0 in case of an error.
21
*/
24
*/
22
u8 fifo_init (fifo_t* f, u8* buf, const u16 size);
25
u8 fifo_init (fifo_t* f, u8* buffer, const u16 size, u16 putvicsource, u16 getvicsource);
23
 
26