Mercurial > sdl-ios-xcode
diff src/timer/mint/SDL_systimer.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | 92947e3a18db |
children | 4da1ee79c9af |
line wrap: on
line diff
--- a/src/timer/mint/SDL_systimer.c Sun May 21 17:27:13 2006 +0000 +++ b/src/timer/mint/SDL_systimer.c Sun May 28 13:04:16 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: */