如何在vxworks中获取当前波特率设置? [英] How to get current baud rate setting in vxworks?

查看:273
本文介绍了如何在vxworks中获取当前波特率设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经更新了我的VxWorks应用程序。目标的RS-232连接到触摸屏。出于某种原因,我必须知道它的波特率。我咨询了网络,发现只设置波特率的方法:

I've been updated my a VxWorks application. The target's RS-232 is connected to touch panel. For some reason, I must know its baud rate. I consulted the web and found only the way to set baud rate:

ioctl (fPipe, FIOBAUDRATE, 19200);



在文件中(ioLib。 h)包含FIOBAUDRATE,我找不到任何看起来像波特率的命令。



我在sioLib.h找到了两个定义:SIO_BAUD_GET& SIO_BAUD_SET,但SIO_BAUD_GET似乎无法获得波特率。



如何获取当前RS-232设置的波特率?



我尝试了什么:



我试图按上述方式运行并搜索我的头文件,发现什么都没能回答我的问题。

我用Google搜索了这个问题但是徒劳无功。


In the file (ioLib.h) containing FIOBAUDRATE, I can't find any command which looks like getting baud rate.

I found two definitions at sioLib.h: SIO_BAUD_GET & SIO_BAUD_SET, but SIO_BAUD_GET seems not working at get baud rate.

How can I do to get baud rate of my current RS-232 setting?

What I have tried:

I tried to run the ways as stated above and searched at my header files, found nothing able to answer my question.
I googled this problem but in vain.

推荐答案

似乎没有一般记录方法。特定的串行驱动程序可能支持它。所以你必须检查使用的驱动程序/接口的文档。或者尝试使用 SIO_BAUD_GET ioctl 调用。结果应该表明驱动程序是否支持它。



作为最后的手段,您可以尝试直接在端口级别访问串行接口硬件并读出设置。但这需要读取接口的数据表(例如外部芯片或SoC)。



但为什么需要当前设置?

为了正确通信,如果不匹配,则必须设置它。所以只需将其设置为所需的速率。一旦您成功设置了费率,您就会知道当前的设置。
There seems to be no general documented method. It might be supported for specific serial drivers. So you have to check the documentation of the used driver / interface. Alternatively try using the SIO_BAUD_GET ioctl call. The result should indicate if it is supported by the driver.

As last resort you can try to access the serial interface hardware directly at port level and read out the settings. But that requires reading the data sheet of the interface (e.g. external chip or SoC).

But why do you need the current setting?
For proper communication you have to set it anyway if it is not matching. So just set it to the required rate. And once you have set the rate successfully you know the current setting.


这篇关于如何在vxworks中获取当前波特率设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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