| plan 9 kernel history: overview | file list | diff list |
1999/1117/pc/devusb.c (diff list | history)
| 1999/1116/sys/src/9/pc/devusb.c:32,38 – 1999/1117/sys/src/9/pc/devusb.c:32,38 (short | long | prev | next) | ||
| 1999/1005 | #define DPRINT if(Chatty)print | |
| 1999/1116 | #define XPRINT if(debug)print | |
| 1999/1005 | ||
| 1999/1116 |
| |
| 1999/1117 | static int debug = 0; | |
| 1999/1116 | ||
| 1999/1005 | /* * USB packet definitions | |
| 1999/1116/sys/src/9/pc/devusb.c:86,96 – 1999/1117/sys/src/9/pc/devusb.c:86,97 | ||
| 1999/1005 | ulong entries; /* address of next TD or QH to process (updated by controller) */ /* software */ | |
| 1999/1117 | QH* hlink; TD* first; QH* next; /* free list */ TD* last; ulong _d1; /* fillers */ ulong _d2; | |
| 1999/1005 | }; #define QFOL(p) ((QH*)KADDR((ulong)(p) & ~0xF)) | |
| 1999/1116/sys/src/9/pc/devusb.c:267,272 – 1999/1117/sys/src/9/pc/devusb.c:268,274 | ||
| 1999/1005 | QH* ctlq; /* queue for control i/o */ QH* bwsop; /* empty bandwidth sop (to PIIX4 errata specifications) */ QH* bulkq; /* queue for bulk i/o (points back to bandwidth sop) */ | |
| 1999/1117 | QH* recvq; /* receive queues for bulk i/o */ | |
| 1999/1005 | Udev* ports[2]; }; | |
| 1999/1116/sys/src/9/pc/devusb.c:371,381 – 1999/1117/sys/src/9/pc/devusb.c:373,384 | ||
| 1999/1005 | if(t->status & LowSpeed) *s++ = 'L'; *s = 0; | |
| 1999/1007 |
| |
| 1999/1005 |
| |
| 1999/1117 | XPRINT("td %8.8lux: ", t); XPRINT("l=%8.8lux s=%8.8lux d=%8.8lux b=%8.8lux %8.8lux f=%8.8lux\n", t->link, t->status, t->dev, t->buffer, t->bp?(ulong)t->bp->rp:0, t->flags); | |
| 1999/1007 | XPRINT("\ts=%s,ep=%ld,d=%ld,D=%ld\n", buf, (t->dev>>15)&0xF, (t->dev>>8)&0xFF, (t->dev>>19)&1); | |
| 1999/1005 |
| |
| 1999/1117 | // if(t->bp && (t->flags & CancelTD) == 0 && (t->status & Active) == 0) // dumpdata(t->bp, n); | |
| 1999/1005 | if(!follow || t->link & Terminate || t->link & IsQH) break; t = TFOL(t->link); | |
| 1999/1116/sys/src/9/pc/devusb.c:417,422 – 1999/1117/sys/src/9/pc/devusb.c:420,426 | ||
| 1999/1005 | iunlock(ub); qh->head = Terminate; qh->entries = Terminate; | |
| 1999/1117 | qh->hlink = nil; | |
| 1999/1005 | qh->first = nil; qh->last = nil; return qh; | |
| 1999/1116/sys/src/9/pc/devusb.c:662,667 – 1999/1117/sys/src/9/pc/devusb.c:666,689 | ||
| 1999/1005 | iunlock(&activends); } | |
| 1999/1117 | static void queueqh(QH *qh) { QH *q; Ctlr *ub; ub = &ubus; // See if it's already queued for (q = ub->recvq->next; q; q = q->hlink) if (q == qh) return; if ((qh->hlink = ub->recvq->next) == nil) qh->head = Terminate; else qh->head = PADDR(ub->recvq->next) | IsQH; ub->recvq->next = qh; ub->recvq->entries = PADDR(qh) | IsQH; } | |
| 1999/1005 | static QH* qxmit(Endpt *e, Block *b, int pid) { | |
| 1999/1116/sys/src/9/pc/devusb.c:670,675 – 1999/1117/sys/src/9/pc/devusb.c:692,698 | ||
| 1999/1005 | Ctlr *ub; QH *qh; | |
| 1999/1117 | XPRINT("qxmit\n"); | |
| 1999/1005 | if(b != nil){ n = BLEN(b); t = alloctde(e, pid, n); | |
| 1999/1116/sys/src/9/pc/devusb.c:684,692 – 1999/1117/sys/src/9/pc/devusb.c:707,717 | ||
| 1999/1005 | if(e->debug)pprint("QTD: %8.8lux n=%ld\n", t, b?BLEN(b): 0); vf = 0; if(e->x == 0){ | |
| 1999/1117 | XPRINT("enq\n"); | |
| 1999/1005 | qh = ub->ctlq; vf = 0; }else if((qh = e->epq) == nil || e->mode != OWRITE){ | |
| 1999/1117 | XPRINT("bulkenq\n"); | |
| 1999/1005 | qh = ub->bulkq; vf = Vf; } | |
| 1999/1116/sys/src/9/pc/devusb.c:898,904 – 1999/1117/sys/src/9/pc/devusb.c:923,929 | ||
| 1999/1005 | int q; ub = &ubus; | |
| 1999/1117 | if(!e->periodic || (q = e->sched) < 0) | |
| 1999/1005 | return; p = PADDR(e->epq) | IsQH; qlock(ub->tree); | |
| 1999/1116/sys/src/9/pc/devusb.c:918,924 – 1999/1117/sys/src/9/pc/devusb.c:943,951 | ||
| 1999/1005 | devendpt(Udev *d, int id, int add) { Endpt *e, **p; | |
| 1999/1117 | Ctlr *ub; | |
| 1999/1005 | ||
| 1999/1117 | ub = &ubus; | |
| 1999/1005 | p = &d->ep[id&0xF]; lock(d); if((e = *p) != nil){ | |
| 1999/1116/sys/src/9/pc/devusb.c:1095,1100 – 1999/1117/sys/src/9/pc/devusb.c:1122,1128 | ||
| 1999/1005 | Ctlr *ub; Endpt *e; int s; | |
| 1999/1117 | QH *q; | |
| 1999/1005 | ub = a; s = IN(Status); | |
| 1999/1116/sys/src/9/pc/devusb.c:1109,1114 – 1999/1117/sys/src/9/pc/devusb.c:1137,1147 | ||
| 1999/1116 | cleanq(ub->ctlq, 0, 0); XPRINT("cleanq(ub->bulkq, 0, Vf)\n"); cleanq(ub->bulkq, 0, Vf); | |
| 1999/1117 | XPRINT("clean recvq\n"); for (q = ub->recvq->next; q; q = q->hlink) { XPRINT("cleanq(q, 0, Vf)\n"); cleanq(q, 0, Vf); } | |
| 1999/1005 | ilock(&activends); for(e = activends.f; e != nil; e = e->activef) if(e->epq != nil) { | |
| 1999/1116/sys/src/9/pc/devusb.c:1217,1228 – 1999/1117/sys/src/9/pc/devusb.c:1250,1261 | ||
| 1999/1005 | static void usbreset(void) { | |
| 1999/1006 |
| |
| 1999/1117 | Ctlr *ub; | |
| 1999/1006 | ub = &ubus; memset(&cfg, 0, sizeof(cfg)); | |
| 1999/1116/sys/src/9/pc/devusb.c:1277,1291 – 1999/1117/sys/src/9/pc/devusb.c:1310,1330 | ||
| 1999/1006 | * with its head entry leading on to the bulk traffic, the last QH of which * links back to the empty QH. */ | |
| 1999/1117 | ub->ctlq = allocqh(ub); ub->bwsop = allocqh(ub); | |
| 1999/1006 | ub->bulkq = allocqh(ub); | |
| 1999/1117 | ub->recvq = allocqh(ub); XPRINT("bulkq: 0x%8.8lux\n", ub->bulkq); XPRINT("recvq: 0x%8.8lux\n", ub->recvq); XPRINT("bwsop: 0x%8.8lux\n", ub->bwsop); XPRINT("ctlq: 0x%8.8lux\n", ub->ctlq); | |
| 1999/1006 | t = alloctd(ub); /* inactive TD, looped */ t->link = PADDR(t); | |
| 1999/1116 |
| |
| 1999/1117 | ub->bwsop->head = PADDR(ub->bulkq) | IsQH; ub->bulkq->head = PADDR(ub->recvq) | IsQH; ub->recvq->head = PADDR(ub->bwsop) | IsQH; /* loop back */ | |
| 1999/1006 | print("usbcmd\t0x%.4x\nusbsts\t0x%.4x\nusbintr\t0x%.4x\nfrnum\t0x%.2x\n", IN(Cmd), IN(Status), IN(Usbintr), inb(port+Frnum)); print("frbaseadd\t0x%.4x\nsofmod\t0x%x\nportsc1\t0x%.4x\nportsc2\t0x%.4x\n", | |
| 1999/1116/sys/src/9/pc/devusb.c:1865,1871 – 1999/1117/sys/src/9/pc/devusb.c:1904,1923 | ||
| 1999/1005 | e->mode = strcmp(fields[3],"r")==0? OREAD: strcmp(fields[3],"w") == 0? OWRITE: ORDWR; e->periodic = 0; e->sched = -1; | |
| 1999/1117 | if(strcmp(fields[4], "bulk") == 0){ Ctlr *ub; ub = &ubus; /* Each bulk device gets a queue head hanging off the * bulk queue head */ if (e->epq == nil) { e->epq = allocqh(ub); if(e->epq == nil) panic("usbwrite: allocqh"); } queueqh(e->epq); } else { | |
| 1999/1005 | e->periodic = 1; i = strtoul(fields[4], nil, 0); if(i > 0 && i <= 1000) | |