[英]Read/Write system call reads/writes data from/to which buffer
I am working with serial port programming and i have following doubt please clear it 我正在使用串行端口编程,并且我有以下疑问,请清除它
Please clarify. 请澄清。
read()
and write()
access data via a so called file-descriptor return by a call to open()
. read()
和write()
通过所谓的文件描述符(通过调用open()
返回write()
访问数据。
open()
gets passed in the name of a serial device. open()
以串行设备的名称传递。
Serial devices could be named "/dev/ttySX"
with X={0..N}
. 串行设备可以使用X={0..N}
命名为"/dev/ttySX"
。
Why are you worried about: 您为什么担心:
Does Read/Write system call reads and writes data directly from/to UART buffer? 读/写系统调用是否直接在UART缓冲区中读写数据?
The kernel takes care of the actual read/write calls to a file regardless if its a device or a data file, in the case of device, IOCTL calls will be made to the device in question and handle it behind the scenes. 内核会处理对文件的实际读/写调用,而不管文件是设备还是数据文件,如果是设备,则将对有问题的设备进行IOCTL调用,并在后台进行处理。
Which buffer does Rx and Tx of "/proc/tty/driver/serial" refers to. “ / proc / tty / driver / serial”的Rx和Tx指的是哪个缓冲区。
Again, that is handled by the kernel and related IOCTL calls to the serial driver by way of device descriptor to the actual serial port. 同样,这是由内核和相关IOCTL调用(通过设备描述符到实际串行端口)对串行驱动程序进行处理的。
If still in doubt, a refresher on serial port programming under Un*x environments such as Linux/FreeBSD would be recommended. 如果仍然不确定,建议在诸如Linux / FreeBSD之类的Un * x环境下对串行端口编程进行复习。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.