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

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

问题的焦点是有没有发包

还是有没有回包

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

相关推荐
吴声子夜歌10 分钟前
Shell编程实例——脚本编程的附加特性
linux·运维·shell
yunwei3718 分钟前
eBPF 教程:BPF 调度器入门
linux·后端·性能优化
Wang's Blog20 分钟前
Java 服务器: Linux-MySQL的rpm安装与初始化配置
java·服务器
叶总没有会23 分钟前
Docker 基础+实战
运维·docker·云原生·容器
byte轻骑兵30 分钟前
【BlueZ 】sdp 模块:服务发现协议的用户态实现基础
linux·人工智能·bluez·电脑蓝牙·嵌入式蓝牙
赴生-41 分钟前
Liunx 操作系统 进程控制(上)
linux
蓝速科技42 分钟前
会议室门牌显示模板选型与品牌视觉适配落地指南丨蓝速科技
大数据·运维·数据库·人工智能·科技
傲世仙尊1 小时前
从.o到ELF-静态库动态库与可执行文件的生命周期
linux
指尖的爷1 小时前
【地狱级难度】ubuntu系统GOCV编译安装
linux·运维·ubuntu
xx~t1 小时前
嵌入式——ARM——汇编2
linux·汇编·arm开发·嵌入式硬件·启动代码