libdragon
Defines | Functions | Variables
timer.c File Reference

Timer Subsystem. More...

#include <malloc.h>
#include "libdragon.h"
#include "regsinternal.h"

Defines

#define read_count(x)   asm volatile("mfc0 %0,$9\n\t nop \n\t" : "=r" (x) : )
 Read the count out of the count register.
#define write_count(x)   asm volatile("mtc0 %0,$9\n\t nop \n\t" : : "r" (x) )
 Write the count to the count register.
#define write_compare(x)   asm volatile("mtc0 %0,$11\n\t nop \n\t" : : "r" (x) )
 Set the compare register.

Functions

static int __proc_timers (timer_link_t *head)
 Process linked list of timers.
static void timer_callback (void)
 Timer callback function.
void timer_init (void)
 Initialize the timer subsystem.
timer_link_tnew_timer (int ticks, int flags, void(*callback)(int ovfl))
 Create a new timer and add to list.
void start_timer (timer_link_t *timer, int ticks, int flags, void(*callback)(int ovfl))
 Start a timer not currently in the list.
void stop_timer (timer_link_t *timer)
 Stop a timer and remove it from the list.
void delete_timer (timer_link_t *timer)
 Remove a timer from the list and delete it.
void timer_close (void)
 Free and close the timer subsystem.
long long timer_ticks (void)
 Return total ticks since timer was initialized.

Variables

static timer_link_tTI_timers = 0
 Internal linked list of timers.
static long long total_ticks
 Total ticks elapsed since timer subsystem initialization.

Detailed Description

Timer Subsystem.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines