Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

DMA (Direct Memory Access) driver
[Device Drivers]


Functions

void dma_xfer (unsigned channel, addr_t physaddr, size_t length, bool read)
 Set up a DMA transfer between a device and memory.
Parameters:
channel  The 8-bit channel number (0..3).
physaddr  The physical address of the buffer.
length  The size of the buffer.
read  If it is TRUE the transfer will be from memory to device, otherwise will be from device to memory.



Variables

dma_channel_t dmainfo []
 Definition of DMA channels.


Detailed Description

The DMA (Direct Memory Access) low level driver (based on i386-architecture).

Function Documentation

void dma_xfer unsigned    channel,
addr_t    physaddr,
size_t    length,
bool    read
 

Set up a DMA transfer between a device and memory.

Parameters:
channel  The 8-bit channel number (0..3).
physaddr  The physical address of the buffer.
length  The size of the buffer.
read  If it is TRUE the transfer will be from memory to device, otherwise will be from device to 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 }


Variable Documentation

dma_channel_t dmainfo[] [static]
 

Initial value:

{
        { 0x87, 0x00, 0x01 },
        { 0x83, 0x02, 0x03 },
        { 0x81, 0x04, 0x05 },
        { 0x82, 0x06, 0x07 }
}
Definition of DMA channels.

Definition at line 32 of file dma.c.


Generated on Fri Feb 20 15:32:22 2004 for Minirighi by doxygen1.2.18