Desktop/xinu_mips-1.0.2.tar/xinu_mips-1.0.2/include/tty.h File Reference

#include <vararg.h>

Include dependency graph for tty.h:

This graph shows which files directly or indirectly include this file:

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 ttyttyAlloc (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 Documentation

#define TTY_IBLEN   1024

input buffer size

Definition at line 14 of file tty.h.

Referenced by ttyRead().

#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

echo input

Definition at line 42 of file tty.h.

Referenced by shell(), and ttyRead().

#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

do raw input

Definition at line 41 of file tty.h.

Referenced by ttyRead().

#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

clear input flags

Definition at line 51 of file tty.h.

Referenced by ttyControl().

#define TTY_IOC_CLROFLAG   0x0024

clear output flags

Definition at line 54 of file tty.h.

Referenced by ttyControl().

#define TTY_IOC_EOF   0x0026

check if EOF in input

Definition at line 56 of file tty.h.

Referenced by shell(), and ttyControl().

#define TTY_IOC_GETIFLAG   0x0022

get input flags

Definition at line 52 of file tty.h.

Referenced by ttyControl().

#define TTY_IOC_GETOFLAG   0x0025

get output flags

Definition at line 55 of file tty.h.

Referenced by ttyControl().

#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

set input flags

Definition at line 50 of file tty.h.

Referenced by shell(), and ttyControl().

#define TTY_IOC_SETOFLAG   0x0023

set output flags

Definition at line 53 of file tty.h.

Referenced by ttyControl().

#define TTY_OFLAG_RAW   0x0001

do raw output

Definition at line 47 of file tty.h.

Referenced by ttyWrite().

#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

Definition at line 37 of file tty.h.

Referenced by ttyAlloc(), ttyClose(), and ttyInit().


Function Documentation

struct tty* ttyAlloc ( void   )  [read]

Allocate a tty structure.

Returns:
pointer to a TTY control block, NULL if none are free

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.

Parameters:
pdev TTY device table entry
Returns:
OK if TTY is closed properly, otherwise SYSERR

Definition at line 19 of file ttyClose.c.

References ASSERT, bzero(), dentry::controlblk, NULL, OK, tty::state, and TTY_STATE_FREE.

devcall ttyControl ( device pdev,
uchar  func,
uchar  arg1,
uchar  arg2 
)

Control function for TTY pseudo devices.

Parameters:
pdev TTY device table entry
func control function to execute
arg1 first argument for the control function
args second argument for the control function
Returns:
the result of 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.

Parameters:
pdev TTY device table entry
Returns:
character read from TTY

Definition at line 18 of file ttyGetChar.c.

References ttyRead().

devcall ttyInit ( device pdev  ) 

Initialize TTY structures.

Parameters:
pdev TTY device table entry
Returns:
OK if device is intialized successfully

Definition at line 21 of file ttyInit.c.

References bzero(), dentry::controlblk, dentry::minor, NULL, OK, TTY_STATE_FREE, and ttytab.

devcall ttyOpen ( device pdev,
va_list  ap 
)

Associate a TTY with a hardware device.

Parameters:
pdev TTY device table entry
ap 2nd argument is the device number for the hardware device
Returns:
OK if TTY is opened properly, otherwise SYSERR

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.

devcall ttyPutChar ( device pdev,
uchar  ch 
)

Wwrite a single character to a TTY.

Parameters:
pdev TTY device table entry
ch character to output
Returns:
1 if character was written successfully

Definition at line 19 of file ttyPutChar.c.

References ttyWrite().

Referenced by ttyRead().

devcall ttyRead ( device pdev,
char *  buf,
ushort  len 
)

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.

Parameters:
pdev pointer to tty device
buf buffer for read characters
len size of the buffer
Returns:
number of characters read, EOF if end of file was reached

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().

devcall ttyWrite ( device pdev,
uchar buf,
ushort  len 
)

Write a buffer to a tty

Parameters:
pdev TTY device table entry
buf buffer of characters to output
len size of the buffer
Returns:
count of characters output

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().


Variable Documentation

struct tty ttytab[]

Definition at line 14 of file ttyInit.c.

Referenced by ttyAlloc(), and ttyInit().


Generated on Thu Oct 9 22:34:45 2008 for xinu by  doxygen 1.5.5