| plan 9 kernel history: overview | file list | diff list |
1993/0915/pc/dma.c (diff list | history)
| 1992/1013/sys/src/9/pc/dma.c:33,39 – 1993/0915/sys/src/9/pc/dma.c:33,39 (short | long | prev | next) | ||
| 1991/0803 | */ struct DMAxfer { | |
| 1993/0915 | Page pg; /* page used by dma */ | |
| 1991/0803 | void *va; /* virtual address destination/src */ long len; /* bytes to be transferred */ int isread; | |
| 1992/1013/sys/src/9/pc/dma.c:79,84 – 1993/0915/sys/src/9/pc/dma.c:79,105 | ||
| 1991/0803 | }; /* | |
| 1993/0915 | * DMA must be in the first 16 meg. This gets called early by main() to * ensure that. */ void dmainit(void) { int i, chan; DMA *dp; DMAxfer *xp; for(i = 0; i < 2; i++){ dp = &dma[i]; for(chan = 0; chan < 4; chan++){ xp = &dp->x[chan]; xp->pg.pa = (ulong)xspanalloc(BY2PG, BY2PG, 0); xp->pg.va = KZERO|xp->pg.pa; } } } /* | |
| 1991/0803 | * setup a dma transfer. if the destination is not in kernel * memory, allocate a page for the transfer. * | |
| 1992/1013/sys/src/9/pc/dma.c:101,122 – 1993/0915/sys/src/9/pc/dma.c:122,142 | ||
| 1991/0803 | xp = &dp->x[chan]; /* | |
| 1993/0915 | * if this isn't kernel memory or crossing 64k boundary or above 16 meg * use the allocated low memory page. | |
| 1991/0803 | */ | |
| 1993/0915 | pa = PADDR(va); | |
| 1992/1013 | if((((ulong)va)&0xF0000000) != KZERO | |
| 1991/0925 |
| |
| 1993/0915 | || (pa&0xFFFF0000) != ((pa+len)&0xFFFF0000) || pa > 16*MB){ | |
| 1991/0803 | if(len > BY2PG) len = BY2PG; if(!isread) | |
| 1993/0915 | memmove((void*)(xp->pg.va), va, len); | |
| 1991/0803 | xp->va = va; xp->len = len; xp->isread = isread; | |
| 1993/0915 | pa = xp->pg.pa; | |
| 1991/0925 | } else xp->len = 0; | |
| 1991/0803 | ||
| 1992/1013/sys/src/9/pc/dma.c:168,173 – 1993/0915/sys/src/9/pc/dma.c:188,193 | ||
| 1991/0803 | /* * copy out of temporary page */ | |
| 1993/0915 | memmove(xp->va, (void*)(xp->pg.va), xp->len); | |
| 1991/0925 | xp->len = 0; | |
| 1991/0803 | } | |