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.c File Reference

#include "SoTimer.h"
#include "SoIntManager.h"
#include "SoDebug.h"

Data Structures

struct  tag_Timer
 Timer register overlay struct;. More...


Functions

void SoTimerClockHandler (void)
 Clock interrupt handler.

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

void SoTimerClockReset (void)
 Resets the clock.

void SoTimerClockDisable (void)
 Disables 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.

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

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.


Variables

u32 s_NumTotalSeconds
 Total number of seconds elapsed since clock start.

u32 s_NumSeconds
 seconds portion of time elapsed since clock start.

u32 s_NumMinutes
 minutes portion of time elapsed since clock start.

u32 s_NumHours
 hours portion of time elapsed since clock start.

u32 s_NumDays
 days portion of time elapsed since clock start.

s8 s_ClockTimerID
tag_Timers_Timer
 Timer register overlay struct;.


Detailed Description

Copyright (C) 2002 by the SGADE authors For conditions of distribution and use, see copyright notice in SoLicense.txt

Author:
Jaap Suter, Eric Rounds, Mark T. Price
Date:
May 23, 2003
See the SoTimer module for more information.


Function Documentation

void SoTimerClockHandler void   
 

Clock interrupt handler.

For internal use only.

This function is called every clock second, to update the clock values.


Variable Documentation

s8 s_ClockTimerID [static]
 

For internal use only.

Timer ID the clock is currently using. Valid values are [0..3] for IRQ's and -1 when the clock is not in use. This also means that s_ClockTimerID + SO_INTERRUPT_TYPE_TIMER_0 equals the interrupt for the clock (when calling SoInterruptManager functions).

u32 s_NumDays [static]
 

days portion of time elapsed since clock start.

For internal use only.

u32 s_NumHours [static]
 

hours portion of time elapsed since clock start.

For internal use only.

u32 s_NumMinutes [static]
 

minutes portion of time elapsed since clock start.

For internal use only.

u32 s_NumSeconds [static]
 

seconds portion of time elapsed since clock start.

For internal use only.

u32 s_NumTotalSeconds [static]
 

Total number of seconds elapsed since clock start.

For internal use only.

struct tag_Timer * s_Timer [static]
 

Timer register overlay struct;.

For internal use only.

This struct is put over the timer registers on the GBA, so we can easily acces different timers.


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