usbKeyboardLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:3k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* usbKeyboardLib.h - USB keyboard SIO driver definitions */
  2. /* Copyright 2000 Wind River Systems, Inc. */
  3. /*
  4. Modification history
  5. --------------------
  6. 01e,18sep01,wef  merge from wrs.tor2_0.usb1_1-f for veloce
  7. 01d,07may01,wef  changed module number to be (module num << 8) | M_usbHostLib
  8. 01c,02may01,wef  changed module number to be M_<module> + M_usbHostLib
  9. 01b,05dec00,wef  moved Module number defs to vwModNum.h - add this
  10.                  to #includes
  11. 01a,27jul99,rcb  First.
  12. */
  13. #ifndef __INCusbKeyboardLibh
  14. #define __INCusbKeyboardLibh
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /* includes */
  19. #include "sioLib.h"
  20. #include "usb/usbPlatform.h"
  21. #include "vwModNum.h"           /* USB Module Number Def's */
  22. /* defines */
  23. /* usbKeyboardLib error values */
  24. /* 
  25.  * USB errnos are defined as being part of the USB host Module, as are all
  26.  * vxWorks module numbers, but the USB Module number is further divided into 
  27.  * sub-modules.  Each sub-module has upto 255 values for its own error codes
  28.  */
  29.  
  30. #define USB_KEYBOARD_SUB_MODULE  6
  31. #define M_usbKeyboardLib  ( (USB_KEYBOARD_SUB_MODULE  << 8) | 
  32.   M_usbHostLib )
  33. #define usbKbdErr(x) (M_usbKeyboardLib | (x))
  34. #define S_usbKeyboardLib_NOT_INITIALIZED    usbKbdErr (1)
  35. #define S_usbKeyboardLib_BAD_PARAM     usbKbdErr (2)
  36. #define S_usbKeyboardLib_OUT_OF_MEMORY     usbKbdErr (3)
  37. #define S_usbKeyboardLib_OUT_OF_RESOURCES   usbKbdErr (4)
  38. #define S_usbKeyboardLib_GENERAL_FAULT     usbKbdErr (5)
  39. #define S_usbKeyboardLib_QUEUE_FULL     usbKbdErr (6)
  40. #define S_usbKeyboardLib_QUEUE_EMPTY     usbKbdErr (7)
  41. #define S_usbKeyboardLib_NOT_IMPLEMENTED    usbKbdErr (8)
  42. #define S_usbKeyboardLib_USBD_FAULT     usbKbdErr (9)
  43. #define S_usbKeyboardLib_NOT_REGISTERED     usbKbdErr (10)
  44. #define S_usbKeyboardLib_NOT_LOCKED     usbKbdErr (11)
  45. /* USB_KBD_xxxx define "attach codes" used by USB_KBD_ATTACH_CALLBACK. */
  46. #define USB_KBD_ATTACH 0     /* new keyboard attached */
  47. #define USB_KBD_REMOVE 1     /* keyboard has been removed */
  48.     /* SIO_CHAN no longer valid */
  49. /* typedefs */
  50. /* USB_KBD_ATTACH_CALLBACK defines a callback routine which will be
  51.  * invoked by usbKeyboardLib.c when the attachment or removal of a keyboard
  52.  * is detected.  When the callback is invoked with an attach code of
  53.  * USB_KBD_ATTACH, the pSioChan points to a newly created SIO_CHAN.  When
  54.  * the attach code is USB_KBD_REMOVE, the pSioChan points to a pSioChan
  55.  * for a keyboard which is no longer attached.
  56.  */
  57. typedef VOID (*USB_KBD_ATTACH_CALLBACK) 
  58.     (
  59.     pVOID arg,     /* caller-defined argument */
  60.     SIO_CHAN *pChan,     /* pointer to affected SIO_CHAN */
  61.     UINT16 attachCode     /* defined as USB_KBD_xxxx */
  62.     );
  63. /* function prototypes */
  64. STATUS usbKeyboardDevInit (void);
  65. STATUS usbKeyboardDevShutdown (void);
  66. STATUS usbKeyboardDynamicAttachRegister
  67.     (
  68.     USB_KBD_ATTACH_CALLBACK callback, /* new callback to be registered */
  69.     pVOID arg /* user-defined arg to callback */
  70.     );
  71. STATUS usbKeyboardDynamicAttachUnRegister
  72.     (
  73.     USB_KBD_ATTACH_CALLBACK callback, /* callback to be unregistered */
  74.     pVOID arg /* user-defined arg to callback */
  75.     );
  76. STATUS usbKeyboardSioChanLock
  77.     (
  78.     SIO_CHAN *pChan     /* SIO_CHAN to be marked as in use */
  79.     );
  80. STATUS usbKeyboardSioChanUnlock
  81.     (
  82.     SIO_CHAN *pChan     /* SIO_CHAN to be marked as unused */
  83.     );
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif /* __INCusbKeyboardLibh */
  88. /* End of file. */