|
From: James S. <jsi...@us...> - 2003-08-11 16:33:40
|
Update of /cvsroot/linuxconsole/ruby/ruby-2.6/include/linux
In directory sc8-pr-cvs1:/tmp/cvs-serv30919/ruby-2.6/include/linux
Added Files:
console.h consolemap.h kbd_kern.h selection.h tty.h vt_kern.h
Log Message:
Synced to 2.6.0-test3
--- NEW FILE: console.h ---
/*
* linux/include/linux/console.h
*
* Copyright (C) 1993 Hamish Macdonald
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*
* Changed:
* 10-Mar-94: Arno Griffioen: Conversion for vt100 emulator port from PC LINUX
*/
#ifndef _LINUX_CONSOLE_H_
#define _LINUX_CONSOLE_H_ 1
#include <linux/types.h>
#include <linux/kdev_t.h>
#include <linux/spinlock.h>
/*
* Array of consoles built from command line options (console=)
*/
struct console_cmdline
{
char name[8]; /* Name of the driver */
int index; /* Minor dev. to use */
char *options; /* Options for the driver */
};
#define MAX_CMDLINECONSOLES 8
extern struct console_cmdline console_list[MAX_CMDLINECONSOLES];
/*
* The interface for a console, or any other device that
* wants to capture console messages (printer driver?)
*/
#define CON_PRINTBUFFER (1)
#define CON_CONSDEV (2) /* Last on the command line */
#define CON_ENABLED (4)
struct console
{
char name[8];
void (*write)(struct console *, const char *, unsigned);
int (*read)(struct console *, char *, unsigned);
struct tty_driver *(*device)(struct console *, int *);
void (*unblank)(void);
int (*setup)(struct console *, char *);
short flags;
short index;
int cflag;
void *data;
struct console *next;
};
extern void register_console(struct console *);
extern int unregister_console(struct console *);
extern struct console *console_drivers;
extern void acquire_console_sem(void);
extern void release_console_sem(void);
extern void console_conditional_schedule(void);
extern void console_unblank(void);
/* VESA Blanking Levels */
#define VESA_NO_BLANKING 0
#define VESA_VSYNC_SUSPEND 1
#define VESA_HSYNC_SUSPEND 2
#define VESA_POWERDOWN 3
#endif /* _LINUX_CONSOLE_H */
--- NEW FILE: consolemap.h ---
/*
* consolemap.h
*
* Interface between console.c, selection.c and consolemap.c
*/
#define LAT1_MAP 0
#define GRAF_MAP 1
#define IBMPC_MAP 2
#define USER_MAP 3
struct vc_data;
extern unsigned char inverse_translate(struct vc_data *vc, int glyph);
extern void set_translate(struct vc_data *vc, int m);
extern int conv_uni_to_pc(struct vc_data *vc, long ucs);
--- NEW FILE: kbd_kern.h ---
#ifndef _KBD_KERN_H
#define _KBD_KERN_H
#include <linux/tty.h>
#include <linux/kd.h>
#include <linux/interrupt.h>
#include <linux/keyboard.h>
extern struct tasklet_struct keyboard_tasklet;
extern int shift_state;
extern char *func_table[MAX_NR_FUNC];
extern char func_buf[];
extern char *funcbufptr;
extern int funcbufsize, funcbufleft;
#define KBD_DEFMODE ((1 << VC_REPEAT) | (1 << VC_META))
/*
* Some laptops take the 789uiojklm,. keys as number pad when NumLock is on.
* This seems a good reason to start with NumLock off. On PC9800 and HIL keyboards
* of PARISC machines however there is no NumLock key and everyone expects the keypad
* to be used for numbers.
*/
#if defined(CONFIG_X86_PC9800)
#define KBD_DEFLEDS (1 << VC_NUMLOCK)
#else
#define KBD_DEFLEDS 0
#endif
#define KBD_DEFLOCK 0
struct vc_data;
/*
* kbd->xxx contains the VC-local things (flag settings etc..)
*
* Note: externally visible are LED_SCR, LED_NUM, LED_CAP defined in kd.h
* The code in KDGETLED / KDSETLED depends on the internal and
* external order being the same.
*
* Note: lockstate is used as index in the array key_map.
*/
struct kbd_struct {
unsigned char lockstate;
/* 8 modifiers - the names do not have any meaning at all;
they can be associated to arbitrarily chosen keys */
#define VC_SHIFTLOCK KG_SHIFT /* shift lock mode */
#define VC_ALTGRLOCK KG_ALTGR /* altgr lock mode */
#define VC_CTRLLOCK KG_CTRL /* control lock mode */
#define VC_ALTLOCK KG_ALT /* alt lock mode */
#define VC_SHIFTLLOCK KG_SHIFTL /* shiftl lock mode */
#define VC_SHIFTRLOCK KG_SHIFTR /* shiftr lock mode */
#define VC_CTRLLLOCK KG_CTRLL /* ctrll lock mode */
#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
unsigned char ledmode:2; /* one 2-bit value */
#define LED_SHOW_FLAGS 0 /* traditional state */
#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */
unsigned char ledflagstate:4; /* flags, not lights */
unsigned char default_ledflagstate:4;
#define VC_SCROLLOCK 0 /* scroll-lock mode */
#define VC_NUMLOCK 1 /* numeric lock mode */
#define VC_CAPSLOCK 2 /* capslock mode */
#define VC_KANALOCK 3 /* kanalock mode */
unsigned char kbdmode:2; /* one 2-bit value */
#define VC_XLATE 0 /* translate keycodes using keymap */
#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
#define VC_RAW 2 /* raw (scancode) mode */
#define VC_UNICODE 3 /* Unicode mode */
unsigned char modeflags:5;
#define VC_APPLIC 0 /* application key mode */
#define VC_CKMODE 1 /* cursor key mode */
#define VC_REPEAT 2 /* keyboard repeat */
#define VC_CRLF 3 /* 0 - enter sends CR, 1 - enter sends CRLF */
#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */
};
extern int kbd_init(void);
extern unsigned char getledstate(struct vc_data *vc);
extern void setledstate(struct vc_data *vc, unsigned int led);
extern int do_poke_blanked_console;
extern void (*kbd_ledfunc) (unsigned int led);
static inline void set_leds(void)
{
tasklet_schedule(&keyboard_tasklet);
}
static inline int get_kbd_mode(struct kbd_struct kbd, int flag)
{
return ((kbd.modeflags >> flag) & 1);
}
static inline int get_kbd_led(struct kbd_struct kbd, int flag)
{
return ((kbd.ledflagstate >> flag) & 1);
}
static inline void set_kbd_mode(struct kbd_struct kbd, int flag)
{
kbd.modeflags |= 1 << flag;
}
static inline void set_kbd_led(struct kbd_struct kbd, int flag)
{
kbd.ledflagstate |= 1 << flag;
}
static inline void clr_kbd_mode(struct kbd_struct kbd, int flag)
{
kbd.modeflags &= ~(1 << flag);
}
static inline void clr_kbd_led(struct kbd_struct kbd, int flag)
{
kbd.ledflagstate &= ~(1 << flag);
}
static inline void chg_kbd_lock(struct kbd_struct kbd, int flag)
{
kbd.lockstate ^= 1 << flag;
}
static inline void chg_kbd_slock(struct kbd_struct kbd, int flag)
{
kbd.slockstate ^= 1 << flag;
}
static inline void chg_kbd_mode(struct kbd_struct kbd, int flag)
{
kbd.modeflags ^= 1 << flag;
}
static inline void chg_kbd_led(struct kbd_struct kbd, int flag)
{
kbd.ledflagstate ^= 1 << flag;
}
#define U(x) ((x) ^ 0xf000)
/* keyboard.c */
struct vc_data;
int getkeycode(struct input_handle *handle, unsigned int scancode);
int setkeycode(struct input_handle *handle, unsigned int scancode, unsigned int keycode);
void kd_mksound(struct input_handle *handle, unsigned int hz, unsigned int ticks);
void kd_nosound(unsigned long private);
int kbd_rate(struct input_handle *handle, struct kbd_repeat *rep);
void puts_queue(struct vc_data *vc, char *cp);
void compute_shiftstate(void);
/* defkeymap.c */
extern unsigned int keymap_count;
#endif
--- NEW FILE: selection.h ---
/*
* selection.h
*
* Interface between console.c, tty_io.c, vt.c, vc_screen.c and selection.c
*/
#ifndef _LINUX_SELECTION_H_
#define _LINUX_SELECTION_H_
#include <linux/tiocl.h>
#include <linux/vt_buffer.h>
extern int sel_cons;
extern void clear_selection(void);
extern int set_selection(const struct tiocl_selection *sel, struct tty_struct *tty, int user);
extern int paste_selection(struct tty_struct *tty);
extern int sel_loadlut(const unsigned long arg);
extern int mouse_reporting(struct vc_data *vc);
extern void mouse_report(struct vc_data *vc, int butt, int mrx, int mry);
extern unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed);
extern u16 screen_glyph(struct vc_data *vc, int offset);
extern void complement_pos(struct vc_data *vc, int offset);
extern void invert_screen(struct vc_data *vc, int offset, int count, int shift);
extern void getconsxy(struct vc_data *vc, char *p);
extern void putconsxy(struct vc_data *vc, char *p);
extern u16 vcs_scr_readw(struct vc_data *vc, const u16 *org);
extern void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org);
#endif
--- NEW FILE: tty.h ---
#ifndef _LINUX_TTY_H
#define _LINUX_TTY_H
/*
* 'tty.h' defines some structures used by tty_io.c and some defines.
*/
#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/fs.h>
#include <linux/major.h>
#include <linux/termios.h>
#include <linux/workqueue.h>
#include <linux/tty_driver.h>
#include <linux/tty_ldisc.h>
#include <asm/system.h>
/*
* Note: don't mess with NR_PTYS until you understand the tty minor
* number allocation game...
* (Note: the *_driver.minor_start values 1, 64, 128, 192 are
* hardcoded at present.)
*/
#define NR_PTYS 256 /* ptys/major */
#define NR_LDISCS 16
/*
* Unix98 PTY's can be defined as any multiple of NR_PTYS up to
* UNIX98_PTY_MAJOR_COUNT; this section defines what we need from the
* config options
*/
#ifdef CONFIG_UNIX98_PTYS
# define UNIX98_NR_MAJORS ((CONFIG_UNIX98_PTY_COUNT+NR_PTYS-1)/NR_PTYS)
# if UNIX98_NR_MAJORS <= 0
# undef CONFIG_UNIX98_PTYS
# elif UNIX98_NR_MAJORS > UNIX98_PTY_MAJOR_COUNT
# error Too many Unix98 ptys defined
# undef UNIX98_NR_MAJORS
# define UNIX98_NR_MAJORS UNIX98_PTY_MAJOR_COUNT
# endif
#endif
/*
* These are set up by the setup-routine at boot-time:
*/
struct screen_info {
u8 orig_x; /* 0x00 */
u8 orig_y; /* 0x01 */
u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
u16 orig_video_page; /* 0x04 */
u8 orig_video_mode; /* 0x06 */
u8 orig_video_cols; /* 0x07 */
u16 unused2; /* 0x08 */
u16 orig_video_ega_bx; /* 0x0a */
u16 unused3; /* 0x0c */
u8 orig_video_lines; /* 0x0e */
u8 orig_video_isVGA; /* 0x0f */
u16 orig_video_points; /* 0x10 */
/* VESA graphic mode -- linear frame buffer */
u16 lfb_width; /* 0x12 */
u16 lfb_height; /* 0x14 */
u16 lfb_depth; /* 0x16 */
u32 lfb_base; /* 0x18 */
u32 lfb_size; /* 0x1c */
u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
u16 lfb_linelength; /* 0x24 */
u8 red_size; /* 0x26 */
u8 red_pos; /* 0x27 */
u8 green_size; /* 0x28 */
u8 green_pos; /* 0x29 */
u8 blue_size; /* 0x2a */
u8 blue_pos; /* 0x2b */
u8 rsvd_size; /* 0x2c */
u8 rsvd_pos; /* 0x2d */
u16 vesapm_seg; /* 0x2e */
u16 vesapm_off; /* 0x30 */
u16 pages; /* 0x32 */
u16 vesa_attributes; /* 0x34 */
/* 0x36 -- 0x3f reserved for future expansion */
};
extern struct screen_info screen_info;
#define ORIG_X (screen_info.orig_x)
#define ORIG_Y (screen_info.orig_y)
#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
#define VIDEO_TYPE_SNI_RM 0x32 /* SNI RM200 PCI video */
#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
/*
* This character is the same as _POSIX_VDISABLE: it cannot be used as
* a c_cc[] character, but indicates that a particular special character
* isn't in use (eg VINTR has no character etc)
*/
#define __DISABLED_CHAR '\0'
/*
* This is the flip buffer used for the tty driver. The buffer is
* located in the tty structure, and is used as a high speed interface
* between the tty driver and the tty line discipline.
*/
#define TTY_FLIPBUF_SIZE 512
struct tty_flip_buffer {
struct work_struct work;
struct semaphore pty_sem;
char *char_buf_ptr;
unsigned char *flag_buf_ptr;
int count;
int buf_num;
unsigned char char_buf[2*TTY_FLIPBUF_SIZE];
char flag_buf[2*TTY_FLIPBUF_SIZE];
unsigned char slop[4]; /* N.B. bug overwrites buffer by 1 */
};
/*
* The pty uses char_buf and flag_buf as a contiguous buffer
*/
#define PTY_BUF_SIZE 4*TTY_FLIPBUF_SIZE
/*
* When a break, frame error, or parity error happens, these codes are
* stuffed into the flags buffer.
*/
#define TTY_NORMAL 0
#define TTY_BREAK 1
#define TTY_FRAME 2
#define TTY_PARITY 3
#define TTY_OVERRUN 4
#define INTR_CHAR(tty) ((tty)->termios->c_cc[VINTR])
#define QUIT_CHAR(tty) ((tty)->termios->c_cc[VQUIT])
#define ERASE_CHAR(tty) ((tty)->termios->c_cc[VERASE])
#define KILL_CHAR(tty) ((tty)->termios->c_cc[VKILL])
#define EOF_CHAR(tty) ((tty)->termios->c_cc[VEOF])
#define TIME_CHAR(tty) ((tty)->termios->c_cc[VTIME])
#define MIN_CHAR(tty) ((tty)->termios->c_cc[VMIN])
#define SWTC_CHAR(tty) ((tty)->termios->c_cc[VSWTC])
#define START_CHAR(tty) ((tty)->termios->c_cc[VSTART])
#define STOP_CHAR(tty) ((tty)->termios->c_cc[VSTOP])
#define SUSP_CHAR(tty) ((tty)->termios->c_cc[VSUSP])
#define EOL_CHAR(tty) ((tty)->termios->c_cc[VEOL])
#define REPRINT_CHAR(tty) ((tty)->termios->c_cc[VREPRINT])
#define DISCARD_CHAR(tty) ((tty)->termios->c_cc[VDISCARD])
#define WERASE_CHAR(tty) ((tty)->termios->c_cc[VWERASE])
#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT])
#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2])
#define _I_FLAG(tty,f) ((tty)->termios->c_iflag & (f))
#define _O_FLAG(tty,f) ((tty)->termios->c_oflag & (f))
#define _C_FLAG(tty,f) ((tty)->termios->c_cflag & (f))
#define _L_FLAG(tty,f) ((tty)->termios->c_lflag & (f))
#define I_IGNBRK(tty) _I_FLAG((tty),IGNBRK)
#define I_BRKINT(tty) _I_FLAG((tty),BRKINT)
#define I_IGNPAR(tty) _I_FLAG((tty),IGNPAR)
#define I_PARMRK(tty) _I_FLAG((tty),PARMRK)
#define I_INPCK(tty) _I_FLAG((tty),INPCK)
#define I_ISTRIP(tty) _I_FLAG((tty),ISTRIP)
#define I_INLCR(tty) _I_FLAG((tty),INLCR)
#define I_IGNCR(tty) _I_FLAG((tty),IGNCR)
#define I_ICRNL(tty) _I_FLAG((tty),ICRNL)
#define I_IUCLC(tty) _I_FLAG((tty),IUCLC)
#define I_IXON(tty) _I_FLAG((tty),IXON)
#define I_IXANY(tty) _I_FLAG((tty),IXANY)
#define I_IXOFF(tty) _I_FLAG((tty),IXOFF)
#define I_IMAXBEL(tty) _I_FLAG((tty),IMAXBEL)
#define O_OPOST(tty) _O_FLAG((tty),OPOST)
#define O_OLCUC(tty) _O_FLAG((tty),OLCUC)
#define O_ONLCR(tty) _O_FLAG((tty),ONLCR)
#define O_OCRNL(tty) _O_FLAG((tty),OCRNL)
#define O_ONOCR(tty) _O_FLAG((tty),ONOCR)
#define O_ONLRET(tty) _O_FLAG((tty),ONLRET)
#define O_OFILL(tty) _O_FLAG((tty),OFILL)
#define O_OFDEL(tty) _O_FLAG((tty),OFDEL)
#define O_NLDLY(tty) _O_FLAG((tty),NLDLY)
#define O_CRDLY(tty) _O_FLAG((tty),CRDLY)
#define O_TABDLY(tty) _O_FLAG((tty),TABDLY)
#define O_BSDLY(tty) _O_FLAG((tty),BSDLY)
#define O_VTDLY(tty) _O_FLAG((tty),VTDLY)
#define O_FFDLY(tty) _O_FLAG((tty),FFDLY)
#define C_BAUD(tty) _C_FLAG((tty),CBAUD)
#define C_CSIZE(tty) _C_FLAG((tty),CSIZE)
#define C_CSTOPB(tty) _C_FLAG((tty),CSTOPB)
#define C_CREAD(tty) _C_FLAG((tty),CREAD)
#define C_PARENB(tty) _C_FLAG((tty),PARENB)
#define C_PARODD(tty) _C_FLAG((tty),PARODD)
#define C_HUPCL(tty) _C_FLAG((tty),HUPCL)
#define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL)
#define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD)
#define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS)
#define L_ISIG(tty) _L_FLAG((tty),ISIG)
#define L_ICANON(tty) _L_FLAG((tty),ICANON)
#define L_XCASE(tty) _L_FLAG((tty),XCASE)
#define L_ECHO(tty) _L_FLAG((tty),ECHO)
#define L_ECHOE(tty) _L_FLAG((tty),ECHOE)
#define L_ECHOK(tty) _L_FLAG((tty),ECHOK)
#define L_ECHONL(tty) _L_FLAG((tty),ECHONL)
#define L_NOFLSH(tty) _L_FLAG((tty),NOFLSH)
#define L_TOSTOP(tty) _L_FLAG((tty),TOSTOP)
#define L_ECHOCTL(tty) _L_FLAG((tty),ECHOCTL)
#define L_ECHOPRT(tty) _L_FLAG((tty),ECHOPRT)
#define L_ECHOKE(tty) _L_FLAG((tty),ECHOKE)
#define L_FLUSHO(tty) _L_FLAG((tty),FLUSHO)
#define L_PENDIN(tty) _L_FLAG((tty),PENDIN)
#define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN)
struct device;
/*
* Where all of the state associated with a tty is kept while the tty
* is open. Since the termios state should be kept even if the tty
* has been closed --- for things like the baud rate, etc --- it is
* not stored here, but rather a pointer to the real state is stored
* here. Possible the winsize structure should have the same
* treatment, but (1) the default 80x24 is usually right and (2) it's
* most often used by a windowing system, which will set the correct
* size each time the window is created or resized anyway.
* - TYT, 9/14/92
*/
struct tty_struct {
int magic;
struct tty_driver *driver;
int index;
struct tty_ldisc ldisc;
struct termios *termios, *termios_locked;
char name[64];
int pgrp;
int session;
dev_t device;
unsigned long flags;
int count;
struct winsize winsize;
unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
unsigned char low_latency:1, warned:1;
unsigned char ctrl_status;
struct tty_struct *link;
struct fasync_struct *fasync;
struct tty_flip_buffer flip;
int max_flip_cnt;
int alt_speed; /* For magic substitution of 38400 bps */
wait_queue_head_t write_wait;
wait_queue_head_t read_wait;
struct work_struct hangup_work;
void *disc_data;
void *driver_data;
struct list_head tty_files;
#define N_TTY_BUF_SIZE 4096
/*
* The following is data for the N_TTY line discipline. For
* historical reasons, this is included in the tty structure.
*/
unsigned int column;
unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
unsigned char closing:1;
unsigned short minimum_to_wake;
unsigned long overrun_time;
int num_overrun;
unsigned long process_char_map[256/(8*sizeof(unsigned long))];
char *read_buf;
int read_head;
int read_tail;
int read_cnt;
unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))];
int canon_data;
unsigned long canon_head;
unsigned int canon_column;
struct semaphore atomic_read;
struct semaphore atomic_write;
spinlock_t read_lock;
/* If the tty has a pending do_SAK, queue it here - akpm */
struct work_struct SAK_work;
};
/* tty magic number */
#define TTY_MAGIC 0x5401
/*
* These bits are used in the flags field of the tty structure.
*
* So that interrupts won't be able to mess up the queues,
* copy_to_cooked must be atomic with respect to itself, as must
* tty->write. Thus, you must use the inline functions set_bit() and
* clear_bit() to make things atomic.
*/
#define TTY_THROTTLED 0
#define TTY_IO_ERROR 1
#define TTY_OTHER_CLOSED 2
#define TTY_EXCLUSIVE 3
#define TTY_DEBUG 4
#define TTY_DO_WRITE_WAKEUP 5
#define TTY_PUSH 6
#define TTY_CLOSING 7
#define TTY_DONT_FLIP 8
#define TTY_HW_COOK_OUT 14
#define TTY_HW_COOK_IN 15
#define TTY_PTY_LOCK 16
#define TTY_NO_WRITE_SPLIT 17
#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
extern void tty_write_flush(struct tty_struct *);
extern struct termios tty_std_termios;
extern struct tty_ldisc ldiscs[];
extern void console_init(void);
extern int lp_init(void);
extern int pty_init(void);
extern void tty_init(void);
extern int mxser_init(void);
extern int moxa_init(void);
extern int ip2_init(void);
extern int pcxe_init(void);
extern int pc_init(void);
extern int vcs_init(void);
extern int rp_init(void);
extern int cy_init(void);
extern int stl_init(void);
extern int stli_init(void);
extern int specialix_init(void);
extern int espserial_init(void);
extern int macserial_init(void);
extern int a2232board_init(void);
extern int vty_init(void);
extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device,
const char *routine);
extern char *tty_name(struct tty_struct *tty, char *buf);
extern void tty_wait_until_sent(struct tty_struct * tty, long timeout);
extern int tty_check_change(struct tty_struct * tty);
extern void stop_tty(struct tty_struct * tty);
extern void start_tty(struct tty_struct * tty);
extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
extern int tty_register_driver(struct tty_driver *driver);
extern int tty_unregister_driver(struct tty_driver *driver);
extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev);
extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
int buflen);
extern void tty_write_message(struct tty_struct *tty, char *msg);
extern int is_orphaned_pgrp(int pgrp);
extern int is_ignored(int sig);
extern int tty_signal(int sig, struct tty_struct *tty);
extern void tty_hangup(struct tty_struct * tty);
extern void tty_vhangup(struct tty_struct * tty);
extern void tty_unhangup(struct file *filp);
extern int tty_hung_up_p(struct file * filp);
extern void do_SAK(struct tty_struct *tty);
extern void disassociate_ctty(int priv);
extern void tty_flip_buffer_push(struct tty_struct *tty);
extern int tty_get_baud_rate(struct tty_struct *tty);
extern int tty_termios_baud_rate(struct termios *termios);
/* n_tty.c */
extern struct tty_ldisc tty_ldisc_N_TTY;
/* tty_ioctl.c */
extern int n_tty_ioctl(struct tty_struct * tty, struct file * file,
unsigned int cmd, unsigned long arg);
/* serial.c */
extern void serial_console_init(void);
/* pcxx.c */
extern int pcxe_open(struct tty_struct *tty, struct file *filp);
/* printk.c */
extern void console_print(const char *);
/* vt.c */
extern int vt_ioctl(struct tty_struct *tty, struct file * file,
unsigned int cmd, unsigned long arg);
#endif /* __KERNEL__ */
#endif
--- NEW FILE: vt_kern.h ---
#ifndef _VT_KERN_H
#define _VT_KERN_H
/*
* All the data structs defining the VT tty system.
*/
#include <linux/config.h>
#include <linux/pm.h>
#include <linux/vt.h>
#include <linux/kbd_kern.h>
#define MIN_NR_CONSOLES 1 /* must be at least 1 */
#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
#define MAX_NR_USER_CONSOLES 16 /* number of VCs per VT */
/* scroll */
#define SM_UP (1)
#define SM_DOWN (2)
/* cursor */
#define CM_DRAW (1)
#define CM_ERASE (2)
#define CM_CHANGE (3)
#define CM_MOVE (4)
#define CUR_DEF 0
#define CUR_NONE 1
#define CUR_UNDERLINE 2
#define CUR_LOWER_THIRD 3
#define CUR_LOWER_HALF 4
#define CUR_TWO_THIRDS 5
#define CUR_BLOCK 6
#define CUR_HWMASK 0x0f
#define CUR_SWMASK 0xfff0
#define CUR_DEFAULT CUR_UNDERLINE
/*
* Low-Level Functions
*/
#define IS_VISIBLE (vc == vc->display_fg->fg_console)
/*
* Presently, a lot of graphics programs do not restore the contents of
* the higher font pages. Defining this flag will avoid use of them, but
* will lose support for PIO_FONTRESET. Note that many font operations are
* not likely to work with these programs anyway; they need to be
* fixed. The linux/Documentation directory includes a code snippet
* to save and restore the text font.
*/
#ifdef CONFIG_VGA_CONSOLE
#define BROKEN_GRAPHICS_PROGRAMS 1
#endif
extern unsigned char color_table[];
extern int default_red[];
extern int default_grn[];
extern int default_blu[];
/*
* Data structure describing single virtual console
*
* Fields marked with [#] must be set by the low-level driver.
* Fields marked with [!] can be changed by the low-level driver
* to achieve effects such as fast scrolling by changing the origin.
*/
#define NPAR 16
struct vc_data {
unsigned short vc_num; /* Console number */
unsigned int vc_cols; /* [#] Console size */
unsigned int vc_rows;
unsigned int vc_size_row; /* Bytes per row */
unsigned int vc_scan_lines; /* # of scan lines */
unsigned int vc_screensize; /* Size of screen */
unsigned char vc_mode; /* KD_TEXT, ... */
unsigned long vc_origin; /* [!] Start of real screen */
unsigned long vc_scr_end; /* [!] End of real screen */
unsigned long vc_visible_origin;/* [!] Top of visible window */
unsigned int vc_scrollback; /* [!] Scrollback size */
unsigned int vc_top, vc_bottom; /* Scrolling region */
unsigned short *vc_screenbuf; /* In-memory character/attribute buffer */
unsigned int vc_screenbuf_size;
unsigned char vc_attr; /* Current attributes */
unsigned char vc_def_color; /* Default colors */
unsigned char vc_color; /* Foreground & background */
unsigned char vc_s_color; /* Saved foreground & background */
unsigned char vc_ulcolor; /* Color for underline mode */
unsigned char vc_halfcolor; /* Color for half intensity mode */
/* cursor */
unsigned int vc_cursor_type;
unsigned short vc_complement_mask; /* [#] Xor mask for mouse pointer */
unsigned short vc_s_complement_mask; /* Saved mouse pointer mask */
unsigned short vc_video_erase_char; /* Background erase character */
unsigned int vc_x, vc_y; /* Cursor position */
unsigned long vc_pos; /* Cursor address */
unsigned int vc_saved_x;
unsigned int vc_saved_y;
unsigned int vc_state; /* Escape sequence parser state */
unsigned int vc_npar, vc_par[NPAR]; /* Parameters of current escape sequence */
unsigned char vc_ledstate;
unsigned char vc_ledioctl;
struct kbd_struct kbd_table; /* VC keyboard state */
unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
struct console_font_op vc_font; /* VC current font set */
struct vt_struct *display_fg; /* Ptr to display */
struct tty_struct *vc_tty; /* TTY we are attached to */
/* data for manual vt switching */
struct vt_mode vt_mode;
int vt_pid;
int vt_newvt;
/* mode flags */
unsigned int vc_charset:1; /* Character set G0 / G1 */
unsigned int vc_s_charset:1; /* Saved character set */
unsigned int vc_disp_ctrl:1; /* Display chars < 32? */
unsigned int vc_toggle_meta:1; /* Toggle high bit? */
unsigned int vc_decscnm:1; /* Screen Mode */
unsigned int vc_decom:1; /* Origin Mode */
unsigned int vc_decawm:1; /* Autowrap Mode */
unsigned int vc_dectcem:1; /* Text Cursor Enable */
unsigned int vc_irm:1; /* Insert/Replace Mode */
unsigned int vc_deccolm:1; /* 80/132 Column Mode */
/* attribute flags */
unsigned int vc_intensity:2; /* 0=half-bright, 1=normal, 2=bold */
unsigned int vc_underline:1;
unsigned int vc_blink:1;
unsigned int vc_reverse:1;
unsigned int vc_s_intensity:2; /* saved rendition */
unsigned int vc_s_underline:1;
unsigned int vc_s_blink:1;
unsigned int vc_s_reverse:1;
/* misc */
unsigned int vc_priv1:1; /* indicating a private control
function */
unsigned int vc_priv2:1; /* indicating a private control
function */
unsigned int vc_priv3:1; /* indicating a private control
function */
unsigned int vc_priv4:1; /* indicating a private control
function (used to be called "ques") */
unsigned int vc_need_wrap:1;
unsigned int vc_can_do_color:1;
unsigned int vc_report_mouse:2;
unsigned char vc_utf:1; /* Unicode UTF-8 encoding */
unsigned char vc_utf_count;
int vc_utf_char;
unsigned int vc_tab_stop[8]; /* Tab stops. 256 columns. */
unsigned char vc_palette[16 * 3]; /* Colour palette for VGA+ */
unsigned short *vc_translate;
unsigned char vc_G0_charset;
unsigned char vc_G1_charset;
unsigned char vc_saved_G0;
unsigned char vc_saved_G1;
unsigned int vc_bell_pitch; /* Console bell pitch */
unsigned int vc_bell_duration; /* Console bell duration */
unsigned long vc_uni_pagedir;
unsigned long *vc_uni_pagedir_loc;/* [!] Location of uni_pagedir
variable for this console */
wait_queue_head_t paste_wait; /* For selections */
/* Internal flags */
unsigned int vc_decscl; /* operating level */
unsigned int vc_c8bit:1; /* 8-bit controls */
unsigned int vc_d8bit:1; /* 8-bit data */
unsigned int vc_shift:1; /* single shift */
/* Private modes */
unsigned int vc_decckm:1; /* Cursor Keys */
unsigned int vc_decsclm:1; /* Scrolling */
unsigned int vc_decarm:1; /* Autorepeat */
unsigned int vc_decnrcm:1; /* National Replacement Character Set */
unsigned int vc_decnkm:1; /* Numeric Keypad */
/* ANSI / ISO mode flags */
unsigned int vc_kam:1; /* Keyboard Action */
unsigned int vc_crm:1; /* Console Representation */
unsigned int vc_lnm:1; /* Line feed/New line */
/* Charset mappings */
unsigned char vc_GL_charset;
unsigned char vc_GR_charset;
unsigned char vc_G2_charset;
unsigned char vc_G3_charset;
unsigned char vc_GS_charset;
unsigned char vc_saved_G2;
unsigned char vc_saved_G3;
unsigned char vc_saved_GS;
};
struct consw {
const char *(*con_startup)(struct vt_struct *, int);
void (*con_init)(struct vc_data *, int);
void (*con_deinit)(struct vc_data *);
void (*con_clear)(struct vc_data *, int, int, int, int);
void (*con_putc)(struct vc_data *, int, int, int);
void (*con_putcs)(struct vc_data *, const unsigned short *, int, int, int);
void (*con_cursor)(struct vc_data *, int);
int (*con_scroll_region)(struct vc_data *, int, int, int, int);
void (*con_bmove)(struct vc_data *, int, int, int, int, int, int);
int (*con_switch)(struct vc_data *);
int (*con_blank)(struct vc_data *, int);
int (*con_font_op)(struct vc_data *, struct console_font_op *);
int (*con_resize)(struct vc_data *, unsigned int, unsigned int);
int (*con_set_palette)(struct vc_data *, unsigned char *);
int (*con_scroll)(struct vc_data *, int);
int (*con_set_origin)(struct vc_data *);
void (*con_save_screen)(struct vc_data *);
u8 (*con_build_attr)(struct vc_data *, u8, u8, u8, u8, u8);
void (*con_invert_region)(struct vc_data *, u16 *, int);
u16* (*con_screen_pos)(struct vc_data *, int);
unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *);
};
struct vt_struct {
struct vc_data *fg_console; /* VC being displayed */
struct vc_data *last_console; /* VC we last switched from */
struct vc_data *want_vc; /* VC we want to switch to */
int scrollback_delta;
int cursor_original;
char kmalloced; /* Did we use kmalloced ? */
char vt_dont_switch; /* VC switching flag */
char vt_blanked; /* Is this display blanked */
int blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */
int blank_interval; /* How long before blanking */
int off_interval;
struct timer_list timer; /* Timer for VT blanking */
struct timer_list beep; /* Timer for adjusting console beeping */
struct pm_dev *pm_con; /* power management */
/*
* This is a temporary buffer used to prepare a tty console write
* so that we can easily avoid touching user space while holding the
* console spinlock. It is shared by with vc_screen read/write tty
* calls.
*/
struct semaphore lock; /* Lock for con_buf */
char con_buf[PAGE_SIZE];
const struct consw *vt_sw; /* Display driver for VT */
struct vc_data *default_mode; /* Default mode */
struct work_struct vt_work; /* VT work queue */
struct input_handle *keyboard; /* Keyboard attached */
struct input_handle *beeper; /* Bell noise support */
void *data_hook; /* Hook for driver data */
unsigned int first_vc;
struct vc_data *vc_cons[MAX_NR_USER_CONSOLES]; /* VT's VC pool */
struct vt_struct *next;
};
extern struct vt_struct *vt_cons;
extern struct vt_struct *admin_vt;
/* universal VT emulation functions */
void vte_ris(struct vc_data *vc, int do_clear);
inline void vte_cr(struct vc_data *vc);
void vte_lf(struct vc_data *vc);
inline void vte_bs(struct vc_data *vc);
void vte_ed(struct vc_data *vc, int vpar);
void vte_decsc(struct vc_data *vc);
void terminal_emulation(struct tty_struct *tty, int c);
/* vt.c */
const char *vt_map_display(struct vt_struct *vt, int init);
void vt_map_input(struct vt_struct *vt);
struct vc_data *find_vc(int currcons);
struct vc_data *vc_allocate(unsigned int console);
inline void set_console(struct vc_data *vc);
int vc_resize(struct vc_data *vc, unsigned int lines, unsigned int cols);
int vc_disallocate(struct vc_data *vc);
void reset_vc(struct vc_data *vc);
void add_softcursor(struct vc_data *vc);
void set_cursor(struct vc_data *vc);
void hide_cursor(struct vc_data *vc);
void gotoxy(struct vc_data *vc, int new_x, int new_y);
inline void gotoxay(struct vc_data *vc, int new_x, int new_y);
void reset_palette(struct vc_data *vc);
void set_palette(struct vc_data *vc);
void scroll_up(struct vc_data *vc, int);
void scroll_down(struct vc_data *vc, int);
void scroll_region_up(struct vc_data *vc, unsigned int t, unsigned int b, int nr);
void scroll_region_down(struct vc_data *vc, unsigned int t, unsigned int b, int nr);
void default_attr(struct vc_data *vc);
void update_attr(struct vc_data *vc);
void insert_char(struct vc_data *vc, unsigned int nr);
void delete_char(struct vc_data *vc, unsigned int nr);
void insert_line(struct vc_data *vc, unsigned int nr);
void delete_line(struct vc_data *vc, unsigned int nr);
void set_origin(struct vc_data *vc);
inline void clear_region(struct vc_data *vc, int x, int y, int width, int height);
void do_update_region(struct vc_data *vc, unsigned long start, int count);
void update_region(struct vc_data *vc, unsigned long start, int count);
void update_screen(struct vc_data *vc);
inline int resize_screen(struct vc_data *vc, int width, int height);
inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed);
inline void save_screen(struct vc_data *vc);
void do_blank_screen(int gfx_mode);
void unblank_screen(void);
void poke_blanked_console(struct vt_struct *vt);
int con_font_op(struct vc_data *vc, struct console_font_op *op);
void take_over_console(struct vt_struct *vt, const struct consw *sw);
int tioclinux(struct tty_struct *tty, unsigned long arg);
/* consolemap.c */
struct unimapinit;
struct unipair;
int con_set_trans_old(struct vc_data *vc, unsigned char *table);
int con_get_trans_old(struct vc_data *vc, unsigned char *table);
int con_set_trans_new(struct vc_data *vc, unsigned short *table);
int con_get_trans_new(struct vc_data *vc, unsigned short *table);
int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui);
int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair *list);
int con_get_unimap(struct vc_data *vc, ushort ct, ushort * uct,
struct unipair *list);
int con_set_default_unimap(struct vc_data *vc);
void con_free_unimap(struct vc_data *vc);
void con_protect_unimap(struct vc_data *vc, int rdonly);
int con_copy_unimap(struct vc_data *dst, struct vc_data *src);
/* vt_ioctl.c */
void complete_change_console(struct vc_data *new_vc, struct vc_data *old_vc);
void change_console(struct vc_data *new_vc, struct vc_data *old_vc);
#endif /* _VT_KERN_H */
|