home *** CD-ROM | disk | FTP | other *** search
- /*
- File: KeyboardModule.h
-
- Contains: Header file for Keyboard Module
-
- Version: xxx put version here xxx
-
- Copyright: © 1997-1998 by Apple Computer, Inc., all rights reserved.
-
- */
- #ifndef __KeyboardModuleH__
- #define __KeyboardModuleH__
-
- #include <Types.h>
- #include <Devices.h>
- #include <DriverServices.h>
- #include <Processes.h>
- #include <USB.h>
-
-
- #define kKeyboardModuleName "\pUSBHIDKeyboardModule"
-
- void PostUSBKeyToMac(UInt16 rawUSBkey);
- void PostADBKeyToMac(UInt16 virtualKeycode, UInt8 state);
-
- void USBDemoKeyIn(UInt32 refcon, void * theData);
- void InitUSBKeyboard(void);
- void KBDHIDNotification(UInt32 devicetype, UInt8 NewHIDData[], UInt8 OldHIDData[]);
-
- Boolean SetBit(UInt8 *bitmapArray, UInt16 index, Boolean value);
-
- static OSStatus KeyboardModuleInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
- static OSStatus KeyboardInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
- static OSStatus KeyboardModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
-
- void InitParamBlock(USBReference theInterfaceRef, USBPB * paramblock);
- void KeyboardInitiateTransaction(USBPB *pb);
- void KeyboardCompletionProc(USBPB *pb);
- void InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBReference theInterfaceRef);
-
- OSErr FindHIDInterfaceByNumber(LogicalAddress pConfigDesc, UInt32 ReqInterface, USBInterfaceDescriptorPtr * hInterfaceDesc);
- void NotifyRegisteredHIDUser(UInt32 devicetype, UInt8 hidReport[]);
-
- #define kKeyboardRetryCount 3
- #define kKeyboardModifierBits 8
- #define kKeyboardReportKeys 6
- #define kKeyboardOffsetToKeys 2
- #define kKeyboardReportSize 8
-
- enum driverstages
- {
- kUndefined = 0,
- kSetKeyboardLEDs,
- kSetProtocol,
- kSetIdleRequest,
- kConfigureInterface,
- kFindPipe,
- kReadInterruptPipe,
- kClearFeature,
- kReturnFromDriver = 0x1000,
- kRetryTransaction = 0x2000,
- kSyncTransaction = 0x4000,
- kCompletionPending = 0x8000
- };
-
- typedef struct
- {
- USBPB pb;
- void (*handler)(USBPB *pb);
-
- USBReference interfaceRef;
- USBPipeRef pipeRef;
-
- USBDeviceDescriptor deviceDescriptor;
- USBInterfaceDescriptor interfaceDescriptor;
-
- USBInterfaceDescriptorPtr pInterfaceDescriptor;
- USBEndPointDescriptorPtr pEndpointDescriptor;
-
- UInt32 hidDeviceType;
- UInt8 hidReport[8];
- UInt8 oldHIDReport[8];
- UInt8 padding[8];
-
- Boolean sendRawReportFlag;
- Boolean hidEmulationInit;
- Boolean keyboardReady;
- Boolean intPipeAborted;
- Boolean driverRemovalPending;
-
- HIDInterruptProcPtr pSHIMInterruptRoutine;
- HIDInterruptProcPtr pSavedInterruptRoutine;
-
- UInt32 interruptRefcon;
-
- SInt32 retryCount;
- SInt32 delayLevel;
- SInt32 transDepth;
- } usbKeyboardPBStruct;
-
- #endif //__KeyboardModuleH__