X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fstruct%2Fkfile_fifo.h;h=78c1f46d3740deff0b99aae1e67d6bfc810269ec;hb=0c71afa65077b10d069192c1d36c0df1440e1b97;hp=5d9ba5c2de5a099c693c6ca268c95797e4d77039;hpb=034d37aa87fba63475b9c5cd6f00d800ab10ed46;p=bertos.git diff --git a/bertos/struct/kfile_fifo.h b/bertos/struct/kfile_fifo.h index 5d9ba5c2..78c1f46d 100644 --- a/bertos/struct/kfile_fifo.h +++ b/bertos/struct/kfile_fifo.h @@ -32,6 +32,27 @@ * * \brief 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: + * \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 + * + * * \version $Id: cfg_adc.h 2348 2009-02-16 13:43:44Z duplo $ * \author Francesco Sacchi * @@ -65,6 +86,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 */