TTY Driver

From Embedded Xinu
Revision as of 17:08, 20 June 2007 by Agember (talk | contribs)
Jump to navigation Jump to search
Diagram of the interaction between hardware, UART driver, TTY driver, and user application.

The TTY driver is built on top of the UART driver (or other TTY appropriate hardware). The driver is responsible for sending and receiving character input between a user level application, such as the XINU Shell, and a char-oriented hardware driver. Line buffering and cooking are the two primary responsibilities for the new TTY driver.

Conceptual structure




This section needs updating


 struct tty *ttyAlloc(void)
 DEVCALL ttyOpen(struct dentry *pdev, va_list ap)

Open associates a TTY with an underlying char-oriented hardware driver. The underlying device should already be initialized. A TTY is allocated from the available TTY devices and its circular buffers are initialized.


 DEVCALL ttyClose(struct dentry *pdev)

Close disasociates a TTY from its underlying device. It also makes the TTY available to be allocated to other processes.


This section needs updating


This section needs updating


 DEVCALL ttyControl(struct dentry *pdev, int func, unsigned char arg1, unsigned char arg2)
 /* ttyControl() functions  */
 #define	TTY_IOC_SETIFLAG	0x0020  /* set input flags	        */
 #define	TTY_IOC_CLRIFLAG	0x0021  /* clear input flags	        */
 #define	TTY_IOC_GETIFLAG	0x0022  /* get input flags              */
 #define	TTY_IOC_SETOFLAG	0x0023  /* set output flags             */
 #define	TTY_IOC_CLROFLAG	0x0024  /* clear output flags           */
 #define	TTY_IOC_GETOFLAG	0x0025  /* get output flags             */
 #define TTY_IOC_EOF             0x0026  /* check if EOF in input        */ 
 #define TTY_IOC_CBREAK          0x0027  /* check if CBREAK in input     */
 /* TTY input flags */
 #define	TTY_IFLAG_RAW		0x0001  /* do raw input                 */
 #define	TTY_IFLAG_ECHO	        0x0002  /* echo input		        */
 #define	TTY_IFLAG_CBREAK	0x0004  /* have seen Break (Control-C)  */
 #define	TTY_IFLAG_EOF		0x0008	/* have seen EOF (Control-D)    */
 /* TTY output flags */
 #define	TTY_OFLAG_RAW		0x0001	/* do raw output		*/

This section needs updating

See also