?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{FILE START}

library

?curdirlinks? - Rev 6

?prevdifflink? - Blame - ?getfile?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Procyon AVRlib: buffer.h Source File</title>
<link href="dox.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>buffer.h</h1><a href="buffer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file buffer.h \brief Multipurpose byte buffer structure and methods. */</span>
00002 <span class="comment">//*****************************************************************************</span>
00003 <span class="comment">//</span>
00004 <span class="comment">// File Name    : 'buffer.h'</span>
00005 <span class="comment">// Title        : Multipurpose byte buffer structure and methods</span>
00006 <span class="comment">// Author       : Pascal Stang - Copyright (C) 2001-2002</span>
00007 <span class="comment">// Created      : 9/23/2001</span>
00008 <span class="comment">// Revised      : 11/16/2002</span>
00009 <span class="comment">// Version      : 1.1</span>
00010 <span class="comment">// Target MCU   : any</span>
00011 <span class="comment">// Editor Tabs  : 4</span>
00012 <span class="comment">//</span><span class="comment"></span>
00013 <span class="comment">/// \ingroup general</span>
00014 <span class="comment">/// \defgroup buffer Circular Byte-Buffer Structure and Function Library (buffer.c)</span>
00015 <span class="comment">/// \code #include "buffer.h" \endcode</span>
00016 <span class="comment">/// \par Overview</span>
00017 <span class="comment">///     This byte-buffer structure provides an easy and efficient way to store</span>
00018 <span class="comment">///     and process a stream of bytes.  You can create as many buffers as you</span>
00019 <span class="comment">///     like (within memory limits), and then use this common set of functions to</span>
00020 <span class="comment">///     access each buffer.  The buffers are designed for FIFO operation (first</span>
00021 <span class="comment">///     in, first out).  This means that the first byte you put in the buffer</span>
00022 <span class="comment">///     will be the first one you get when you read out the buffer.  Supported</span>
00023 <span class="comment">///     functions include buffer initialize, get byte from front of buffer, add</span>
00024 <span class="comment">///     byte to end of buffer, check if buffer is full, and flush buffer.  The</span>
00025 <span class="comment">///     buffer uses a circular design so no copying of data is ever necessary.</span>
00026 <span class="comment">///     This buffer is not dynamically allocated, it has a user-defined fixed</span>
00027 <span class="comment">///     maximum size.  This buffer is used in many places in the avrlib code.</span>
00028 <span class="comment"></span><span class="comment">//</span>
00029 <span class="comment">// This code is distributed under the GNU Public License</span>
00030 <span class="comment">//      which can be found at http://www.gnu.org/licenses/gpl.txt</span>
00031 <span class="comment">//</span>
00032 <span class="comment">//*****************************************************************************</span><span class="comment"></span>
00033 <span class="comment">//@{</span>
00034 <span class="comment"></span>
00035 <span class="preprocessor">#ifndef BUFFER_H</span>
00036 <span class="preprocessor"></span><span class="preprocessor">#define BUFFER_H</span>
00037 <span class="preprocessor"></span>
00038 <span class="comment">// structure/typdefs</span>
00039 <span class="comment"></span>
00040 <span class="comment">//! cBuffer structure</span>
<a name="l00041"></a><a class="code" href="structstruct__cBuffer.html">00041</a> <span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structstruct__cBuffer.html">struct_cBuffer</a>
00042 {
<a name="l00043"></a><a class="code" href="structstruct__cBuffer.html#o0">00043</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *<a class="code" href="structstruct__cBuffer.html#o0">dataptr</a>;         <span class="comment">///&lt; the physical memory address where the buffer is stored</span>
<a name="l00044"></a><a class="code" href="structstruct__cBuffer.html#o1">00044</a> <span class="comment"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structstruct__cBuffer.html#o1">size</a>;            <span class="comment">///&lt; the allocated size of the buffer</span>
<a name="l00045"></a><a class="code" href="structstruct__cBuffer.html#o2">00045</a> <span class="comment"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structstruct__cBuffer.html#o2">datalength</a>;      <span class="comment">///&lt; the length of the data currently in the buffer</span>
<a name="l00046"></a><a class="code" href="structstruct__cBuffer.html#o3">00046</a> <span class="comment"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structstruct__cBuffer.html#o3">dataindex</a>;       <span class="comment">///&lt; the index into the buffer where the data starts</span>
00047 <span class="comment"></span>} <a class="code" href="structstruct__cBuffer.html">cBuffer</a>;
00048 
00049 <span class="comment">// function prototypes</span>
00050 <span class="comment"></span>
00051 <span class="comment">//! initialize a buffer to start at a given address and have given size</span>
00052 <span class="comment"></span><span class="keywordtype">void</span>            <a class="code" href="group__buffer.html#ga1">bufferInit</a>(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *start, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> size);
00053 <span class="comment"></span>
00054 <span class="comment">//! get the first byte from the front of the buffer</span>
00055 <span class="comment"></span><span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>   <a class="code" href="group__buffer.html#ga2">bufferGetFromFront</a>(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* buffer);
00056 <span class="comment"></span>
00057 <span class="comment">//! dump (discard) the first numbytes from the front of the buffer</span>
00058 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__buffer.html#ga3">bufferDumpFromFront</a>(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> numbytes);
00059 <span class="comment"></span>
00060 <span class="comment">//! get a byte at the specified index in the buffer (kind of like array access)</span>
00061 <span class="comment"></span><span class="comment">// ** note: this does not remove the byte that was read from the buffer</span>
00062 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>   <a class="code" href="group__buffer.html#ga4">bufferGetAtIndex</a>(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> index);
00063 <span class="comment"></span>
00064 <span class="comment">//! add a byte to the end of the buffer</span>
00065 <span class="comment"></span><span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>   <a class="code" href="group__buffer.html#ga5">bufferAddToEnd</a>(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> data);
00066 <span class="comment"></span>
00067 <span class="comment">//! check if the buffer is full/not full (returns zero value if full)</span>
00068 <span class="comment"></span><span class="keywordtype">unsigned</span> <span class="keywordtype">short</span>  <a class="code" href="group__buffer.html#ga6">bufferIsNotFull</a>(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* buffer);
00069 <span class="comment"></span>
00070 <span class="comment">//! flush (clear) the contents of the buffer</span>
00071 <span class="comment"></span><span class="keywordtype">void</span>            <a class="code" href="group__buffer.html#ga7">bufferFlush</a>(<a class="code" href="structstruct__cBuffer.html">cBuffer</a>* buffer);
00072 
00073 <span class="preprocessor">#endif</span>
00074 <span class="preprocessor"></span><span class="comment">//@}</span>
</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
{FILE END}
{FOOTER START}

Powered by WebSVN v2.8.3