usbhspecific.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. //*****************************************************************************
  29. //
  30. // If building with a C++ compiler, make all of the definitions in this header
  31. // have a C binding.
  32. //
  33. //*****************************************************************************
  34. #ifdef __cplusplus
  35. extern "C"
  36. {
  37. #endif
  38. //*****************************************************************************
  39. //
  40. //! \addtogroup usblib_host_class
  41. //! @{
  42. //
  43. //*****************************************************************************
  44. //*****************************************************************************
  45. //
  46. // These defines are the the events that will be passed in the ulEvent
  47. // parameter of the callback from the driver.
  48. //
  49. //*****************************************************************************
  50. #define USBH_EVENT_SPECIFIC_SETRPT USBH_SPECIFIC_EVENT_BASE + 0
  51. #define USBH_EVENT_SPECIFIC_REPORT USBH_SPECIFIC_EVENT_BASE + 1
  52. //
  53. //! The SPECIFIC keyboard detected a key being pressed.
  54. //
  55. #define USBH_EVENT_SPECIFIC_KB_PRESS USBH_SPECIFIC_EVENT_BASE + 16
  56. //
  57. //! The SPECIFIC keyboard detected a key being released.
  58. //
  59. #define USBH_EVENT_SPECIFIC_KB_REL USBH_SPECIFIC_EVENT_BASE + 17
  60. //
  61. //! The SPECIFIC keyboard detected one of the keyboard modifiers being pressed.
  62. //
  63. #define USBH_EVENT_SPECIFIC_KB_MOD USBH_SPECIFIC_EVENT_BASE + 18
  64. //
  65. //! A button was pressed on a SPECIFIC mouse.
  66. //
  67. #define USBH_EVENT_SPECIFIC_MS_PRESS USBH_SPECIFIC_EVENT_BASE + 32
  68. //
  69. //! A button was released on a SPECIFIC mouse.
  70. //
  71. #define USBH_EVENT_SPECIFIC_MS_REL USBH_SPECIFIC_EVENT_BASE + 33
  72. //
  73. //! The SPECIFIC mouse detected movement in the X direction.
  74. //
  75. #define USBH_EVENT_SPECIFIC_MS_X USBH_SPECIFIC_EVENT_BASE + 34
  76. //
  77. //! The SPECIFIC mouse detected movement in the Y direction.
  78. //
  79. #define USBH_EVENT_SPECIFIC_MS_Y USBH_SPECIFIC_EVENT_BASE + 35
  80. //*****************************************************************************
  81. //
  82. //! The following values are used to register callbacks to the USB HOST SPECIFIC
  83. //! device class layer.
  84. //
  85. //*****************************************************************************
  86. typedef enum
  87. {
  88. //
  89. //! No device should be used. This value should not be used by
  90. //! applications.
  91. //
  92. USBH_SPECIFIC_DEV_NONE = 0,
  93. //
  94. //! This is a vendor specific device.
  95. //
  96. USBH_SPECIFIC_DEV_VENDOR
  97. }
  98. tSPECIFICSubClassProtocol;
  99. //*****************************************************************************
  100. //
  101. // This is the structure that holds all of the data for a given instance of
  102. // a SPECIFIC device.
  103. //
  104. //*****************************************************************************
  105. typedef struct
  106. {
  107. bool isConnected;
  108. //
  109. // Save the device instance.
  110. //
  111. tUSBHostDevice *pDevice;
  112. //
  113. // Used to save the callback.
  114. //
  115. tUSBCallback pfnCallback;
  116. //
  117. // Callback data provided by caller.
  118. //
  119. unsigned int ulCBData;
  120. //
  121. // Used to remember what type of device was registered.
  122. //
  123. tSPECIFICSubClassProtocol eDeviceType;
  124. //
  125. // Interrupt IN pipe.
  126. //
  127. unsigned int ulIntInPipe;
  128. //
  129. // Bulk IN pipe.
  130. //
  131. unsigned int ulBulkInPipe;
  132. //
  133. // Bulk OUT pipe.
  134. //
  135. unsigned int ulBulkOutPipe;
  136. unsigned int ulIndex;
  137. }
  138. tSPECIFICInstance;
  139. //*****************************************************************************
  140. //
  141. // Close the Doxygen group.
  142. //! @}
  143. //
  144. //*****************************************************************************
  145. //*****************************************************************************
  146. //
  147. // Prototypes.
  148. //
  149. //*****************************************************************************
  150. extern unsigned int USBHSPECIFICOpen(unsigned int ulIndex,
  151. tSPECIFICSubClassProtocol eDeviceType,
  152. tUSBCallback pfnCallback,
  153. unsigned int ulCBData);
  154. extern void USBHSPECIFICClose(unsigned int ulInstance);
  155. extern unsigned int USBHSPECIFICGetReportDescriptor(unsigned int ulInstance,
  156. unsigned char *pucBuffer,
  157. unsigned int ulSize);
  158. extern unsigned int USBHSPECIFICSetIdle(unsigned int ulInstance,
  159. unsigned char ucDuration,
  160. unsigned char ucReportID);
  161. extern unsigned int USBHSPECIFICSetProtocol(unsigned int ulInstance,
  162. unsigned int ulBootProtocol);
  163. extern unsigned int USBHSPECIFICSetReport(unsigned int ulInstance,
  164. unsigned int ulInterface,
  165. unsigned char *pucData,
  166. unsigned int ulSize);
  167. extern unsigned int USBHSPECIFICGetReport(unsigned int ulInstance,
  168. unsigned int ulInterface,
  169. unsigned char *pucData,
  170. unsigned int ulSize);
  171. extern const tUSBHostClassDriver g_USBSPECIFICClassDriver;
  172. extern tSPECIFICInstance g_SPECIFICInstance;
  173. //*****************************************************************************
  174. //
  175. // Mark the end of the C bindings section for C++ compilers.
  176. //
  177. //*****************************************************************************
  178. #ifdef __cplusplus
  179. }
  180. #endif
  181. #endif // __USBHSPECIFIC_H__