156815Sralph /*- 256815Sralph * Copyright (c) 1992 The Regents of the University of California. 356815Sralph * All rights reserved. 456815Sralph * 556815Sralph * This code is derived from software contributed to Berkeley by 656815Sralph * Ralph Campbell and Rick Macklem. 756815Sralph * 856815Sralph * %sccs.include.redist.c% 956815Sralph * 10*58793Sralph * @(#)fbreg.h 7.2 (Berkeley) 03/23/93 1156815Sralph */ 1256815Sralph 1356815Sralph /* 1456815Sralph * Data for fb.c generic frame buffer routines that are called by the 1556815Sralph * various frame buffer drivers. 1656815Sralph */ 1756815Sralph struct fbuaccess { 1856815Sralph PM_Info scrInfo; 1956815Sralph pmEvent events[PM_MAXEVQ]; 2056815Sralph pmTimeCoord tcs[MOTION_BUFFER_SIZE]; 2156815Sralph }; 2256815Sralph 2356815Sralph struct pmax_fb { 2456815Sralph int GraphicsOpen; /* Open yet? */ 2556815Sralph int initialized; /* Set up yet? */ 2656815Sralph int isMono; /* Monochrome fb? */ 2756815Sralph int row, col; /* Screen pos for glass tty */ 2856815Sralph struct fbuaccess *fbu; /* X event stuff */ 2956815Sralph char *fr_addr; /* Frame buffer address */ 30*58793Sralph char *fr_chipaddr; /* Base address for chips */ 3156815Sralph void (*posCursor)(); /* Position cursor func */ 3256815Sralph void (*KBDPutc)(); /* Send char to keyboard func */ 3356815Sralph dev_t kbddev; /* Device for KBDPutc */ 3456815Sralph struct selinfo selp; /* Select structure */ 3556815Sralph }; 3656815Sralph 3756815Sralph /* 3856815Sralph * Definitions for the Keyboard and mouse. 3956815Sralph */ 4056815Sralph /* 4156815Sralph * Special key values. 4256815Sralph */ 4356815Sralph #define KEY_R_SHIFT 0xab 4456815Sralph #define KEY_SHIFT 0xae 4556815Sralph #define KEY_CONTROL 0xaf 4656815Sralph #define KEY_R_ALT 0xb2 4756815Sralph #define KEY_UP 0xb3 4856815Sralph #define KEY_REPEAT 0xb4 4956815Sralph #define KEY_F1 0x56 5056815Sralph #define KEY_COMMAND KEY_F1 5156815Sralph 5256815Sralph /* 5356815Sralph * Lk201/301 keyboard 5456815Sralph */ 5556815Sralph #define LK_UPDOWN 0x86 /* bits for setting lk201 modes */ 5656815Sralph #define LK_AUTODOWN 0x82 5756815Sralph #define LK_DOWN 0x80 5856815Sralph #define LK_DEFAULTS 0xd3 /* reset mode settings */ 5956815Sralph #define LK_AR_ENABLE 0xe3 /* global auto repeat enable */ 6056815Sralph #define LK_CL_ENABLE 0x1b /* keyclick enable */ 6156815Sralph #define LK_KBD_ENABLE 0x8b /* keyboard enable */ 6256815Sralph #define LK_BELL_ENABLE 0x23 /* the bell */ 6356815Sralph #define LK_LED_ENABLE 0x13 /* light led */ 6456815Sralph #define LK_LED_DISABLE 0x11 /* turn off led */ 6556815Sralph #define LK_RING_BELL 0xa7 /* ring keyboard bell */ 6656815Sralph #define LED_1 0x81 /* led bits */ 6756815Sralph #define LED_2 0x82 6856815Sralph #define LED_3 0x84 6956815Sralph #define LED_4 0x88 7056815Sralph #define LED_ALL 0x8f 7156815Sralph #define LK_HELP 0x7c /* help key */ 7256815Sralph #define LK_DO 0x7d /* do key */ 7356815Sralph #define LK_KDOWN_ERROR 0x3d /* key down on powerup error */ 7456815Sralph #define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/ 7556815Sralph #define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */ 7656815Sralph #define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */ 7756815Sralph #define LK_LOWEST 0x56 /* lowest significant keycode */ 7856815Sralph 7956815Sralph /* max volume is 0, lowest is 0x7 */ 8056815Sralph #define LK_PARAM_VOLUME(v) (0x80|((v)&0x7)) 8156815Sralph 8256815Sralph /* mode command details */ 8356815Sralph #define LK_CMD_MODE(m,div) ((m)|((div)<<3)) 8456815Sralph 8556815Sralph /* 8656815Sralph * Command characters for the mouse. 8756815Sralph */ 8856815Sralph #define MOUSE_SELF_TEST 'T' 8956815Sralph #define MOUSE_INCREMENTAL 'R' 9056815Sralph 9156815Sralph /* 9256815Sralph * Mouse output bits. 9356815Sralph * 9456815Sralph * MOUSE_START_FRAME Start of report frame bit. 9556815Sralph * MOUSE_X_SIGN Sign bit for X. 9656815Sralph * MOUSE_Y_SIGN Sign bit for Y. 9756815Sralph * MOUSE_X_OFFSET X offset to start cursor at. 9856815Sralph * MOUSE_Y_OFFSET Y offset to start cursor at. 9956815Sralph */ 10056815Sralph #define MOUSE_START_FRAME 0x80 10156815Sralph #define MOUSE_X_SIGN 0x10 10256815Sralph #define MOUSE_Y_SIGN 0x08 10356815Sralph 10456815Sralph /* 10556815Sralph * Definitions for mouse buttons 10656815Sralph */ 10756815Sralph #define EVENT_LEFT_BUTTON 0x01 10856815Sralph #define EVENT_MIDDLE_BUTTON 0x02 10956815Sralph #define EVENT_RIGHT_BUTTON 0x03 11056815Sralph #define RIGHT_BUTTON 0x01 11156815Sralph #define MIDDLE_BUTTON 0x02 11256815Sralph #define LEFT_BUTTON 0x04 11356815Sralph 11456815Sralph /* 11556815Sralph * Mouse report structure definition 11656815Sralph */ 11756815Sralph typedef struct { 11856815Sralph char state; /* buttons and sign bits */ 11956815Sralph short dx; /* delta X since last change */ 12056815Sralph short dy; /* delta Y since last change */ 12156815Sralph char byteCount; /* mouse report byte count */ 12256815Sralph } MouseReport; 12356815Sralph 12456815Sralph /* 12556815Sralph * Macro to translate from a time struct to milliseconds. 12656815Sralph */ 12756815Sralph #define TO_MS(tv) ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)) 128