www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/11/06:45:03

From: "Tims News" <ttodd_nospam AT cct DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: DMA, Pointers and Physical Memory
Date: Fri, 11 May 2001 11:42:10 +0100
Message-ID: <989577210.22969.0.nnrp-02.c30b1810@news.demon.co.uk>
NNTP-Posting-Host: [195.11.24.16]
X-NNTP-Posting-Host: [195.11.24.16]:195.11.24.16
X-Trace: news.demon.co.uk 989577210 nnrp-02:22969 NO-IDENT [195.11.24.16]:195.11.24.16
X-Complaints-To: abuse AT demon DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Lines: 55
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

I am currently working on MultiBus II Message Passing and have hit a small
problem with the DMA transfer.

I need to convert a standard pointer (eg. struct mystruct* pInstance) to a
PHYSICAL memory address.  This is not the address of the data to be
transferred (that seems well documented in the FAQ - although I haven't
tried the code yet), this is for the DMA command block.

The code I have at present, does not seem to be working - can anybody help
me please.  Also, PLEASE PLEASE PLEASE, if you send me a "read faq entry n"
could you please also include the link for the FAQ to which you refer - as
far as I can make out there are a number of (all sleightly) different ones
around - Thank You :)

By means of further explanation, below is a snippet of my code:


main()
{

struct cb_short1*    pCmd;

cb_short.info=some_stuff;
AdmaStart(1,pCmd);

}

void     AdmaStart(UINT8 chan, struct cb_short1* pCmd)
{

UINT32  Physical;
UINT16  Selector;

// Convert pointer to physical memory location
  Selector = *((UINT16*)(((UINT8*)(&pCmd))+4));
  __dpmi_get_segment_base_address((UINT32)Selector, &Physical);
  Physical += *((UINT32*)(&pCmd));

// Address of command block
  outportb(CPRL +(CHAN_SEP*chan), Physical &0xFF );
  outportb(CPRH +(CHAN_SEP*chan), (Physical>>16) &0xFF );

// GO!
  outportb(GCR, 1<<(chan+4) |0x0A);

}



Tim
=%¬}


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019