X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fstruct%2Fkfile_fifo.h;h=fbc5d097f2265af3d0f097d023b2b51511d98118;hb=7a613efa9f80222fa9642bfb6a249972c7ae6c6e;hp=5d9ba5c2de5a099c693c6ca268c95797e4d77039;hpb=034d37aa87fba63475b9c5cd6f00d800ab10ed46;p=bertos.git diff --git a/bertos/struct/kfile_fifo.h b/bertos/struct/kfile_fifo.h index 5d9ba5c2..fbc5d097 100644 --- a/bertos/struct/kfile_fifo.h +++ b/bertos/struct/kfile_fifo.h @@ -32,7 +32,27 @@ * * \brief KFile interface over a FIFO buffer. * - * \version $Id: cfg_adc.h 2348 2009-02-16 13:43:44Z duplo $ + * 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: + * \code + * // 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 + * } + * \endcode + * + * * \author Francesco Sacchi * * $WIZ$ module_name = "kfilefifo" @@ -43,7 +63,7 @@ #define STRUCT_KFILE_FIFO #include "fifobuf.h" -#include +#include typedef struct KFileFifo { @@ -65,6 +85,15 @@ INLINE KFileFifo * KFILEFIFO_CAST(KFile *fd) return (KFileFifo *)fd; } +/** + * Initialize KFileFifo struct. + * + * \param kf Interface to initialize. + * \param fifo Fifo buffer to operate on. + */ void kfilefifo_init(KFileFifo *kf, FIFOBuffer *fifo); +int kfilefifo_testSetup(void); +int kfilefifo_testRun(void); +int kfilefifo_testTearDown(void); #endif /* STRUCT_KFILE_FIFO */