1*56815Sralph /*- 2*56815Sralph * Copyright (c) 1992 The Regents of the University of California. 3*56815Sralph * All rights reserved. 4*56815Sralph * 5*56815Sralph * This code is derived from software contributed to Berkeley by 6*56815Sralph * Ralph Campbell and Rick Macklem. 7*56815Sralph * 8*56815Sralph * %sccs.include.redist.c% 9*56815Sralph * 10*56815Sralph * @(#)fbreg.h 7.1 (Berkeley) 11/15/92 11*56815Sralph */ 12*56815Sralph 13*56815Sralph /* 14*56815Sralph * Data for fb.c generic frame buffer routines that are called by the 15*56815Sralph * various frame buffer drivers. 16*56815Sralph */ 17*56815Sralph struct fbuaccess { 18*56815Sralph PM_Info scrInfo; 19*56815Sralph pmEvent events[PM_MAXEVQ]; 20*56815Sralph pmTimeCoord tcs[MOTION_BUFFER_SIZE]; 21*56815Sralph }; 22*56815Sralph 23*56815Sralph struct pmax_fb { 24*56815Sralph int GraphicsOpen; /* Open yet? */ 25*56815Sralph int initialized; /* Set up yet? */ 26*56815Sralph int isMono; /* Monochrome fb? */ 27*56815Sralph int row, col; /* Screen pos for glass tty */ 28*56815Sralph struct fbuaccess *fbu; /* X event stuff */ 29*56815Sralph char *fr_addr; /* Frame buffer address */ 30*56815Sralph void (*posCursor)(); /* Position cursor func */ 31*56815Sralph void (*KBDPutc)(); /* Send char to keyboard func */ 32*56815Sralph dev_t kbddev; /* Device for KBDPutc */ 33*56815Sralph struct selinfo selp; /* Select structure */ 34*56815Sralph }; 35*56815Sralph 36*56815Sralph /* 37*56815Sralph * Definitions for the Keyboard and mouse. 38*56815Sralph */ 39*56815Sralph /* 40*56815Sralph * Special key values. 41*56815Sralph */ 42*56815Sralph #define KEY_R_SHIFT 0xab 43*56815Sralph #define KEY_SHIFT 0xae 44*56815Sralph #define KEY_CONTROL 0xaf 45*56815Sralph #define KEY_R_ALT 0xb2 46*56815Sralph #define KEY_UP 0xb3 47*56815Sralph #define KEY_REPEAT 0xb4 48*56815Sralph #define KEY_F1 0x56 49*56815Sralph #define KEY_COMMAND KEY_F1 50*56815Sralph 51*56815Sralph /* 52*56815Sralph * Lk201/301 keyboard 53*56815Sralph */ 54*56815Sralph #define LK_UPDOWN 0x86 /* bits for setting lk201 modes */ 55*56815Sralph #define LK_AUTODOWN 0x82 56*56815Sralph #define LK_DOWN 0x80 57*56815Sralph #define LK_DEFAULTS 0xd3 /* reset mode settings */ 58*56815Sralph #define LK_AR_ENABLE 0xe3 /* global auto repeat enable */ 59*56815Sralph #define LK_CL_ENABLE 0x1b /* keyclick enable */ 60*56815Sralph #define LK_KBD_ENABLE 0x8b /* keyboard enable */ 61*56815Sralph #define LK_BELL_ENABLE 0x23 /* the bell */ 62*56815Sralph #define LK_LED_ENABLE 0x13 /* light led */ 63*56815Sralph #define LK_LED_DISABLE 0x11 /* turn off led */ 64*56815Sralph #define LK_RING_BELL 0xa7 /* ring keyboard bell */ 65*56815Sralph #define LED_1 0x81 /* led bits */ 66*56815Sralph #define LED_2 0x82 67*56815Sralph #define LED_3 0x84 68*56815Sralph #define LED_4 0x88 69*56815Sralph #define LED_ALL 0x8f 70*56815Sralph #define LK_HELP 0x7c /* help key */ 71*56815Sralph #define LK_DO 0x7d /* do key */ 72*56815Sralph #define LK_KDOWN_ERROR 0x3d /* key down on powerup error */ 73*56815Sralph #define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/ 74*56815Sralph #define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */ 75*56815Sralph #define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */ 76*56815Sralph #define LK_LOWEST 0x56 /* lowest significant keycode */ 77*56815Sralph 78*56815Sralph /* max volume is 0, lowest is 0x7 */ 79*56815Sralph #define LK_PARAM_VOLUME(v) (0x80|((v)&0x7)) 80*56815Sralph 81*56815Sralph /* mode command details */ 82*56815Sralph #define LK_CMD_MODE(m,div) ((m)|((div)<<3)) 83*56815Sralph 84*56815Sralph /* 85*56815Sralph * Command characters for the mouse. 86*56815Sralph */ 87*56815Sralph #define MOUSE_SELF_TEST 'T' 88*56815Sralph #define MOUSE_INCREMENTAL 'R' 89*56815Sralph 90*56815Sralph /* 91*56815Sralph * Mouse output bits. 92*56815Sralph * 93*56815Sralph * MOUSE_START_FRAME Start of report frame bit. 94*56815Sralph * MOUSE_X_SIGN Sign bit for X. 95*56815Sralph * MOUSE_Y_SIGN Sign bit for Y. 96*56815Sralph * MOUSE_X_OFFSET X offset to start cursor at. 97*56815Sralph * MOUSE_Y_OFFSET Y offset to start cursor at. 98*56815Sralph */ 99*56815Sralph #define MOUSE_START_FRAME 0x80 100*56815Sralph #define MOUSE_X_SIGN 0x10 101*56815Sralph #define MOUSE_Y_SIGN 0x08 102*56815Sralph 103*56815Sralph /* 104*56815Sralph * Definitions for mouse buttons 105*56815Sralph */ 106*56815Sralph #define EVENT_LEFT_BUTTON 0x01 107*56815Sralph #define EVENT_MIDDLE_BUTTON 0x02 108*56815Sralph #define EVENT_RIGHT_BUTTON 0x03 109*56815Sralph #define RIGHT_BUTTON 0x01 110*56815Sralph #define MIDDLE_BUTTON 0x02 111*56815Sralph #define LEFT_BUTTON 0x04 112*56815Sralph 113*56815Sralph /* 114*56815Sralph * Mouse report structure definition 115*56815Sralph */ 116*56815Sralph typedef struct { 117*56815Sralph char state; /* buttons and sign bits */ 118*56815Sralph short dx; /* delta X since last change */ 119*56815Sralph short dy; /* delta Y since last change */ 120*56815Sralph char byteCount; /* mouse report byte count */ 121*56815Sralph } MouseReport; 122*56815Sralph 123*56815Sralph /* 124*56815Sralph * Macro to translate from a time struct to milliseconds. 125*56815Sralph */ 126*56815Sralph #define TO_MS(tv) ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)) 127