|
|
1.1 ! root 1: /* $Id: serial-kb.h,v 1.2 2003/09/01 14:33:15 fredette Exp $ */ ! 2: ! 3: /* serial/serial-kb.h - implementation header file for serial keyboard ! 4: emulation: */ ! 5: ! 6: /* ! 7: * Copyright (c) 2003 Matt Fredette ! 8: * All rights reserved. ! 9: * ! 10: * Redistribution and use in source and binary forms, with or without ! 11: * modification, are permitted provided that the following conditions ! 12: * are met: ! 13: * 1. Redistributions of source code must retain the above copyright ! 14: * notice, this list of conditions and the following disclaimer. ! 15: * 2. Redistributions in binary form must reproduce the above copyright ! 16: * notice, this list of conditions and the following disclaimer in the ! 17: * documentation and/or other materials provided with the distribution. ! 18: * 3. All advertising materials mentioning features or use of this software ! 19: * must display the following acknowledgement: ! 20: * This product includes software developed by Matt Fredette. ! 21: * 4. The name of the author may not be used to endorse or promote products ! 22: * derived from this software without specific prior written permission. ! 23: * ! 24: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ! 25: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ! 26: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ! 27: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, ! 28: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ! 29: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ! 30: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! 31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ! 32: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ! 33: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! 34: * POSSIBILITY OF SUCH DAMAGE. ! 35: */ ! 36: ! 37: #ifndef _SERIAL_SERIAL_KB_H ! 38: #define _SERIAL_SERIAL_KB_H ! 39: ! 40: #include <tme/common.h> ! 41: _TME_RCSID("$Id: serial-kb.h,v 1.2 2003/09/01 14:33:15 fredette Exp $"); ! 42: ! 43: /* includes: */ ! 44: #include <tme/generic/keyboard.h> ! 45: #include <tme/generic/serial.h> ! 46: #include <tme/element.h> ! 47: ! 48: /* macros: */ ! 49: ! 50: /* the callout flags: */ ! 51: #define TME_SERIAL_KB_CALLOUT_CHECK (0) ! 52: #define TME_SERIAL_KB_CALLOUT_RUNNING TME_BIT(0) ! 53: #define TME_SERIAL_KB_CALLOUTS_MASK (-2) ! 54: #define TME_SERIAL_KB_CALLOUT_SERIAL_CTRL TME_BIT(1) ! 55: #define TME_SERIAL_KB_CALLOUT_SERIAL_CONFIG TME_BIT(2) ! 56: #define TME_SERIAL_KB_CALLOUT_SERIAL_READ TME_BIT(3) ! 57: #define TME_SERIAL_KB_CALLOUT_KEYBOARD_CTRL TME_BIT(4) ! 58: #define TME_SERIAL_KB_CALLOUT_KEYBOARD_READ TME_BIT(5) ! 59: ! 60: /* types: */ ! 61: ! 62: /* a serial keyboard: */ ! 63: struct tme_serial_kb { ! 64: ! 65: /* backpointer to our element: */ ! 66: struct tme_element *tme_serial_kb_element; ! 67: ! 68: /* our mutex: */ ! 69: tme_mutex_t tme_serial_kb_mutex; ! 70: ! 71: /* our type: */ ! 72: _tme_const char *tme_serial_kb_type; ! 73: ! 74: /* our type-specific state: */ ! 75: void *tme_serial_kb_type_state; ! 76: ! 77: /* our type-specific pre-map-adding function: */ ! 78: int (*tme_serial_kb_type_map_add_pre) _TME_P((struct tme_serial_kb *, ! 79: struct tme_keyboard_map *)); ! 80: ! 81: /* our type-specific post-map-adding function: */ ! 82: int (*tme_serial_kb_type_map_add_post) _TME_P((struct tme_serial_kb *, ! 83: _tme_const struct tme_keyboard_map *)); ! 84: ! 85: /* our type-specific event function: */ ! 86: tme_uint8_t (*tme_serial_kb_type_event) _TME_P((struct tme_serial_kb *, ! 87: _tme_const struct tme_keyboard_event *)); ! 88: ! 89: /* our type-specific serial control function: */ ! 90: int (*tme_serial_kb_type_serial_ctrl) _TME_P((struct tme_serial_kb *, ! 91: unsigned int)); ! 92: ! 93: /* our type-specific serial input function: */ ! 94: int (*tme_serial_kb_type_serial_input) _TME_P((struct tme_serial_kb *, ! 95: tme_uint8_t *, ! 96: unsigned int, ! 97: tme_serial_data_flags_t)); ! 98: ! 99: /* our type-specific serial configuration: */ ! 100: struct tme_serial_config tme_serial_kb_type_config; ! 101: ! 102: /* our stored macros: */ ! 103: char **tme_serial_kb_macros; ! 104: ! 105: /* our stored map entries: */ ! 106: char **tme_serial_kb_map; ! 107: ! 108: /* our keyboard connection: */ ! 109: struct tme_keyboard_connection *tme_serial_kb_connection_kb; ! 110: ! 111: /* our serial connection: */ ! 112: struct tme_serial_connection *tme_serial_kb_connection_serial; ! 113: ! 114: /* the callout flags: */ ! 115: int tme_serial_kb_callout_flags; ! 116: ! 117: /* our keyboard buffer: */ ! 118: struct tme_keyboard_buffer *tme_serial_kb_keyboard_buffer; ! 119: ! 120: /* our serial output buffer: */ ! 121: struct tme_serial_buffer tme_serial_kb_serial_buffer; ! 122: ! 123: /* our current keyboard control outputs: */ ! 124: unsigned int tme_serial_kb_keyboard_ctrl; ! 125: ! 126: /* our current serial control outputs: */ ! 127: unsigned int tme_serial_kb_serial_ctrl; ! 128: ! 129: /* when nonzero, the rate-limiting sleep time, in microseconds: */ ! 130: unsigned long tme_serial_kb_rate_sleep; ! 131: ! 132: /* when nonzero, rate-limiting is active: */ ! 133: int tme_serial_kb_rate_limited; ! 134: ! 135: /* when nonzero, rate-limiting is active and sleeping: */ ! 136: int tme_serial_kb_rate_sleeping; ! 137: ! 138: /* our rate-limiting thread condition: */ ! 139: tme_cond_t tme_serial_kb_rate_cond; ! 140: }; ! 141: ! 142: /* prototypes: */ ! 143: int _tme_serial_kb_sun_init _TME_P((struct tme_serial_kb *)); ! 144: ! 145: #endif /* !_SERIAL_SERIAL_KB_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.