<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Circular buffer logical error?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/28209/circular-buffer-logical-error</link><description> 
I was going through the sample code i obtained from the keil
website for LpC2148 USB .As far as i could make out, the code just
echos the contents of a buffer onto the hyperterminal when a keypress
is detected. 

 
In the PopfromCIrBuf function, i have</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Circular buffer logical error?</title><link>https://community.arm.com/thread/80016?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2012 20:22:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:084a972a-bc5c-45a0-8110-1072a7a31ba6</guid><dc:creator>tara rajendran</dc:creator><description>&lt;p&gt;&lt;p&gt;

&lt;a href="http://shop.ngxtechnologies.com/product_info.php?cPath=21&amp;amp;products_id=28."&gt;shop.ngxtechnologies.com/product_info.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
I downloaded the code from this site under &amp;#39;keil sample
projects.&amp;#39;&lt;/p&gt;

&lt;p&gt;
&amp;#39;As i understand it&amp;#39; - the phrase was used just becuase i am a
newbie and my understanding might be flawed which is why i am
here.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Circular buffer logical error?</title><link>https://community.arm.com/thread/60403?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2012 09:32:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:19dad6f4-3e2e-4786-af79-a0713f3c1bf5</guid><dc:creator>erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;As i understand it&lt;/i&gt;&lt;br /&gt;
who wrote the code? contact that entity&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Circular buffer logical error?</title><link>https://community.arm.com/thread/80014?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2012 00:17:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:05e631e9-b70c-4c9c-a0fb-b4de9e050a45</guid><dc:creator>tara rajendran</dc:creator><description>&lt;p&gt;&lt;p&gt;
yes that is logical. And yes i meant amount of data already
present in buffer which is available to be popped. i guess i did not
express that clearly. I think i get it now . please correct me if i
am wrong&lt;/p&gt;

&lt;p&gt;
So suppose bufsize = 8 and size =5 then it will write only 5 bytes
to the buffer whose length =size and return the value 5?&lt;/p&gt;

&lt;p&gt;
and the purpose of this comparison is to ensure that at least
&amp;#39;size&amp;#39; bytes of data is present in the circular buffer before
popping&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Circular buffer logical error?</title><link>https://community.arm.com/thread/91445?ContentTypeID=1</link><pubDate>Sun, 19 Feb 2012 23:59:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bc63fbfc-46c9-4bd8-bf82-a3888a6823ef</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;As i understand it, Bufsize is the amt of data to be read in
the cir buf&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
No - it is the number of bytes stored in the buffer at the time of
the call. Your statement refers to the parameter provided to the
function that read data from the ring buffer.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Circular buffer logical error?</title><link>https://community.arm.com/thread/60404?ContentTypeID=1</link><pubDate>Sun, 19 Feb 2012 23:57:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b172f8fe-aac6-4213-8793-66c4e8c74f58</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
It seems logical to extract data from the circular buffer only if
it contains at least the amount of data you request, not?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>