X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fdrv%2Fdma.c;h=9116703efd7c77ad4941e3e067432f120654c03b;hb=1c2a87ec67d332b6a165c79398693eac1eb1166e;hp=0fae172bf709c33f535c21753fba51690ba924bd;hpb=15e56ad3bfa5a55e213fb4e70e05d398523d3bcd;p=tpg%2Facess2.git diff --git a/Kernel/drv/dma.c b/Kernel/drv/dma.c index 0fae172b..9116703e 100644 --- a/Kernel/drv/dma.c +++ b/Kernel/drv/dma.c @@ -2,7 +2,7 @@ * AcessOS 1.0 * DMA Driver */ -#include +#include #define DMA_SIZE (0x2400) #define DMA_ADDRESS(c) ((c)*DMA_SIZE+0x500) //Save Space for IDT and BDA @@ -32,7 +32,7 @@ t_dmaChannel dma_channels[8]; */ void DMA_Install() { - int i; + Uint i; for(i=8;i--;) { outb( cMASKPORT[i], 0x04 | (i & 0x3) ); // mask channel @@ -49,32 +49,32 @@ void DMA_Install() dma_channels[i].mode = 0; dma_addresses[i] = (char*)DMA_ADDRESS(i); - dma_addresses[i] += 0xC0000000; + dma_addresses[i] += KERNEL_BASE; } } /** - * \fn void DMA_SetChannel(int channel, int length, int read) + * \fn void DMA_SetChannel(int Channel, int length, int read) * \brief Set DMA Channel Length and RW */ -void DMA_SetChannel(int channel, int length, int read) +void DMA_SetChannel(int Channel, int length, int read) { - channel &= 7; - read = read && 1; + Uint chan = Channel & 7; + read = !!read; if(length > DMA_SIZE) length = DMA_SIZE; length --; //Adjust for DMA //__asm__ __volatile__ ("cli"); - outb( cMASKPORT[channel], 0x04 | (channel & 0x3) ); // mask channel - outb( cCLEARPORT[channel], 0x00 ); - outb( cMODEPORT[channel], (0x44 + (!read)*4) | (channel & 0x3) ); - outb( cADDRPORT[channel], LOWB(DMA_ADDRESS(channel)) ); // send address - outb( cADDRPORT[channel], HIB(DMA_ADDRESS(channel)) ); // send address - outb( cPAGEPORT[channel], HIW(DMA_ADDRESS(channel)) ); // send page - outb( cCOUNTPORT[channel], LOWB(length) ); // send size - outb( cCOUNTPORT[channel], HIB(length) ); // send size - outb( cMASKPORT[channel], channel & 0x3 ); // unmask channel - dma_addresses[channel] = (char*)DMA_ADDRESS(channel); - dma_addresses[channel] += 0xC0000000; + outb( cMASKPORT[chan], 0x04 | (chan & 0x3) ); // mask channel + outb( cCLEARPORT[chan], 0x00 ); + outb( cMODEPORT[chan], (0x44 + (!read)*4) | (chan & 0x3) ); + outb( cADDRPORT[chan], LOWB(DMA_ADDRESS(chan)) ); // send address + outb( cADDRPORT[chan], HIB(DMA_ADDRESS(chan)) ); // send address + outb( cPAGEPORT[chan], HIW(DMA_ADDRESS(chan)) ); // send page + outb( cCOUNTPORT[chan], LOWB(length) ); // send size + outb( cCOUNTPORT[chan], HIB(length) ); // send size + outb( cMASKPORT[chan], chan & 0x3 ); // unmask channel + dma_addresses[chan] = (char*)DMA_ADDRESS(chan); + dma_addresses[chan] += KERNEL_BASE; //__asm__ __volatile__ ("sti"); }