# HG changeset patch # User Patrice Mandin # Date 1123417048 0 # Node ID 856f76a099c7abd75d1c4c54ca1c31096557b37f # Parent 524fd51f5d2c7ab7c6d19a700da1637eb559bc5c Can use both clocks of FDI interface on Falcon, plus digital output diff -r 524fd51f5d2c -r 856f76a099c7 src/audio/mint/SDL_mintaudio.c --- a/src/audio/mint/SDL_mintaudio.c Fri Jul 29 10:59:49 2005 +0000 +++ b/src/audio/mint/SDL_mintaudio.c Sun Aug 07 12:17:28 2005 +0000 @@ -76,7 +76,8 @@ } /* Add a new frequency/clock/predivisor to the current list */ -void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock, Uint32 prediv) +void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock, + Uint32 prediv, int gpio_bits) { int i, p; @@ -94,9 +95,7 @@ /* Put all following ones farer */ if (MINTAUDIO_freqcount>0) { for (i=MINTAUDIO_freqcount; i>p; i--) { - MINTAUDIO_frequencies[i].frequency = MINTAUDIO_frequencies[i-1].frequency; - MINTAUDIO_frequencies[i].masterclock = MINTAUDIO_frequencies[i-1].masterclock; - MINTAUDIO_frequencies[i].predivisor = MINTAUDIO_frequencies[i-1].predivisor; + memcpy(&MINTAUDIO_frequencies[i], &MINTAUDIO_frequencies[i-1], sizeof(mint_frequency_t)); } } @@ -104,6 +103,7 @@ MINTAUDIO_frequencies[p].frequency = frequency; MINTAUDIO_frequencies[p].masterclock = clock; MINTAUDIO_frequencies[p].predivisor = prediv; + MINTAUDIO_frequencies[p].gpio_bits = gpio_bits; MINTAUDIO_freqcount++; } diff -r 524fd51f5d2c -r 856f76a099c7 src/audio/mint/SDL_mintaudio.h --- a/src/audio/mint/SDL_mintaudio.h Fri Jul 29 10:59:49 2005 +0000 +++ b/src/audio/mint/SDL_mintaudio.h Sun Aug 07 12:17:28 2005 +0000 @@ -42,6 +42,7 @@ Uint32 frequency; Uint32 masterclock; Uint32 predivisor; + int gpio_bits; /* in case of external clock */ } mint_frequency_t; struct SDL_PrivateAudioData { @@ -124,7 +125,8 @@ /* Functions */ void SDL_MintAudio_Callback(void); -void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock, Uint32 prediv); +void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock, + Uint32 prediv, int gpio_bits); int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq); /* ASM interrupt functions */ diff -r 524fd51f5d2c -r 856f76a099c7 src/audio/mint/SDL_mintaudio_dma8.c --- a/src/audio/mint/SDL_mintaudio_dma8.c Fri Jul 29 10:59:49 2005 +0000 +++ b/src/audio/mint/SDL_mintaudio_dma8.c Sun Aug 07 12:17:28 2005 +0000 @@ -250,7 +250,8 @@ MINTAUDIO_freqcount=0; for (i=sfreq;i<4;i++) { - SDL_MintAudio_AddFrequency(this, masterclock/(masterprediv*(1<channels=1; spec->format=8; /* FIXME: is it signed or unsigned ? */ - SDL_MintAudio_AddFrequency(this, 12500, 0, 0); + SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1); break; case MCSN_TT: /* Also STE, Mega STE */ spec->format=AUDIO_S8; @@ -244,7 +244,8 @@ masterprediv=MASTERPREDIV_TT; } for (i=0; i<4; i++) { - SDL_MintAudio_AddFrequency(this, masterclock/(masterprediv*(1<res1 != 0) { for (i=1; i<4; i++) { - SDL_MintAudio_AddFrequency(this, (cookie_mcsn->res1)/(MASTERPREDIV_FALCON*(1<res1)/(MASTERPREDIV_FALCON*(1<format |= 0x8000; /* Audio is always signed */ diff -r 524fd51f5d2c -r 856f76a099c7 src/audio/mint/SDL_mintaudio_stfa.c --- a/src/audio/mint/SDL_mintaudio_stfa.c Fri Jul 29 10:59:49 2005 +0000 +++ b/src/audio/mint/SDL_mintaudio_stfa.c Sun Aug 07 12:17:28 2005 +0000 @@ -213,7 +213,7 @@ /* Check formats available */ MINTAUDIO_freqcount=0; for (i=0;i<16;i++) { - SDL_MintAudio_AddFrequency(this, freqs[i], 0, i); + SDL_MintAudio_AddFrequency(this, freqs[i], 0, i, -1); } #if 1 diff -r 524fd51f5d2c -r 856f76a099c7 src/audio/mint/SDL_mintaudio_xbios.c --- a/src/audio/mint/SDL_mintaudio_xbios.c Fri Jul 29 10:59:49 2005 +0000 +++ b/src/audio/mint/SDL_mintaudio_xbios.c Sun Aug 07 12:17:28 2005 +0000 @@ -263,32 +263,29 @@ Super(oldstack); } -static Uint32 Mint_CheckExternalClock(void) +static void Mint_CheckExternalClock(_THIS) { #define SIZE_BUF_CLOCK_MEASURE (44100/10) unsigned long cookie_snd; - Uint32 masterclock; char *buffer; - int i; + int i, j; /* DSP present with its GPIO port ? */ if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { - return 0; + return; } if ((cookie_snd & SND_DSP)==0) { - return 0; + return; } buffer = Atari_SysMalloc(SIZE_BUF_CLOCK_MEASURE, MX_STRAM); if (buffer==NULL) { DEBUG_PRINT((DEBUG_NAME "Not enough memory for the measure\n")); - return 0; + return; } memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE); - masterclock=0; - Buffoper(0); Settracks(0,0); Setmontracks(0); @@ -313,13 +310,13 @@ khz = ((SIZE_BUF_CLOCK_MEASURE/SDL_MintAudio_clocktics) +1) & 0xFFFFFFFE; DEBUG_PRINT((DEBUG_NAME "measure %d: freq=%lu KHz\n", i+1, khz)); - if (i==0) { - if(khz==44) { - masterclock = MASTERCLOCK_44K; + if(khz==44) { + for (j=1; j<4; j++) { + SDL_MintAudio_AddFrequency(this, MASTERCLOCK_44K/(MASTERPREDIV_FALCON*(1<channels=2; /* 16 bits always stereo */ } - extclock=Mint_CheckExternalClock(); + MINTAUDIO_freqcount=0; + + /* Add external clocks if present */ + Mint_CheckExternalClock(this); /* Standard clocks */ - MINTAUDIO_freqcount=0; for (i=1;i<12;i++) { /* Remove unusable Falcon codec predivisors */ if ((i==6) || (i==8) || (i==10)) { continue; } - SDL_MintAudio_AddFrequency(this, MASTERCLOCK_FALCON1/(MASTERPREDIV_FALCON*(i+1)), MASTERCLOCK_FALCON1, i); - } - - if (extclock>0) { - for (i=1; i<4; i++) { - SDL_MintAudio_AddFrequency(this, extclock/(MASTERPREDIV_FALCON*(1<