home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Mac OS USB DDK / Examples / MouseModule / MouseModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-10  |  2.4 KB  |  89 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MouseModule.h
  3.  
  4.     Contains:    Header file for mouse module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MouseModuleH__
  12. #define __MouseModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <CursorDevices.h>
  19. #include <USB.h>
  20.  
  21. #define kMouseModuleName    "\pUSBHIDMouseModule"
  22.  
  23. Boolean    immediateError(OSStatus err);
  24. void     InitParamBlock(USBReference theInterfaceRef, USBPB * paramblock);
  25. void     MouseInitiateTransaction(USBPB *pb);
  26. void     MouseCompletionProc(USBPB *pb);
  27. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  28.  
  29. /*    Prototypes from MouseModuleHeader.c    Tue, Mar 17, 1998 3:30:22 PM    */
  30. static     OSStatus    MouseDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  31. static     OSStatus    MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  32. static     OSStatus    MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  33.  
  34. /*    Prototypes from MouseConfigParse.c    Tue, Mar 17, 1998 3:17:14 PM    */
  35.  
  36. OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
  37. void     NotifyRegisteredHIDUser(UInt32 devicetype, UInt8 hidReport[]);
  38.  
  39. void     USBMouseIn(UInt32 refcon, void * theData);
  40.  
  41. #define kMouseRetryCount    3
  42.  
  43. enum driverstages
  44. {  
  45.     kUndefined = 0,
  46.     kSetProtocol,
  47.     kSetIdleRequest,
  48.     kConfigureInterface,
  49.     kFindPipe,
  50.     kReadInterruptPipe,
  51.     kClearFeature,
  52.     kReturnFromDriver =     0x1000,
  53.     kRetryTransaction =     0x2000,
  54.     kSyncTransaction =         0x4000,
  55.     kCompletionPending =     0x8000
  56. };
  57.  
  58. typedef struct
  59. {
  60.     USBPB                             pb;
  61.     void (*handler)(USBPB             *pb);
  62.     
  63.     Boolean                            intPipeAborted;
  64.     Boolean                            driverRemovalPending;
  65.  
  66.     USBReference                    interfaceRef;
  67.     USBPipeRef                        pipeRef;
  68.     
  69.     USBDeviceDescriptor             deviceDescriptor;
  70.     USBInterfaceDescriptor            interfaceDescriptor;
  71.  
  72.     UInt32                            hidDeviceType;
  73.     UInt8                            hidReport[64];
  74.     UInt32                            maxPacketSize;
  75.     
  76.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  77.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  78.     
  79.     UInt32                            interruptRefcon;
  80.     
  81.     SInt32                             retryCount;
  82.     SInt32                            transDepth;
  83.     
  84.     CursorDevicePtr                    pCursorDeviceInfo;
  85.     CursorDevice                    cursorDeviceInfo;
  86.     Fixed                            unitsPerInch;
  87. } usbMousePBStruct;
  88.  
  89. #endif //__MouseModuleH__