#include <vararg.h>
Go to the source code of this file.
Data Structures | |
struct | tty |
Defines | |
#define | TTY_IBLEN 1024 |
#define | TTY_STATE_FREE 0 |
#define | TTY_STATE_ALLOC 1 |
#define | TTY_IFLAG_RAW 0x0001 |
#define | TTY_IFLAG_ECHO 0x0002 |
#define | TTY_IFLAG_CBREAK 0x0004 |
#define | TTY_IFLAG_EOF 0x0008 |
#define | TTY_OFLAG_RAW 0x0001 |
#define | TTY_IOC_SETIFLAG 0x0020 |
#define | TTY_IOC_CLRIFLAG 0x0021 |
#define | TTY_IOC_GETIFLAG 0x0022 |
#define | TTY_IOC_SETOFLAG 0x0023 |
#define | TTY_IOC_CLROFLAG 0x0024 |
#define | TTY_IOC_GETOFLAG 0x0025 |
#define | TTY_IOC_EOF 0x0026 |
#define | TTY_IOC_CBREAK 0x0027 |
#define | TTY_IOC_NEXTC 0x0028 |
Functions | |
struct tty * | ttyAlloc (void) |
devcall | ttyInit (device *) |
devcall | ttyOpen (device *, va_list) |
devcall | ttyClose (device *) |
devcall | ttyRead (device *, char *, ushort) |
devcall | ttyWrite (device *, uchar *, ushort) |
devcall | ttyGetChar (device *) |
devcall | ttyPutChar (device *, uchar) |
devcall | ttyControl (device *, uchar, uchar, uchar) |
Variables | |
struct tty | ttytab [] |
#define TTY_IBLEN 1024 |
#define TTY_IFLAG_CBREAK 0x0004 |
have seen Break (Control-C)
Definition at line 43 of file tty.h.
Referenced by ttyControl(), and ttyRead().
#define TTY_IFLAG_ECHO 0x0002 |
#define TTY_IFLAG_EOF 0x0008 |
have seen EOF (Control-D)
Definition at line 44 of file tty.h.
Referenced by ttyControl(), and ttyRead().
#define TTY_IFLAG_RAW 0x0001 |
#define TTY_IOC_CBREAK 0x0027 |
check if CBREAK in input
Definition at line 57 of file tty.h.
Referenced by shell(), and ttyControl().
#define TTY_IOC_CLRIFLAG 0x0021 |
#define TTY_IOC_CLROFLAG 0x0024 |
#define TTY_IOC_EOF 0x0026 |
#define TTY_IOC_GETIFLAG 0x0022 |
#define TTY_IOC_GETOFLAG 0x0025 |
#define TTY_IOC_NEXTC 0x0028 |
Peek at next input character
Definition at line 58 of file tty.h.
Referenced by getch(), and ttyControl().
#define TTY_IOC_SETIFLAG 0x0020 |
#define TTY_IOC_SETOFLAG 0x0023 |
#define TTY_OFLAG_RAW 0x0001 |
#define TTY_STATE_ALLOC 1 |
Definition at line 38 of file tty.h.
Referenced by ttyAlloc(), ttyControl(), ttyRead(), and ttyWrite().
#define TTY_STATE_FREE 0 |
struct tty* ttyAlloc | ( | void | ) | [read] |
Allocate a tty structure.
Definition at line 17 of file ttyAlloc.c.
References disable(), NTTY, NULL, restore(), tty::state, TTY_STATE_ALLOC, TTY_STATE_FREE, and ttytab.
Referenced by ttyOpen().
devcall ttyClose | ( | device * | pdev | ) |
Close a TTY device.
pdev | TTY device table entry |
Definition at line 19 of file ttyClose.c.
References ASSERT, bzero(), dentry::controlblk, NULL, OK, tty::state, and TTY_STATE_FREE.
Control function for TTY pseudo devices.
pdev | TTY device table entry | |
func | control function to execute | |
arg1 | first argument for the control function | |
args | second argument for the control function |
Definition at line 21 of file ttyControl.c.
References ASSERT, dentry::controlblk, dentry::getc, tty::icount, tty::iflags, tty::inbuf, tty::istart, NULL, tty::oflags, tty::state, SYSERR, TTY_IFLAG_CBREAK, TTY_IFLAG_EOF, TTY_IOC_CBREAK, TTY_IOC_CLRIFLAG, TTY_IOC_CLROFLAG, TTY_IOC_EOF, TTY_IOC_GETIFLAG, TTY_IOC_GETOFLAG, TTY_IOC_NEXTC, TTY_IOC_SETIFLAG, TTY_IOC_SETOFLAG, tty::tty_phw, and TTY_STATE_ALLOC.
devcall ttyGetChar | ( | device * | pdev | ) |
Read a single character from a TTY.
pdev | TTY device table entry |
Definition at line 18 of file ttyGetChar.c.
References ttyRead().
devcall ttyInit | ( | device * | pdev | ) |
Initialize TTY structures.
pdev | TTY device table entry |
Definition at line 21 of file ttyInit.c.
References bzero(), dentry::controlblk, dentry::minor, NULL, OK, TTY_STATE_FREE, and ttytab.
Associate a TTY with a hardware device.
pdev | TTY device table entry | |
ap | 2nd argument is the device number for the hardware device |
Definition at line 20 of file ttyOpen.c.
References ASSERT, dentry::controlblk, devtab, tty::icount, tty::iflags, isbaddev, tty::istart, NULL, tty::oflags, OK, tty::tty_dev, tty::tty_phw, ttyAlloc(), and va_arg.
Wwrite a single character to a TTY.
pdev | TTY device table entry | |
ch | character to output |
Definition at line 19 of file ttyPutChar.c.
References ttyWrite().
Referenced by ttyRead().
Read characters from a tty.
Characters are read from an underlying device, normally a UART. Input is read from the underlying device in lines. Lines may be terminated with the line feed or carriage return characters. Read requests are not satsified until a full line has been read, or the tty's buffer is full. When the tty is not in raw mode, backspaces are cooked and escape sequences and the null character is ignored. When the end of file (Control+D) character is read, the tty stops reading from the underlying device. Subsquent calls to ttyRead will attempt to staisfy the request from the tty's buffer, otherwise EOF will be returned.
pdev | pointer to tty device | |
buf | buffer for read characters | |
len | size of the buffer |
Definition at line 31 of file ttyRead.c.
References ASSERT, dentry::controlblk, EOF, dentry::getc, tty::icount, tty::iflags, tty::inbuf, tty::istart, NULL, tty::state, SYSERR, tty::tty_dev, TTY_IBLEN, TTY_IFLAG_CBREAK, TTY_IFLAG_ECHO, TTY_IFLAG_EOF, TTY_IFLAG_RAW, tty::tty_phw, TTY_STATE_ALLOC, and ttyPutChar().
Referenced by ttyGetChar().
Write a buffer to a tty
pdev | TTY device table entry | |
buf | buffer of characters to output | |
len | size of the buffer |
Definition at line 20 of file ttyWrite.c.
References ASSERT, dentry::controlblk, NULL, tty::oflags, dentry::putc, tty::state, SYSERR, TTY_OFLAG_RAW, tty::tty_phw, and TTY_STATE_ALLOC.
Referenced by ttyPutChar().