On 2/25/08, Kevin Cozens <> wrote:
>
> Martin Guy wrote:
> > You'll find what you need in the ARM920T Technical Reference
> > Manual, section 12: "Instruction cycle summary".
>
> Thanks for the pointer, Martin. The ARM being a RISC based chip meant that
> the
> instruction set summary and timings is a little different than I'm used to
> seeing.
>
> A delay routine uses sub and bne. I didn't find a specific reference to
> either
> instruction in the manual. I took a guess that subs takes 1 cycle and bne
> takes 2 when the branch is taken and 1 when not.
>
> Using the above assumptions, I set up several #defines for use in my LCD
> output routines to calculate all the delays from a master #define which
> specifies the CPU clock rate in MHz.
I'm not sure why you would want to count cycles when you're running a
multi-user, non-realtime OS (and your code is running from
userland...) If you're already eating up CPU cycles, you may as well
do a loop around the gettimeofday() function. This will let you delay
your program with microsecond resolution (disregarding the odd 10ms
bumps that every userland process experiences.) If your delays are <
10us, then I suppose counting cycles may be a better choice, otherwise
gettimeofday() should be just fine. Remember, it isn't a 8086 or a
microcontroller, there is a lot more going, and accuracy in timing is
incredibly poor (for sub 10ms resolutions.)
-Mark C.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|