Added initial support for Dreamcast (thanks HERO!)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40510
This commit is contained in:
Sam Lantinga 2002-10-05 16:50:56 +00:00
parent 148a1a64f4
commit 3ee2de057f
43 changed files with 2847 additions and 4 deletions

View file

@ -5,6 +5,7 @@ noinst_LTLIBRARIES = libtimer.la
ARCH_SUBDIRS = $(srcdir)/amigaos \
$(srcdir)/beos \
$(srcdir)/dc \
$(srcdir)/epoc \
$(srcdir)/linux \
$(srcdir)/macos \

106
src/timer/dc/SDL_systimer.c Normal file
View file

@ -0,0 +1,106 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
BERO
bero@geocities.co.jp
based on win32/SDL_systimer.c
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#include <kos.h>
#include "SDL_thread.h"
#include "SDL_timer.h"
#include "SDL_error.h"
#include "SDL_timer_c.h"
static unsigned start;
/*
jif = ms * HZ /1000
ms = jif * 1000/HZ
*/
void SDL_StartTicks(void)
{
/* Set first ticks value */
start = jiffies;
}
Uint32 SDL_GetTicks(void)
{
return((jiffies-start)*1000/HZ);
}
void SDL_Delay(Uint32 ms)
{
thd_sleep(ms);
}
/* Data to handle a single periodic alarm */
static int timer_alive = 0;
static SDL_Thread *timer = NULL;
static int RunTimer(void *unused)
{
while ( timer_alive ) {
if ( SDL_timer_running ) {
SDL_ThreadedTimerCheck();
}
SDL_Delay(10);
}
return(0);
}
/* This is only called if the event thread is not running */
int SDL_SYS_TimerInit(void)
{
timer_alive = 1;
timer = SDL_CreateThread(RunTimer, NULL);
if ( timer == NULL )
return(-1);
return(SDL_SetTimerThreaded(1));
}
void SDL_SYS_TimerQuit(void)
{
timer_alive = 0;
if ( timer ) {
SDL_WaitThread(timer, NULL);
timer = NULL;
}
}
int SDL_SYS_StartTimer(void)
{
SDL_SetError("Internal logic error: DC uses threaded timer");
return(-1);
}
void SDL_SYS_StopTimer(void)
{
return;
}