diff src/timer/mint/SDL_systimer.c @ 1895:c121d94672cb

SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 21:04:37 +0000
parents 92947e3a18db
children eb5e61b72da3
line wrap: on
line diff
--- a/src/timer/mint/SDL_systimer.c	Thu Jul 06 18:01:37 2006 +0000
+++ b/src/timer/mint/SDL_systimer.c	Mon Jul 10 21:04:37 2006 +0000
@@ -51,107 +51,116 @@
 /* The first ticks value of the application */
 static Uint32 start;
 static SDL_bool supervisor;
-static int mint_present; /* can we use Syield() ? */
+static int mint_present;        /* can we use Syield() ? */
 
-void SDL_StartTicks(void)
+void
+SDL_StartTicks(void)
 {
-	void *oldpile;
-	unsigned long dummy;
+    void *oldpile;
+    unsigned long dummy;
 
-	/* Set first ticks value */
-	oldpile=(void *)Super(0);
-	start=*((volatile long *)_hz_200);
-	Super(oldpile);
+    /* Set first ticks value */
+    oldpile = (void *) Super(0);
+    start = *((volatile long *) _hz_200);
+    Super(oldpile);
 
-	start *= 5;	/* One _hz_200 tic is 5ms */
+    start *= 5;                 /* One _hz_200 tic is 5ms */
 
-	mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
+    mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
 }
 
-Uint32 SDL_GetTicks (void)
+Uint32
+SDL_GetTicks(void)
 {
-	Uint32 now;
-	void *oldpile=NULL;
+    Uint32 now;
+    void *oldpile = NULL;
 
-	/* Check if we are in supervisor mode 
-	   (this is the case when called from SDL_ThreadedTimerCheck,
-	   which is called from RunTimer, running in the vbl vector)
-	*/
-	if (!supervisor) {
-		oldpile=(void *)Super(0);
-	}
+    /* Check if we are in supervisor mode 
+       (this is the case when called from SDL_ThreadedTimerCheck,
+       which is called from RunTimer, running in the vbl vector)
+     */
+    if (!supervisor) {
+        oldpile = (void *) Super(0);
+    }
 
-	now=*((volatile long *)_hz_200);
+    now = *((volatile long *) _hz_200);
 
-	if (!supervisor) {
-		Super(oldpile);
-	}
+    if (!supervisor) {
+        Super(oldpile);
+    }
 
-	return((now*5)-start);
+    return ((now * 5) - start);
 }
 
-void SDL_Delay (Uint32 ms)
+void
+SDL_Delay(Uint32 ms)
 {
-	Uint32 now;
+    Uint32 now;
 
-	now = SDL_GetTicks();
-	while ((SDL_GetTicks()-now)<ms){
-		if (mint_present) {
-			Syield();
-		}
-	}
+    now = SDL_GetTicks();
+    while ((SDL_GetTicks() - now) < ms) {
+        if (mint_present) {
+            Syield();
+        }
+    }
 }
 
 /* Data to handle a single periodic alarm */
-static SDL_bool timer_installed=SDL_FALSE;
+static SDL_bool timer_installed = SDL_FALSE;
 
-static void RunTimer(void)
+static void
+RunTimer(void)
 {
-	supervisor=SDL_TRUE;
-	SDL_ThreadedTimerCheck();
-	supervisor=SDL_FALSE;
+    supervisor = SDL_TRUE;
+    SDL_ThreadedTimerCheck();
+    supervisor = SDL_FALSE;
 }
 
 /* This is only called if the event thread is not running */
-int SDL_SYS_TimerInit(void)
+int
+SDL_SYS_TimerInit(void)
 {
-	void *oldpile;
+    void *oldpile;
 
-	supervisor=SDL_FALSE;
+    supervisor = SDL_FALSE;
 
-	/* Install RunTimer in vbl vector */
-	oldpile=(void *)Super(0);
-	timer_installed = !SDL_AtariVblInstall(RunTimer);
-	Super(oldpile);
+    /* Install RunTimer in vbl vector */
+    oldpile = (void *) Super(0);
+    timer_installed = !SDL_AtariVblInstall(RunTimer);
+    Super(oldpile);
 
-	if (!timer_installed) {
-		return(-1);
-	}
-	return(SDL_SetTimerThreaded(0));
+    if (!timer_installed) {
+        return (-1);
+    }
+    return (SDL_SetTimerThreaded(0));
 }
 
-void SDL_SYS_TimerQuit(void)
+void
+SDL_SYS_TimerQuit(void)
 {
-	void *oldpile;
+    void *oldpile;
 
-	if (timer_installed) {
-		/* Uninstall RunTimer vbl vector */
-		oldpile=(void *)Super(0);
-		SDL_AtariVblUninstall(RunTimer);
-		Super(oldpile);
-		timer_installed = SDL_FALSE;
-	}
+    if (timer_installed) {
+        /* Uninstall RunTimer vbl vector */
+        oldpile = (void *) Super(0);
+        SDL_AtariVblUninstall(RunTimer);
+        Super(oldpile);
+        timer_installed = SDL_FALSE;
+    }
 }
 
-int SDL_SYS_StartTimer(void)
+int
+SDL_SYS_StartTimer(void)
 {
-	SDL_SetError("Internal logic error: MiNT uses vbl timer");
-	return(-1);
+    SDL_SetError("Internal logic error: MiNT uses vbl timer");
+    return (-1);
 }
 
-void SDL_SYS_StopTimer(void)
+void
+SDL_SYS_StopTimer(void)
 {
-	return;
+    return;
 }
 
 #endif /* SDL_TIMER_MINT */
+/* vi: set ts=4 sw=4 expandtab: */