changeset 3865:e958a003b69b SDL-1.2

Add function to check FPU presence
author Patrice Mandin <patmandin@gmail.com>
date Sat, 16 Sep 2006 10:38:09 +0000
parents ea2a327b92d7
children afbcf97a5dd9
files src/audio/mint/SDL_mintaudio.c src/audio/mint/SDL_mintaudio.h src/audio/mint/SDL_mintaudio_dma8.c src/audio/mint/SDL_mintaudio_gsxb.c src/audio/mint/SDL_mintaudio_mcsn.c src/audio/mint/SDL_mintaudio_stfa.c src/audio/mint/SDL_mintaudio_xbios.c
diffstat 7 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/mint/SDL_mintaudio.c	Sat Sep 16 09:15:11 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio.c	Sat Sep 16 10:38:09 2006 +0000
@@ -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_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 @@
 	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)
 {
--- a/src/audio/mint/SDL_mintaudio.h	Sat Sep 16 09:15:11 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio.h	Sat Sep 16 10:38:09 2006 +0000
@@ -123,6 +123,7 @@
 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_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);
--- a/src/audio/mint/SDL_mintaudio_dma8.c	Sat Sep 16 09:15:11 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_dma8.c	Sat Sep 16 10:38:09 2006 +0000
@@ -352,6 +352,8 @@
 	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);
 
--- a/src/audio/mint/SDL_mintaudio_gsxb.c	Sat Sep 16 09:15:11 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_gsxb.c	Sat Sep 16 10:38:09 2006 +0000
@@ -406,6 +406,8 @@
 	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);
 
--- a/src/audio/mint/SDL_mintaudio_mcsn.c	Sat Sep 16 09:15:11 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_mcsn.c	Sat Sep 16 10:38:09 2006 +0000
@@ -395,6 +395,8 @@
 	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);
 
--- a/src/audio/mint/SDL_mintaudio_stfa.c	Sat Sep 16 09:15:11 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_stfa.c	Sat Sep 16 10:38:09 2006 +0000
@@ -314,6 +314,8 @@
 	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);
 
--- a/src/audio/mint/SDL_mintaudio_xbios.c	Sat Sep 16 09:15:11 2006 +0000
+++ b/src/audio/mint/SDL_mintaudio_xbios.c	Sat Sep 16 10:38:09 2006 +0000
@@ -486,6 +486,8 @@
 	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);