Add function to check FPU presence

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402088
This commit is contained in:
Patrice Mandin 2006-09-16 10:38:09 +00:00
parent 75df00ebdf
commit 336e30592d
7 changed files with 34 additions and 0 deletions

View file

@ -32,6 +32,7 @@
#include <mint/osbind.h>
#include <mint/falcon.h>
#include <mint/mintbind.h>
#include <mint/cookie.h>
#include "SDL_audio.h"
#include "SDL_mintaudio.h"
@ -46,6 +47,7 @@ volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
volatile unsigned short SDL_MintAudio_mutex;
volatile unsigned long SDL_MintAudio_clocktics;
cookie_stfa_t *SDL_MintAudio_stfa;
unsigned short SDL_MintAudio_hasfpu;
/* MiNT thread variables */
SDL_bool SDL_MintAudio_mint_present;
@ -139,6 +141,26 @@ int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq)
return MINTAUDIO_freqcount-1;
}
/* Check if FPU is present */
void SDL_MintAudio_CheckFpu(void)
{
unsigned long cookie_fpu;
SDL_MintAudio_hasfpu = 0;
if (Getcookie(C__FPU, &cookie_fpu) != C_FOUND) {
return;
}
switch ((cookie_fpu>>16)&0xfffe) {
case 2:
case 4:
case 6:
case 8:
case 16:
SDL_MintAudio_hasfpu = 1;
break;
}
}
/* The thread function, used under MiNT with xbios */
int SDL_MintAudio_Thread(long param)
{

View file

@ -123,6 +123,7 @@ extern volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
extern volatile unsigned short SDL_MintAudio_mutex;
extern cookie_stfa_t *SDL_MintAudio_stfa;
extern volatile unsigned long SDL_MintAudio_clocktics;
extern unsigned short SDL_MintAudio_hasfpu; /* To preserve fpu registers if needed */
/* MiNT thread variables */
extern SDL_bool SDL_MintAudio_mint_present;
@ -135,6 +136,7 @@ void SDL_MintAudio_Callback(void);
void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
Uint32 prediv, int gpio_bits);
int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq);
void SDL_MintAudio_CheckFpu(void);
/* MiNT thread functions */
int SDL_MintAudio_Thread(long param);

View file

@ -352,6 +352,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -406,6 +406,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -395,6 +395,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -314,6 +314,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -486,6 +486,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);