To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3026
  sys_time (long post)
 
As I was poking around in the BrickOS kernel, it occurred to me that using the sys_time variable isn't entirely safe. Since sys_time is 32-bits and the processor can only read 16-bits at a time into a register, there is a period of time between the (...) (22 years ago, 12-Dec-02, to lugnet.robotics.rcx.legos)
 
  Re: sys_time (long post)
 
Mark, Excellent Post ! Ok, I will admit it; I was the one that put the sys_time handler on the NMI. 8-) I guess I will want to think about this a bit; but I see that you have done a good bit of that yourself. ... Could the 'Get' function do the (...) (22 years ago, 12-Dec-02, to lugnet.robotics.rcx.legos)
 
  Re: sys_time (long post)
 
(...) It turns out that the nature of the glitch depends on the order you read the upper and lower 16-bits of sys_time. If the compiler generates code that reads the high word first (which it seems to do), then your example will work. However, if (...) (22 years ago, 13-Dec-02, to lugnet.robotics.rcx.legos)
 
  Re: sys_time (long post)
 
Does the H8 let an interrupt interrupt an interrupt? (Or at least the interrupts that matter in this case?) You two might want to check on that. It would seem the code is safe if the answer to the first question is no... ? Maybe I'm missing (...) (22 years ago, 13-Dec-02, to lugnet.robotics.rcx.legos)
 
  Re: sys_time (long post)
 
(...) I went back and read... I was missing something apparently... Note to self... do not skim. -Kekoa (22 years ago, 13-Dec-02, to lugnet.robotics.rcx.legos)
 
  Re: sys_time (long post)
 
Only a suggestion, In any processor architecture (with or without disabling or recursive interrupts) when I need to read timers with more than 1 single instruction I do the following: Read the timer (both low and high value) until I get 2 times the (...) (22 years ago, 16-Dec-02, to lugnet.robotics.rcx.legos)

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR