osStopTimer osStopTimer (function)

osSetTimer, osStopTimer

Starts/stops an interval or countdown timer


#include <ultra64.h>     /* ultra64.h */
int osSetTimer(OSTimer *timer, OSTime countdown, OSTime interval, 
               OSMesgQueue *mq, OSMesg msg);
void osStopTimer(OSTimer *timer);


The osSetTimer function enables timer operations by (among things) setting the timer value specified by an argument into the OSTimer structure variable timer reserved by the application, and then passing this to the OS. This function call supports both countdown timers and interval timers.
If "countdown" is non-zero, it indicates the duration to the next end of the timer. If "interval" is non-zero, it specifies the value to be used when resetting the timer after it ends.
(If "countdown" is zero when "interval" is non-zero, the value of "interval" is also used as the value for the first timer.)
The message "msg" is sent unblocked to the message queue "mq" when the timer ends. osSetTimer always returns 0.

osStopTimer stops the specified interval timer. This function does not need to be called if the osSetTimer call only involves countdown timers.

Both countdown and interval are expressed in CPU count register cycles. This timer increments at 46.875 MHz, with 1 cycle represents approximately 21.33 nanoseconds. See OS_CYCLES_TO_NSEC and related macros for ways of converting between counter cycles and time in nanoseconds and microseconds.

To avoid any reduction in overall system performance, do not set time value at less than 50 microseconds.


Since the VI Manager performs timer management, you must activate the VI Manager with osCreateViManager before using this function.

See Also


Revision history

1999/06/15 Completely revised