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

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

问题的焦点是有没有发包

还是有没有回包

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

相关推荐
kyle~2 小时前
嵌入式 SoC 系统
linux·c++·嵌入式·计算系统
tianyuanwo3 小时前
PostgreSQL 部署运维实战总结:从安装踩坑到生产可用
运维·数据库·postgresql
Decay__3 小时前
SQLServer 优化案例集 —— 慢 SQL 优化、索引重构与参数调整收益对比
运维·数据库·sql·mysql·架构
人生!?4 小时前
Linux 从入门到进阶 | 基础语法
linux·笔记·教程
优化Henry5 小时前
LTE 站点 S1 链路反复闪断导致小区频闪退服故障排查
运维·网络·学习·信息与通信·tdd
心之王者7165 小时前
Linux 进程信号:从产生、阻塞到捕捉与子进程回收
linux·服务器·网络
AndreaYYmm5 小时前
日志里 grep 到 Fail 就判失败?这六个假阳性我全踩过
linux·shell
manageengine5 小时前
服务器 CPU 100% 怎么排查:8 条命令从现象定位到根因
运维·服务器·cpu
分布式存储与RustFS5 小时前
RustFS 分片上传怎么配:大文件断点续传的最小可验证流程
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
赤生云电竞6 小时前
云游戏边缘节点部署:机房选址与网络拓扑优化实践 —— 从80ms时延预算看节点落位与Spine-Leaf组网
服务器·游戏·spine