RTF_GET(3)

NAME
rtf_get - read data from a real-time fifo

SYNOPSIS
#include <rtl_fifo.h>

int rtf_get(unsigned int fifo, char * buf, int count);

DESCRIPTION
rtf_get reads a block of data from a real-time fifo (RT-FIFO) previously created with a call to rtf_create(3). 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 (2) from the corresponding fifo device to dequeue data from a fifo. Similarly, Linux processes use write (2) 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(2), write(2), and select(2).

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 as described below.

ERRORS

-ENODEV
    fifo is greater than or equal to RTF_NO.

-EINVAL
    fifo is not a valid RT-FIFO identifier.

SEE ALSO
read(2), rtf_create(3), rtf_create_handler(3), rtf_destroy(3), rtf_put(3), write(2)