Mail Archives: djgpp/2003/06/25/22:53:28
From: | "Simon" <simonhch AT yahoo DOT com DOT tw>
|
To: | <djgpp AT delorie DOT com>
|
Subject: | Using UDMA with DJGPP
|
Date: | Thu, 26 Jun 2003 10:52:40 +0800
|
Message-ID: | <000201c33b8e$136f1e30$2810a8c0@epo.com.tw>
|
MIME-Version: | 1.0
|
X-Priority: | 3 (Normal)
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook, Build 10.0.4024
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1106
|
Importance: | Normal
|
Sorry, Email again...
I want to use UDMA, but I don't know how to get the physical address of
the buffer I allocate for that purpose
For BCC code fragment :
// Builds the PRD table for the given buffer address and size
int build_PRD_table(unsigned int far *buffer, unsigned long size)
{
register unsigned long linear_address = ((unsigned
long)FP_SEG(buffer) << 4) + FP_OFF(buffer);
register unsigned long residual_size = size;
unsigned long int temp_size;
// Use 2's complement to caculate
if ((temp_size = (-linear_address) & 0x0000FFFFL) == 0)
temp_size = 0x10000L;
PRD_table[0].base_addr = linear_address;
PRD_used = 1;
if (residual_size <= temp_size) // one PRD is enough?
{
PRD_table[0].byte_count = residual_size;
PRD_table[0].eot = 0x8000;
return(1);
}
else
{
PRD_table[0].eot = 0;
PRD_table[0].byte_count = temp_size;
linear_address += temp_size;
residual_size -= temp_size;
}
while (residual_size > 0x10000L)
{
PRD_table[PRD_used].base_addr = linear_address;
PRD_table[PRD_used].byte_count = 0; // 0 idicates 64K
bytes
PRD_table[PRD_used++].eot = 0;
linear_address += 0x10000L;
residual_size -= 0x10000L;
}
PRD_table[PRD_used].base_addr = linear_address;
PRD_table[PRD_used].byte_count = residual_size;
PRD_table[PRD_used++].eot = 0x8000;
return(1);
}
How to get linear_address ?
DJGPP not support FP_SEG() and FP_OFF() macro.
Thanks your help.
- Raw text -