从Linux用户空间设置16550A UART硬件FIFO中断级别 [英] Set 16550A UART Hardware FIFO interrupt level from Linux Userspace

查看:1194
本文介绍了从Linux用户空间设置16550A UART硬件FIFO中断级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用16550兼容的UART,并且我希望能够更改FIFO中断触发级别(我在UART高负载下丢弃字节,并且希望降低阈值-这是一个功率不足的嵌入式系统).当然,如果需要,我可以在8250_port.c驱动程序中对其进行更改:

I am currently using a 16550-compatible UART, and I want to be able to change the FIFO interrupt trigger level (I am dropping bytes under high UART loads and I want to reduce the threshold - it's an underpowered embedded system). Of course, I can change it in the 8250_port.c driver if I want:

[PORT_NS16550A] = {
    .name       = "NS16550A",
    .fifo_size  = 16,
    .tx_loadsz  = 16,
    .fcr        = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
    .flags      = UART_CAP_FIFO | UART_NATSEMI,
},

但是从用户空间更改它而不必重新编译内核会更加方便.

But it would be far more convenient to change it from userspace without having to recompile a kernel.

我希望以下文档已过期:

截至2000年末,Linux用户无法设置这些值. 直接(setserial无法做到).虽然许多PC只有16550 具有16个字节的缓冲区,更好的UART具有更大的缓冲区.

As of late 2000 there was no way the Linux user could set these directly (setserial can't do it). While many PC's only have a 16550 with 16-byte buffers, better UARTS have even larger buffers.

如果有办法(例如一些新的ioctl),则 seterial( 8) stty(1)尚未公开该接口.

If there is a means to doing so (e.g. some new-ish ioctl), then seterial (8) and stty (1) do not yet expose the interface.

推荐答案

我认为,此问题的一般解决方案是使用setserial来更改uart的更改模式.例如,对于pericom PI7C9X7958,您可以使用多种操作模式,例如"550"和950模式.这些对应于16550或16950标准uart类型.每种模式都有与之关联的特定fifo大小以及其他一些功能.

I think the general solution to this problem is to use setserial to make the uart change modes. For instance with the pericom PI7C9X7958, you have multiple modes of operation such as the "550" and the 950 modes. These correspond to a 16550 or a 16950 standard uart type. Each mode has a certain fifo size associated with it and some other features.

因此,如果您的设备支持,则可以尝试

So, if your device supports it you can try

setserial -v/dev/ttyS1 uart 16950

setserial -v /dev/ttyS1 uart 16950

然后进行验证

setserial -g/dev/ttyS1 /dev/ttyS1,UART:16950/954,端口:0xc800,IRQ:16

setserial -g /dev/ttyS1 /dev/ttyS1, UART: 16950/954, Port: 0xc800, IRQ: 16

这篇关于从Linux用户空间设置16550A UART硬件FIFO中断级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆