Collaboration diagram for Terminal Emulator.:
Detailed Description
Virtual terminal emulator.
The virtual terminal driver allows to use a LC or VF display for standard I/O. It supports VT52 control codes.
|
Data Structures |
| struct | _WINSIZE |
| struct | _TERMDCB |
| | Terminal device control block structure. More...
|
| struct | _TERMDCB |
| | Terminal device control block structure. More...
|
Defines |
|
#define | LCD_CMDBYTE |
|
#define | LCD_CMDWORD16 |
|
#define | LCD_CMDWORD32 |
|
#define | LCD_DATABYTE |
|
#define | LCD_DATAWORD16 |
|
#define | LCD_DATAWORD32 |
|
#define | LCD_SETCOOKEDMODE |
| | Set raw mode.
|
|
#define | LCD_GETCOOKEDMODE |
| | Query raw mode.
|
| #define | TIOCGWINSZ |
| #define | TIOCSWINSZ |
|
#define | LCD_MF_CURSORON |
| | Cursor on flag.
|
|
#define | LCD_MF_COOKEDMODE |
| | Control character interpretation on flag.
|
|
#define | ESC_CHAR |
|
#define | ESC_POS |
|
#define | ESC_UP |
|
#define | ESC_DOWN |
|
#define | ESC_RIGHT |
|
#define | ESC_LEFT |
|
#define | ESC_CLRHOME |
|
#define | ESC_CLR |
|
#define | ESC_CLREND |
|
#define | ESC_CLREOL |
|
#define | ESC_CLRSTART |
|
#define | ESC_CLRSOL |
|
#define | ESC_INSCHAR |
|
#define | ESC_INSLINE |
|
#define | ESC_DELCHAR |
|
#define | ESC_DELLINE |
|
#define | ESC_RLF |
|
#define | ESC_CURSORON |
|
#define | ESC_CURSOROFF |
|
#define | ESC_SPECIALSET |
|
#define | ESC_DEFAULTSET |
|
#define | ESC_ACTIVE |
|
#define | ESC_SLEEP |
Typedefs |
|
typedef _WINSIZE | WINSIZE |
| typedef _TERMDCB | TERMDCB |
Functions |
|
void | TermRefresh (TERMDCB *dcb) |
| int | TermIOCtl (NUTDEVICE *dev, int req, void *conf) |
| | Perform special LCD control functions.
|
| int | TermInit (NUTDEVICE *dev) |
| | Initialize the terminal device.
|
| int | TermWrite (NUTFILE *fp, CONST void *buffer, int len) |
| | Write data to a terminal device.
|
| NUTFILE * | TermOpen (NUTDEVICE *dev, CONST char *name, int mode, int acc) |
| | Write data from program space to a terminal device. Open a terminal device.
|
| int | TermClose (NUTFILE *fp) |
| | Close a device or file.
|
Define Documentation
Typedef Documentation
|
|
Terminal device control block type. |
Function Documentation
|
|
Close a device or file.
Application should not call this function directly, but use the stdio interface.
- Parameters:
-
| fp | Pointer to a previously opened NUTFILE structure. |
- Returns:
- 0 if the device was successfully closed or –1 to indicate an error.
|
|
|
Initialize the terminal device.
Prepares the device for subsequent writing.
Application should not call this function directly, but use the stdio interface.
- Parameters:
-
| dev | Identifies the device to initialize. |
- Returns:
- 0 on success, -1 otherwise.
|
| int TermIOCtl |
( |
NUTDEVICE * |
dev, |
|
|
int |
req, |
|
|
void * |
conf |
|
) |
|
|
|
|
Perform special LCD control functions.
- Parameters:
-
| dev | Identifies the device that receives the device-control function. |
| req | Requested control function. May be set to one of the following constants:
- LCD_CMDBYTE Send command byte to display. Parameter conf points to an u_char value containing the command byte.
- LCD_CMDWORD16 Send 16 bit command word to display. Parameter conf points to an u_short value containing the command bytes. The most significant byte is send first.
- LCD_CMDWORD32 Send 32 bit command byte to display. Parameter conf points to an u_long value containing the command bytes. The most significant bytes are send first.
- LCD_DATABYTE Send raw data byte to display. Parameter conf points to an u_char value containing the data byte.
- LCD_DATAWORD16 Send 16 bit raw data word to display. Parameter conf points to an u_short value containing the data bytes. The most significant byte is send first.
- LCD_DATAWORD32 Send 32 bit raw data word to display. Parameter conf points to an u_long value containing the data bytes. The most significant bytes are send first.
- LCD_SETCOOKEDMODE Set terminal control character mode. Parameter conf points to an u_long value containing 0 (off) or 1 (on).
- LCD_GETCOOKEDMODE Query terminal control character mode. Parameter conf points to an u_long value receiving 0 (off) or 1 (on).
|
| conf | Points to a buffer that contains any data required for the given control function or receives data from that function. |
- Returns:
- 0 on success, -1 otherwise.
|
|
|
Write data from program space to a terminal device. Open a terminal device.
Application should not call this function directly, but use the stdio interface.
- Parameters:
-
| dev | Pointer to device information structure. |
| name | Filename. Not used with terminal devices. |
| mode | Operation mode. May be any of the following:
- _O_BINARY Raw mode, no control character interpretation.
- _O_TEXT Text mode. Control characters are interpreted and tranlated to LCD commands.
|
| acc | Access mode. Not used with terminal devices. |
- Returns:
- Pointer to a NUTFILE structure or –1 to indicate an error.
|
| int TermWrite |
( |
NUTFILE * |
fp, |
|
|
CONST void * |
buffer, |
|
|
int |
len |
|
) |
|
|
|
|
Write data to a terminal device.
Application should not call this function directly, but use the stdio interface.
The data may contain special character sequences, which are interpreted by the terminal device to control specific display functions:
- Ctrl-H (ASCII 8) Backspace
- Ctrl-J (ASCII 10) Linefeed
- Ctrl-L (ASCII 12) Formfeed
- Ctrl-M (ASCII 13) Carriage return
In addition a superset of VT52 control sequences are interpreted. Each sequence starts with an ESC character (ASCII 27):
- ESC @ Insert space(*).
- ESC A Move cursor up, ignored if on first line.
- ESC B Move cursor down, ignored if on last line.
- ESC C Move cursor right, ignored if on last column.
- ESC D Move cursor left, ignored if on first column.
- ESC E Clear display and move cursor home (*).
- ESC H Move cursor home.
- ESC I Reverse linefeed.
- ESC J Erase to end of display.
- ESC K Erase to end of line.
- ESC L Insert line (*).
- ESC M Delete line (*).
- ESC P Delete character (*).
- ESC R Reactivate display (*).
- ESC S Put display in sleep mode (*).
- ESC Y x+32 y+32 Move cursor to position.
- ESC e Cursor on (*).
- ESC f Cursor off (*).
- ESC d Erase to start of display (*).
- ESC o Erase to start of line (*).
(*) Not a VT52 command.
- Parameters:
-
| fp | File pointer to a previously opened device. |
| buffer | Pointer to the data bytes to be written. |
| len | Number of bytes to write. |
- Returns:
- The number of bytes written.
|