usb_hcd_int.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /**
  2. ******************************************************************************
  3. * @file usb_hcd_int.h
  4. * @author MCD Application Team
  5. * @version V2.1.0
  6. * @date 19-March-2012
  7. * @brief Peripheral Device Interface 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 __HCD_INT_H__
  29. #define __HCD_INT_H__
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "usb_hcd.h"
  32. /** @addtogroup USB_OTG_DRIVER
  33. * @{
  34. */
  35. /** @defgroup USB_HCD_INT
  36. * @brief This file is the
  37. * @{
  38. */
  39. /** @defgroup USB_HCD_INT_Exported_Defines
  40. * @{
  41. */
  42. /**
  43. * @}
  44. */
  45. /** @defgroup USB_HCD_INT_Exported_Types
  46. * @{
  47. */
  48. typedef struct _USBH_HCD_INT
  49. {
  50. uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev);
  51. uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev);
  52. uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev);
  53. }USBH_HCD_INT_cb_TypeDef;
  54. extern USBH_HCD_INT_cb_TypeDef *USBH_HCD_INT_fops;
  55. /**
  56. * @}
  57. */
  58. /** @defgroup USB_HCD_INT_Exported_Macros
  59. * @{
  60. */
  61. #define CLEAR_HC_INT(HC_REGS, intr) \
  62. {\
  63. USB_OTG_HCINTn_TypeDef hcint_clear; \
  64. hcint_clear.d32 = 0; \
  65. hcint_clear.b.intr = 1; \
  66. USB_OTG_WRITE_REG32(&((HC_REGS)->HCINT), hcint_clear.d32);\
  67. }\
  68. #define MASK_HOST_INT_CHH(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \
  69. INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \
  70. INTMSK.b.chhltd = 0; \
  71. USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);}
  72. #define UNMASK_HOST_INT_CHH(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \
  73. INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \
  74. INTMSK.b.chhltd = 1; \
  75. USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);}
  76. #define MASK_HOST_INT_ACK(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \
  77. INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \
  78. INTMSK.b.ack = 0; \
  79. USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, GINTMSK.d32);}
  80. #define UNMASK_HOST_INT_ACK(hc_num) { USB_OTG_HCGINTMSK_TypeDef INTMSK; \
  81. INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \
  82. INTMSK.b.ack = 1; \
  83. USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);}
  84. /**
  85. * @}
  86. */
  87. /** @defgroup USB_HCD_INT_Exported_Variables
  88. * @{
  89. */
  90. /**
  91. * @}
  92. */
  93. /** @defgroup USB_HCD_INT_Exported_FunctionsPrototype
  94. * @{
  95. */
  96. /* Callbacks handler */
  97. void ConnectCallback_Handler(USB_OTG_CORE_HANDLE *pdev);
  98. void Disconnect_Callback_Handler(USB_OTG_CORE_HANDLE *pdev);
  99. void Overcurrent_Callback_Handler(USB_OTG_CORE_HANDLE *pdev);
  100. uint32_t USBH_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev);
  101. /**
  102. * @}
  103. */
  104. #endif //__HCD_INT_H__
  105. /**
  106. * @}
  107. */
  108. /**
  109. * @}
  110. */
  111. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/