/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* bos720 src/bos/kernext/lft/inc/vt.h 1.21.2.7                           */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1993,1999              */
/* All Rights Reserved                                                    */
/*                                                                        */
/* US Government Users Restricted Rights - Use, duplication or            */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/* @(#)15       1.21.2.7  src/bos/kernext/lft/inc/vt.h, sysxdisp, bos720 4/2/99 15:50:06 */
/*
 *
 * COMPONENT_NAME: LFTDD
 *
 * FUNCTIONS:
 *
 * ORIGINS: 27
 *
 * (C) COPYRIGHT International Business Machines Corp. 1993
 * All Rights Reserved
 * US Government Users Restricted Rights - Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 */
#include <sys/font.h>

/* ------------------------------------------------------------------------ */
/* presentation space structure						    */
/* ------------------------------------------------------------------------ */

struct ps_s {
        int ps_w;                      /* presentation space width */
        int ps_h;                      /* presentation space height */
};

/* ------------------------------------------------------------------------ */
/* The vtt_box_rc_parms structure is supplied as a parameter to the	    */
/* VDD clear rectangle routine						    */
/* ------------------------------------------------------------------------ */

struct vtt_box_rc_parms {
        int row_ul;                    /* row number of upper-left corner */
                                        /*   of the upright rectangle      */
        int column_ul;                 /* col number of upper-left corner */
                                        /*   of the upright rectangle      */
        int row_lr;                    /* row number of lower-right corner */
                                        /*   of the upright rectangle      */
        int column_lr;                 /* col number of lower-right corner */
                                        /*   of the upright rectangle      */
};

/* ------------------------------------------------------------------------ */
/* Color palette structure.  Define data sent to VDD			    */
/* ------------------------------------------------------------------------ */

#define COLORPAL        16

struct colorpal {
        short numcolors ;               /* # of palette entries */
        int   rgbval[COLORPAL];         /* adapter-specific value settings 
                                           for color palette entry */
};

/* ------------------------------------------------------------------------ */
/* Font palette structure.  Define data sent to VDD			    */
/* ------------------------------------------------------------------------ */

#define FONTPAL         8
struct fontpal {
        short  font_index[FONTPAL];       /* index into font.h structure  */
};

/* ------------------------------------------------------------------------ */
/* row column length structure interfaces to VDD Routine		    */
/* ------------------------------------------------------------------------ */

struct vtt_rc_parms {
        uint string_length;            /* length of char string that 	    */
                                        /*   must be displayed 	            */
        uint string_index;             /* index of the 1st char to display */
        int start_row;                 /* starting row for draw/move       */
                                        /*   operations, unity based        */
        int start_column;              /* starting column for draw/move    */
                                        /*   operations, unity based        */
        int dest_row;                  /* destination row number for move  */
                                        /*   operations, zero based         */
        int dest_column;               /* destination column number for move*/
                                        /*   operations, zero based         */
};

/* ------------------------------------------------------------------------ */
/* cursor positioning structure used as parameter to VDD routine	    */
/* ------------------------------------------------------------------------ */

struct vtt_cursor {
        int                    x;
        int                    y;
};

/* ------------------------------------------------------------------------ */
/* code point base/mask and attribute parameters			    */
/* ------------------------------------------------------------------------ */

struct vtt_cp_parms {
        uint                   cp_mask;	/* code point mask for 	    */
						/* implementing 7 or 8 bit  */
						/* ascii		    */
        int                    cp_base;	/* code point base, added to*/
						/* code point if base >=0   */
        ushort                  attributes;	/*  attribute bits	    */
        struct vtt_cursor       cursor;		/* cursor x, y position     */
};

/* ------------------------------------------------------------------------ */
/*                          masks for attributes field			    */
/* ------------------------------------------------------------------------ */

#define FG_COLOR_MASK    0xf000
#define BG_COLOR_MASK    0x0f00
#define FONT_SELECT_MASK 0x00e0
#define NO_DISP_MASK     0x0010           /* non displayable char attr */
#define BRIGHT_MASK      0x0008           /* bright char attr */
#define BLINK_MASK       0x0004           /* blink char attr */
#define REV_VIDEO_MASK   0x0002           /* reverse video char attr */
#define UNDERSCORE_MASK  0x0001           /* underscore char attr */

#define REV_VIDEO_MASK   0x0002           /* reverse video char attr */
#define UNDERSCORE_MASK  0x0001           /* underscore char attr */
#define ATTRIBUTES_INITIAL 0x2000         /* */

/* ------------------------------------------------------------------------ */
/* Define rvalue macros used to access bit-oriented fields in "attribute"   */
/* ------------------------------------------------------------------------ */

#define ATTRIBRI(attribute)             ((attribute) & BRIGHT_MASK)
#define ATTRIUNSC(attribute)            ((attribute) & UNDERSCORE_MASK)
#define ATTRIBLI(attribute)             ((attribute) & BLINK_MASK)
#define ATTRIRV(attribute)              ((attribute) & REV_VIDEO_MASK)
#define ATTRIBLA(attribute)             ((attribute) & NO_DISP_MASK)
#define ATTRIBAKCOL(attribute)          (((attribute) >> 8) & 0x000f)
#define ATTRIFORECOL(attribute)         (((attribute) >> 12) & 0x000f)
#define ATTRIFONT(attribute)            (((attribute) >> 5) & 0x0007)

/* ------------------------------------------------------------------------ */
/* Define rvalue macros used to set multibit fields in "attribute":	    */
/* ------------------------------------------------------------------------ */
#define SET_ATTRIFONT(attribute, value) attribute = \
                      (((attribute) & ~FONT_SELECT_MASK) | ((value) << 5))
#define SET_ATTRIFORECOL(attribute, value) attribute = \
                      (((attribute) & ~FG_COLOR_MASK) | ((value) << 12))
#define SET_ATTRIBAKCOL(attribute, value) attribute = \
                      (((attribute) & ~BG_COLOR_MASK) | ((value) << 8))

/* ------------------------------------------------------------------------ */
/* The vtm structure and some of the elements in the structure have been    */
/* included to allow for backward compatibility with existing display device*/
/* drivers. This structure contains device dependent information for a given*/
/* display adapter.  vtm structures are allocated and initialized by the    */
/* lft device drivers.  Each available display has a corresponding vtm      */
/* structure.								    */
/* ------------------------------------------------------------------------ */

#define KSR_MODE        	1               /* Keyboard Send/Receive Mode*/
#define GRAPHICS_MODE 		0               /* Monitor Mode              */

struct vtmstruc {
	struct phys_displays	*display;	/* display this vt is using */
	struct vtt_cp_parms	mparms;		/* attribute+cursor position*/
	char			*vttld;		/* pointer to VTT local data*/
	off_t			vtid;		/* virtual terminal id = 0  */
	uchar			vtm_mode;	/* mode = KSR		    */
	int			font_index;	/* -1 means use 'best' font */
	int			number_of_fonts; /* number of fonts found   */
	struct font_data	*fonts;		/* font information         */
	int			(*fsp_enq)();	/* font request enqueue func*/
};

/* vtt function prototypes */
#if defined(__64BIT_KERNEL) || defined(__FULL_PROTO)
int vttact(struct vtmstruc *);
int vttcfl(struct vtmstruc *,int,int,int,uint);
int vttclr(struct vtmstruc *,struct vtt_box_rc_parms *,ushort,uint);
int vttcpl(struct vtmstruc *,struct vtt_rc_parms *,uint);
int vttdact(struct vtmstruc *);
int vttddf(struct _gscDev *, int, void *, int, void *);
int vttdefc(struct vtmstruc *,uchar,uint);
int vttdma_setup(struct _gscDev *, struct _gscdma *);
int vttdma(struct _gscDev *, struct _gscdma *,int (*)(), struct vtmstruc *, int);
int vttinit(struct vtmstruc *,struct fontpal *,struct ps_s *);
int vttmovc(struct vtmstruc *);
int vttpwrphase(struct phys_displays *, int);
int vttrds(struct vtmstruc * ,ushort *, int, ushort *, int, struct vtt_rc_parms *);
int vttscr(struct vtmstruc *,int,ushort,uint);
int vttsetm(struct vtmstruc *, int);
int vttstct(struct vtmstruc *, struct colorpal *);
int vttterm(struct vtmstruc *);
int vtttext(struct vtmstruc *,char *,struct vtt_rc_parms *, struct vtt_cp_parms *, uint);
#endif /* __64BIT_KERNEL || __FULL_PROTO */