Re[2]: Dos2Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> static union {
>>   unsigned int *a;      // One 32 bits address
>>   unsigned long  l;     // One 32 bits long
>>   unsigned int w[2];    // Two 16 bits words
>>   unsigned char  b[4];  // Four 8 bits bytes
>> } DMAaddr;
>> 
>> ...
>> static void setadr( unsigned int far *buff, unsigned int length )
>> {
>>   unsigned int lw;
>> 
>>   lw = FP_SEG( buff );                // Segment address of buffer
>>   DMAaddr.w[1] = ( lw >> 12 ) & 0xf;    // Makes real 32bit address
>>   DMAaddr.w[0] = ( lw << 4 ) & 0xfff0;
>>   DMAaddr.l += ( unsigned long )FP_OFF( buff );
>>   DMAcntr.w = length;
>> }
>> 

Right so I'd suspect that, as you say, you can drop the 'far' qualifier and
instead of FP_SEG and FP_OFF, you could probably just write:

static void setadr( unsigned int *buf, unsigned int length )
{
    DMAaddr.a = buf;
    DMAcntr.w = length;
}

Hmm .. further thoughts ... physical/ virtual addresses. What address space does
this function run in? If you're doing stuff with DMA, you need to make sure
you're using a physical address (and one that's not going to be swapped out).

Comments?

Matt
   
----------------------------------------------------------------------
The contents of this communication are confidential to the normal user of
the email address to which it was sent.  If you have received this email
in error, any use, dissemination, forwarding, printing or copying of this
email is strictly prohibited.  If this is the case, please notify the
sender and delete this message.
----------------------------------------------------------------------
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux