Working on GUI, side changes to the message passing
[tpg/acess2.git] / Kernel / drv / dma.c
index 0fae172..9116703 100644 (file)
@@ -2,7 +2,7 @@
  * AcessOS 1.0\r
  * DMA Driver\r
  */\r
-#include <common.h>\r
+#include <acess.h>\r
 \r
 #define DMA_SIZE       (0x2400)\r
 #define DMA_ADDRESS(c) ((c)*DMA_SIZE+0x500)    //Save Space for IDT and BDA\r
@@ -32,7 +32,7 @@ t_dmaChannel  dma_channels[8];
  */\r
 void DMA_Install()\r
 {\r
-       int i;\r
+       Uint    i;\r
        for(i=8;i--;)\r
        {\r
                outb( cMASKPORT[i], 0x04 | (i & 0x3) ); // mask channel\r
@@ -49,32 +49,32 @@ void DMA_Install()
                \r
                dma_channels[i].mode = 0;\r
                dma_addresses[i] = (char*)DMA_ADDRESS(i);\r
-               dma_addresses[i] += 0xC0000000;\r
+               dma_addresses[i] += KERNEL_BASE;\r
        }\r
 }\r
 \r
 /**\r
- * \fn void DMA_SetChannel(int channel, int length, int read)\r
+ * \fn void DMA_SetChannel(int Channel, int length, int read)\r
  * \brief Set DMA Channel Length and RW\r
  */\r
-void DMA_SetChannel(int channel, int length, int read)\r
+void DMA_SetChannel(int Channel, int length, int read)\r
 {\r
-       channel &= 7;\r
-       read = read && 1;\r
+       Uint    chan = Channel & 7;\r
+       read = !!read;\r
        if(length > DMA_SIZE)   length = DMA_SIZE;\r
        length --;      //Adjust for DMA\r
        //__asm__ __volatile__ ("cli");\r
-       outb( cMASKPORT[channel], 0x04 | (channel & 0x3) );             // mask channel\r
-       outb( cCLEARPORT[channel], 0x00 );\r
-       outb( cMODEPORT[channel], (0x44 + (!read)*4) | (channel & 0x3) );\r
-       outb( cADDRPORT[channel], LOWB(DMA_ADDRESS(channel)) );         // send address\r
-       outb( cADDRPORT[channel], HIB(DMA_ADDRESS(channel)) );          // send address\r
-       outb( cPAGEPORT[channel], HIW(DMA_ADDRESS(channel)) );          // send page\r
-       outb( cCOUNTPORT[channel], LOWB(length) );      // send size\r
-       outb( cCOUNTPORT[channel], HIB(length) );       // send size\r
-       outb( cMASKPORT[channel], channel & 0x3 );              // unmask channel\r
-       dma_addresses[channel] = (char*)DMA_ADDRESS(channel);\r
-       dma_addresses[channel] += 0xC0000000;\r
+       outb( cMASKPORT[chan], 0x04 | (chan & 0x3) );           // mask channel\r
+       outb( cCLEARPORT[chan], 0x00 );\r
+       outb( cMODEPORT[chan], (0x44 + (!read)*4) | (chan & 0x3) );\r
+       outb( cADDRPORT[chan], LOWB(DMA_ADDRESS(chan)) );               // send address\r
+       outb( cADDRPORT[chan], HIB(DMA_ADDRESS(chan)) );                // send address\r
+       outb( cPAGEPORT[chan], HIW(DMA_ADDRESS(chan)) );                // send page\r
+       outb( cCOUNTPORT[chan], LOWB(length) );      // send size\r
+       outb( cCOUNTPORT[chan], HIB(length) );       // send size\r
+       outb( cMASKPORT[chan], chan & 0x3 );              // unmask channel\r
+       dma_addresses[chan] = (char*)DMA_ADDRESS(chan);\r
+       dma_addresses[chan] += KERNEL_BASE;\r
        //__asm__ __volatile__ ("sti");\r
 }\r
 \r

UCC git Repository :: git.ucc.asn.au