diff packages/io/serial/current/src/common/serial.c @ 107:7f461c3a372c

Merge from eCos master repository on 2000-07-04-08:04:30-BST
author jlarmour
date Tue, 04 Jul 2000 07:34:17 +0000
parents afdeb44241de
children 6ed91473a1cd
line wrap: on
line diff
--- a/packages/io/serial/current/src/common/serial.c
+++ b/packages/io/serial/current/src/common/serial.c
@@ -538,7 +538,14 @@ serial_data_rcv_req(serial_channel *chan
         gap = cbuf->get - cbuf->put - 1;
         if (gap < 0) {
             // If failed, the gap is between put and the end of buffer
-            gap = cbuf->len - cbuf->put - 1;
+            gap = cbuf->len - cbuf->put;
+
+            // If get is at the beginning of the buffer, we cannot
+            // fill the last character, since that would make put==get
+            // implying empty. In this case we must offer last chunk-1 only.
+            //  GxxxxxP.......
+            if (cbuf->get == 0)
+                gap--;
         }
     }