KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
timer.h File Reference

Low-level timer functionality. More...

#include <stdint.h>
#include <kos/cdefs.h>
#include <arch/irq.h>
#include <time.h>
#include <kos/timer.h>

Go to the source code of this file.

Data Structures

struct  timer_val_t
 Structure that holds timer values in seconds + ticks. More...
 

Macros

#define TMU0   0
 SH4 Timer Channel 0.
 
#define TMU1   1
 SH4 Timer Channel 1.
 
#define TMU2   2
 SH4 Timer Channel 2.
 

Typedefs

typedef void(* timer_primary_callback_t) (irq_context_t *)
 Primary timer callback type.
 

Functions

int timer_prime (int channel, uint32_t speed, int interrupts)
 Pre-initialize a timer channel, but do not start it.
 
int timer_start (int channel)
 Start a timer channel.
 
int timer_stop (int channel)
 Stop a timer channel.
 
int timer_running (int channel)
 Checks whether a timer channel is running.
 
uint32_t timer_count (int channel)
 Obtain the count of a timer channel.
 
int timer_clear (int channel)
 Clear the underflow bit of a timer channel.
 
void timer_enable_ints (int channel)
 Enable high-priority timer interrupts.
 
void timer_disable_ints (int channel)
 Disable timer interrupts.
 
int timer_ints_enabled (int channel)
 Check whether interrupts are enabled on a timer channel.
 
timer_val_t __dreamcast_get_ticks (void)
 Get the current uptime of the system (in seconds and ticks).
 
static struct timespec arch_timer_gettime (void)
 Get the current uptime of the system (in seconds and nanoseconds).
 
timer_primary_callback_t timer_primary_set_callback (timer_primary_callback_t callback)
 Set the primary timer callback.
 
void timer_primary_wakeup (uint32_t millis)
 Request a primary timer wakeup.
 

Detailed Description

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.

See also
arch/rtc.h
dc/wdt.h
Author
Megan Potter
Falco Girgis