beautypg.com

Intel 386 User Manual

Page 391

background image

Intel386™ EX EMBEDDED MICROPROCESSOR USER’S MANUAL

12-56

#else /*Else in compact, large, or huge memory model*/

wSegment = _FP_SEG(ptMemory); /*...grab the segment from the pointer*/

wOffset = _FP_OFF(ptMemory); /*...and the offset from the pointer*/

#endif /*Assuming real mode, compute our physical

address*/

lAddress = ((DWORD) wSegment << 4) + wOffset;

_SetEXRegByte(DMACLRBP, 0x0); /*Clear the byte pointer flip-flop */

/* Write target address, bits 0-7 */

_SetEXRegByte(addrDMATar0_1, (BYTE) (lAddress & 0xFF));

/* Write target address, bits 8-15 */

_SetEXRegByte(addrDMATar0_1, (BYTE) ((lAddress >> 8) & 0xFF));

/* Write target address, bits 16-23 */

_SetEXRegByte(addrDMATar2, (BYTE) ((lAddress >> 16) & 0xFF));

/* Write target address, bits 24-25 */

_SetEXRegByte(addrDMATar3, (BYTE) ((lAddress >> 24) & 0x03));

return ERR_NONE;

}

/*****************************************************************************

SetDMAXferCount:

Description:

Sets the target memory device for the DMA channel specified

by nChannel

PARAMETERS:

nChannel

--channel for which to set target address

ptMemory

--pointer to target memory location

Returns:

None

Assumptions:

Processor is in real mode.

Syntax:

static char lpsz[]=”Hello World”;

SetDMATargMemAddr(DMA_Channel0, lpsz);

Real/Protected Mode:

The address calculation from ptMemory assumes the processor is in real

mode.