2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "SDL_config.h"
30 #ifndef _SDL_mintaudio_h
31 #define _SDL_mintaudio_h
33 #include "../SDL_sysaudio.h"
34 #include "SDL_mintaudio_stfa.h"
36 /* Hidden "this" pointer for the audio functions */
37 #define _THIS SDL_AudioDevice *this
39 /* 16 predivisors with 3 clocks max. */
40 #define MINTAUDIO_maxfreqs (16*3)
46 int gpio_bits; /* in case of external clock */
49 struct SDL_PrivateAudioData {
50 mint_frequency_t frequencies[MINTAUDIO_maxfreqs];
51 int freq_count; /* Number of frequencies in the array */
52 int numfreq; /* Number of selected frequency */
55 /* Old variable names */
57 #define MINTAUDIO_frequencies (this->hidden->frequencies)
58 #define MINTAUDIO_freqcount (this->hidden->freq_count)
59 #define MINTAUDIO_numfreq (this->hidden->numfreq)
61 /* _MCH cookie (values>>16) */
71 /* Master clocks for replay frequencies */
72 #define MASTERCLOCK_STE 8010666 /* Not sure of this one */
73 #define MASTERCLOCK_TT 16107953 /* Not sure of this one */
74 #define MASTERCLOCK_FALCON1 25175000
75 #define MASTERCLOCK_FALCON2 32000000 /* Only usable for DSP56K */
76 #define MASTERCLOCK_FALCONEXT -1 /* Clock on DSP56K port, unknown */
77 #define MASTERCLOCK_44K 22579200 /* Standard clock for 44.1 Khz */
78 #define MASTERCLOCK_48K 24576000 /* Standard clock for 48 Khz */
80 /* Master clock predivisors */
81 #define MASTERPREDIV_STE 160
82 #define MASTERPREDIV_TT 320
83 #define MASTERPREDIV_FALCON 256
84 #define MASTERPREDIV_MILAN 256
87 extern SDL_AudioDevice *SDL_MintAudio_device;
88 extern Uint8 *SDL_MintAudio_audiobuf[2]; /* Pointers to buffers */
89 extern unsigned long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */
90 extern volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
91 extern volatile unsigned short SDL_MintAudio_mutex;
92 extern cookie_stfa_t *SDL_MintAudio_stfa;
93 extern volatile unsigned long SDL_MintAudio_clocktics;
94 extern unsigned short SDL_MintAudio_hasfpu; /* To preserve fpu registers if needed */
96 /* MiNT thread variables */
97 extern SDL_bool SDL_MintAudio_mint_present;
98 extern SDL_bool SDL_MintAudio_quit_thread;
99 extern SDL_bool SDL_MintAudio_thread_finished;
100 extern long SDL_MintAudio_thread_pid;
103 void SDL_MintAudio_Callback(void);
104 void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
105 Uint32 prediv, int gpio_bits);
106 int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq);
107 void SDL_MintAudio_CheckFpu(void);
109 /* MiNT thread functions */
110 int SDL_MintAudio_Thread(long param);
111 void SDL_MintAudio_WaitThread(void);
113 /* ASM interrupt functions */
114 void SDL_MintAudio_GsxbInterrupt(void);
115 void SDL_MintAudio_EmptyGsxbInterrupt(void);
116 void SDL_MintAudio_XbiosInterruptMeasureClock(void);
117 void SDL_MintAudio_XbiosInterrupt(void);
118 void SDL_MintAudio_Dma8Interrupt(void);
119 void SDL_MintAudio_StfaInterrupt(void);
121 #endif /* _SDL_mintaudio_h */