/*
 * $Header: /smsa/bsd:include/dev/vte.h:bsd  1.13  $
 * $Source: /smsa/bsd:include/dev/vte.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 */
/* vte.h
 *
 * Generic Video Terminal Emulator specification
 */

#ifndef __dev_vte_h
#define __dev_vte_h

void VTE_initialise (/* void */);

/* When the rx handler (vcrxint) is called, 
 * it is passed a device number and a byte code to be put
 * on that device's input queue.  vctxint is passed
 * a device code and a second argument which is either a
 * count (>= 0) of how many characters have been output-
 * processed and hence may be removed from the device's
 * output Q, or if negative a special function code as
 * defined below.  Device numbers are defined in the file
 * "vcminor.h".
 */

/*
 * VTE_display is passed a device number, a buffer pointer and the
 * number of contiguous characters in the buffer.  When these
 * have been output by VTE, the tx interrupt handler will be called
 * to indicate this (see comment above re. tx handler).  The device
 * should be flagged busy if VTE_display returns != 0, and not-busy when
 * the tx handler is called with arg2 >= 0.
 */
int  VTE_display (/* int dev, unsigned char *buff, int count */);


/*
 * VTE_set_panic prepares for console diagnostics on a system crash.
 * It selects a suitable console mode, disables all other activity and
 * returns.  Calls to VTE_display (VCM_NONE, .. ) will then cause
 * diags to appear on the console, regardless of what was previously
 * happening..
 */
void VTE_set_panic (/* int *panic_prio */);

/*
 * VTE_device returns the minor number for the currently selected,
 * active, writeable, output device, or VCM_NONE if there is none.
 */
int VTE_device (/* void */);

/*
 * VTE_device_size returns the character dimensions of the specified
 * terminal emulation.
 */
void VTE_device_size (/* int dev, int *rows, int *cols */);

/* VTE_get_fb_subtype returns the current graphics fb subtype  */
int VTE_get_fb_subtype (void);
/* VTE_get_fb_subtypes returns the number of available graphics fb subtypes  */
int VTE_get_fb_subtypes (void);
/* VTE_set_fb_subtype sets the current fb subtype as specified */
void VTE_set_fb_subtype (unsigned int /*subtype*/);

/*
 * VTE_{g,s}et_fb_blank_{time,lull} () manipulate the screen blank interval
 * on the frame buffer.
 */
int VTE_get_fb_blank_time (void);
void VTE_set_fb_blank_time (int seconds, bool force_refresh);
int VTE_get_fb_blank_lull (void);
void VTE_set_fb_blank_lull (int seconds);


/* Determine CMOS-configured monitor type */
int VTE_get_vdu_type ();

/*
 * Palette here refers to frame-buffer palette, not console/terminal.
 */
int VTE_set_palette (/*VCIOCPaletteRef p*/);
int VTE_get_palette (/*VCIOCPaletteRef p*/);


/* Text colour control */
int VTE_set_text_colours (/*VCIOCTextColoursRef tc, int dev*/);
void VTE_get_text_colours (/*VCIOCTextColoursRef tc, int dev*/);


/*
 * Control of kbd device auto-repeat, and return of
 * keyboard type.
 */
void VTE_get_kbd_repeat (/*VCIOCRepeatRef r*/);
void VTE_set_kbd_repeat (/*VCIOCRepeatRef r*/);
int  VTE_keyboard_type (/*void*/);

/*
 * The following procedures are part of the byte-stream processing
 * mechanism, called from the byte-sequence module.
 */
extern void VTE_process_control_char ();
extern void VTE_process_escape_sequence ();
extern void VTE_process_flow_control ();
extern void VTE_process_protocol_error ();
extern void VTE_process_graphic_chars ();
extern void VTE_process_control_sequence ();
extern void VTE_process_device_control_string ();


/*
 * The following codes may be passed to the tx interrupt handler 
 * as the second argument, instead of the normal count of characters
 * which have been output & should be dequeued.
 */
#define VTE_OPEN	(-1)			/* open has been performed */
#define VTE_CLOSE	(-2)			/* close has been performed */
#define VTE_SELECT	(-3)			/* select o/p dev now <arg1> */
#define VTE_CHECK_SIZE	(-4)			/* screen dimensions changed */

/*
 * The following functions set/get parameters of the specified terminal
 * emulation.  They return 0 on success, -1 on error.
 */
extern int VTE_get_param (/*int dev, int param_no, int *valp*/);
extern int VTE_set_param (/*int dev, int param_no, int val*/);

#endif/*__dev_vte_h*/

/* EOF vte.h */
