hv_drv_UsbMusbHost.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * @file hv_drv_UsbMusbHost.h
  3. * @brief Header file of musb Host driver.
  4. *
  5. * @author HiView SoC Software Team
  6. * @version 1.0.0
  7. * @date 2022-06-15
  8. */
  9. #ifndef __HV_DRV_USB_MUSB_HOST_H
  10. #define __HV_DRV_USB_MUSB_HOST_H
  11. #include "hv_drv_UsbCoreHcd.h"
  12. #include "hv_drv_UsbCoreCommonUsb.h"
  13. struct musb_xfer {
  14. struct usb_host_endpoint *hep; /* usbcore info */
  15. struct usb_device *dev;
  16. struct musb_hw_ep *hw_ep; /* current binding */
  17. u8 epnum;
  18. u8 hb_mult; /* high bandwidth pkts per uf */
  19. u32 offset;
  20. u32 segsize;
  21. u8 type_reg;
  22. u8 intv_reg;
  23. u8 addr_reg;
  24. u8 type;
  25. u16 maxpacket;
  26. u16 frame;
  27. u8 is_ready;
  28. u8 rx_stall_cnt;
  29. u8 error_cnt;
  30. };
  31. #include "hv_drv_UsbMusbCore.h"
  32. #include "hv_drv_UsbMusbDma.h"
  33. INLINE void musb_set_vbus(struct musb *musb, int is_on) {
  34. musb->ops->set_vbus(musb, is_on);
  35. }
  36. INLINE struct musb *hcd_to_musb(struct usb_hcd *hcd) {
  37. return (struct musb *) hcd->hcd_priv;
  38. }
  39. extern void musb_h_ep0_irq(struct musb *musb);
  40. extern void musb_host_tx(struct musb *musb, u8 epnum);
  41. extern void musb_host_rx(struct musb *musb, u8 epnum);
  42. extern void musb_host_tx_dma(struct musb *musb, u8 epnum);
  43. extern void musb_host_rx_dma(struct musb *musb, u8 epnum);
  44. extern u32 musb_abort_xfer(struct musb *musb);
  45. extern int musb_host_alloc(struct musb *musb);
  46. extern int musb_host_setup(struct musb *musb);
  47. extern void musb_host_free(struct musb *musb);
  48. extern int musb_hub_status_data(struct usb_hcd *hcd, char *buf);
  49. extern void musb_host_cleanup(struct musb *musb);
  50. extern int musb_hub_control(struct usb_hcd *hcd,
  51. u16 typeReq, u16 wValue, u16 wIndex,
  52. char *buf, u16 wLength);
  53. extern int musb_hub_port1_connect_state(void);
  54. INLINE
  55. struct urb *current_urb(struct musb_xfer *xfer) {
  56. if (!xfer)
  57. return NULL;
  58. return xfer->hep->xfer_urb;
  59. }
  60. #endif /* _MUSB_HOST_H */