1 /****************************************************************************** 2 * keyhandler.h 3 * 4 * We keep an array of 'handlers' for each key code between 0 and 255; 5 * this is intended to allow very simple debugging routines (toggle 6 * debug flag, dump registers, reboot, etc) to be hooked in in a slightly 7 * nicer fashion than just editing the serial/keyboard drivers. 8 */ 9 10 #ifndef __XEN_KEYHANDLER_H__ 11 #define __XEN_KEYHANDLER_H__ 12 13 #include <xen/types.h> 14 15 /* 16 * Callback type for keyhander. 17 * 18 * Called in softirq context with interrupts enabled. 19 */ 20 typedef void (keyhandler_fn_t)(unsigned char key); 21 22 /* 23 * Callback type for irq_keyhandler. 24 * 25 * Called in hardirq context with interrupts disabled. 26 */ 27 struct cpu_user_regs; 28 typedef void (irq_keyhandler_fn_t)(unsigned char key, 29 struct cpu_user_regs *regs); 30 31 /* Initialize keytable with default handlers. */ 32 void initialize_keytable(void); 33 34 /* 35 * Regiser a callback handler for key @key for either plain or irq context. 36 * If @diagnostic is set, the handler will be included in the "dump 37 * everything" keyhandler. 38 */ 39 void register_keyhandler(unsigned char key, 40 keyhandler_fn_t *fn, 41 const char *desc, 42 bool_t diagnostic); 43 void register_irq_keyhandler(unsigned char key, 44 irq_keyhandler_fn_t *fn, 45 const char *desc, 46 bool_t diagnostic); 47 48 /* Inject a keypress into the key-handling subsystem. */ 49 extern void handle_keypress(unsigned char key, struct cpu_user_regs *regs); 50 51 /* Scratch space is available for use of any keyhandler. */ 52 extern char keyhandler_scratch[1024]; 53 54 #endif /* __XEN_KEYHANDLER_H__ */ 55