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

1999/0506/alphapc/dma.c (diff list | history)

1999/0505/sys/src/9/alphapc/dma.c:3,91999/0506/sys/src/9/alphapc/dma.c:3,8 (short | long | prev | next)
1999/0415    
#include	"mem.h" 
#include	"dat.h" 
#include	"fns.h" 
#include	"io.h" 
 
typedef struct DMAport	DMAport; 
typedef struct DMA	DMA; 
1999/0505/sys/src/9/alphapc/dma.c:63,681999/0506/sys/src/9/alphapc/dma.c:62,86
1999/0415    
	 1 }, 
}; 
 
1999/0506    
static void 
dmastatus(DMA *dp, int chan, char c) 
{ 
	int a, l, s; 
 
	ilock(dp); 
	outb(dp->cbp, 0); 
	a = inb(dp->addr[chan]); 
	a |= inb(dp->addr[chan])<<8; 
	a |= inb(dp->page[chan])<<16; 
	a |= inb(0x400|dp->page[chan])<<24; 
	outb(dp->cbp, 0); 
	l = inb(dp->count[chan]); 
	l |= inb(dp->count[chan])<<8; 
	s = inb(dp->cmd); 
	iunlock(dp); 
	print("%c: addr %uX len %uX stat %uX\n", c, a, l, s); 
} 
 
1999/0415    
/* 
 *  DMA must be in the first 16MB.  This gets called early by the 
 *  initialisation routines of any devices which require DMA to ensure 
1999/0505/sys/src/9/alphapc/dma.c:73,791999/0506/sys/src/9/alphapc/dma.c:91,107
1999/0415    
{ 
	DMA *dp; 
	DMAxfer *xp; 
1999/0506    
	static int once; 
1999/0415    
 
1999/0506    
	if(once == 0){ 
		outb(dma[0].mc, 0); 
		outb(dma[1].mc, 0); 
		outb(dma[0].cmask, 0); 
		outb(dma[1].cmask, 0); 
		outb(dma[1].mode, 0xC0); 
		once = 1; 
	} 
 
1999/0423    
	if(maxtransfer > 64*1024) 
		maxtransfer = 64*1024; 
 
1999/0505/sys/src/9/alphapc/dma.c:85,911999/0506/sys/src/9/alphapc/dma.c:113,119
1999/0423    
			return 1; 
		return 0; 
1999/0415    
	} 
1999/0501    
outb(dp->mc, 0); 
1999/0506    
//dmastatus(dp, chan, 'I'); 
1999/0423    
 
	xp->bva = xspanalloc(maxtransfer, BY2PG, 64*1024); 
	if(xp->bva == nil) 
1999/0505/sys/src/9/alphapc/dma.c:107,1311999/0506/sys/src/9/alphapc/dma.c:135,140
1999/0423    
	return 0; 
1999/0415    
} 
 
1999/0504    
static void 
1999/0505    
dmastatus(DMA *dp, int chan, char c) 
1999/0504    
{ 
	int a, l, s; 
                 
	ilock(dp); 
	outb(dp->cbp, 0); 
	a = inb(dp->addr[chan]); 
	a |= inb(dp->addr[chan])<<8; 
	a |= inb(dp->page[chan])<<16; 
	a |= inb(0x400|dp->page[chan])<<24; 
	outb(dp->cbp, 0); 
	l = inb(dp->count[chan]); 
	l |= inb(dp->count[chan])<<8; 
	s = inb(dp->cmd); 
	iunlock(dp); 
1999/0505    
	print("%c: addr %uX len %uX stat %uX\n", c, a, l, s); 
1999/0504    
} 
                 
void 
xdmastatus(int chan) 
{ 
1999/0505/sys/src/9/alphapc/dma.c:159,1641999/0506/sys/src/9/alphapc/dma.c:168,176
1999/0415    
	chan = chan & 3; 
1999/0501    
//print("va%lux+", va); 
#define tryPCI 
1999/0506    
#ifndef PCIWADDR 
#define PCIWADDR(va)	PADDR(va) 
#endif /* PCIWADDR */ 
1999/0501    
#ifdef notdef 
1999/0415    
	xp = &dp->x[chan]; 
 
1999/0505/sys/src/9/alphapc/dma.c:209,2151999/0506/sys/src/9/alphapc/dma.c:221,227
1999/0415    
	outb(dp->count[chan], ((len>>dp->shift)-1)>>8); 
	outb(dp->sbm, chan);		/* enable the channel */ 
	iunlock(dp); 
1999/0505    
dmastatus(dp, chan, 'S'); 
1999/0506    
//dmastatus(dp, chan, 'S'); 
1999/0415    
 
	return len; 
} 
1999/0505/sys/src/9/alphapc/dma.c:241,2471999/0506/sys/src/9/alphapc/dma.c:253,259
1999/0415    
	dp = &dma[(chan>>2)&1]; 
	chan = chan & 3; 
 
1999/0505    
dmastatus(dp, chan, 'E'); 
1999/0506    
//dmastatus(dp, chan, 'E'); 
1999/0415    
	/* 
	 *  disable the channel 
	 */ 


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