zl程序教程

您现在的位置是:首页 >  大数据

当前栏目

rk3288 android12 串口数据分段接收

数据 串口 接收 分段 RK3288 Android12
2023-09-14 09:04:19 时间

kernel-4.19/drivers/tty/serial/8250/8250_early.c
diff --git a/kernel-4.19/drivers/tty/serial/8250/8250_port.c b/kernel-4.19/drivers/tty/serial/8250/8250_port.c
old mode 100644
new mode 100755
index 39156ecbeb…4557b63e48
— a/kernel-4.19/drivers/tty/serial/8250/8250_port.c
+++ b/kernel-4.19/drivers/tty/serial/8250/8250_port.c
@@ -1768,17 +1768,31 @@ EXPORT_SYMBOL_GPL(serial8250_read_char);
*/
unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr)
{
+printk(KERN_INFO " serial8250_rx_chars ");
struct uart_port *port = &up->port;
int max_count = 256;

  •   unsigned int iir = serial_port_in(port, UART_IIR);
    
  •   if ((iir & 0x0f) == 0x0c){
    
  •           max_count = serial_in(up, UART_RFL);
    
  •   }
    
  •   else{
    
  •           max_count = serial_in(up, UART_RFL) - 2;
    
  •   }
    
  •   max_count = 256;
    
  •   printk(KERN_INFO " max_count %d ",max_count);
      do {
              serial8250_read_char(up, lsr);
              if (--max_count == 0)
                      break;
              lsr = serial_in(up, UART_LSR);
    
  •   } while (lsr & (UART_LSR_DR | UART_LSR_BI));
    
  •   } while (lsr & (UART_LSR_DR | UART_LSR_BI) && (max_count-- > 0));
    
  •   if ((iir & 0x0f) == 0x0c){
      tty_flip_buffer_push(&port->state->port);
    
  •   printk(KERN_INFO " tty_flip_buffer_push ");
    
  •   }
      return lsr;
    

}