1 /* override default macros from ../port/usb.h */ 2 #undef dprint 3 #undef ddprint 4 #undef deprint 5 #undef ddeprint 6 #define dprint if(ehcidebug)print 7 #define ddprint if(ehcidebug>1)print 8 #define deprint if(ehcidebug || ep->debug)print 9 #define ddeprint if(ehcidebug>1 || ep->debug>1)print 10 11 typedef struct Ctlr Ctlr; 12 typedef struct Eopio Eopio; 13 typedef struct Isoio Isoio; 14 typedef struct Poll Poll; 15 typedef struct Qh Qh; 16 typedef struct Qtree Qtree; 17 18 #pragma incomplete Ctlr; 19 #pragma incomplete Eopio; 20 #pragma incomplete Isoio; 21 #pragma incomplete Poll; 22 #pragma incomplete Qh; 23 #pragma incomplete Qtree; 24 25 struct Poll 26 { 27 Lock; 28 Rendez; 29 int must; 30 int does; 31 }; 32 33 struct Ctlr 34 { 35 Rendez; /* for waiting to async advance doorbell */ 36 Lock; /* for ilock. qh lists and basic ctlr I/O */ 37 QLock portlck; /* for port resets/enable... (and doorbell) */ 38 int active; /* in use or not */ 39 Ecapio* capio; /* Capability i/o regs */ 40 Eopio* opio; /* Operational i/o regs */ 41 42 int nframes; /* 1024, 512, or 256 frames in the list */ 43 ulong* frames; /* periodic frame list (hw) */ 44 Qh* qhs; /* async Qh circular list for bulk/ctl */ 45 Qtree* tree; /* tree of Qhs for the periodic list */ 46 int ntree; /* number of dummy qhs in tree */ 47 Qh* intrqhs; /* list of (not dummy) qhs in tree */ 48 Isoio* iso; /* list of active Iso I/O */ 49 ulong load; 50 ulong isoload; 51 int nintr; /* number of interrupts attended */ 52 int ntdintr; /* number of intrs. with something to do */ 53 int nqhintr; /* number of async td intrs. */ 54 int nisointr; /* number of periodic td intrs. */ 55 int nreqs; 56 Poll poll; 57 }; 58 59 /* 60 * Operational registers (hw) 61 */ 62 struct Eopio 63 { 64 ulong cmd; /* 00 command */ 65 ulong sts; /* 04 status */ 66 ulong intr; /* 08 interrupt enable */ 67 ulong frno; /* 0c frame index */ 68 ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ 69 ulong frbase; /* 14 frame list base addr, 4096-byte boundary */ 70 ulong link; /* 18 link for async list */ 71 uchar d2c[0x40-0x1c]; /* 1c dummy */ 72 ulong config; /* 40 1: all ports default-routed to this HC */ 73 ulong portsc[3]; /* 44 Port status and control, one per port */ 74 75 /* defined for omap35 ehci at least */ 76 uchar _pad0[0x80 - 0x50]; 77 ulong insn[6]; /* implementation-specific */ 78 }; 79 80 extern Ecapio *ehcidebugcapio; 81 extern int ehcidebugport; 82 83 extern int ehcidebug; 84 85 void ehcilinkage(Hci *hp); 86 void ehcimeminit(Ctlr *ctlr); 87 void ehcirun(Ctlr *ctlr, int on); 88