“Serial TTY line discipline”的版本间的差异

来自百问网嵌入式Linux wiki
 
第28行: 第28行:
 
===APIs description===
 
===APIs description===
  
The TTY provides only '''character device interface''' (named /dev/ttyX) to user space.
+
TTY仅向用户空间提供'''字符设备接口'''(命名为/ dev / ttyX)。
The main API for user space TTY client applications is provided by the portable POSIX terminal interface termios, which relies on /dev/ttyX interface for TTY link configuration.<br/>
+
用户空间TTY客户端应用程序的主要API由便携式POSIX终端接口termios提供,该终端依靠/ dev / ttyX接口进行TTY链接配置。<br/>
  
The '''termios API'''<ref name="termios API"/> is a user land API, and its functions describe a general terminal interface that is provided to control asynchronous communications ports. <br/>
+
'''termios API'''<ref name="termios API"/> 是用户登陆API,其功能描述了提供的通用终端接口,用于控制异步通信端口。 <br/>
  
The POSIX termios API abstracts the low-level details of the hardware, and provides a simple yet complete programming interface that can be used for advanced projects. It is a wrapper on '''character device API''' <ref> [http://bootlin.com/doc/accessing-hardware.pdf Character device API overview], ''Accessing hardware from userspace'' training, Bootlin documentation</ref> ioctl operations.<br/>
+
POSIX termios API抽象化了硬件的底层细节,并提供了一个简单而完整的编程接口,可用于高级项目。 它是'''字符设备API'''<ref> [http://bootlin.com/doc/accessing-hardware.pdf Character device API overview], “从用户空间访问硬件”培训,Bootlin的包装 文档</ ref> ioctl操作。<br/>
  
{{Info|A [[Serial TTY line discipline|'''line discipline''']] driver can be used when a serial interface is needed at kernel level.}}
+
{{Info|A [[Serial TTY line discipline|'''line discipline''']]当需要在内核级别使用串行接口时,可以使用驱动程序。}}
For example, a kernel driver maybe needed to control an external device through an U(S)ART port.
+
例如,可能需要内核驱动程序通过U(S)ART端口控制外部设备。
{{ReviewsComments|FGA W1941: I rephrased above note, can you please double-ckeck ?}}
 
* The '''line discipline''' will be responsible for:
 
** creating this new kernel API
 
** routing data flow between serial core and new kernel API <br/>
 
  
{{ReviewsComments|FGA W1941: No how to use section, nor examples ? Is it deliberate ?<br/>
+
*  '''line discipline''' 将负责:
FGA W1941: Maybe worth pointing out some existing examples in the kernel ?}}
+
** 创建这个新的内核API
 +
** 在串行内核和新内核API之间路由数据流<br/>
  
 
==References==
 
==References==

2020年11月9日 (一) 10:57的最新版本

本文提供有关 Linux® TTY 框架的信息。 它说明了如何使用线路规则激活“ UART”接口,以及如何从用户和内核空间访问它。

Framework purpose

UART是几种设备类型(例如蓝牙,NFC,FM收音机和GPS设备)的通用接口。
从内核版本4.12开始,TTY框架中引入了串行设备总线(也称为Serdev),以改善提供给连接到串行端口的设备的接口。 请参考 Serial TTY overview文章,以详细了解TTY框架的用途。尽管如此,仍然有可能(即使不推荐)使用行规“驱动程序”。 本文重点介绍提供给连接到串行端口的设备的线路规范接口。

System overview

Serial TTY Line Discipline overview.png


Components description

从客户端应用程序到硬件

  • 应用程序:客户应用程序,用于从串行端口上连接的外围设备读取/写入数据。
  • TTY tools: Linux社区提供的工具,例 stty, ldattach, inputattach, tty, ttys, agetty, mingetty, kermit and minicom.
  • Termios: API[1] 提供使用串行驱动程序开发应用程序的接口。
  • 客户端子系统:TTY内核的内核子系统客户端(示例:蓝牙设备)

APIs description

TTY仅向用户空间提供字符设备接口(命名为/ dev / ttyX)。 用户空间TTY客户端应用程序的主要API由便携式POSIX终端接口termios提供,该终端依靠/ dev / ttyX接口进行TTY链接配置。

termios API[1] 是用户登陆API,其功能描述了提供的通用终端接口,用于控制异步通信端口。

POSIX termios API抽象化了硬件的底层细节,并提供了一个简单而完整的编程接口,可用于高级项目。 它是字符设备API<ref> Character device API overview, “从用户空间访问硬件”培训,Bootlin的包装 文档</ ref> ioctl操作。

Info.png A line discipline当需要在内核级别使用串行接口时,可以使用驱动程序。

例如,可能需要内核驱动程序通过U(S)ART端口控制外部设备。

  • line discipline 将负责:
    • 创建这个新的内核API
    • 在串行内核和新内核API之间路由数据流

References

  1. 1.01.1 termios API, Linux Programmer's Manual termios API Documentation (user land API with serial devices)