xiaoxiang781216 commented on code in PR #21144:
URL: https://github.com/apache/nuttx/pull/21144#discussion_r4434888616


##########
drivers/serial/serial_dma.c:
##########
@@ -59,27 +58,51 @@
 static int uart_recvchars_check_special(FAR uart_dev_t *dev)
 {
   FAR struct uart_dmaxfer_s *xfer = &dev->dmarx;
+  size_t nfirst;
+  size_t nsecond;
+  size_t pos;
+  size_t i;
   int signo;
+  int sig;
 
   /* Check if the valid DMAed data is in one or two contiguous regions */
 
   if (xfer->nbytes <= xfer->length)
     {
-      return uart_check_special(dev, xfer->buffer, xfer->nbytes);
+      nfirst = xfer->nbytes;
+      signo  = uart_check_special(dev, xfer->buffer, &nfirst);
+      xfer->nbytes = nfirst;
+      return signo;
     }
-  else
+
+  nfirst  = xfer->length;
+  nsecond = xfer->nbytes - xfer->length;
+  signo   = uart_check_special(dev, xfer->buffer, &nfirst);
+  sig     = uart_check_special(dev, xfer->nbuffer, &nsecond);
+  if (signo == 0)
     {
-      /* REVISIT:  Additional signals could be in the second region. */
+      signo = sig;
+    }
+
+  /* Close the gap at the end of the first region.  The write position is
+   * never after the read position i.
+   */
 
-      signo = uart_check_special(dev, xfer->buffer, xfer->length);
-      if (signo != 0)
+  for (i = 0; i < nsecond; i++)

Review Comment:
   could we use memcpy instead



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to