plan 9 kernel history: overview | file list | diff list

1999/1118/pc/devusb.c (diff list | history)

1999/1117/sys/src/9/pc/devusb.c:27,331999/1118/sys/src/9/pc/devusb.c:27,32 (short | long | prev | next)
1999/1005    
#endif 
*/ 
 
#define Pprint 
#define Chatty	1 
#define DPRINT if(Chatty)print 
1999/1116    
#define XPRINT if(debug)print 
1999/1117/sys/src/9/pc/devusb.c:377,3841999/1118/sys/src/9/pc/devusb.c:376,383
1999/1117    
		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/1117    
	//	if(t->bp && (t->flags & CancelTD) == 0 && (t->status & Active) == 0) 
	//		dumpdata(t->bp, n); 
1999/1118    
		if(debug && t->bp && (t->flags & CancelTD) == 0) 
			dumpdata(t->bp, n); 
1999/1005    
		if(!follow || t->link & Terminate || t->link & IsQH) 
			break; 
		t = TFOL(t->link); 
1999/1117/sys/src/9/pc/devusb.c:692,6981999/1118/sys/src/9/pc/devusb.c:691,696
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/1117/sys/src/9/pc/devusb.c:704,7171999/1118/sys/src/9/pc/devusb.c:702,713
1999/1005    
	ilock(ub); 
	e->ntd++; 
	iunlock(ub); 
if(e->debug)pprint("QTD: %8.8lux n=%ld\n", t, b?BLEN(b): 0); 
1999/1118    
	if(e->debug) pprint("QTD: %8.8lux n=%ld\n", t, b?BLEN(b): 0); 
1999/1005    
	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/1117/sys/src/9/pc/devusb.c:728,7341999/1118/sys/src/9/pc/devusb.c:724,729
1999/1005    
	QH *qh; 
	int vf; 
 
1999/1116    
XPRINT("qrcv\n"); 
1999/1005    
	t = alloctde(e, TokIN, e->maxpkt); 
	b = allocb(e->maxpkt); 
	t->bp = b; 
1999/1117/sys/src/9/pc/devusb.c:736,7451999/1118/sys/src/9/pc/devusb.c:731,738
1999/1005    
	ub = &ubus; 
	vf = 0; 
	if(e->x == 0){ 
1999/1116    
XPRINT("enq\n"); 
1999/1005    
		qh = ub->ctlq; 
	}else if((qh = e->epq) == nil || e->mode != OREAD){ 
1999/1116    
XPRINT("bulkenq\n"); 
1999/1005    
		qh = ub->bulkq; 
		vf = Vf; 
	} 
1999/1117/sys/src/9/pc/devusb.c:1179,11911999/1118/sys/src/9/pc/devusb.c:1172,1184
1999/1005    
#define	DEVPATH(q)	(((q)&~CHDIR)>>QSHIFT) 
 
static Dirtab usbdir2[] = { 
	"new",	{Qnew},	0,	0666, 
1999/1118    
	"new",		{Qnew},		0,	0666, 
1999/1005    
	"ctl",		{Qbusctl},	0,	0666, 
	"port",	{Qport},	0,	0444, 
1999/1118    
	"port",		{Qport},	0,	0444, 
1999/1005    
}; 
 
static Dirtab usbdir3[]={ 
	"ctl",		{Qctl},	0,	0666, 
1999/1118    
	"ctl",		{Qctl},		0,	0666, 
1999/1005    
	"setup",	{Qsetup},	0,	0666, 
	"status",	{Qstatus},	0,	0444, 
	"debug",	{Qdebug},	1,	0666, 
1999/1117/sys/src/9/pc/devusb.c:1276,12821999/1118/sys/src/9/pc/devusb.c:1269,1275
1999/1006    
		return; 
	} 
 
	print("USB: %x/%x port 0x%lux size 0x%x irq %d\n", 
1999/1118    
	DPRINT("USB: %x/%x port 0x%lux size 0x%x irq %d\n", 
1999/1006    
		cfg->vid, cfg->did, port, cfg->mem[4].size, cfg->intl); 
 
	i = inb(port+SOFMod); 
1999/1117/sys/src/9/pc/devusb.c:1314,13231999/1118/sys/src/9/pc/devusb.c:1307,1312
1999/1117    
	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); 
	ub->bwsop->entries = PADDR(t); 
1999/1117/sys/src/9/pc/devusb.c:1325,13331999/1118/sys/src/9/pc/devusb.c:1314,1322
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", 
1999/1118    
	XPRINT("usbcmd\t0x%.4x\nusbsts\t0x%.4x\nusbintr\t0x%.4x\nfrnum\t0x%.2x\n", 
1999/1006    
		IN(Cmd), IN(Status), IN(Usbintr), inb(port+Frnum)); 
	print("frbaseadd\t0x%.4x\nsofmod\t0x%x\nportsc1\t0x%.4x\nportsc2\t0x%.4x\n", 
1999/1118    
	XPRINT("frbaseadd\t0x%.4x\nsofmod\t0x%x\nportsc1\t0x%.4x\nportsc2\t0x%.4x\n", 
1999/1006    
		IN(Flbaseadd), inb(port+SOFMod), IN(Portsc0), IN(Portsc1)); 
	OUT(Cmd, 0);	/* stop */ 
	ub->frames = xspanalloc(FRAMESIZE, FRAMESIZE, 0); 
1999/1117/sys/src/9/pc/devusb.c:1339,13511999/1118/sys/src/9/pc/devusb.c:1328,1340
1999/1006    
	} 
	qt->root->head = PADDR(ub->ctlq) | IsQH; 
	ub->tree = qt; 
	print("usb tree: nel=%d depth=%d\n", qt->nel, qt->depth); 
1999/1118    
	XPRINT("usb tree: nel=%d depth=%d\n", qt->nel, qt->depth); 
1999/1006    
 
	outl(port+Flbaseadd, PADDR(ub->frames)); 
	OUT(Frnum, 0); 
	OUT(Usbintr, 0xF);	/* enable all interrupts */ 
	print("cmd 0x%x sofmod 0x%x\n", IN(Cmd), inb(port+SOFMod)); 
	print("sc0 0x%x sc1 0x%x\n", IN(Portsc0), IN(Portsc1)); 
1999/1118    
	XPRINT("cmd 0x%x sofmod 0x%x\n", IN(Cmd), inb(port+SOFMod)); 
	XPRINT("sc0 0x%x sc1 0x%x\n", IN(Portsc0), IN(Portsc1)); 
1999/1005    
} 
 
void 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)