Source to include/mach/con_ibm.h
0001 /*
0002 * con_ibm.h : IBM and clone specific header for the console driver.
0003 *
0004 * Written by G.T.Nicol with bits borrowed from the original
0005 */
0006
0007 #ifndef __VSTA_CON_IBM_H__
0008 #define __VSTA_CON_IBM_H__
0009
0010 #include <sys/types.h>
0011 #include <sys/param.h>
0012 #include <sys/perm.h>
0013 #include <sys/fs.h>
0014
0015 #define CONS_MAX_PARAM 128
0016 #define CONS_TAB_SIZE 8 /* Tab stops every 8 positions */
0017
0018 /*
0019 * Colors for the IBM et al.
0020 */
0021 #define CONS_BLACK 0
0022 #define CONS_BLUE 1
0023 #define CONS_GREEN 2
0024 #define CONS_CYAN 3
0025 #define CONS_RED 4
0026 #define CONS_MAGENTA 5
0027 #define CONS_YELLOW 6
0028 #define CONS_WHITE 7
0029 #define CONS_BLINK (1 << 8)
0030 #define CONS_BOLD (1 << 8)
0031 #define CONS_FOREGROUND_MASK 0x0F
0032 #define CONS_BACKGROUND_MASK 0xF0
0033 #define CONS_SET_FORE(x,y) (((x) & ~CONS_FOREGROUND_MASK) | (y))
0034 #define CONS_SET_BACK(x,y) (((x) & ~CONS_BACKGROUND_MASK) | ((y)<<4))
0035
0036 /*
0037 * These are used by con_move() to decide how to move the cursor
0038 */
0039 #define CONS_MOVE_UP 1
0040 #define CONS_MOVE_DOWN 2
0041 #define CONS_MOVE_LEFT 3
0042 #define CONS_MOVE_RIGHT 4
0043
0044 /*
0045 * These are used by con_erase() to decide where to clear to
0046 */
0047 #define CONS_ERASE_EOS 1
0048 #define CONS_ERASE_EOL 2
0049 #define CONS_ERASE_SOS 3
0050 #define CONS_ERASE_SOL 4
0051 #define CONS_ERASE_SCREEN 5
0052 #define CONS_ERASE_LINE 6
0053
0054 /*
0055 * These are used in con_insert() and con_delete()
0056 */
0057 #define CONS_LINE_MODE 7
0058 #define CONS_CHAR_MODE 8
0059
0060 /*
0061 * These are almost meaningless, but in the NEC version we have more states
0062 * for kanji mode etc.
0063 */
0064 #define CONS_MODE_NORMAL 0
0065 #define CONS_VTGRAPH (1 << 1) /* use the VT52 graphics set */
0066 #define CONS_VT52_PRIORITY (1 << 2) /* interpret VT52 codes first */
0067
0068 /*
0069 * These are the states of the escape sequence parser in con_putchar()
0070 */
0071 #define STATE_NORMAL 0x00 /* Normal state */
0072 #define STATE_ESCAPE 0x01 /* ESC seen state */
0073 #define STATE_ESCAPE_LPAREN 0x02 /* ESC ( seen state */
0074 #define STATE_ESCAPE_RPAREN 0x03 /* ESC ) seen state */
0075 #define STATE_ESCAPE_BRACKET 0x04 /* ESC [ seen state */
0076 #define STATE_ESCAPE_SHARP 0x05 /* ESC # seen state */
0077 #define STATE_FUNCTION_KEY 0x06 /* ESC [[ seen state */
0078 #define STATE_GET_PARAMETERS 0x07 /* ESC [ seen. Read params */
0079 #define STATE_GOT_PARAMETERS 0x08 /* ESC [ seen. Got params */
0080
0081 /*
0082 * These are the responses. Currently they are unused....
0083 */
0084 #define RESPOND_VT52_ID "\033/Z"
0085 #define RESPOND_VT102_ID "\033[?6c"
0086 #define RESPOND_STATUS_OK "\033[0n"
0087
0088 #define min(a,b) ((a) < (b) ? a : b)
0089 #define max(a,b) ((a) > (b) ? a : b)
0090
0091 /*
0092 * An open file
0093 */
0094 struct file {
0095 uint f_gen; /* Generation of access */
0096 uint f_flags;/* User access bits */
0097 };
0098
0099 /* main.c */
0100 extern struct prot con_prot;
0101
0102 /* con_nec.c */
0103 extern uint con_max_rows;
0104 extern uint con_max_cols;
0105 extern void con_initialise(int argc, char **argv);
0106 extern void con_write_string(char *string, int count);
0107
0108 /* stat.c */
0109 extern void con_stat(struct msg * m, struct file * f);
0110 extern void con_wstat(struct msg * m, struct file * f);
0111
0112 #endif /* __VSTA_CON_NEC_H__ */