/* * @file hv_drv_UsbMusbHost.h * @brief Header file of musb Host driver. * * @author HiView SoC Software Team * @version 1.0.0 * @date 2022-06-15 */ #ifndef __HV_DRV_USB_MUSB_HOST_H #define __HV_DRV_USB_MUSB_HOST_H #include "hv_drv_UsbCoreHcd.h" #include "hv_drv_UsbCoreCommonUsb.h" struct musb_xfer { struct usb_host_endpoint *hep; /* usbcore info */ struct usb_device *dev; struct musb_hw_ep *hw_ep; /* current binding */ u8 epnum; u8 hb_mult; /* high bandwidth pkts per uf */ u32 offset; u32 segsize; u8 type_reg; u8 intv_reg; u8 addr_reg; u8 type; u16 maxpacket; u16 frame; u8 is_ready; u8 rx_stall_cnt; u8 error_cnt; }; #include "hv_drv_UsbMusbCore.h" #include "hv_drv_UsbMusbDma.h" INLINE void musb_set_vbus(struct musb *musb, int is_on) { musb->ops->set_vbus(musb, is_on); } INLINE struct musb *hcd_to_musb(struct usb_hcd *hcd) { return (struct musb *) hcd->hcd_priv; } extern void musb_h_ep0_irq(struct musb *musb); extern void musb_host_tx(struct musb *musb, u8 epnum); extern void musb_host_rx(struct musb *musb, u8 epnum); extern void musb_host_tx_dma(struct musb *musb, u8 epnum); extern void musb_host_rx_dma(struct musb *musb, u8 epnum); extern u32 musb_abort_xfer(struct musb *musb); extern int musb_host_alloc(struct musb *musb); extern int musb_host_setup(struct musb *musb); extern void musb_host_free(struct musb *musb); extern int musb_hub_status_data(struct usb_hcd *hcd, char *buf); extern void musb_host_cleanup(struct musb *musb); extern int musb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength); extern int musb_hub_port1_connect_state(void); INLINE struct urb *current_urb(struct musb_xfer *xfer) { if (!xfer) return NULL; return xfer->hep->xfer_urb; } #endif /* _MUSB_HOST_H */