aboutsummaryrefslogtreecommitdiffstats
path: root/src/usb-ohci.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-10-12 10:09:15 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-10-12 10:09:15 -0400
commit59f02834f38c63be537f63a702c69b68af913bfa (patch)
tree86b5c59b50021ae851a8dffb60d3118d76269b94 /src/usb-ohci.h
parent91031edcb2a6adf2510478bc81a4df68c5e3daf2 (diff)
downloadseabios-59f02834f38c63be537f63a702c69b68af913bfa.tar.gz
Add stubs for USB OHCI support.
Enable USB wrapper functions to call either ohci or ehci helpers. Implement pci_config_maskw in place of pci_set_bus_master. Introduce 'struct usb_pipe' in place of 'void *' for pipes.
Diffstat (limited to 'src/usb-ohci.h')
-rw-r--r--src/usb-ohci.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/usb-ohci.h b/src/usb-ohci.h
new file mode 100644
index 00000000..9d13f8ce
--- /dev/null
+++ b/src/usb-ohci.h
@@ -0,0 +1,97 @@
+#ifndef __USB_OHCI_H
+#define __USB_OHCI_H
+
+// usb-ohci.c
+struct usb_s;
+int ohci_init(struct usb_s *cntl);
+int ohci_control(u32 endp, int dir, const void *cmd, int cmdsize
+ , void *data, int datasize);
+struct usb_pipe *ohci_alloc_intr_pipe(u32 endp, int period);
+int ohci_poll_intr(void *pipe, void *data);
+
+
+/****************************************************************
+ * ohci structs and flags
+ ****************************************************************/
+
+struct ohci_ed {
+ u32 hwINFO;
+ u32 hwTailP;
+ u32 hwHeadP;
+ u32 hwNextED;
+} PACKED;
+
+#define ED_ISO (1 << 15)
+#define ED_SKIP (1 << 14)
+#define ED_LOWSPEED (1 << 13)
+#define ED_OUT (0x01 << 11)
+#define ED_IN (0x02 << 11)
+
+#define ED_C (0x02)
+#define ED_H (0x01)
+
+struct ohci_td {
+ u32 hwINFO;
+ u32 hwCBP;
+ u32 hwNextTD;
+ u32 hwBE;
+} PACKED;
+
+#define TD_CC 0xf0000000
+#define TD_CC_GET(td_p) ((td_p >>28) & 0x0f)
+#define TD_DI 0x00E00000
+#define TD_DI_SET(X) (((X) & 0x07)<< 21)
+
+#define TD_DONE 0x00020000
+#define TD_ISO 0x00010000
+
+#define TD_EC 0x0C000000
+#define TD_T 0x03000000
+#define TD_T_DATA0 0x02000000
+#define TD_T_DATA1 0x03000000
+#define TD_T_TOGGLE 0x00000000
+#define TD_DP 0x00180000
+#define TD_DP_SETUP 0x00000000
+#define TD_DP_IN 0x00100000
+#define TD_DP_OUT 0x00080000
+
+#define TD_R 0x00040000
+
+struct ohci_hcca {
+ u32 int_table[32];
+ u32 frame_no;
+ u32 done_head;
+ u8 reserved[120];
+} PACKED;
+
+struct ohci_regs {
+ u32 revision;
+ u32 control;
+ u32 cmdstatus;
+ u32 intrstatus;
+ u32 intrenable;
+ u32 intrdisable;
+
+ u32 hcca;
+ u32 ed_periodcurrent;
+ u32 ed_controlhead;
+ u32 ed_controlcurrent;
+ u32 ed_bulkhead;
+ u32 ed_bulkcurrent;
+ u32 donehead;
+
+ u32 fminterval;
+ u32 fmremaining;
+ u32 fmnumber;
+ u32 periodicstart;
+ u32 lsthresh;
+
+ u32 roothub_a;
+ u32 roothub_b;
+ u32 roothub_status;
+ u32 roothub_portstatus[15];
+} PACKED;
+
+#define OHCI_INTR_MIE (1 << 31)
+
+#endif // usb-ohci.h