Poster of Linux kernelThe best gift for a Linux geek
 Linux kernel map 
⇦ prev ⇱ home next ⇨

18.9. Quick Reference

This section provides a reference for the concepts introduced in this chapter. It also explains the role of each header file that a tty driver needs to include. The lists of fields in the tty_driver and tty_device structures, however, are not repeated here.

#include <linux/tty_driver.h>

Header file that contains the definition of struct tty_driver and declares some of the different flags used in this structure.

#include <linux/tty.h>

Header file that contains the definition of struct tty_struct and a number of different macros to access the individual values of the struct termios fields easily. It also contains the function declarations of the tty driver core.

#include <linux/tty_flip.h>

Header file that contains some tty flip buffer inline functions that make it easier to manipulate the flip buffer structures.

#include <asm/termios.h>

Header file that contains the definition of struct termio for the specific hardware platform the kernel is built for.

struct tty_driver *alloc_tty_driver(int lines);

Function that creates a struct tty_driver that can be later passed to the tty_register_driver and tty_unregister_driver functions.

void put_tty_driver(struct tty_driver *driver);

Function that cleans up a struct tty_driver structure that has not been successfully registered with the tty core.

void tty_set_operations(struct tty_driver *driver, struct tty_operations *op);

Function that initializes the function callbacks of a struct tty_driver. This is necessary to call before tty_register_driver can be called.

int tty_register_driver(struct tty_driver *driver);

int tty_unregister_driver(struct tty_driver *driver);

Functions that register and unregister a tty driver from the tty core.

void tty_register_device(struct tty_driver *driver, unsigned minor, struct

device *device);

void tty_unregister_device(struct tty_driver *driver, unsigned minor);

Functions that register and unregister a single tty device with the tty core.

void tty_insert_flip_char(struct tty_struct *tty, unsigned char ch,

char flag);

Function that inserts characters into the tty device's flip buffer to be read by a user.

TTY_NORMAL

TTY_BREAK

TTY_FRAME

TTY_PARITY

TTY_OVERRUN

Different values for the flag paramater used in the tty_insert_flip_char function.

int tty_get_baud_rate(struct tty_struct *tty);

Function that gets the baud rate currently set for the specific tty device.

void tty_flip_buffer_push(struct tty_struct *tty);

Function that pushes the data in the current flip buffer to the user.

tty_std_termios

Variable that initializes a termios structure with a common set of default line settings.

    ⇦ prev ⇱ home next ⇨
    Poster of Linux kernelThe best gift for a Linux geek