~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/driver-api/tty/index.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 .. SPDX-License-Identifier: GPL-2.0
  2 
  3 ===
  4 TTY
  5 ===
  6 
  7 Teletypewriter (TTY) layer takes care of all those serial devices. Including
  8 the virtual ones like pseudoterminal (PTY).
  9 
 10 TTY structures
 11 ==============
 12 
 13 There are several major TTY structures. Every TTY device in a system has a
 14 corresponding struct tty_port. These devices are maintained by a TTY driver
 15 which is struct tty_driver. This structure describes the driver but also
 16 contains a reference to operations which could be performed on the TTYs. It is
 17 struct tty_operations. Then, upon open, a struct tty_struct is allocated and
 18 lives until the final close. During this time, several callbacks from struct
 19 tty_operations are invoked by the TTY layer.
 20 
 21 Every character received by the kernel (both from devices and users) is passed
 22 through a preselected :doc:`tty_ldisc` (in
 23 short ldisc; in C, struct tty_ldisc_ops). Its task is to transform characters
 24 as defined by a particular ldisc or by user too. The default one is n_tty,
 25 implementing echoes, signal handling, jobs control, special characters
 26 processing, and more. The transformed characters are passed further to
 27 user/device, depending on the source.
 28 
 29 In-detail description of the named TTY structures is in separate documents:
 30 
 31 .. toctree::
 32    :maxdepth: 2
 33 
 34    tty_driver
 35    tty_port
 36    tty_struct
 37    tty_ldisc
 38    tty_buffer
 39    tty_ioctl
 40    tty_internals
 41    console
 42 
 43 Writing TTY Driver
 44 ==================
 45 
 46 Before one starts writing a TTY driver, they must consider
 47 :doc:`Serial <../serial/driver>` and :doc:`USB Serial <../../usb/usb-serial>`
 48 layers first. Drivers for serial devices can often use one of these specific
 49 layers to implement a serial driver. Only special devices should be handled
 50 directly by the TTY Layer. If you are about to write such a driver, read on.
 51 
 52 A *typical* sequence a TTY driver performs is as follows:
 53 
 54 #. Allocate and register a TTY driver (module init)
 55 #. Create and register TTY devices as they are probed (probe function)
 56 #. Handle TTY operations and events like interrupts (TTY core invokes the
 57    former, the device the latter)
 58 #. Remove devices as they are going away (remove function)
 59 #. Unregister and free the TTY driver (module exit)
 60 
 61 Steps regarding driver, i.e. 1., 3., and 5. are described in detail in
 62 :doc:`tty_driver`. For the other two (devices handling), look into
 63 :doc:`tty_port`.
 64 
 65 Other Documentation
 66 ===================
 67 
 68 Miscellaneous documentation can be further found in these documents:
 69 
 70 .. toctree::
 71    :maxdepth: 2
 72 
 73    moxa-smartio
 74    n_gsm
 75    n_tty

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php