blob: 9d13f8ce27b4a2ac27e7bcfd96a95ac694650809 [file] [log] [blame]
Kevin O'Connor59f02832009-10-12 10:09:15 -04001#ifndef __USB_OHCI_H
2#define __USB_OHCI_H
3
4// usb-ohci.c
5struct usb_s;
6int ohci_init(struct usb_s *cntl);
7int ohci_control(u32 endp, int dir, const void *cmd, int cmdsize
8 , void *data, int datasize);
9struct usb_pipe *ohci_alloc_intr_pipe(u32 endp, int period);
10int ohci_poll_intr(void *pipe, void *data);
11
12
13/****************************************************************
14 * ohci structs and flags
15 ****************************************************************/
16
17struct ohci_ed {
18 u32 hwINFO;
19 u32 hwTailP;
20 u32 hwHeadP;
21 u32 hwNextED;
22} PACKED;
23
24#define ED_ISO (1 << 15)
25#define ED_SKIP (1 << 14)
26#define ED_LOWSPEED (1 << 13)
27#define ED_OUT (0x01 << 11)
28#define ED_IN (0x02 << 11)
29
30#define ED_C (0x02)
31#define ED_H (0x01)
32
33struct ohci_td {
34 u32 hwINFO;
35 u32 hwCBP;
36 u32 hwNextTD;
37 u32 hwBE;
38} PACKED;
39
40#define TD_CC 0xf0000000
41#define TD_CC_GET(td_p) ((td_p >>28) & 0x0f)
42#define TD_DI 0x00E00000
43#define TD_DI_SET(X) (((X) & 0x07)<< 21)
44
45#define TD_DONE 0x00020000
46#define TD_ISO 0x00010000
47
48#define TD_EC 0x0C000000
49#define TD_T 0x03000000
50#define TD_T_DATA0 0x02000000
51#define TD_T_DATA1 0x03000000
52#define TD_T_TOGGLE 0x00000000
53#define TD_DP 0x00180000
54#define TD_DP_SETUP 0x00000000
55#define TD_DP_IN 0x00100000
56#define TD_DP_OUT 0x00080000
57
58#define TD_R 0x00040000
59
60struct ohci_hcca {
61 u32 int_table[32];
62 u32 frame_no;
63 u32 done_head;
64 u8 reserved[120];
65} PACKED;
66
67struct ohci_regs {
68 u32 revision;
69 u32 control;
70 u32 cmdstatus;
71 u32 intrstatus;
72 u32 intrenable;
73 u32 intrdisable;
74
75 u32 hcca;
76 u32 ed_periodcurrent;
77 u32 ed_controlhead;
78 u32 ed_controlcurrent;
79 u32 ed_bulkhead;
80 u32 ed_bulkcurrent;
81 u32 donehead;
82
83 u32 fminterval;
84 u32 fmremaining;
85 u32 fmnumber;
86 u32 periodicstart;
87 u32 lsthresh;
88
89 u32 roothub_a;
90 u32 roothub_b;
91 u32 roothub_status;
92 u32 roothub_portstatus[15];
93} PACKED;
94
95#define OHCI_INTR_MIE (1 << 31)
96
97#endif // usb-ohci.h