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;
>> }
>> 
>
>Pointers in the tiny and small memory models are called "near pointers"
>because you only need the offset of the pointer within a segment. The
>other memory models used so called "far pointers" which means that a
>pointer contains a segment and an offset. To be able to specify what
>kind of pointers you meant, the C language had the "near" and "far"
>extensions.

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;
}

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