00001 /* 00002 * @file tty.h 00003 * 00004 * $Id: tty.h 226 2007-07-12 01:18:27Z mschul $ 00005 */ 00006 /* Embedded XINU, Copyright (C) 2007. All rights reserved. */ 00007 00008 #ifndef __TTY_H__ 00009 #define __TTY_H__ 00010 00011 #include <vararg.h> 00012 00013 /* TTY Buffer lengths */ 00014 #define TTY_IBLEN 1024 00016 struct tty 00017 { 00018 uchar state; 00020 /* Pointers to associated structures */ 00021 device *tty_dev; 00022 device *tty_phw; 00024 /* TTY input fields */ 00025 uchar iflags; 00026 ushort istart; 00027 ushort icount; 00028 uchar inbuf[TTY_IBLEN]; 00030 /* TTY output fields */ 00031 uchar oflags; 00032 }; 00033 00034 extern struct tty ttytab[]; 00035 00036 /* TTY states */ 00037 #define TTY_STATE_FREE 0 00038 #define TTY_STATE_ALLOC 1 00039 00040 /* TTY input flags */ 00041 #define TTY_IFLAG_RAW 0x0001 00042 #define TTY_IFLAG_ECHO 0x0002 00043 #define TTY_IFLAG_CBREAK 0x0004 00044 #define TTY_IFLAG_EOF 0x0008 00046 /* TTY output flags */ 00047 #define TTY_OFLAG_RAW 0x0001 00049 /* ttyControl() functions */ 00050 #define TTY_IOC_SETIFLAG 0x0020 00051 #define TTY_IOC_CLRIFLAG 0x0021 00052 #define TTY_IOC_GETIFLAG 0x0022 00053 #define TTY_IOC_SETOFLAG 0x0023 00054 #define TTY_IOC_CLROFLAG 0x0024 00055 #define TTY_IOC_GETOFLAG 0x0025 00056 #define TTY_IOC_EOF 0x0026 00057 #define TTY_IOC_CBREAK 0x0027 00058 #define TTY_IOC_NEXTC 0x0028 00060 /* Driver functions */ 00061 struct tty *ttyAlloc(void); 00062 devcall ttyInit(device *); 00063 devcall ttyOpen(device *, va_list); 00064 devcall ttyClose(device *); 00065 devcall ttyRead(device *, char *, ushort); 00066 devcall ttyWrite(device *, uchar *, ushort); 00067 devcall ttyGetChar(device *); 00068 devcall ttyPutChar(device *, uchar); 00069 devcall ttyControl(device *, uchar, uchar, uchar); 00070 00071 #endif /* __TTY_H__ */