156815Sralph /*- 2*63205Sbostic * Copyright (c) 1992, 1993 3*63205Sbostic * The Regents of the University of California. 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*63205Sbostic * @(#)fbreg.h 8.1 (Berkeley) 06/10/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 */ 3058974Sralph size_t fr_size; /* Frame buffer size */ 3158793Sralph char *fr_chipaddr; /* Base address for chips */ 3256815Sralph void (*posCursor)(); /* Position cursor func */ 3356815Sralph void (*KBDPutc)(); /* Send char to keyboard func */ 3456815Sralph dev_t kbddev; /* Device for KBDPutc */ 3556815Sralph struct selinfo selp; /* Select structure */ 3656815Sralph }; 3756815Sralph 3856815Sralph /* 3956815Sralph * Definitions for the Keyboard and mouse. 4056815Sralph */ 4156815Sralph /* 4256815Sralph * Special key values. 4356815Sralph */ 4456815Sralph #define KEY_R_SHIFT 0xab 4556815Sralph #define KEY_SHIFT 0xae 4656815Sralph #define KEY_CONTROL 0xaf 4756815Sralph #define KEY_R_ALT 0xb2 4856815Sralph #define KEY_UP 0xb3 4956815Sralph #define KEY_REPEAT 0xb4 5056815Sralph #define KEY_F1 0x56 5156815Sralph #define KEY_COMMAND KEY_F1 5256815Sralph 5356815Sralph /* 5456815Sralph * Lk201/301 keyboard 5556815Sralph */ 5656815Sralph #define LK_UPDOWN 0x86 /* bits for setting lk201 modes */ 5756815Sralph #define LK_AUTODOWN 0x82 5856815Sralph #define LK_DOWN 0x80 5956815Sralph #define LK_DEFAULTS 0xd3 /* reset mode settings */ 6056815Sralph #define LK_AR_ENABLE 0xe3 /* global auto repeat enable */ 6156815Sralph #define LK_CL_ENABLE 0x1b /* keyclick enable */ 6256815Sralph #define LK_KBD_ENABLE 0x8b /* keyboard enable */ 6356815Sralph #define LK_BELL_ENABLE 0x23 /* the bell */ 6456815Sralph #define LK_LED_ENABLE 0x13 /* light led */ 6556815Sralph #define LK_LED_DISABLE 0x11 /* turn off led */ 6656815Sralph #define LK_RING_BELL 0xa7 /* ring keyboard bell */ 6756815Sralph #define LED_1 0x81 /* led bits */ 6856815Sralph #define LED_2 0x82 6956815Sralph #define LED_3 0x84 7056815Sralph #define LED_4 0x88 7156815Sralph #define LED_ALL 0x8f 7256815Sralph #define LK_HELP 0x7c /* help key */ 7356815Sralph #define LK_DO 0x7d /* do key */ 7456815Sralph #define LK_KDOWN_ERROR 0x3d /* key down on powerup error */ 7556815Sralph #define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/ 7656815Sralph #define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */ 7756815Sralph #define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */ 7856815Sralph #define LK_LOWEST 0x56 /* lowest significant keycode */ 7956815Sralph 8056815Sralph /* max volume is 0, lowest is 0x7 */ 8156815Sralph #define LK_PARAM_VOLUME(v) (0x80|((v)&0x7)) 8256815Sralph 8356815Sralph /* mode command details */ 8456815Sralph #define LK_CMD_MODE(m,div) ((m)|((div)<<3)) 8556815Sralph 8656815Sralph /* 8756815Sralph * Command characters for the mouse. 8856815Sralph */ 8956815Sralph #define MOUSE_SELF_TEST 'T' 9056815Sralph #define MOUSE_INCREMENTAL 'R' 9156815Sralph 9256815Sralph /* 9356815Sralph * Mouse output bits. 9456815Sralph * 9556815Sralph * MOUSE_START_FRAME Start of report frame bit. 9656815Sralph * MOUSE_X_SIGN Sign bit for X. 9756815Sralph * MOUSE_Y_SIGN Sign bit for Y. 9856815Sralph * MOUSE_X_OFFSET X offset to start cursor at. 9956815Sralph * MOUSE_Y_OFFSET Y offset to start cursor at. 10056815Sralph */ 10156815Sralph #define MOUSE_START_FRAME 0x80 10256815Sralph #define MOUSE_X_SIGN 0x10 10356815Sralph #define MOUSE_Y_SIGN 0x08 10456815Sralph 10556815Sralph /* 10656815Sralph * Definitions for mouse buttons 10756815Sralph */ 10856815Sralph #define EVENT_LEFT_BUTTON 0x01 10956815Sralph #define EVENT_MIDDLE_BUTTON 0x02 11056815Sralph #define EVENT_RIGHT_BUTTON 0x03 11156815Sralph #define RIGHT_BUTTON 0x01 11256815Sralph #define MIDDLE_BUTTON 0x02 11356815Sralph #define LEFT_BUTTON 0x04 11456815Sralph 11556815Sralph /* 11656815Sralph * Mouse report structure definition 11756815Sralph */ 11856815Sralph typedef struct { 11956815Sralph char state; /* buttons and sign bits */ 12056815Sralph short dx; /* delta X since last change */ 12156815Sralph short dy; /* delta Y since last change */ 12256815Sralph char byteCount; /* mouse report byte count */ 12356815Sralph } MouseReport; 12456815Sralph 12556815Sralph /* 12656815Sralph * Macro to translate from a time struct to milliseconds. 12756815Sralph */ 12856815Sralph #define TO_MS(tv) ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)) 12958974Sralph 13058974Sralph extern void fbKbdEvent __P((int, struct pmax_fb *)); 13158974Sralph extern void fbMouseEvent __P((MouseReport *, struct pmax_fb *)); 13258974Sralph extern void fbMouseButtons __P((MouseReport *, struct pmax_fb *)); 13358974Sralph extern void fbScroll __P((struct pmax_fb *)); 13458974Sralph extern void fbPutc __P((dev_t, int)); 13558974Sralph extern void fbBlitc __P((int, struct pmax_fb *)); 13658974Sralph extern void fbBlitc __P((int, struct pmax_fb *)); 13758974Sralph extern int kbdMapChar __P((int)); 13858974Sralph extern void KBDReset __P((dev_t, void (*)(dev_t, int))); 13958974Sralph extern void MouseInit __P((dev_t, void (*)(dev_t, int), int (*)(dev_t))); 14058974Sralph extern int KBDGetc __P((void)); 14158974Sralph extern int tb_kbdmouseconfig __P((struct pmax_fb *)); 14258974Sralph extern int fbmmap __P((struct pmax_fb *, dev_t, caddr_t, struct proc *)); 143