Internal Timer <timer.h>

Top  Previous  Next

The C6000 has two internal timers: Timer 0 is controlled by the microkernel while timer 1 is available for user programs.

 

User programs cannot access timer 0 directly, but instead use the <timer.h> functions which work from an internal clock maintained by the microkernel. The timer currently ticks 1000 times a second, and so has a resolution of 1msec. Note that this applies to threads of all priorities. It is possible that this rate of ticking may be changed in future releases of Diamond. Rather than assume a rate of 1000 ticks a second you should use the value returned by the library function timer_rate; this always returns the correct rate.

 

If your module’s processor clock does not tick at the rate defined in the standard processor type for that module, you can change the rate using the CLOCK attribute of the configurer’s PROCESSOR statement. The CLOCK attribute can also be used to prevent the kernel from using TIMER 0.

 


timer_after

indicates whether one clock value is later than another


timer_delay

wait at least a specified number of kernel clock ticks


timer_now

returns the kernel’s current clock value


timer_wait

wait until the kernel’s clock reaches some value


timer_rate

return number of kernel clock ticks per second (currently 1000)