Functions | |||||||||
| void | dma_xfer (unsigned channel, addr_t physaddr, size_t length, bool read) | ||||||||
Set up a DMA transfer between a device and memory.
| |||||||||
Variables | |||||||||
| dma_channel_t | dmainfo [] | ||||||||
| Definition of DMA channels. | |||||||||
|
||||||||||||||||||||
|
Set up a DMA transfer between a device and memory.
Definition at line 47 of file dma.c.
00048 {
00049 int page, offset;
00050
00051 if (channel > 3) return;
00052
00053 // calculate dma page and offset //
00054 page = physaddr >> 16;
00055 offset = physaddr & 0xFFFF;
00056 length -= 1; // with dma, if you want k bytes, you ask for k-1 //
00057
00058 disable();
00059
00060 // set the mask bit for the channel //
00061 outportb(0x0A, channel | 0x04);
00062
00063 // clear flipflop //
00064 outportb(0x0C, 0x00);
00065
00066 // set DMA mode (write+single+r/w) //
00067 outportb(0x0B, (read ? 0x48 : 0x44) + channel);
00068
00069 // set DMA page //
00070 outportb(dmainfo[channel].page, page);
00071
00072 // set DMA offset //
00073 outportb(dmainfo[channel].offset, offset & 0xFF); // low byte //
00074 outportb(dmainfo[channel].offset, offset >> 8); // high byte //
00075
00076 // set DMA length //
00077 outportb(dmainfo[channel].length, length & 0xFF); // low byte //
00078 outportb(dmainfo[channel].length, length >> 8); // high byte //
00079
00080 // clear DMA mask bit //
00081 outportb(0x0A, channel);
00082
00083 enable();
00084 }
|
|
|
Initial value:
{
{ 0x87, 0x00, 0x01 },
{ 0x83, 0x02, 0x03 },
{ 0x81, 0x04, 0x05 },
{ 0x82, 0x06, 0x07 }
}
|
1.2.18