#ifndef _DWC_OTG_H_ #define _DWC_OTG_H_ struct usb_hw_ep_profile { uint16_t max_in_frame_size; /* IN-token direction */ uint16_t max_out_frame_size; /* OUT-token direction */ uint8_t is_simplex:1; uint8_t support_multi_buffer:1; uint8_t support_bulk:1; uint8_t support_control:1; uint8_t support_interrupt:1; uint8_t support_isochronous:1; uint8_t support_in:1; /* IN-token is supported */ uint8_t support_out:1; /* OUT-token is supported */ }; struct dwc_otg_td; struct dwc_otg_softc; struct dwc_otg_std_temp { dwc_otg_cmd_t *func; #if 0 struct usb_page_cache *pc; #else usbd_xfer_handle xfer; usb_dma_t *dmap; #endif struct dwc_otg_td *td; struct dwc_otg_td *td_next; uint32_t len; uint32_t offset; uint16_t max_frame_size; uint8_t short_pkt; /* * short_pkt = 0: transfer should be short terminated * short_pkt = 1: transfer should not be short terminated */ uint8_t setup_alt_next; uint8_t did_stall; uint8_t bulk_or_control; }; union dwc_otg_hub_temp { uWord wValue; usb_port_status_t ps; }; struct dwc_otg_profile { struct usb_hw_ep_profile usb; uint16_t max_buffer; }; struct dwc_otg_softc { struct usbd_bus sc_bus; union dwc_otg_hub_temp sc_hub_temp; struct dwc_otg_profile sc_hw_ep_profile[DWC_OTG_MAX_ENDPOINTS]; // callout_t sc_timer; struct usb_device *sc_devices[DWC_OTG_MAX_DEVICES]; // struct resource *sc_io_res; // struct resource *sc_irq_res; // void *sc_intr_hdl; // bus_size_t sc_io_size; // bus_space_tag_t sc_io_tag; // bus_space_handle_t sc_io_hdl; uint32_t sc_rx_bounce_buffer[1024 / 4]; uint32_t sc_tx_bounce_buffer[(512 * DWC_OTG_MAX_TXP) / 4]; uint32_t sc_fifo_size; uint32_t sc_irq_mask; uint32_t sc_last_rx_status; uint32_t sc_out_ctl[DWC_OTG_MAX_ENDPOINTS]; uint32_t sc_in_ctl[DWC_OTG_MAX_ENDPOINTS]; // struct dwc_otg_chan_state sc_chan_state[DWC_OTG_MAX_CHANNELS]; // uint32_t sc_tmr_val; // // uint32_t sc_hprt_val; uint16_t sc_active_rx_ep; // uint8_t sc_timer_active; // uint8_t sc_dev_ep_max; // uint8_t sc_dev_in_ep_max; // uint8_t sc_host_ch_max; // uint8_t sc_rt_addr; /* root HUB address */ // uint8_t sc_conf; /* root HUB config */ // uint8_t sc_mode; /* mode of operation */ // #define DWC_MODE_OTG 0 /* both modes */ // #define DWC_MODE_DEVICE 1 /* device only */ // #define DWC_MODE_HOST 2 /* host only */ // uint8_t sc_hub_idata[1]; // struct dwc_otg_flags sc_flags; // device_t sc_child; /* /dev/usb# device */ }; /* prototypes */ int dwc_otg_interrupt(void *); int dwc_otg_init(struct dwc_otg_softc *); void dwc_otg_uninit(struct dwc_otg_softc *); #endif /* _DWC_OTG_H_ */