extern int rtf_create
(unsigned int fifo, int size);
SYNOPSIS
#include "rtl_fifo.h"
DESCRIPTION
creates a real-time fifo (RT-FIFO) of size size and
assigns it the identifier fifo.
fifo is a value unique within the system, and
must be less than RTF_NO.
The RT-FIFO is a mechanism, implemented as a character
device, to communicate between real-time tasks and ordinary Linux processes.
The rtf_* functions are used by the real-time tasks; Linux processes use
standard character device access functions such as read, write, and select.
RETURN VALUE
On success, 0 is returned. On failure, a negative value is
returned .
ERRORS
fifo is greater than or equal to RTF_NO.
fifo is already in use. Choose a different ID.
size bytes could not be allocated for the RT-FIFO.
extern int rtf_destroy
(unsigned int fifo);
SYNOPSIS
#include "rtl_fifo.h"
DESCRIPTION
removes a real-time fifo (RT-FIFO) previously created with
rtf_create.
fifo is then available for reuse by another call
to rtf_create.
The RT-FIFO is a mechanism, implemented as a character
device, to communicate between real-time tasks and ordinary Linux processes.
The rtf_* functions are used by the real-time tasks; Linux processes use
standard character device access functions such as read, write, and select.
RETURN VALUE
On success, 0 is returned. On failure, -1 is returned.
ERRORS
fifo is greater than or equal to RTF_NO.
fifo is not a valid RT-FIFO identifier.
extern int rtf_resize
(unsigned int fifo, int size);
SYNOPSIS
#include "rtl_fifo.h"
DESCRIPTION
modifies the real-time fifo (RT-FIFO) fifo, previously
created with , rtf_create, to have a new size
of size. The RT-FIFO is a mechanism, implemented as a character
device, to communicate between real-time tasks and ordinary Linux processes.
The rtf_* functions are used by the real-time tasks; Linux processes use
standard character device access functions such as read, write, and select.
RETURN VALUE
On success, size is returned. On failure, a negative
value is returned.
ERRORS
fifo is greater than or equal to RTF_NO.
size bytes could not be allocated for the RT-FIFO.
"BUGS" Any data present in the RT-FIFO when rtf_resize
is executed is lost.
extern int rtf_put
(unsigned int fifo, void *buf,
int count);
SYNOPSIS
#include "rtl_fifo.h"
DESCRIPTION
writes a block of data to a real-time fifo (RT-FIFO) previously
created with a call to rtf_create.
fifo is the ID with which the RT-FIFO was created.
buf is the block of data to be written, while
count is the size of the block in bytes.
This mechanism is available only to real-time tasks;
Linux processes use a write to the corresponding fifo device to enqueue
data to a fifo. Similarly, Linux processes use read or similar functions
to read the data previously written via rtf_put
by a real-time task.
The RT-FIFO is a mechanism, implemented as a character
device, to communicate between real-time tasks and ordinary Linux processes.
The rtf_* functions are used by the real-time tasks; Linux processes use
standard character device access functions such as read, write, and select.
RETURN VALUE
On success, 0 is returned. On failure, -1 is returned .
ERRORS
fifo is greater than or equal to RTF_NO.
fifo is not a valid RT-FIFO identifier.
insufficient space is available in the RT-FIFO for countbytes.
(-EINVAL)
extern int rtf_get
(unsigned int fifo, void *buf,
int count);
SYNOPSIS
#include "rtl_fifo.h"
DESCRIPTION
reads a block of data from a real-time fifo (RT-FIFO) previously
created with a call to rtf_create.
fifo is the ID with which the RT-FIFO was created.
buf is the block of data to be filled with the
received bytes, while count is the size of the block in bytes. This
mechanism is available only to real-time tasks; Linux processes use a read
from the corresponding fifo device to dequeue data from a fifo. Similarly,
Linux processes use write or similar functions to write the data to be
read via rtf_put by a real-time task.
rtf_get is often used in conjunction with rtf_create_handler
to process data received asynchronously from a Linux process. A handler
is installed via rtf_create_handler; this handler calls rtf_get to receive
any data present in the RT-FIFO as it becomes available. In this way, polling
is not necessary; the handler is called only when data is present in the
fifo.
The RT-FIFO is a mechanism, implemented as a character
device, to communicate between real-time tasks and ordinary Linux processes.
The rtf_* functions are used by the real-time tasks; Linux processes use
standard character device access functions such as read, write, and select.
RETURN VALUE
On success, the size of the received data block is returned.
Note that this value may be less than count if count bytes
are not available in the fifo. On failure, a negative value is returned.
ERRORS
fifo is greater than or equal to RTF_NO.
fifo is not a valid RT-FIFO identifier.
extern int rtf_create_handler
(unsiged int fifo, int (*handler)(unsigned
int fifo));
SYNOPSIS
#include "rtl_fifo.h"
DESCRIPTION
installs a handler which is executed when data is written
to or read from a real-time fifo (RT-FIFO).
fifo is an RT-FIFO that must have previously been
created with a call to rtf_create.
handler is then called whenever a Linux process
accesses that fifo.
rtf_create_handler is often used in conjunction with
rtf_get to process data acquired asynchronously
from a Linux process. The installed handler calls rtf_get when data is
present. Because the handler is only executed when there is activity on
the fifo, polling is not necessary.
The RT-FIFO is a mechanism, implemented as a character
device, to communicate between real-time tasks and ordinary Linux processes.
The rtf_* functions are used by the real-time tasks; Linux processes use
standard character device access functions such as read, write, and select.
RETURN VALUE
On success, 0 is returned. On failure, a negative value is
returned .
ERRORS
fifo is greater than or equal to RTF_NO, or is not
a valid RT-FIFO identifier; or handler is NULL. (-EINVAL)