usbdevice.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //*****************************************************************************
  2. //
  3. // usbdevice.h - types and definitions used during USB enumeration.
  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 and reused from revision 6288
  22. // of the Stellaris USB Library.
  23. //
  24. //*****************************************************************************
  25. #ifndef __USBDEVICE_H__
  26. #define __USBDEVICE_H__
  27. //*****************************************************************************
  28. //
  29. // If building with a C++ compiler, make all of the definitions in this header
  30. // have a C binding.
  31. //
  32. //*****************************************************************************
  33. #ifdef __cplusplus
  34. extern "C"
  35. {
  36. #endif
  37. //*****************************************************************************
  38. //
  39. //! \addtogroup device_api
  40. //! @{
  41. //
  42. //*****************************************************************************
  43. //*****************************************************************************
  44. //
  45. //! The maximum number of independent interfaces that any single device
  46. //! implementation can support. Independent interfaces means interface
  47. //! descriptors with different bInterfaceNumber values - several interface
  48. //! descriptors offering different alternative settings but the same interface
  49. //! number count as a single interface.
  50. //
  51. //*****************************************************************************
  52. #define USB_MAX_INTERFACES_PER_DEVICE 8
  53. //*****************************************************************************
  54. //
  55. // Close the Doxygen group.
  56. //! @}
  57. //
  58. //*****************************************************************************
  59. //*****************************************************************************
  60. //
  61. // The default USB endpoint FIFO configuration structure. This structure
  62. // contains definitions to set all USB FIFOs into single buffered mode with
  63. // no DMA use. Each endpoint's FIFO is sized to hold the largest maximum
  64. // packet size for any interface alternate setting in the current config
  65. // descriptor. A pointer to this structure may be passed in the psFIFOConfig
  66. // field of the tDeviceInfo structure passed to USBCDCInit if the application
  67. // does not require any special handling of the USB controller FIFO.
  68. //
  69. //*****************************************************************************
  70. extern const tFIFOConfig g_sUSBDefaultFIFOConfig;
  71. //*****************************************************************************
  72. //
  73. // Public APIs offered by the USB library device control driver.
  74. //
  75. //*****************************************************************************
  76. extern void USBDCDInit(unsigned int ulIndex, tDeviceInfo *psDevice);
  77. extern void USBDCDTerm(unsigned int ulIndex);
  78. extern void USBDCDStallEP0(unsigned int ulIndex);
  79. extern void USBDCDRequestDataEP0(unsigned int ulIndex, unsigned char *pucData,
  80. unsigned int ulSize);
  81. extern void USBDCDSendDataEP0(unsigned int ulIndex, unsigned char *pucData,
  82. unsigned int ulSize);
  83. extern void USBDCDSetDefaultConfiguration(unsigned int ulIndex,
  84. unsigned int ulDefaultConfig);
  85. extern unsigned int USBDCDConfigDescGetSize(const tConfigHeader *psConfig);
  86. extern unsigned int USBDCDConfigDescGetNum(const tConfigHeader *psConfig,
  87. unsigned int ulType);
  88. extern tDescriptorHeader *USBDCDConfigDescGet(const tConfigHeader *psConfig,
  89. unsigned int ulType,
  90. unsigned int ulIndex,
  91. unsigned int *pulSection);
  92. extern unsigned int
  93. USBDCDConfigGetNumAlternateInterfaces(const tConfigHeader *psConfig,
  94. unsigned char ucInterfaceNumber);
  95. extern tInterfaceDescriptor *
  96. USBDCDConfigGetInterface(const tConfigHeader *psConfig,
  97. unsigned int ulIndex, unsigned int ulAltCfg,
  98. unsigned int *pulSection);
  99. extern tEndpointDescriptor *
  100. USBDCDConfigGetInterfaceEndpoint(const tConfigHeader *psConfig,
  101. unsigned int ulInterfaceNumber,
  102. unsigned int ulAltCfg,
  103. unsigned int ulIndex);
  104. extern void USBDCDPowerStatusSet(unsigned int ulIndex, unsigned char ucPower);
  105. extern tBoolean USBDCDRemoteWakeupRequest(unsigned int ulIndex);
  106. //*****************************************************************************
  107. //
  108. // Early releases of the USB library had the following function named
  109. // incorrectly. This macro ensures that any code which used the previous name
  110. // will still operate as expected.
  111. //
  112. //*****************************************************************************
  113. #ifndef DEPRECATED
  114. #define USBCDCConfigGetInterfaceEndpoint(a, b, c, d) \
  115. USBDCDConfigGetInterfaceEndpoint((a), (b), (c), (d))
  116. #endif
  117. //*****************************************************************************
  118. //
  119. // Device mode interrupt handler for controller index 0.
  120. //
  121. //*****************************************************************************
  122. extern void USB0DeviceIntHandler(void);
  123. extern void USB1DeviceIntHandler(void);
  124. //*****************************************************************************
  125. //
  126. // Mark the end of the C bindings section for C++ compilers.
  127. //
  128. //*****************************************************************************
  129. #ifdef __cplusplus
  130. }
  131. #endif
  132. #endif // __USBENUM_H__