嵌入式Linux中UART上的9位协议 [英] 9 bit protocol on UART in embedded Linux

查看:485
本文介绍了嵌入式Linux中UART上的9位协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在嵌入式Linux中的UART上强制使用9位协议.目前,我正在am335x_evm板上进行测试.我正计划使用棍子奇偶校验来执行此操作.理想情况下,我希望我不需要为omap-serial.c驱动程序实际修改任何代码.

I am trying to force a 9-bit protocol on a UART in embedded Linux. Currently I am testing this out on the am335x_evm board. I am planning on doing this using stick parity. Ideally I was hoping I would not need to actually modify any of the code for the omap-serial.c driver.

使用9位协议的原因是要支持某些使用该协议的旧硬件.消息的地址部分的奇偶校验位必须为1,数据部分的奇偶校验位必须为0,然后对于终止字节,再次为1.

The reason for the 9-bit protocol is to support some legacy hardware that uses it. The parity bit needs to be 1 for the address portion of the message, 0 for the data portion, then 1 again for the termination byte.

我正计划在用户空间中运行一个进程,该进程将通过标准系统调用(打开,写入,读取,ioctl,tcsetattr等)与UART接口.我将配置UART以启用奇偶校验并设置棍子奇偶校验.然后,我将奇偶校验设置为偶数,并调用write()发送我的地址数据.然后,我将奇偶校验设置为0并发送数据.我担心的是,如果我将奇偶校验从1更改为0,什么时候生效?如果UART没有完成发送所有地址数据的操作,那么奇偶校验的更改是否适用于任何未发送的数据?

I was planning on having a process running in user space that would interface with the UART through standard system calls (open, write, read, ioctl, tcsetattr, etc). I would configure the UART to enable parity and set the stick parity. I would then set the parity to even and call write() to send out my address data. I would then set the parity to 0 and send out the data. My concern is if I change the parity from 1 to 0, when does that take affect? If the UART is not done sending all the address data, will the change in parity apply to any unsent data?

推荐答案

最终编写了自己的9位uart驱动程序.是最简单,最有效的解决方案.

Ended up writing my own 9-bit uart driver. Was the easiest and most efficient solution.

这篇关于嵌入式Linux中UART上的9位协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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