endianness : Re: timer.c and ckinit.c Re: Timer resolution et al : Read_timer()

sashti srinivasan svasn_rtems at yahoo.com
Sat Mar 13 09:39:19 UTC 2004


Hello,
 
    Lots of thanks for making things much clearer. 
Now I hope that I am somewhat clear, still I have
one problem in Read_timer() related to the endianness
of x86.  Here is a fragment from this routine:
 
These lines latch the value of timer0, then reads lsb
 first and msb next.
   outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_LATCH);
   inport_byte(TIMER_CNTR0, lsb);
   inport_byte(TIMER_CNTR0, msb);
 
 This lines store two bytes on variable clicks.
   clicks = (msb << 8) | lsb;
 
 My doubt is, since i386 is little endian, why this
 line is written like this instead of:
   clicks = (lsb << 8) | msb;
 
    I guess whatever is written already is correct,
 something is wrong with my understanding.  Very
 sorry if my doubt is a trivial one.
 
 With Regards
 Srinivasan
 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com



More information about the users mailing list