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

VxWorks

开发平台:

C/C++

  1. /* usbPrinterLib.h - USB printer 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,01sep99,rcb First.
  12. */
  13. #ifndef __INCusbPrinterLibh
  14. #define __INCusbPrinterLibh
  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. /* usbPrinterLib 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_PRINTER_SUB_MODULE 7 
  31. #define M_usbPrinterLib ( ( USB_PRINTER_SUB_MODULE   << 8) | M_usbHostLib )
  32. #define usbPrnErr(x) (M_usbPrinterLib | (x))
  33. #define S_usbPrinterLib_NOT_INITIALIZED     usbPrnErr (1)
  34. #define S_usbPrinterLib_BAD_PARAM     usbPrnErr (2)
  35. #define S_usbPrinterLib_OUT_OF_MEMORY     usbPrnErr (3)
  36. #define S_usbPrinterLib_OUT_OF_RESOURCES    usbPrnErr (4)
  37. #define S_usbPrinterLib_GENERAL_FAULT     usbPrnErr (5)
  38. #define S_usbPrinterLib_QUEUE_FULL     usbPrnErr (6)
  39. #define S_usbPrinterLib_QUEUE_EMPTY     usbPrnErr (7)
  40. #define S_usbPrinterLib_NOT_IMPLEMENTED     usbPrnErr (8)
  41. #define S_usbPrinterLib_USBD_FAULT     usbPrnErr (9)
  42. #define S_usbPrinterLib_NOT_REGISTERED     usbPrnErr (10)
  43. #define S_usbPrinterLib_NOT_LOCKED     usbPrnErr (11)
  44. /* USB_PRN_xxxx define "attach codes" used by USB_PRN_ATTACH_CALLBACK. */
  45. #define USB_PRN_ATTACH 0     /* new printer attached */
  46. #define USB_PRN_REMOVE 1     /* printer has been removed */
  47.     /* SIO_CHAN no longer valid */
  48. /* IOCTL codes unique to usbPrinterLib. */
  49. #define SIO_USB_PRN_DEVICE_ID_GET   0x8000
  50. #define SIO_USB_PRN_PROTOCOL_GET    0x8001
  51. #define SIO_USB_PRN_STATUS_GET     0x8002
  52. #define SIO_USB_PRN_SOFT_RESET     0x8003
  53. /* typedefs */
  54. /* USB_PRN_ATTACH_CALLBACK defines a callback routine which will be
  55.  * invoked by usbPrinterLib.c when the attachment or removal of a printer
  56.  * is detected.  When the callback is invoked with an attach code of
  57.  * USB_PRN_ATTACH, the pSioChan points to a newly created SIO_CHAN.  When
  58.  * the attach code is USB_PRN_REMOVE, the pSioChan points to a pSioChan
  59.  * for a printer which is no longer attached.
  60.  */
  61. typedef VOID (*USB_PRN_ATTACH_CALLBACK) 
  62.     (
  63.     pVOID arg,     /* caller-defined argument */
  64.     SIO_CHAN *pChan,     /* pointer to affected SIO_CHAN */
  65.     UINT16 attachCode     /* defined as USB_PRN_xxxx */
  66.     );
  67. /* function prototypes */
  68. STATUS usbPrinterDevInit (void);
  69. STATUS usbPrinterDevShutdown (void);
  70. STATUS usbPrinterDynamicAttachRegister
  71.     (
  72.     USB_PRN_ATTACH_CALLBACK callback, /* new callback to be registered */
  73.     pVOID arg /* user-defined arg to callback */
  74.     );
  75. STATUS usbPrinterDynamicAttachUnRegister
  76.     (
  77.     USB_PRN_ATTACH_CALLBACK callback, /* callback to be unregistered */
  78.     pVOID arg /* user-defined arg to callback */
  79.     );
  80. STATUS usbPrinterSioChanLock
  81.     (
  82.     SIO_CHAN *pChan     /* SIO_CHAN to be marked as in use */
  83.     );
  84. STATUS usbPrinterSioChanUnlock
  85.     (
  86.     SIO_CHAN *pChan     /* SIO_CHAN to be marked as unused */
  87.     );
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* __INCusbPrinterLibh */
  92. /* End of file. */