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

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

问题的焦点是有没有发包

还是有没有回包

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

相关推荐
Web3探索者1 天前
可视化服务器管理和传统命令行区别是什么?新手教程:Linux 运维到底该用图形界面还是 SSH 命令行?
linux·ssh
zylyehuo1 天前
Linux系统中网线与USB网络共享冲突
linux
荣--1 天前
一键部署不是为了省时间 —— 它是把"买来的 PaaS"变成"自己的平台"的拐点
运维·zabbix·工程化·一键部署·平台化·边界设计
江华森1 天前
动手实战学 Docker — 从零到集群编排完全指南
运维
Avan_菜菜2 天前
FRP 内网穿透完整实战:从 HTTP 映射到 HTTPS 自签代理
运维·nginx·https
Sokach10152 天前
Linux Shell 脚本从零到能用:一个新手的一天学习总结
linux
SelectDB3 天前
Litefuse 开源并推出单进程轻量模式,25 秒就能跑起来的 Agent 可观测与评估平台
运维·后端·自动化运维
AlfredZhao3 天前
Docker 容器时区不对,`timedatectl` 不存在怎么办?
linux·timezone
zzzzzz3104 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode4 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏