The SGADE Documentation

the SGADE The Socrates Gameboy Advance Development Engine

The SGADE is a development library for the Nintendo Gameboy Advance. It's free for all uses and is distributed without guarantees. For more information visit the SGADE page.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoTimer

All timer related stuff. More...

Files

file  SoTimer.c
file  SoTimer.h

Functions

void SoTimerClockEnable (u32 a_TimerID)
 Enables and starts the clock.

u32 SoTimerClockGetTimerID (void)
 Returns the timer that is used by the clock, if one is used at all.

void SoTimerClockDisable (void)
 Disables the clock;.

void SoTimerClockReset (void)
 Resets the clock.

void SoTimerClockPause (void)
 Pauses the clock.

void SoTimerClockResume (void)
 Resumes the clock.

u32 SoTimerClockGetTotalSeconds (void)
 Returns the total number of seconds of the clock.

u32 SoTimerClockGetTotalMilliseconds (void)
 Returns the total number of seconds of the clock.

u32 SoTimerClockGetSeconds (void)
 Returns the number of seconds of the clock.

u32 SoTimerClockGetMinutes (void)
 Returns the number of minutes of the clock.

u32 SoTimerClockGetHours (void)
 Returns the number of hours of the clock.

u32 SoTimerClockGetDays (void)
 Returns the number of days of the clock.

void SoTimerClockSet (u32 a_NumDays, u32 a_NumHours, u32 a_NumMinutes, u32 a_NumSeconds)
 Sets the clock to the given value.

void SoTimerWait (u32 a_TimerID, u32 a_NumMilliSeconds)
 Halts the CPU for the given time. Interrupts are still executed.

void SoTimerEnableForDirectSound (u32 a_TimerID)
 This enables the given timer for direct sound purposes.


Detailed Description

All timer related stuff.

Singleton

At the moment this module contains a clock and a wait-routine. It also contains some functions to setup timers for using them together with the SoSound module.


Function Documentation

void SoTimerClockEnable u32    a_TimerID
 

Enables and starts the clock.

Parameters:
a_TimerID  The timer you want the clock to use. Range in [0..3].
Warning:
Note that something else (direct sound for example) might already be using this timer, so make sure you pick a free one.
The given timer will be in use until you call SoTimerClockDisable. So do not use the timer for anything else in between.

u32 SoTimerClockGetDays void   
 

Returns the number of days of the clock.

Returns :
Number of days of the clock.

u32 SoTimerClockGetHours void   
 

Returns the number of hours of the clock.

Returns :
Number of hours of the clock.

u32 SoTimerClockGetMinutes void   
 

Returns the number of minutes of the clock.

Returns :
Number of minutes of the clock.

u32 SoTimerClockGetSeconds void   
 

Returns the number of seconds of the clock.

Returns :
Number of seconds of the clock.

u32 SoTimerClockGetTimerID void   
 

Returns the timer that is used by the clock, if one is used at all.

Returns :
0, 1, 2, or 3 if the clock is enabled, -1 if no timer is used by the clock.

u32 SoTimerClockGetTotalMilliseconds void   
 

Returns the total number of seconds of the clock.

Returns :
Total number of 'milliseconds' of the clock (actually number of 1024th seconds).

u32 SoTimerClockGetTotalSeconds void   
 

Returns the total number of seconds of the clock.

Returns :
Total number of seconds of the clock.

void SoTimerClockSet u32    a_NumDays,
u32    a_NumHours,
u32    a_NumMinutes,
u32    a_NumSeconds
 

Sets the clock to the given value.

Parameters:
a_NumDays  Number of days you want to set the clock to.
a_NumHours  Number of hours you want to set the clock to.
a_NumMinutes  Number of minutes you want to set the clock to.
a_NumSeconds  Number of seconds you want to set the clock to.

void SoTimerEnableForDirectSound u32    a_TimerID
 

This enables the given timer for direct sound purposes.

Parameters:
a_TimerID  Timer you want to use. Note that only timer and 0 and 1 are available for direct sound purposes. Do not supply 2 or 3.
Warning:
Make sure the timer you supply is free, and not in use by something else (the clock for example). This is up to you to take care of.

void SoTimerWait u32    a_TimerID,
u32    a_NumMilliSeconds
 

Halts the CPU for the given time. Interrupts are still executed.

Parameters:
a_TimerID  Timer you want the wait to use. Range in [0..3].
a_NumMilliSeconds  Number of milliseconds you want to wait.
Warning:
Note that something else (the clock, or a direct sound channel for example) might already be using the timer, so make sure you pick a free one. This is up to you to take care of.
Upon returning the timer is free to use again. The timer is only used inside the function.


Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.