Mercurial > sdl-ios-xcode
diff src/timer/nds/SDL_systimer.c @ 2696:0b395a60deff gsoc2008_nds
Timers work now.
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Mon, 18 Aug 2008 07:29:52 +0000 |
parents | e858ac8868b6 |
children | e1da92da346c |
line wrap: on
line diff
--- a/src/timer/nds/SDL_systimer.c Sun Aug 17 09:50:28 2008 +0000 +++ b/src/timer/nds/SDL_systimer.c Mon Aug 18 07:29:52 2008 +0000 @@ -28,7 +28,10 @@ #include "SDL_timer.h" #include "../SDL_timer_c.h" +#include "../SDL_systimer.h" +/* Data to handle a single periodic alarm */ +static int timer_alive = 0; static Uint32 timer_ticks; void @@ -57,10 +60,6 @@ } } -/* Data to handle a single periodic alarm */ -static int timer_alive = 0; -static int timer_ticks = 0; - static int RunTimer(void *unused) { @@ -72,8 +71,8 @@ return (0); } -void NDS_TimerInterrupt() { - printf("timer irq\n"); +void NDS_TimerInterrupt(void) { + timer_ticks++; } /* This is only called if the event thread is not running */ @@ -82,9 +81,10 @@ { timer_alive = 1; timer_ticks = 0; - TIMER_CR(0) = TIMER_DIV_1024 | TIMER_IRQ_REQ; - TIMER_DATA(0) = TIMER_FREQ_1024(1000); - irqSet(IRQ_TIMER1, NDS_TimerInterrupt); + TIMER_CR(3) = TIMER_DIV_1024 | TIMER_IRQ_REQ; + TIMER_DATA(3) = TIMER_FREQ_1024(1000); + irqSet(IRQ_TIMER3, NDS_TimerInterrupt); + irqEnable(IRQ_TIMER3); return 0; } @@ -92,22 +92,23 @@ SDL_SYS_TimerQuit(void) { if (timer_alive) { - TIMER_CR(0) = 0; + TIMER_CR(3) = 0; } timer_alive = 0; + irqDisable(IRQ_TIMER3); } int SDL_SYS_StartTimer(void) { - TIMER_CR(0) |= TIMER_ENABLE; + TIMER_CR(3) |= TIMER_ENABLE; return 0; } void SDL_SYS_StopTimer(void) { - TIMER_CR(0) &= ~TIMER_ENABLE; + TIMER_CR(3) &= ~TIMER_ENABLE; return; }