usb_dcd.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /**
  2. ******************************************************************************
  3. * @file usb_dcd.h
  4. * @author MCD Application Team
  5. * @version V2.1.0
  6. * @date 19-March-2012
  7. * @brief Peripheral Driver Header file
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
  12. *
  13. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  14. * You may not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at:
  16. *
  17. * http://www.st.com/software_license_agreement_liberty_v2
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS,
  21. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. *
  25. ******************************************************************************
  26. */
  27. /* Define to prevent recursive inclusion -------------------------------------*/
  28. #ifndef __DCD_H__
  29. #define __DCD_H__
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "usb_core.h"
  32. /** @addtogroup USB_OTG_DRIVER
  33. * @{
  34. */
  35. /** @defgroup USB_DCD
  36. * @brief This file is the
  37. * @{
  38. */
  39. /** @defgroup USB_DCD_Exported_Defines
  40. * @{
  41. */
  42. #define USB_OTG_EP_CONTROL 0
  43. #define USB_OTG_EP_ISOC 1
  44. #define USB_OTG_EP_BULK 2
  45. #define USB_OTG_EP_INT 3
  46. #define USB_OTG_EP_MASK 3
  47. /* Device Status */
  48. #define USB_OTG_DEFAULT 1
  49. #define USB_OTG_ADDRESSED 2
  50. #define USB_OTG_CONFIGURED 3
  51. #define USB_OTG_SUSPENDED 4
  52. /**
  53. * @}
  54. */
  55. /** @defgroup USB_DCD_Exported_Types
  56. * @{
  57. */
  58. /********************************************************************************
  59. Data structure type
  60. ********************************************************************************/
  61. typedef struct
  62. {
  63. uint8_t bLength;
  64. uint8_t bDescriptorType;
  65. uint8_t bEndpointAddress;
  66. uint8_t bmAttributes;
  67. uint16_t wMaxPacketSize;
  68. uint8_t bInterval;
  69. }
  70. EP_DESCRIPTOR , *PEP_DESCRIPTOR;
  71. /**
  72. * @}
  73. */
  74. /** @defgroup USB_DCD_Exported_Macros
  75. * @{
  76. */
  77. /**
  78. * @}
  79. */
  80. /** @defgroup USB_DCD_Exported_Variables
  81. * @{
  82. */
  83. /**
  84. * @}
  85. */
  86. /** @defgroup USB_DCD_Exported_FunctionsPrototype
  87. * @{
  88. */
  89. /********************************************************************************
  90. EXPORTED FUNCTION FROM THE USB-OTG LAYER
  91. ********************************************************************************/
  92. void DCD_Init(USB_OTG_CORE_HANDLE *pdev ,
  93. USB_OTG_CORE_ID_TypeDef coreID);
  94. void DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev);
  95. void DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev);
  96. void DCD_EP_SetAddress (USB_OTG_CORE_HANDLE *pdev,
  97. uint8_t address);
  98. uint32_t DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev ,
  99. uint8_t ep_addr,
  100. uint16_t ep_mps,
  101. uint8_t ep_type);
  102. uint32_t DCD_EP_Close (USB_OTG_CORE_HANDLE *pdev,
  103. uint8_t ep_addr);
  104. uint32_t DCD_EP_PrepareRx ( USB_OTG_CORE_HANDLE *pdev,
  105. uint8_t ep_addr,
  106. uint8_t *pbuf,
  107. uint16_t buf_len);
  108. uint32_t DCD_EP_Tx (USB_OTG_CORE_HANDLE *pdev,
  109. uint8_t ep_addr,
  110. uint8_t *pbuf,
  111. uint32_t buf_len);
  112. uint32_t DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev,
  113. uint8_t epnum);
  114. uint32_t DCD_EP_ClrStall (USB_OTG_CORE_HANDLE *pdev,
  115. uint8_t epnum);
  116. uint32_t DCD_EP_Flush (USB_OTG_CORE_HANDLE *pdev,
  117. uint8_t epnum);
  118. uint32_t DCD_Handle_ISR(USB_OTG_CORE_HANDLE *pdev);
  119. uint32_t DCD_GetEPStatus(USB_OTG_CORE_HANDLE *pdev ,
  120. uint8_t epnum);
  121. void DCD_SetEPStatus (USB_OTG_CORE_HANDLE *pdev ,
  122. uint8_t epnum ,
  123. uint32_t Status);
  124. /**
  125. * @}
  126. */
  127. #endif //__DCD_H__
  128. /**
  129. * @}
  130. */
  131. /**
  132. * @}
  133. */
  134. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/