| 1 | \ ========== Copyright Header Begin ========================================== |
| 2 | \ |
| 3 | \ Hypervisor Software File: usbdefs.fth |
| 4 | \ |
| 5 | \ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
| 6 | \ |
| 7 | \ - Do no alter or remove copyright notices |
| 8 | \ |
| 9 | \ - Redistribution and use of this software in source and binary forms, with |
| 10 | \ or without modification, are permitted provided that the following |
| 11 | \ conditions are met: |
| 12 | \ |
| 13 | \ - Redistribution of source code must retain the above copyright notice, |
| 14 | \ this list of conditions and the following disclaimer. |
| 15 | \ |
| 16 | \ - Redistribution in binary form must reproduce the above copyright notice, |
| 17 | \ this list of conditions and the following disclaimer in the |
| 18 | \ documentation and/or other materials provided with the distribution. |
| 19 | \ |
| 20 | \ Neither the name of Sun Microsystems, Inc. or the names of contributors |
| 21 | \ may be used to endorse or promote products derived from this software |
| 22 | \ without specific prior written permission. |
| 23 | \ |
| 24 | \ This software is provided "AS IS," without a warranty of any kind. |
| 25 | \ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, |
| 26 | \ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A |
| 27 | \ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN |
| 28 | \ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR |
| 29 | \ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR |
| 30 | \ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN |
| 31 | \ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR |
| 32 | \ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE |
| 33 | \ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, |
| 34 | \ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF |
| 35 | \ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
| 36 | \ |
| 37 | \ You acknowledge that this software is not designed, licensed or |
| 38 | \ intended for use in the design, construction, operation or maintenance of |
| 39 | \ any nuclear facility. |
| 40 | \ |
| 41 | \ ========== Copyright Header End ============================================ |
| 42 | \ id: @(#)usbdefs.fth 1.9 00/06/01 |
| 43 | \ purpose: |
| 44 | \ copyright: Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved |
| 45 | |
| 46 | |
| 47 | \ This file holds usb-specific definitions. |
| 48 | |
| 49 | |
| 50 | \ headers \ XXX for debugging |
| 51 | external |
| 52 | hex |
| 53 | |
| 54 | \ debug stuff from here - take out later |
| 55 | \ ************************************ |
| 56 | |
| 57 | : dobigoffset |
| 58 | case |
| 59 | 30 of 0 endof |
| 60 | 31 of 10 endof |
| 61 | 32 of 20 endof |
| 62 | 33 of 30 endof |
| 63 | 34 of 40 endof |
| 64 | 35 of 50 endof |
| 65 | 36 of 70 endof |
| 66 | 37 of 90 endof |
| 67 | 38 of b0 endof |
| 68 | 39 of d0 endof |
| 69 | endcase |
| 70 | ; |
| 71 | : dolitloffset |
| 72 | case |
| 73 | 30 of 0 endof |
| 74 | 31 of 1 endof |
| 75 | 32 of 2 endof |
| 76 | 33 of 3 endof |
| 77 | 34 of 4 endof |
| 78 | 35 of 5 endof |
| 79 | 36 of 6 endof |
| 80 | 37 of 7 endof |
| 81 | 38 of 8 endof |
| 82 | 39 of 9 endof |
| 83 | endcase |
| 84 | ; |
| 85 | \ ************************************ |
| 86 | \ debug stuff to here - take out later |
| 87 | |
| 88 | |
| 89 | \ 1 constant GET-REPORT |
| 90 | \ 2 constant GET-IDLE |
| 91 | \ 3 constant GET-PROTOCOL |
| 92 | \ 4 - 8 are reserved, according to the USB HID doc |
| 93 | \ 9 constant SET-REPORT |
| 94 | \ a constant SET-IDLE |
| 95 | \ b constant SET-PROTOCOL |
| 96 | |
| 97 | \ 0 constant BootProtocol |
| 98 | \ 1 constant ReportProtocol |
| 99 | |
| 100 | \ Class Descriptor Types |
| 101 | \ 21 constant HID-Descriptor-Type |
| 102 | \ 22 constant REPORT-Descriptor-Type |
| 103 | \ 23 constant PHYSICAL-Descriptor-Type |
| 104 | |
| 105 | \ 81 constant ReqType-HID-Cl-Descr |
| 106 | |
| 107 | |
| 108 | \ 6 constant GET-DESCRIPTOR |
| 109 | |
| 110 | \ 1 constant GET-CLASS-DESCR |
| 111 | |
| 112 | |
| 113 | \ These are global. |
| 114 | defer turn-me-off ' noop is turn-me-off |
| 115 | defer toggle-mon ' noop is toggle-mon |
| 116 | |
| 117 | |
| 118 | 0 constant reglkey |
| 119 | h# ff constant spclkey |
| 120 | |
| 121 | 0 instance value unstall-cnt |
| 122 | |
| 123 | instance variable our-ha-token |
| 124 | |
| 125 | 0 instance value set-prtcl-buff^v |
| 126 | 0 instance value get-descr-buff^v |
| 127 | 0 instance value hid-descr-buff^v |
| 128 | 0 instance value std-pkt-buff^v |
| 129 | |
| 130 | \ The following struct is designed to keep track of the down keys - up to |
| 131 | \ 6 per report, plus related information. The code is not currently |
| 132 | \ doing anything with the modifier byte or the reserved byte, but |
| 133 | \ including those makes it very convenient because the key# information |
| 134 | \ coming back from the USB report fits directly into the struct format. |
| 135 | \ The #keys-down and #regl-keys-dn bytes are not filled in by the USB |
| 136 | \ boot report but instead are calculated sometime after receiving the |
| 137 | \ USB report. |
| 138 | \ Note: fields >kbd-in-byte7, >kbd-in-byte8, and >kbd-in-byte9 are used |
| 139 | \ to potentially hold the shift, cntrl and altgraph, which are |
| 140 | \ actually reported as status bits in the >kbd-in-modkeys byte. |
| 141 | struct |
| 142 | 1 field >kbd-in-modkeys \ bmRequestType |
| 143 | 1 field >kbd-in-reserved \ bmRequestType |
| 144 | 1 field >kbd-in-byte1 \ bmRequestType |
| 145 | 1 field >kbd-in-byte2 \ bmRequestType |
| 146 | 1 field >kbd-in-byte3 \ bmRequestType |
| 147 | 1 field >kbd-in-byte4 \ bmRequestType |
| 148 | 1 field >kbd-in-byte5 \ bmRequestType |
| 149 | 1 field >kbd-in-byte6 \ bmRequestType |
| 150 | 1 field >kbd-in-byte7 \ bmRequestType |
| 151 | 1 field >kbd-in-byte8 \ bmRequestType |
| 152 | 1 field >kbd-in-byte9 \ bmRequestType |
| 153 | 1 field >#keys-down |
| 154 | 1 field >#regl-keys-dn \ Can determine #spcl keys dn by subtracting |
| 155 | \ #regl-keys-dn from #keys-down. |
| 156 | constant /key-info-buff |
| 157 | |
| 158 | 0 instance value keybuff-curr^v |
| 159 | |
| 160 | /key-info-buff buffer: keybuff-prev |
| 161 | |
| 162 | 0 value curr-byte1-bfaddr |
| 163 | 0 value curr-#ksdn-bfaddr |
| 164 | 0 value prev-byte1-bfaddr |
| 165 | \ These offsets are used frequently enough to have global variables |
| 166 | \ that hold the offset to the indicated locations in the key buffers. |
| 167 | |
| 168 | |
| 169 | \ Various keyboard flags; |
| 170 | -1 instance value shiftflag \ True if the shift key is down |
| 171 | -1 instance value ctrlflag \ True if the ctrl key is down |
| 172 | -1 instance value altgflag \ True if the alt graph key is down |
| 173 | -1 instance value powerflag \ True if the power key is down |
| 174 | -1 instance value monflag \ True if the monitor key is down |
| 175 | -1 instance value stopflag \ True if the stop (L1) key is down |
| 176 | \ Following indicate special flags for "previous" report; |
| 177 | -1 instance value pr-shiftflag \ True if the shift key is down |
| 178 | -1 instance value pr-ctrlflag \ True if the ctrl key is down |
| 179 | -1 instance value pr-altgflag \ True if the alt graph key is down |
| 180 | -1 instance value pr-powerflag \ True if the power key is down |
| 181 | -1 instance value pr-monflag \ True if the monitor key is down |
| 182 | -1 instance value pr-stopflag \ True if the stop (L1) key is down |
| 183 | |
| 184 | 0 instance value key-repeat-time \ Time of next repeat |
| 185 | \ 0 instance value key-click |
| 186 | nokey instance value curr-repeat-key |
| 187 | \ curr-repeat-key will hold the converted keyvalue which represents |
| 188 | \ the currently repeating key. |
| 189 | |
| 190 | |
| 191 | \ Following will be set if several special keys have been entered |
| 192 | \ but the control key was given the highest priority. Without this |
| 193 | \ flag we end up applying the control offset if the control key is |
| 194 | \ down - even if shift (a higher priority key) is down. |
| 195 | 0 instance value ctrl-in-effect |