usbhspecific.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. //*****************************************************************************
  2. //
  3. // usbhhid.h - This hold the host driver for hid class.
  4. //
  5. // Copyright (c) 2008-2010 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of AM1808 StarterWare USB Library, resused from revision 6288 of the
  22. // stellaris USB Library
  23. //
  24. //*****************************************************************************
  25. #ifndef __USBHSPECIFIC_H__
  26. #define __USBHSPECIFIC_H__
  27. #include "stdbool.h"
  28. #include "hw_types.h"
  29. #include "usb.h"
  30. #include "usblib.h"
  31. #include "usbhost.h"
  32. //*****************************************************************************
  33. //
  34. // If building with a C++ compiler, make all of the definitions in this header
  35. // have a C binding.
  36. //
  37. //*****************************************************************************
  38. #ifdef __cplusplus
  39. extern "C"
  40. {
  41. #endif
  42. //*****************************************************************************
  43. //
  44. //! \addtogroup usblib_host_class
  45. //! @{
  46. //
  47. //*****************************************************************************
  48. //*****************************************************************************
  49. //
  50. // These defines are the the events that will be passed in the ulEvent
  51. // parameter of the callback from the driver.
  52. //
  53. //*****************************************************************************
  54. #define USBH_EVENT_SPECIFIC_SETRPT USBH_SPECIFIC_EVENT_BASE + 0
  55. #define USBH_EVENT_SPECIFIC_REPORT USBH_SPECIFIC_EVENT_BASE + 1
  56. //
  57. //! The SPECIFIC keyboard detected a key being pressed.
  58. //
  59. #define USBH_EVENT_SPECIFIC_KB_PRESS USBH_SPECIFIC_EVENT_BASE + 16
  60. //
  61. //! The SPECIFIC keyboard detected a key being released.
  62. //
  63. #define USBH_EVENT_SPECIFIC_KB_REL USBH_SPECIFIC_EVENT_BASE + 17
  64. //
  65. //! The SPECIFIC keyboard detected one of the keyboard modifiers being pressed.
  66. //
  67. #define USBH_EVENT_SPECIFIC_KB_MOD USBH_SPECIFIC_EVENT_BASE + 18
  68. //
  69. //! A button was pressed on a SPECIFIC mouse.
  70. //
  71. #define USBH_EVENT_SPECIFIC_MS_PRESS USBH_SPECIFIC_EVENT_BASE + 32
  72. //
  73. //! A button was released on a SPECIFIC mouse.
  74. //
  75. #define USBH_EVENT_SPECIFIC_MS_REL USBH_SPECIFIC_EVENT_BASE + 33
  76. //
  77. //! The SPECIFIC mouse detected movement in the X direction.
  78. //
  79. #define USBH_EVENT_SPECIFIC_MS_X USBH_SPECIFIC_EVENT_BASE + 34
  80. //
  81. //! The SPECIFIC mouse detected movement in the Y direction.
  82. //
  83. #define USBH_EVENT_SPECIFIC_MS_Y USBH_SPECIFIC_EVENT_BASE + 35
  84. //*****************************************************************************
  85. //
  86. //! The following values are used to register callbacks to the USB HOST SPECIFIC
  87. //! device class layer.
  88. //
  89. //*****************************************************************************
  90. typedef enum
  91. {
  92. //
  93. //! No device should be used. This value should not be used by
  94. //! applications.
  95. //
  96. USBH_SPECIFIC_DEV_NONE = 0,
  97. //
  98. //! This is a vendor specific device.
  99. //
  100. USBH_SPECIFIC_DEV_VENDOR
  101. }
  102. tSPECIFICSubClassProtocol;
  103. //*****************************************************************************
  104. //
  105. // This is the structure that holds all of the data for a given instance of
  106. // a SPECIFIC device.
  107. //
  108. //*****************************************************************************
  109. typedef struct
  110. {
  111. bool isConnected;
  112. //
  113. // Save the device instance.
  114. //
  115. tUSBHostDevice *pDevice;
  116. //
  117. // Used to save the callback.
  118. //
  119. tUSBCallback pfnCallback;
  120. //
  121. // Callback data provided by caller.
  122. //
  123. unsigned int ulCBData;
  124. //
  125. // Used to remember what type of device was registered.
  126. //
  127. tSPECIFICSubClassProtocol eDeviceType;
  128. //
  129. // Interrupt IN pipe.
  130. //
  131. unsigned int ulIntInPipe;
  132. //
  133. // Bulk IN pipe.
  134. //
  135. unsigned int ulBulkInPipe;
  136. //
  137. // Bulk OUT pipe.
  138. //
  139. unsigned int ulBulkOutPipe;
  140. unsigned int ulIndex;
  141. }
  142. tSPECIFICInstance;
  143. //*****************************************************************************
  144. //
  145. // Close the Doxygen group.
  146. //! @}
  147. //
  148. //*****************************************************************************
  149. //*****************************************************************************
  150. //
  151. // Prototypes.
  152. //
  153. //*****************************************************************************
  154. extern unsigned int USBHSPECIFICOpen(unsigned int ulIndex,
  155. tSPECIFICSubClassProtocol eDeviceType,
  156. tUSBCallback pfnCallback,
  157. unsigned int ulCBData);
  158. extern void USBHSPECIFICClose(unsigned int ulInstance);
  159. extern unsigned int USBHSPECIFICGetReportDescriptor(unsigned int ulInstance,
  160. unsigned char *pucBuffer,
  161. unsigned int ulSize);
  162. extern unsigned int USBHSPECIFICSetIdle(unsigned int ulInstance,
  163. unsigned char ucDuration,
  164. unsigned char ucReportID);
  165. extern unsigned int USBHSPECIFICSetProtocol(unsigned int ulInstance,
  166. unsigned int ulBootProtocol);
  167. extern unsigned int USBHSPECIFICSetReport(unsigned int ulInstance,
  168. unsigned int ulInterface,
  169. unsigned char *pucData,
  170. unsigned int ulSize);
  171. extern unsigned int USBHSPECIFICGetReport(unsigned int ulInstance,
  172. unsigned int ulInterface,
  173. unsigned char *pucData,
  174. unsigned int ulSize);
  175. extern const tUSBHostClassDriver g_USBSPECIFICClassDriver;
  176. extern tSPECIFICInstance g_SPECIFICInstance;
  177. unsigned int USBHSPECIFICWrite(unsigned char *pucData, unsigned int ulSize);
  178. //*****************************************************************************
  179. //
  180. // Mark the end of the C bindings section for C++ compilers.
  181. //
  182. //*****************************************************************************
  183. #ifdef __cplusplus
  184. }
  185. #endif
  186. #endif // __USBHSPECIFIC_H__