GBA System Timer
[System Support]

Collaboration diagram for GBA System Timer:


Detailed Description

Nut/OS System Timer implemented on the GBA.


Defines

#define NUT_CPU_FREQ   1000000UL
#define NUT_TICK_FREQ   1000UL

Functions

void NutDelay (u_char ms)
 Loop for a specified number of milliseconds.
void Timer3Entry (void *arg)
 Timer 0 interrupt entry.
void NutRegisterTimer (void(*handler)(void *))
 Initialize system timer hardware.
u_long NutGetCpuClock (void)
 Return the CPU clock in Hertz.
u_long NutGetTickClock (void)
 Return the number of system ticks per second.
u_long NutTimerMillisToTicks (u_long ms)
 Calculate system ticks for a given number of milliseconds.


Define Documentation

#define NUT_CPU_FREQ   1000000UL

Definition at line 79 of file ostimer_gba.c.

#define NUT_TICK_FREQ   1000UL

Definition at line 83 of file ostimer_gba.c.


Function Documentation

void NutDelay ( u_char  ms  ) 

Loop for a specified number of milliseconds.

This call will not release the CPU and will not switch to another thread. However, because of absent thread switching, this delay time is very exact.

Use NutSleep() to avoid blocking the CPU, if no exact timing is needed.

Bug:
This function is a miserable hack.
Parameters:
ms Delay time in milliseconds, maximum is 255.

Definition at line 103 of file ostimer_gba.c.

void Timer3Entry ( void *  arg  ) 

Timer 0 interrupt entry.

Definition at line 118 of file ostimer_gba.c.

References INT_TMR3, outw, and REG_IF.

Referenced by NutRegisterTimer().

void NutRegisterTimer ( void(*)(void *)  handler  ) 

Initialize system timer hardware.

This function is automatically called by Nut/OS during system initialization.

Nut/OS uses on-chip timer 0 for its timer services. Applications should not modify any registers of this timer, but make use of the Nut/OS timer API. Timer 1 and timer 2 are available to applications.

Definition at line 135 of file ostimer_gba.c.

References INT_TMR3, inw, NutRegisterIrqHandler(), outdw, outw, REG_IE, REG_IME, REG_TMR3CNT, sig_TMR3, Timer3Entry(), TMR_ENA, and TMR_IRQ_ENA.

u_long NutGetCpuClock ( void   ) 

Return the CPU clock in Hertz.

Returns:
CPU clock frequency in Hertz, which is 16780000 for the GBA.

Definition at line 161 of file ostimer_gba.c.

References NUT_CPU_FREQ.

u_long NutGetTickClock ( void   ) 

Return the number of system ticks per second.

Returns:
System tick frequency in Hertz.

Definition at line 171 of file ostimer_gba.c.

References NUT_TICK_FREQ.

u_long NutTimerMillisToTicks ( u_long  ms  ) 

Calculate system ticks for a given number of milliseconds.

Definition at line 179 of file ostimer_gba.c.

References NutGetTickClock().


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/