Sie sind auf Seite 1von 7

System Programming Course Code: CS609

Cs609@vu.edu.pk

Lecture # 24

This register can be used to simulate a DMA request through software (in case of
memory to memory transfer). The lower 2 bits contains the channel number to be
requested and the bit # 2 is set to indicate a request.

Virtual University of Pakistan 199


System Programming Course Code: CS609
Cs609@vu.edu.pk

This register can be used to mask/unmask requests from a device for a certain DMA
channel. The lower 2 bits contains the channel number and the bit #2 is set if the channel
is to be masked.

Virtual University of Pakistan 200


System Programming Course Code: CS609
Cs609@vu.edu.pk

This register can also be used to mask the DMA channels. It contains a single bit for each
channel. The corresponding bit is set to mask the requests for that channel.

Virtual University of Pakistan 201


System Programming Course Code: CS609
Cs609@vu.edu.pk

This register can be used to set the mode on each. The slide shows the detail of the values
and bits which should be placed in the register in order to program a required mode.

Virtual University of Pakistan 202


System Programming Course Code: CS609
Cs609@vu.edu.pk

A channel is programmed for a start address and the count of bytes to be transferred
before the transfer can take place. Both these values are placed in various registers
according to the channel number as shown by the slide above. Once the transfer starts
these values start changing. The start address is updated in to the current address and the
count is also updates as bytes are transferred. During the transfer the status of the transfer
can be analyzed by getting the values of these registers listed In the slide above for the
channel(s) involved in the transfer.

Virtual University of Pakistan 203


System Programming Course Code: CS609
Cs609@vu.edu.pk

High Address Nibble/Byte

The above slide shows the port number for each channel in which the higher 4 or 8 bits of
the absolute address is stored in case of 20 or 24 bit address bus.

#include <dos.h>
#include <bios.h>
char st[80];
unsigned long int temp;
unsigned int i;
unsigned int count=48;

void main (void)


{
temp=(unsigned long int)_DS;
temp = temp << 4L;
i = *((unsigned int *)(&temp));
temp = temp>>16L;

This program, programs the DMA channel 3 for read cycle by placing 0x0B in mode
register (0x0B). Before the channel is unmasked and the channel mode is programmed
the base address the count and the higher 4 or 8 bits of the address should be placed in
base register, count register and Latch B respectively. The 20 (or 24) bit address is

Virtual University of Pakistan 204


System Programming Course Code: CS609
Cs609@vu.edu.pk

calculated. The higher 4 ( or 8) bits are placed in the Latch B for channel 3, then the rest
of the 16 bits of the base address are placed in base register for channe3 and ultimately
the count is loaded into the count register for channel 3.

outportb (0x81,*((unsigned char *)(&temp)));


outportb(0x06,*(((unsigned char *)(&i))));
outportb(0x06,*(((unsigned char *)(&i))+1));
count--;
outportb(0x07,*((unsigned char *)(&count)));
outportb(0x07,*(((unsigned char*)(&count))+1));
outportb(0x0b,0x0b);
outportb(0x08,0);
outport(0x0a,3);
getch();
}

Virtual University of Pakistan 205

Das könnte Ihnen auch gefallen