37#define OHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128)
39#define OHCI_NO_INTRS 32
40#define OHCI_HCCA_SIZE 256
43#define OHCI_HCCA_ALIGN 256
44#define OHCI_ED_ALIGN 16
45#define OHCI_TD_ALIGN 16
46#define OHCI_ITD_ALIGN 32
48#define OHCI_PAGE_SIZE 0x1000
49#define OHCI_PAGE(x) ((x) &~ 0xfff)
50#define OHCI_PAGE_OFFSET(x) ((x) & 0xfff)
51#define OHCI_PAGE_MASK(x) ((x) & 0xfff)
53#if ((USB_PAGE_SIZE < OHCI_ED_ALIGN) || (OHCI_ED_ALIGN == 0) || \
54 (USB_PAGE_SIZE < OHCI_TD_ALIGN) || (OHCI_TD_ALIGN == 0) || \
55 (USB_PAGE_SIZE < OHCI_ITD_ALIGN) || (OHCI_ITD_ALIGN == 0) || \
56 (USB_PAGE_SIZE < OHCI_PAGE_SIZE) || (OHCI_PAGE_SIZE == 0))
57#error "Invalid USB page size!"
60#define OHCI_VIRTUAL_FRAMELIST_COUNT 128
62#if (OHCI_VIRTUAL_FRAMELIST_COUNT < USB_MAX_FS_ISOC_FRAMES_PER_XFER)
63#error "maximum number of full-speed isochronous frames is higher than supported!"
70#define OHCI_DONE_INTRS 1
77#define OHCI_ED_GET_FA(s) ((s) & 0x7f)
78#define OHCI_ED_ADDRMASK 0x0000007f
79#define OHCI_ED_SET_FA(s) (s)
80#define OHCI_ED_GET_EN(s) (((s) >> 7) & 0xf)
81#define OHCI_ED_SET_EN(s) ((s) << 7)
82#define OHCI_ED_DIR_MASK 0x00001800
83#define OHCI_ED_DIR_TD 0x00000000
84#define OHCI_ED_DIR_OUT 0x00000800
85#define OHCI_ED_DIR_IN 0x00001000
86#define OHCI_ED_SPEED 0x00002000
87#define OHCI_ED_SKIP 0x00004000
88#define OHCI_ED_FORMAT_GEN 0x00000000
89#define OHCI_ED_FORMAT_ISO 0x00008000
90#define OHCI_ED_GET_MAXP(s) (((s) >> 16) & 0x07ff)
91#define OHCI_ED_SET_MAXP(s) ((s) << 16)
92#define OHCI_ED_MAXPMASK (0x7ff << 16)
95#define OHCI_HALTED 0x00000001
96#define OHCI_TOGGLECARRY 0x00000002
97#define OHCI_HEADMASK 0xfffffffc
113#define OHCI_TD_R 0x00040000
114#define OHCI_TD_DP_MASK 0x00180000
115#define OHCI_TD_SETUP 0x00000000
116#define OHCI_TD_OUT 0x00080000
117#define OHCI_TD_IN 0x00100000
118#define OHCI_TD_GET_DI(x) (((x) >> 21) & 7)
119#define OHCI_TD_SET_DI(x) ((x) << 21)
120#define OHCI_TD_NOINTR 0x00e00000
121#define OHCI_TD_INTR_MASK 0x00e00000
122#define OHCI_TD_TOGGLE_CARRY 0x00000000
123#define OHCI_TD_TOGGLE_0 0x02000000
124#define OHCI_TD_TOGGLE_1 0x03000000
125#define OHCI_TD_TOGGLE_MASK 0x03000000
126#define OHCI_TD_GET_EC(x) (((x) >> 26) & 3)
127#define OHCI_TD_GET_CC(x) ((x) >> 28)
128#define OHCI_TD_SET_CC(x) ((x) << 28)
129#define OHCI_TD_NOCC 0xf0000000
132#define OHCI_TD_NEXT_END 0
148#define OHCI_ITD_GET_SF(x) ((x) & 0x0000ffff)
149#define OHCI_ITD_SET_SF(x) ((x) & 0xffff)
150#define OHCI_ITD_GET_DI(x) (((x) >> 21) & 7)
151#define OHCI_ITD_SET_DI(x) ((x) << 21)
152#define OHCI_ITD_NOINTR 0x00e00000
153#define OHCI_ITD_GET_FC(x) ((((x) >> 24) & 7)+1)
154#define OHCI_ITD_SET_FC(x) (((x)-1) << 24)
155#define OHCI_ITD_GET_CC(x) ((x) >> 28)
156#define OHCI_ITD_NOCC 0xf0000000
157#define OHCI_ITD_NOFFSET 8
163#define OHCI_ITD_PAGE_SELECT 0x00001000
164#define OHCI_ITD_MK_OFFS(len) (0xe000 | ((len) & 0x1fff))
165#define OHCI_ITD_PSW_LENGTH(x) ((x) & 0xfff)
166#define OHCI_ITD_PSW_GET_CC(x) ((x) >> 12)
178#define OHCI_CC_NO_ERROR 0
180#define OHCI_CC_BIT_STUFFING 2
181#define OHCI_CC_DATA_TOGGLE_MISMATCH 3
182#define OHCI_CC_STALL 4
183#define OHCI_CC_DEVICE_NOT_RESPONDING 5
184#define OHCI_CC_PID_CHECK_FAILURE 6
185#define OHCI_CC_UNEXPECTED_PID 7
186#define OHCI_CC_DATA_OVERRUN 8
187#define OHCI_CC_DATA_UNDERRUN 9
188#define OHCI_CC_BUFFER_OVERRUN 12
189#define OHCI_CC_BUFFER_UNDERRUN 13
190#define OHCI_CC_NOT_ACCESSED 15
193#define OHCI_ENABLE_POWER_DELAY 5
194#define OHCI_READ_DESC_DELAY 5
196#define OHCI_NO_EDS (2*OHCI_NO_INTRS)
struct ohci_hw_softc __aligned
void ohci_interrupt(ohci_softc_t *sc)
void ohci_detach(struct ohci_softc *sc)
usb_bus_mem_cb_t ohci_iterate_hw_softc
struct ohci_config_desc __packed
usb_error_t ohci_init(ohci_softc_t *sc)
struct ohci_softc ohci_softc_t
struct usb_config_descriptor confd
struct usb_endpoint_descriptor endpd
struct usb_interface_descriptor ifcd
volatile uint32_t ed_flags
struct usb_page_cache * page_cache
volatile uint32_t ed_next
struct ohci_ed * obj_next
volatile uint32_t ed_tailp
volatile uint32_t ed_headp
volatile uint32_t hcca_interrupt_table[OHCI_NO_INTRS]
volatile uint32_t hcca_done_head
volatile uint32_t hcca_frame_number
struct usb_page_cache bulk_start_pc
struct usb_page_cache ctrl_start_pc
struct usb_page bulk_start_pg
struct usb_page_cache hcca_pc
struct usb_page_cache intr_start_pc[OHCI_NO_EDS]
struct usb_page isoc_start_pg
struct usb_page intr_start_pg[OHCI_NO_EDS]
struct usb_page_cache isoc_start_pc
struct usb_page ctrl_start_pg
volatile uint32_t itd_next
struct ohci_itd * obj_next
volatile uint32_t itd_bp0
volatile uint32_t itd_flags
volatile uint16_t itd_offset[OHCI_ITD_NOFFSET]
struct usb_page_cache * page_cache
struct ohci_ed * sc_intr_p_last[OHCI_NO_EDS]
struct usb_callout sc_tmo_rhsc
struct ohci_ed * sc_bulk_p_last
bus_space_tag_t sc_io_tag
struct ohci_hw_softc sc_hw
struct ohci_ed * sc_isoc_p_last
union ohci_hub_desc sc_hub_desc
struct ohci_hcca * sc_hcca_p
struct usb_device * sc_devices[OHCI_MAX_DEVICES]
struct ohci_ed * sc_ctrl_p_last
uint16_t sc_intr_stat[OHCI_NO_EDS]
struct resource * sc_irq_res
struct resource * sc_io_res
bus_space_handle_t sc_io_hdl
struct ohci_td * alt_next
struct ohci_td * obj_next
volatile uint32_t td_flags
volatile uint32_t td_next
struct usb_page_cache * page_cache
struct usb_port_status ps
struct usb_hub_descriptor hubd
void() usb_bus_mem_cb_t(struct usb_bus *bus, usb_bus_mem_sub_cb_t *scb)