usb_defines.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /**
  2. ******************************************************************************
  3. * @file usb_defines.h
  4. * @author MCD Application Team
  5. * @version V2.1.0
  6. * @date 19-March-2012
  7. * @brief Header of the Core Layer
  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 __USB_DEF_H__
  29. #define __USB_DEF_H__
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "usb_conf.h"
  32. /** @addtogroup USB_OTG_DRIVER
  33. * @{
  34. */
  35. /** @defgroup USB_DEFINES
  36. * @brief This file is the
  37. * @{
  38. */
  39. /** @defgroup USB_DEFINES_Exported_Defines
  40. * @{
  41. */
  42. /**
  43. * @}
  44. */
  45. /** @defgroup _CORE_DEFINES_
  46. * @{
  47. */
  48. #define USB_OTG_SPEED_PARAM_HIGH 0
  49. #define USB_OTG_SPEED_PARAM_HIGH_IN_FULL 1
  50. #define USB_OTG_SPEED_PARAM_FULL 3
  51. #define USB_OTG_SPEED_HIGH 0
  52. #define USB_OTG_SPEED_FULL 1
  53. #define USB_OTG_ULPI_PHY 1
  54. #define USB_OTG_EMBEDDED_PHY 2
  55. /**
  56. * @}
  57. */
  58. /** @defgroup _GLOBAL_DEFINES_
  59. * @{
  60. */
  61. #define GAHBCFG_TXFEMPTYLVL_EMPTY 1
  62. #define GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0
  63. #define GAHBCFG_GLBINT_ENABLE 1
  64. #define GAHBCFG_INT_DMA_BURST_SINGLE 0
  65. #define GAHBCFG_INT_DMA_BURST_INCR 1
  66. #define GAHBCFG_INT_DMA_BURST_INCR4 3
  67. #define GAHBCFG_INT_DMA_BURST_INCR8 5
  68. #define GAHBCFG_INT_DMA_BURST_INCR16 7
  69. #define GAHBCFG_DMAENABLE 1
  70. #define GAHBCFG_TXFEMPTYLVL_EMPTY 1
  71. #define GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0
  72. #define GRXSTS_PKTSTS_IN 2
  73. #define GRXSTS_PKTSTS_IN_XFER_COMP 3
  74. #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5
  75. #define GRXSTS_PKTSTS_CH_HALTED 7
  76. /**
  77. * @}
  78. */
  79. /** @defgroup _OnTheGo_DEFINES_
  80. * @{
  81. */
  82. #define MODE_HNP_SRP_CAPABLE 0
  83. #define MODE_SRP_ONLY_CAPABLE 1
  84. #define MODE_NO_HNP_SRP_CAPABLE 2
  85. #define MODE_SRP_CAPABLE_DEVICE 3
  86. #define MODE_NO_SRP_CAPABLE_DEVICE 4
  87. #define MODE_SRP_CAPABLE_HOST 5
  88. #define MODE_NO_SRP_CAPABLE_HOST 6
  89. #define A_HOST 1
  90. #define A_SUSPEND 2
  91. #define A_PERIPHERAL 3
  92. #define B_PERIPHERAL 4
  93. #define B_HOST 5
  94. #define DEVICE_MODE 0
  95. #define HOST_MODE 1
  96. #define OTG_MODE 2
  97. /**
  98. * @}
  99. */
  100. /** @defgroup __DEVICE_DEFINES_
  101. * @{
  102. */
  103. #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ 0
  104. #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ 1
  105. #define DSTS_ENUMSPD_LS_PHY_6MHZ 2
  106. #define DSTS_ENUMSPD_FS_PHY_48MHZ 3
  107. #define DCFG_FRAME_INTERVAL_80 0
  108. #define DCFG_FRAME_INTERVAL_85 1
  109. #define DCFG_FRAME_INTERVAL_90 2
  110. #define DCFG_FRAME_INTERVAL_95 3
  111. #define DEP0CTL_MPS_64 0
  112. #define DEP0CTL_MPS_32 1
  113. #define DEP0CTL_MPS_16 2
  114. #define DEP0CTL_MPS_8 3
  115. #define EP_SPEED_LOW 0
  116. #define EP_SPEED_FULL 1
  117. #define EP_SPEED_HIGH 2
  118. #define EP_TYPE_CTRL 0
  119. #define EP_TYPE_ISOC 1
  120. #define EP_TYPE_BULK 2
  121. #define EP_TYPE_INTR 3
  122. #define EP_TYPE_MSK 3
  123. #define STS_GOUT_NAK 1
  124. #define STS_DATA_UPDT 2
  125. #define STS_XFER_COMP 3
  126. #define STS_SETUP_COMP 4
  127. #define STS_SETUP_UPDT 6
  128. /**
  129. * @}
  130. */
  131. /** @defgroup __HOST_DEFINES_
  132. * @{
  133. */
  134. #define HC_PID_DATA0 0
  135. #define HC_PID_DATA2 1
  136. #define HC_PID_DATA1 2
  137. #define HC_PID_SETUP 3
  138. #define HPRT0_PRTSPD_HIGH_SPEED 0
  139. #define HPRT0_PRTSPD_FULL_SPEED 1
  140. #define HPRT0_PRTSPD_LOW_SPEED 2
  141. #define HCFG_30_60_MHZ 0
  142. #define HCFG_48_MHZ 1
  143. #define HCFG_6_MHZ 2
  144. #define HCCHAR_CTRL 0
  145. #define HCCHAR_ISOC 1
  146. #define HCCHAR_BULK 2
  147. #define HCCHAR_INTR 3
  148. #define MIN(a, b) (((a) < (b)) ? (a) : (b))
  149. /**
  150. * @}
  151. */
  152. /** @defgroup USB_DEFINES_Exported_Types
  153. * @{
  154. */
  155. typedef enum
  156. {
  157. USB_OTG_HS_CORE_ID = 0,
  158. USB_OTG_FS_CORE_ID = 1
  159. }USB_OTG_CORE_ID_TypeDef;
  160. /**
  161. * @}
  162. */
  163. /** @defgroup USB_DEFINES_Exported_Macros
  164. * @{
  165. */
  166. /**
  167. * @}
  168. */
  169. /** @defgroup USB_DEFINES_Exported_Variables
  170. * @{
  171. */
  172. /**
  173. * @}
  174. */
  175. /** @defgroup USB_DEFINES_Exported_FunctionsPrototype
  176. * @{
  177. */
  178. /**
  179. * @}
  180. */
  181. /** @defgroup Internal_Macro's
  182. * @{
  183. */
  184. #define USB_OTG_READ_REG32(reg) (*(__IO uint32_t *)reg)
  185. #define USB_OTG_WRITE_REG32(reg,value) (*(__IO uint32_t *)reg = value)
  186. #define USB_OTG_MODIFY_REG32(reg,clear_mask,set_mask) \
  187. USB_OTG_WRITE_REG32(reg, (((USB_OTG_READ_REG32(reg)) & ~clear_mask) | set_mask ) )
  188. /********************************************************************************
  189. ENUMERATION TYPE
  190. ********************************************************************************/
  191. enum USB_OTG_SPEED {
  192. USB_SPEED_UNKNOWN = 0,
  193. USB_SPEED_LOW,
  194. USB_SPEED_FULL,
  195. USB_SPEED_HIGH
  196. };
  197. #endif //__USB_DEFINES__H__
  198. /**
  199. * @}
  200. */
  201. /**
  202. * @}
  203. */
  204. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/