snikeguo commented on issue #16784: URL: https://github.com/apache/nuttx/issues/16784#issuecomment-3127097478
I think the serial driver framework should not use a ring buffer, as it is not friendly for DMA operations. Currently, almost all chip drivers implement the receive method, even for chips that support DMA; they still implement the receive method instead of the dmareceive method. This results in data being copied twice. For example, on STM32, the data flow is: g_usart1rxfifo → g_usart1rxbuffer → user buffer. If MMU is not considered, data copying can be optimized to zero or at most one time. ``` read(user buffer) { if(query buffer is available serial dma buffer?) { setup dma(user buffer) } else{ tempbuffer=alloc from chip serial driver(align(len)); setup dma(tempbuffer) memcpy(....) } } ``` If MMU is considered, data is copied only once.(user mode memory page fault ) -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org