Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


imported SEABIOS source tree
[palacios.git] / bios / seabios / src / usb-ohci.h
1 #ifndef __USB_OHCI_H
2 #define __USB_OHCI_H
3
4 // usb-ohci.c
5 void ohci_init(struct pci_device *pci, int busid);
6 struct usb_pipe;
7 void ohci_free_pipe(struct usb_pipe *p);
8 struct usb_pipe *ohci_alloc_control_pipe(struct usb_pipe *dummy);
9 int ohci_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
10                  , void *data, int datasize);
11 struct usb_pipe *ohci_alloc_bulk_pipe(struct usb_pipe *dummy);
12 int ohci_send_bulk(struct usb_pipe *p, int dir, void *data, int datasize);
13 struct usb_pipe *ohci_alloc_intr_pipe(struct usb_pipe *dummy, int frameexp);
14 int ohci_poll_intr(struct usb_pipe *p, void *data);
15
16
17 /****************************************************************
18  * ohci structs and flags
19  ****************************************************************/
20
21 struct ohci_ed {
22     u32 hwINFO;
23     u32 hwTailP;
24     u32 hwHeadP;
25     u32 hwNextED;
26 } PACKED;
27
28 #define ED_ISO          (1 << 15)
29 #define ED_SKIP         (1 << 14)
30 #define ED_LOWSPEED     (1 << 13)
31 #define ED_OUT          (0x01 << 11)
32 #define ED_IN           (0x02 << 11)
33
34 #define ED_C            (0x02)
35 #define ED_H            (0x01)
36
37 struct ohci_td {
38     u32 hwINFO;
39     u32 hwCBP;
40     u32 hwNextTD;
41     u32 hwBE;
42 } PACKED;
43
44 #define TD_CC       0xf0000000
45 #define TD_CC_GET(td_p) ((td_p >>28) & 0x0f)
46 #define TD_DI       0x00E00000
47
48 #define TD_DONE     0x00020000
49 #define TD_ISO      0x00010000
50
51 #define TD_EC       0x0C000000
52 #define TD_T        0x03000000
53 #define TD_T_DATA0  0x02000000
54 #define TD_T_DATA1  0x03000000
55 #define TD_T_TOGGLE 0x00000000
56 #define TD_DP       0x00180000
57 #define TD_DP_SETUP 0x00000000
58 #define TD_DP_IN    0x00100000
59 #define TD_DP_OUT   0x00080000
60
61 #define TD_R        0x00040000
62
63 struct ohci_hcca {
64     u32  int_table[32];
65     u32  frame_no;
66     u32  done_head;
67     u8   reserved[120];
68 } PACKED;
69
70 struct ohci_regs {
71     u32  revision;
72     u32  control;
73     u32  cmdstatus;
74     u32  intrstatus;
75     u32  intrenable;
76     u32  intrdisable;
77
78     u32  hcca;
79     u32  ed_periodcurrent;
80     u32  ed_controlhead;
81     u32  ed_controlcurrent;
82     u32  ed_bulkhead;
83     u32  ed_bulkcurrent;
84     u32  donehead;
85
86     u32  fminterval;
87     u32  fmremaining;
88     u32  fmnumber;
89     u32  periodicstart;
90     u32  lsthresh;
91
92     u32  roothub_a;
93     u32  roothub_b;
94     u32  roothub_status;
95     u32  roothub_portstatus[15];
96 } PACKED;
97
98 #define OHCI_CTRL_CBSR  (3 << 0)
99 #define OHCI_CTRL_PLE   (1 << 2)
100 #define OHCI_CTRL_CLE   (1 << 4)
101 #define OHCI_CTRL_BLE   (1 << 5)
102 #define OHCI_CTRL_HCFS  (3 << 6)
103 #       define OHCI_USB_RESET   (0 << 6)
104 #       define OHCI_USB_OPER    (2 << 6)
105 #define OHCI_CTRL_RWC   (1 << 9)
106
107 #define OHCI_HCR        (1 << 0)
108 #define OHCI_CLF        (1 << 1)
109
110 #define OHCI_INTR_MIE   (1 << 31)
111
112 #define RH_PS_CCS            0x00000001
113 #define RH_PS_PES            0x00000002
114 #define RH_PS_PSS            0x00000004
115 #define RH_PS_POCI           0x00000008
116 #define RH_PS_PRS            0x00000010
117 #define RH_PS_PPS            0x00000100
118 #define RH_PS_LSDA           0x00000200
119 #define RH_PS_CSC            0x00010000
120 #define RH_PS_PESC           0x00020000
121 #define RH_PS_PSSC           0x00040000
122 #define RH_PS_OCIC           0x00080000
123 #define RH_PS_PRSC           0x00100000
124
125 #define RH_HS_LPS            0x00000001
126 #define RH_HS_OCI            0x00000002
127 #define RH_HS_DRWE           0x00008000
128 #define RH_HS_LPSC           0x00010000
129 #define RH_HS_OCIC           0x00020000
130 #define RH_HS_CRWE           0x80000000
131
132 #define RH_B_DR         0x0000ffff
133 #define RH_B_PPCM       0xffff0000
134
135 #define RH_A_NDP        (0xff << 0)
136 #define RH_A_PSM        (1 << 8)
137 #define RH_A_NPS        (1 << 9)
138 #define RH_A_DT         (1 << 10)
139 #define RH_A_OCPM       (1 << 11)
140 #define RH_A_NOCP       (1 << 12)
141 #define RH_A_POTPGT     (0xff << 24)
142
143 #endif // usb-ohci.h