|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: File: KeyboardModule.h
27:
28: Contains: Header file for Keyboard Module
29:
30: Version: xxx put version here xxx
31:
32: Copyright: � 1997-1998 by Apple Computer, Inc., all rights reserved.
33:
34: File Ownership:
35:
36: DRI: Craig Keithley
37:
38: Other Contact: xxx put other contact here xxx
39:
40: Technology: xxx put technology here xxx
41:
42: Writers:
43:
44: (BWS) Brent Schorsch
45: (CJK) Craig Keithley
46:
47: Change History (most recent first):
48:
49: <USB19> 6/18/98 BWS fix interrupt refcon support
50: <USB18> 6/18/98 CJK add interrupt refcon
51: <USB17> 6/17/98 CJK change retry count to 3
52: <USB16> 6/16/98 CJK change FindHIDInterfaceByProtocol to FindHIDInterfaceByNumber
53: <USB15> 6/11/98 CJK Remove driverentry routine (not needed or used).
54: <USB14> 4/30/98 CJK init rawreportmode and initialized flags appropriately.
55: <USB13> 4/26/98 CJK add code/states to handle getting the full configuration and
56: parsing it.
57: <USB12> 4/9/98 CJK remove include of USBDeviceDefines.h
58: <11> 4/8/98 CJK rework PostUSBKeyToMac to work the same way as the standard interrupt
59: handler
60: <10> 3/25/98 CJK Remove unneeded readHID & delay enums
61: <9> 3/24/98 CJK Change 'kTransactionPending' to 'kCompletionPending'
62: <8> 3/17/98 CJK Beging adding support for interrupt transactions. Add function
63: prototypes for the various keyboard HID module files.
64: <7> 3/2/98 CJK remove include of KBDHIDEmulation.h
65: <6> 2/27/98 CJK add include of USBHIDModules.h
66: <5> 2/26/98 CJK add set LED state
67: <4> 2/16/98 CJK add extra poll state (not currently used)
68: <3> 2/11/98 CJK remove unneeded state values.
69: <2> 2/10/98 CJK Correct change history (to reflect the keyboard module changes)
70: <1> 2/10/98 CJK First time check in. Cloned from Mouse HID Module
71: */
72: #ifndef __KeyboardModuleH__
73: #define __KeyboardModuleH__
74:
75: //#include <Types.h>
76: //#include <Devices.h>
77: #include "../driverservices.h"
78: //#include <Processes.h>
79: #include "../USB.h"
80:
81: void PostUSBKeyToMac(UInt16 rawUSBkey);
82: void PostADBKeyToMac(UInt16 virtualKeycode, UInt8 state);
83:
84: void USBDemoKeyIn(UInt32 refcon, void * theData);
85: void InitUSBKeyboard(void);
86: void KBDHIDNotification(UInt32 devicetype, UInt8 NewHIDData[], UInt8 OldHIDData[]);
87:
88: Boolean SetBit(UInt8 *bitmapArray, UInt16 index, Boolean value);
89:
90: OSStatus KeyboardModuleInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
91: OSStatus KeyboardInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
92: OSStatus KeyboardModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
93:
94: void KeyboardModuleInitiateTransaction(USBPB *pb);
95: void KeyboardModuleDelay1CompletionProc(USBPB *pb);
96: void KeyboardCompletionProc(USBPB *pb);
97: void kbd_InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
98:
99: OSErr FindHIDInterfaceByNumber(LogicalAddress pConfigDesc, UInt32 ReqInterface, USBInterfaceDescriptorPtr * hInterfaceDesc);
100: void kbd_NotifyRegisteredHIDUser(UInt32 devicetype, UInt8 hidReport[]);
101:
102: #define kKeyboardRetryCount 3
103: #define kKeyboardModifierBits 8
104: #define kKeyboardReportKeys 6
105: #define kKeyboardOffsetToKeys 2
106: #define kKeyboardReportSize 8
107:
108: enum driverstages
109: {
110: kUndefined = 0,
111: kSetKeyboardLEDs,
112: kGetFullConfiguration,
113: kFindInterfaceAndSetProtocol,
114: kSetIdleRequest,
115: kFindAndOpenInterruptPipe,
116: kReadInterruptPipe,
117: kReturnFromDriver = 0x1000,
118: kRetryTransaction = 0x2000,
119: kSyncTransaction = 0x4000,
120: kCompletionPending = 0x8000
121: };
122:
123: typedef struct
124: {
125: USBPB pb;
126: void (*handler)(USBPB *pb);
127:
128: USBDeviceRef deviceRef;
129: USBInterfaceRef interfaceRef;
130: USBPipeRef pipeRef;
131:
132: USBDeviceDescriptor deviceDescriptor;
133: USBInterfaceDescriptor interfaceDescriptor;
134:
135: USBConfigurationDescriptorPtr pFullConfigDescriptor;
136: USBInterfaceDescriptorPtr pInterfaceDescriptor;
137: USBEndPointDescriptorPtr pEndpointDescriptor;
138:
139: UInt32 hidDeviceType;
140: UInt8 hidReport[8];
141: UInt8 oldHIDReport[8];
142: UInt8 padding[8];
143:
144: Boolean sendRawReportFlag;
145: Boolean hidEmulationInit;
146:
147: HIDInterruptProcPtr pSHIMInterruptRoutine;
148: HIDInterruptProcPtr pSavedInterruptRoutine;
149:
150: UInt32 interruptRefcon;
151:
152: SInt32 retryCount;
153: SInt32 delayLevel;
154: SInt32 transDepth;
155: } usbKeyboardPBStruct;
156:
157: #endif //__KeyboardModuleH__
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.