The tstart, tfree, talloc, and tstop services provide fine-resolution timing functions. These timer services should be used when the following conditions are required:
The Watchdog timer services can be used for noncritical times having a one-second resolution. The timeout service can be used for noncritical times having a clock-tick resolution.
The trb (timer request) structure is found in the /sys/timer.h file. The itimerstruc_t structure contains the second/nanosecond structure for time operations and is found in the sys/time.h file.
The itimerstruc_t t.it value substructure should be used to store time information for both absolute and incremental timers. The T_ABSOLUTE absolute request flag is defined in the sys/timer.h file. It should be ORed into the t->flag field if an absolute timer request is desired.
The T_LOWRES flag causes the system to round the t->timeout value to the next timer timeout. It should be ORed into the t->flags field. The timeout is always rounded to a larger value. Because the system maintains 10ms interval timer, T_LOWRES will never cause more than 10ms to be added to a timeout. The advantage of using T_LOWRES is that it prevents an extra interrupt from being generated.
The t->timeout and t->flags fields must be set or reset before each call to the tstart kernel service.
The t->func timer function should be declared as follows:
void func (t) struct trb *t;
The argument to the func completion handler routine is the address of the trb structure, not the contents of the t_union field.
The t->func timer function is called on an interrupt level. Therefore, code for this routine must follow conventions for interrupt handlers.