Low-level timer functionality. More...
#include <sys/cdefs.h>
#include <arch/types.h>
#include <arch/irq.h>
Go to the source code of this file.
Low-level timer functionality.
This file contains functions for interacting with the timer sources on the SH4. Many of these functions may interfere with thread operation or other such things, and should thus be used with caution. Basically, the only functionality that you might use in practice in here in normal programs is the gettime functions.
Which timer does the thread system use?
SH4 Timer 0.
This timer is used for thread operation, and thus is off limits if you want that to work properly.
SH4 Timer 1.
This timer is used for the timer_spin_sleep() function.
SH4 Timer 2.
This timer is used by the various gettime functions in this header.
SH4 Watchdog Timer.
KallistiOS does not currently support using this timer.
Primary timer callback type.
Clear the underflow bit of a timer.
This function clears the underflow bit of a timer if it was set.
Obtain the count of a timer.
This function simply returns the count of the timer.
Disable timer interrupts.
This function disables interrupts on the specified timer.
Enable high-priority timer interrupts.
This function enables interrupts on the specified timer.
Check whether interrupts are enabled on a timer.
This function checks whether or not interrupts are enabled on the specified timer.
Get the current uptime of the system.
This function retrieves the number of seconds and milliseconds since KOS was started.
Get the current uptime of the system (in milliseconds).
This function retrieves the number of milliseconds since KOS was started. It is equivalent to calling timer_ms_gettime() and combining the number of seconds and milliseconds into one 64-bit value.
Set the primary timer callback.
This function sets the primary timer callback to the specified function pointer. Generally, you should not do this, as the threading system relies on the primary timer to work.
Request a primary timer wakeup.
This function will wake the caller (by calling the primary timer callback) in approximately the number of milliseconds specified. You can only have one timer wakeup scheduled at a time. Any subsequently scheduled wakeups will replace any existing one.
Pre-initialize a timer, but do not start it.
This function sets up a timer for use, but does not start it.
Start a timer.
This function starts a timer that has been initialized with timer_prime(), starting raising interrupts if applicable.
Stop a timer.
This function stops a timer that was started with timer_start(), and as a result stops interrupts coming in from the timer.
Get the current uptime of the system (in microseconds).
This function retrieves the number of microseconds since KOS was started. It should be more precise, in theory, than timer_ms_gettime64(), but the exact amount of preciseness is undetermined.