BeRTOS
Defines | Functions
kfile_fifo.h File Reference

KFile interface over a FIFO buffer. More...

#include "fifobuf.h"
#include <io/kfile.h>

Go to the source code of this file.

Defines

#define KFT_KFILEFIFO   MAKE_ID('F', 'I', 'F', '0')
 ID for KFile FIFO.

Functions

KFileFifo * KFILEFIFO_CAST (KFile *fd)
 Convert + ASSERT from generic KFile to KFileFifo.
void kfilefifo_init (KFileFifo *kf, FIFOBuffer *fifo)
 Initialize KFileFifo struct.

Detailed Description

KFile interface over a FIFO buffer.

Convenient way to push data into a FIFO using the KFile interface. For example, it's possible to read from a serial port and put the characters into a fifo:

 // serial reader process
 {
   // other stuff here...
   kfile_read(&ser_port.fd, buffer, sizeof(buffer));
   kfile_write(&kfifo.fd, buffer, sizeof(buffer));
   // ...
 }

 // controller process
 {
   //...
   kfile_read(&kfifo.fd, buffer2, sizeof(buffer2));
   // use read data
 }
Author:
Francesco Sacchi <asterix@develer.com>

Definition in file kfile_fifo.h.


Function Documentation

void kfilefifo_init ( KFileFifo *  kf,
FIFOBuffer *  fifo 
)

Initialize KFileFifo struct.

Parameters:
kfInterface to initialize.
fifoFifo buffer to operate on.

Definition at line 67 of file kfile_fifo.c.