记录一个串口模块没有回包的问题

一个偶发的串口模块不回包

问题的焦点是有没有发包

还是有没有回包

watch -n 1 后面这一串 发现rx没有变化 但是tx是正常在增加的

cat /proc/tty/driver/ttyAMA I grep '7:'

7: uart:PL011 reV2 mmio:0x18062000 irq:19 tx:1192969 rx:30416 RTS|DTR|DSR|CD|RI

打印这串信息的源码

复制代码
grep -n "uart_line_info" drivers/tty/serial/serial_core.c

static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
{
        struct uart_state *state = drv->state + i;
        struct tty_port *port = &state->port;
        enum uart_pm_state pm_state;
        struct uart_port *uport;
        char stat_buf[32];
        unsigned int status;
        int mmio;

        mutex_lock(&port->mutex);
        uport = uart_port_check(state);
        if (!uport)
                goto out;

        mmio = uport->iotype >= UPIO_MEM;
        seq_printf(m, "%d: uart:%s %s%08llX irq:%d",
                        uport->line, uart_type(uport),
                        mmio ? "mmio:0x" : "port:",
                        mmio ? (unsigned long long)uport->mapbase
                             : (unsigned long long)uport->iobase,
                        uport->irq);

        if (uport->type == PORT_UNKNOWN) {
                seq_putc(m, '\n');
                goto out;
        }

        if (capable(CAP_SYS_ADMIN)) {
                pm_state = state->pm_state;
                if (pm_state != UART_PM_STATE_ON)
                        uart_change_pm(state, UART_PM_STATE_ON);
                spin_lock_irq(&uport->lock);

   seq_printf(m, " tx:%d rx:%d",
                                uport->icount.tx, uport->icount.rx);
                if (uport->icount.frame)
                        seq_printf(m, " fe:%d", uport->icount.frame);
                if (uport->icount.parity)
                        seq_printf(m, " pe:%d", uport->icount.parity);
                if (uport->icount.brk)
                        seq_printf(m, " brk:%d", uport->icount.brk);
                if (uport->icount.overrun)
                        seq_printf(m, " oe:%d", uport->icount.overrun);

////////////////////////

驱动代码里面计数

cat ./drivers/tty/serial/amba-pl011.c | grep ount.rx

uap->port.icount.rx++;

uap->port.icount.rx += dma_count;

pl011_fifo_to_tty

相关推荐
智恒百亿5 小时前
RTX 5090 全场景技术应用解析:从游戏算力到专业生产力落地
大数据·服务器·游戏
2401_868534785 小时前
指令集-最常用 Linux 命令速查手册(整合版)
linux·网络协议
ltl5 小时前
小文件问题:文件数量如何放大元数据与 I/O 成本
linux
ltl5 小时前
网络延迟优化:Nagle、TCP_NODELAY 与中断亲和
linux
OpenCloudOS5 小时前
从快速响应到问题发现:一次backport挖出全新漏洞CVE-2026-76641
服务器·网络·安全
张文君6 小时前
ubuntu26.04从ext4改成mdadm的raid1+lvm启动
linux·运维·网络
xx~t6 小时前
嵌入式——进程与线程1
linux·c语言·学习·嵌入式·进程与线程
DevHub6 小时前
QEMU + Busybox 搭建嵌入式 Linux 开发环境:内核编译到启动,30 秒一个迭代
linux·运维·服务器
ouynagda6 小时前
Linux 进程管理详解:从概念到实践
linux·运维·网络