2 AHI - Hardware independent audio subsystem
3 Copyright (C) 1996-2005 Martin Blom <martin@blom.org>
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
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
23 #include <exec/memory.h>
24 #include <exec/resident.h>
25 #include <exec/alerts.h>
26 #include <exec/execbase.h>
27 #include <proto/dos.h>
28 #include <proto/exec.h>
29 #include <proto/gadtools.h>
30 #include <proto/graphics.h>
31 #include <proto/iffparse.h>
33 #include <proto/stdc.h>
40 #include "gatestubs.h"
46 # define RTF_NATIVE (1<<3)
47 # define FUNCARRAY_32BIT_NATIVE 0xfffefffe
50 #if !defined( __AROS__ ) && !defined( __amithlon__ )
53 # define _etext RomTag+1 // Fake it
56 /******************************************************************************
57 ** Function prototypes ********************************************************
58 ******************************************************************************/
66 #define GetSymbol( name ) AHIGetELFSymbol( #name, (void*) &name ## Ptr )
69 #define Req( msg ) ReqA( msg, NULL )
71 /******************************************************************************
72 ** Device entry ***************************************************************
73 ******************************************************************************/
75 #if defined( __amithlon__ )
78 .byte 0x4e, 0xfa, 0x00, 0x03\n\
88 #if defined( __MORPHOS__ )
90 ULONG __amigappc__
=1; // deprecated, used in MOS 0.4
93 /******************************************************************************
94 ** Device resident structure **************************************************
95 ******************************************************************************/
97 #if defined( __AMIGAOS4__ )
98 static const struct TagItem InitTable
[];
100 static const APTR InitTable
[4];
103 // This structure must reside in the text segment or the read-only
104 // data segment! "const" makes it happen.
105 const struct Resident RomTag
__attribute__((used
)) =
108 (struct Resident
*) &RomTag
,
109 (struct Resident
*) &_etext
,
110 #if defined( __MORPHOS__ )
111 RTF_EXTENDED
| RTF_PPC
| RTF_AUTOINIT
,
112 #elif defined( __AROS__ )
113 RTF_EXTENDED
| RTF_AUTOINIT
,
114 #elif defined( __amithlon__ )
115 RTF_NATIVE
| RTF_AUTOINIT
,
116 #elif defined( __AMIGAOS4__ )
117 RTF_NATIVE
| RTF_AUTOINIT
,
124 (BYTE
*) &DevName
[0],
125 (BYTE
*) &IDString
[6],
127 #if defined( __MORPHOS__ ) || defined( __AROS__ )
133 /******************************************************************************
134 ** Globals ********************************************************************
135 ******************************************************************************/
137 const ULONG DriverVersion
= 2;
138 const ULONG Version
= VERSION
;
139 const ULONG Revision
= REVISION
;
141 const char DevName
[] = AHINAME
;
142 const char IDString
[] = "$VER: " AHINAME
" " VERS
143 " ©1994-2005 Martin Blom. " CPU
" version.\r\n";
145 struct ExecBase
*SysBase
= NULL
;
146 struct DosLibrary
*DOSBase
= NULL
;
147 struct GfxBase
*GfxBase
= NULL
;
148 struct AHIBase
*AHIBase
= NULL
;
149 struct Library
*GadToolsBase
= NULL
;
150 struct Library
*IFFParseBase
= NULL
;
151 struct IntuitionBase
*IntuitionBase
= NULL
;
152 struct LocaleBase
*LocaleBase
= NULL
;
153 struct Device
*TimerBase
= NULL
;
154 struct UtilityBase
*UtilityBase
= NULL
;
155 #if defined (__AROS__)
156 struct StdCBase
*StdCBase
= NULL
;
159 #if defined( __AMIGAOS4__ )
160 struct ExecIFace
*IExec
= NULL
;
161 struct DOSIFace
*IDOS
= NULL
;
162 struct GadToolsIFace
*IGadTools
= NULL
;
163 struct GraphicsIFace
*IGraphics
= NULL
;
164 struct IFFParseIFace
*IIFFParse
= NULL
;
165 struct IntuitionIFace
*IIntuition
= NULL
;
166 struct LocaleIFace
*ILocale
= NULL
;
167 struct TimerIFace
*ITimer
= NULL
;
168 struct UtilityIFace
*IUtility
= NULL
;
171 struct Resident
*MorphOSRes
= NULL
;
172 static struct timerequest
*TimerIO
= NULL
;
174 #if defined( ENABLE_WARPUP )
175 struct Library
*PowerPCBase
= NULL
;
176 void *PPCObject
= NULL
;
177 const ULONG __LIB_Version
= VERSION
;
178 const ULONG __LIB_Revision
= REVISION
;
181 enum MixBackend_t MixBackend
= MB_NATIVE
;
183 ADDFUNC
* AddByteMonoPtr
= AddByteMono
;
184 ADDFUNC
* AddByteStereoPtr
= AddByteStereo
;
185 ADDFUNC
* AddByte71Ptr
= AddByte71
;
186 ADDFUNC
* AddBytesMonoPtr
= AddBytesMono
;
187 ADDFUNC
* AddBytesStereoPtr
= AddBytesStereo
;
188 ADDFUNC
* AddBytes71Ptr
= AddBytes71
;
189 ADDFUNC
* AddWordMonoPtr
= AddWordMono
;
190 ADDFUNC
* AddWordStereoPtr
= AddWordStereo
;
191 ADDFUNC
* AddWord71Ptr
= AddWord71
;
192 ADDFUNC
* AddWordsMonoPtr
= AddWordsMono
;
193 ADDFUNC
* AddWordsStereoPtr
= AddWordsStereo
;
194 ADDFUNC
* AddWords71Ptr
= AddWords71
;
195 ADDFUNC
* AddLongMonoPtr
= AddLongMono
;
196 ADDFUNC
* AddLongStereoPtr
= AddLongStereo
;
197 ADDFUNC
* AddLong71Ptr
= AddLong71
;
198 ADDFUNC
* AddLongsMonoPtr
= AddLongsMono
;
199 ADDFUNC
* AddLongsStereoPtr
= AddLongsStereo
;
200 ADDFUNC
* Add71MonoPtr
= Add71Mono
;
201 ADDFUNC
* Add71StereoPtr
= Add71Stereo
;
202 ADDFUNC
* AddLongs71Ptr
= AddLongs71
;
203 ADDFUNC
* Add7171Ptr
= Add7171
;
205 ADDFUNC
* AddByteMonoBPtr
= AddByteMonoB
;
206 ADDFUNC
* AddByteStereoBPtr
= AddByteStereoB
;
207 ADDFUNC
* AddByte71BPtr
= AddByte71B
;
208 ADDFUNC
* AddBytesMonoBPtr
= AddBytesMonoB
;
209 ADDFUNC
* AddBytesStereoBPtr
= AddBytesStereoB
;
210 ADDFUNC
* AddBytes71BPtr
= AddBytes71B
;
211 ADDFUNC
* AddWordMonoBPtr
= AddWordMonoB
;
212 ADDFUNC
* AddWordStereoBPtr
= AddWordStereoB
;
213 ADDFUNC
* AddWord71BPtr
= AddWord71B
;
214 ADDFUNC
* AddWordsMonoBPtr
= AddWordsMonoB
;
215 ADDFUNC
* AddWordsStereoBPtr
= AddWordsStereoB
;
216 ADDFUNC
* AddWords71BPtr
= AddWords71B
;
217 ADDFUNC
* AddLongMonoBPtr
= AddLongMonoB
;
218 ADDFUNC
* AddLongStereoBPtr
= AddLongStereoB
;
219 ADDFUNC
* AddLong71BPtr
= AddLong71B
;
220 ADDFUNC
* AddLongsMonoBPtr
= AddLongsMonoB
;
221 ADDFUNC
* AddLongsStereoBPtr
= AddLongsStereoB
;
222 ADDFUNC
* AddLongs71BPtr
= AddLongs71B
;
223 ADDFUNC
* Add71MonoBPtr
= Add71MonoB
;
224 ADDFUNC
* Add71StereoBPtr
= Add71StereoB
;
225 ADDFUNC
* Add7171BPtr
= Add7171B
;
227 ADDFUNC
* AddLofiByteMonoPtr
= AddLofiByteMono
;
228 ADDFUNC
* AddLofiByteStereoPtr
= AddLofiByteStereo
;
229 ADDFUNC
* AddLofiBytesMonoPtr
= AddLofiBytesMono
;
230 ADDFUNC
* AddLofiBytesStereoPtr
= AddLofiBytesStereo
;
231 ADDFUNC
* AddLofiWordMonoPtr
= AddLofiWordMono
;
232 ADDFUNC
* AddLofiWordStereoPtr
= AddLofiWordStereo
;
233 ADDFUNC
* AddLofiWordsMonoPtr
= AddLofiWordsMono
;
234 ADDFUNC
* AddLofiWordsStereoPtr
= AddLofiWordsStereo
;
235 ADDFUNC
* AddLofiLongMonoPtr
= AddLofiLongMono
;
236 ADDFUNC
* AddLofiLongStereoPtr
= AddLofiLongStereo
;
237 ADDFUNC
* AddLofiLongsMonoPtr
= AddLofiLongsMono
;
238 ADDFUNC
* AddLofiLongsStereoPtr
= AddLofiLongsStereo
;
239 ADDFUNC
* AddLofiByteMonoBPtr
= AddLofiByteMonoB
;
240 ADDFUNC
* AddLofiByteStereoBPtr
= AddLofiByteStereoB
;
241 ADDFUNC
* AddLofiBytesMonoBPtr
= AddLofiBytesMonoB
;
242 ADDFUNC
* AddLofiBytesStereoBPtr
= AddLofiBytesStereoB
;
243 ADDFUNC
* AddLofiWordMonoBPtr
= AddLofiWordMonoB
;
244 ADDFUNC
* AddLofiWordStereoBPtr
= AddLofiWordStereoB
;
245 ADDFUNC
* AddLofiWordsMonoBPtr
= AddLofiWordsMonoB
;
246 ADDFUNC
* AddLofiWordsStereoBPtr
= AddLofiWordsStereoB
;
247 ADDFUNC
* AddLofiLongMonoBPtr
= AddLofiLongMonoB
;
248 ADDFUNC
* AddLofiLongStereoBPtr
= AddLofiLongStereoB
;
249 ADDFUNC
* AddLofiLongsMonoBPtr
= AddLofiLongsMonoB
;
250 ADDFUNC
* AddLofiLongsStereoBPtr
= AddLofiLongsStereoB
;
252 /******************************************************************************
253 ** Device code ****************************************************************
254 ******************************************************************************/
257 static inline void DeleteLibrary(struct Library
*base
) {
258 FreeMem((APTR
)(((char*)base
)-base
->lib_NegSize
),base
->lib_NegSize
+base
->lib_PosSize
);
263 _DevInit( struct AHIBase
* device
,
265 struct ExecBase
* sysbase
)
270 ahibug("[AHI:Device] %s()\n", __func__
);
273 IExec
= (struct ExecIFace
*) SysBase
->MainInterface
;
276 device
->ahib_Library
.lib_Revision
= REVISION
;
278 device
->ahib_SysLib
= sysbase
;
279 device
->ahib_SegList
= (BPTR
) seglist
;
281 #if defined( __mc68000__ )
282 // Make sure we're running on a M68020 or better
284 if( ( sysbase
->AttnFlags
& AFF_68020
) == 0 )
286 Alert( ( AN_Unknown
| ACPU_InstErr
) & (~AT_DeadEnd
) );
287 DeleteLibrary( &device
->ahib_Library
);
292 InitSemaphore( &device
->ahib_Lock
);
297 DeleteLibrary( &device
->ahib_Library
);
306 _DevExpunge( struct AHIBase
* device
)
310 ahibug("[AHI:Device] %s()\n", __func__
);
312 //DebugPrintF("AHI: _DevExpunge\n");
314 if( device
->ahib_Library
.lib_OpenCnt
== 0)
316 seglist
= device
->ahib_SegList
;
318 Remove( (struct Node
*) device
);
322 DeleteLibrary( &device
->ahib_Library
);
326 device
->ahib_Library
.lib_Flags
|= LIBF_DELEXP
;
340 static const APTR FuncTable
[] =
342 #if defined( __MORPHOS__ ) || defined( __amithlon__ )
343 (APTR
) FUNCARRAY_32BIT_NATIVE
,
365 gwAHI_GetAudioAttrsA
,
367 gwAHI_AllocAudioRequestA
,
369 gwAHI_FreeAudioRequest
,
371 gwAHI_SampleFrameSize
,
373 gwAHI_RemoveAudioMode
,
380 static const APTR InitTable
[4] =
382 (APTR
) sizeof( struct AHIBase
),
385 #if defined( __MORPHOS__ ) || defined( __amithlon__ )
392 #else // __AMIGAOS4__
394 static ULONG
generic_Obtain(struct Interface
*Self
)
396 return Self
->Data
.RefCount
++;
399 static ULONG
generic_Release(struct Interface
*Self
)
401 return Self
->Data
.RefCount
--;
405 static const CONST_APTR DevManagerVectors
[] =
422 static const struct TagItem DevManagerTags
[] =
424 { MIT_Name
, (IPTR
) "__device" },
425 { MIT_VectorTable
, (IPTR
) DevManagerVectors
},
431 static const CONST_APTR MainVectors
[] = {
450 gwAHI_GetAudioAttrsA
,
454 gwAHI_AllocAudioRequestA
,
455 gwAHI_AllocAudioRequest
,
458 gwAHI_FreeAudioRequest
,
461 gwAHI_SampleFrameSize
,
463 gwAHI_RemoveAudioMode
,
469 static const struct TagItem MainTags
[] =
471 { MIT_Name
, (IPTR
) "main" },
472 { MIT_VectorTable
, (IPTR
) MainVectors
},
478 /* MLT_INTERFACES array */
479 static const CONST_APTR Interfaces
[] =
486 /* m68k library vectors */
487 static const CONST_APTR VecTable68K
[] = {
488 (CONST_APTR
) &m68kgwDevOpen
,
489 (CONST_APTR
) &m68kgwDevClose
,
490 (CONST_APTR
) &m68kgwDevExpunge
,
491 (CONST_APTR
) &m68kgwDevNull
,
493 (CONST_APTR
) &m68kgwDevBeginIO
,
494 (CONST_APTR
) &m68kgwDevAbortIO
,
495 (CONST_APTR
) &m68kgwAHI_AllocAudioA
,
496 (CONST_APTR
) &m68kgwAHI_FreeAudio
,
497 (CONST_APTR
) &m68kgwAHI_KillAudio
,
498 (CONST_APTR
) &m68kgwAHI_ControlAudioA
,
499 (CONST_APTR
) &m68kgwAHI_SetVol
,
500 (CONST_APTR
) &m68kgwAHI_SetFreq
,
501 (CONST_APTR
) &m68kgwAHI_SetSound
,
502 (CONST_APTR
) &m68kgwAHI_SetEffect
,
503 (CONST_APTR
) &m68kgwAHI_LoadSound
,
504 (CONST_APTR
) &m68kgwAHI_UnloadSound
,
505 (CONST_APTR
) &m68kgwAHI_NextAudioID
,
506 (CONST_APTR
) &m68kgwAHI_GetAudioAttrsA
,
507 (CONST_APTR
) &m68kgwAHI_BestAudioIDA
,
508 (CONST_APTR
) &m68kgwAHI_AllocAudioRequestA
,
509 (CONST_APTR
) &m68kgwAHI_AudioRequestA
,
510 (CONST_APTR
) &m68kgwAHI_FreeAudioRequest
,
511 (CONST_APTR
) &m68kgwAHI_PlayA
,
512 (CONST_APTR
) &m68kgwAHI_SampleFrameSize
,
513 (CONST_APTR
) &m68kgwAHI_AddAudioMode
,
514 (CONST_APTR
) &m68kgwAHI_RemoveAudioMode
,
515 (CONST_APTR
) &m68kgwAHI_LoadModeFile
,
520 /* CreateLibrary() tag list */
521 static const struct TagItem InitTable
[] =
523 { CLT_DataSize
, sizeof(struct AHIBase
) },
524 { CLT_Interfaces
, (ULONG
) Interfaces
},
525 { CLT_Vector68K
, (ULONG
) VecTable68K
},
526 { CLT_InitFunc
, (ULONG
) gwDevInit
},
530 #endif // __AMIGAOS4__
533 /******************************************************************************
534 ** OpenLibs *******************************************************************
535 ******************************************************************************/
537 // This function is called by the device startup code when the device is
538 // first loaded into memory.
543 /* Intuition Library */
545 ahibug("[AHI:Device] %s()\n", __func__
);
547 IntuitionBase
= (struct IntuitionBase
*) OpenLibrary( "intuition.library", 37 );
549 if( IntuitionBase
== NULL
)
551 Alert(AN_Unknown
|AG_OpenLib
|AO_Intuition
);
557 DOSBase
= (struct DosLibrary
*) OpenLibrary( "dos.library", 37 );
561 Req( "Unable to open 'dos.library'." );
565 /* Graphics Library */
567 GfxBase
= (struct GfxBase
*) OpenLibrary( "graphics.library", 37 );
571 Req( "Unable to open 'graphics.library'." );
575 /* GadTools Library */
577 GadToolsBase
= OpenLibrary( "gadtools.library", 37 );
579 if( GadToolsBase
== NULL
)
581 Req( "Unable to open 'gadtools.library'." );
585 /* IFFParse Library */
587 IFFParseBase
= OpenLibrary( "iffparse.library", 37 );
589 if( IFFParseBase
== NULL
)
591 Req( "Unable to open 'iffparse.library'." );
597 LocaleBase
= (struct LocaleBase
*) OpenLibrary( "locale.library", 38 );
601 TimerIO
= (struct timerequest
*) AllocMem( sizeof(struct timerequest
),
602 MEMF_PUBLIC
| MEMF_CLEAR
);
606 Req( "Out of memory." );
610 if( OpenDevice( "timer.device",
616 Req( "Unable to open 'timer.device'." );
621 TimerBase
= (struct Device
*) TimerIO
->tr_node
.io_Device
;
624 /* Utility Library */
626 UtilityBase
= (struct UtilityBase
*) OpenLibrary( "utility.library", 37 );
628 if( UtilityBase
== NULL
)
630 Req( "Unable to open 'utility.library'." );
634 #if defined(__AROS__)
637 StdCBase
= (struct StdCBase
*) OpenLibrary( "stdc.library", 0 );
639 if( StdCBase
== NULL
)
641 Req( "Unable to open 'stdc.library'." );
647 if ((IIntuition
= (struct IntuitionIFace
*) GetInterface((struct Library
*) IntuitionBase
, "main", 1, NULL
)) == NULL
)
649 Req("Couldn't open IIntuition interface!\n");
653 if ((IDOS
= (struct DOSIFace
*) GetInterface((struct Library
*) DOSBase
, "main", 1, NULL
)) == NULL
)
655 Req("Couldn't open IDOS interface!\n");
659 if ((IGraphics
= (struct GraphicsIFace
*) GetInterface((struct Library
*) GfxBase
, "main", 1, NULL
)) == NULL
)
661 Req("Couldn't open Graphics interface!\n");
665 if ((IGadTools
= (struct GadToolsIFace
*) GetInterface((struct Library
*) GadToolsBase
, "main", 1, NULL
)) == NULL
)
667 Req("Couldn't open IGadTools interface!\n");
671 if ((IIFFParse
= (struct IFFParseIFace
*) GetInterface((struct Library
*) IFFParseBase
, "main", 1, NULL
)) == NULL
)
673 Req("Couldn't open IFFParse interface!\n");
677 if ((ILocale
= (struct LocaleIFace
*) GetInterface((struct Library
*) LocaleBase
, "main", 1, NULL
)) == NULL
)
679 Req("Couldn't open ILocale interface!\n");
683 if ((ITimer
= (struct TimerIFace
*) GetInterface((struct Library
*) TimerBase
, "main", 1, NULL
)) == NULL
)
685 Req("Couldn't open Timer interface!\n");
689 if ((IUtility
= (struct UtilityIFace
*) GetInterface((struct Library
*) UtilityBase
, "main", 1, NULL
)) == NULL
)
691 Req("Couldn't open Utility interface!\n");
695 if ((IAHI
= (struct AHIIFace
*) GetInterface((struct Library
*) AHIBase
, "main", 1, NULL
)) == NULL
)
697 Req("Couldn't open AHI interface!\n");
703 /* MorphOS/PowerUp/WarpOS loading
707 1) If MorphOS is running, use it.
708 2) If PowerUp is running, but not WarpUp, use the m68k core
709 3) If neither of them are running, try WarpUp.
713 // Check if MorpOS/PowerUp/WarpUp is running.
715 #if defined( ENABLE_WARPUP )
716 struct Library
* ppclib
= NULL
;
717 struct Library
* powerpclib
= NULL
;
721 MorphOSRes
= FindResident( "MorphOS" );
723 #if defined( ENABLE_WARPUP )
724 powerpclib
= (struct Library
*) FindName( &SysBase
->LibList
,
726 ppclib
= (struct Library
*) FindName( &SysBase
->LibList
,
732 #if defined( ENABLE_WARPUP )
733 if( MorphOSRes
== NULL
&& ! ( ppclib
!= NULL
&& powerpclib
== NULL
) )
735 // Open WarpUp (but not if MorphOS or PowerUp is active)
737 PowerPCBase
= OpenLibrary( "powerpc.library", 15 );
742 if( MorphOSRes
!= NULL
)
744 MixBackend
= MB_NATIVE
;
747 #if defined( ENABLE_WARPUP )
749 else if( PowerPCBase
!= NULL
)
751 MixBackend
= MB_WARPUP
;
753 /* Load our code to PPC.. */
755 PPCObject
= AHILoadObject( "DEVS:ahi.device.elf" );
757 if( PPCObject
!= NULL
)
759 ULONG
* version
= NULL
;
760 ULONG
* revision
= NULL
;
764 AHIGetELFSymbol( "__LIB_Version", (void*) &version
);
765 AHIGetELFSymbol( "__LIB_Revision", (void*) &revision
);
767 if( version
!= NULL
&& revision
!= NULL
)
769 if( *version
== VERSION
&& *revision
== REVISION
)
771 r
&= GetSymbol( AddByteMono
);
772 r
&= GetSymbol( AddByteStereo
);
773 r
&= GetSymbol( AddBytesMono
);
774 r
&= GetSymbol( AddBytesStereo
);
775 r
&= GetSymbol( AddWordMono
);
776 r
&= GetSymbol( AddWordStereo
);
777 r
&= GetSymbol( AddWordsMono
);
778 r
&= GetSymbol( AddWordsStereo
);
779 r
&= GetSymbol( AddLongMono
);
780 r
&= GetSymbol( AddLongStereo
);
781 r
&= GetSymbol( AddLongsMono
);
782 r
&= GetSymbol( AddLongsStereo
);
783 r
&= GetSymbol( AddByteMonoB
);
784 r
&= GetSymbol( AddByteStereoB
);
785 r
&= GetSymbol( AddBytesMonoB
);
786 r
&= GetSymbol( AddBytesStereoB
);
787 r
&= GetSymbol( AddWordMonoB
);
788 r
&= GetSymbol( AddWordStereoB
);
789 r
&= GetSymbol( AddWordsMonoB
);
790 r
&= GetSymbol( AddWordsStereoB
);
791 r
&= GetSymbol( AddLongMonoB
);
792 r
&= GetSymbol( AddLongStereoB
);
793 r
&= GetSymbol( AddLongsMonoB
);
794 r
&= GetSymbol( AddLongsStereoB
);
796 r
&= GetSymbol( AddLofiByteMono
);
797 r
&= GetSymbol( AddLofiByteStereo
);
798 r
&= GetSymbol( AddLofiBytesMono
);
799 r
&= GetSymbol( AddLofiBytesStereo
);
800 r
&= GetSymbol( AddLofiWordMono
);
801 r
&= GetSymbol( AddLofiWordStereo
);
802 r
&= GetSymbol( AddLofiWordsMono
);
803 r
&= GetSymbol( AddLofiWordsStereo
);
804 r
&= GetSymbol( AddLofiLongMono
);
805 r
&= GetSymbol( AddLofiLongStereo
);
806 r
&= GetSymbol( AddLofiLongsMono
);
807 r
&= GetSymbol( AddLofiLongsStereo
);
808 r
&= GetSymbol( AddLofiByteMonoB
);
809 r
&= GetSymbol( AddLofiByteStereoB
);
810 r
&= GetSymbol( AddLofiBytesMonoB
);
811 r
&= GetSymbol( AddLofiBytesStereoB
);
812 r
&= GetSymbol( AddLofiWordMonoB
);
813 r
&= GetSymbol( AddLofiWordStereoB
);
814 r
&= GetSymbol( AddLofiWordsMonoB
);
815 r
&= GetSymbol( AddLofiWordsStereoB
);
816 r
&= GetSymbol( AddLofiLongMonoB
);
817 r
&= GetSymbol( AddLofiLongStereoB
);
818 r
&= GetSymbol( AddLofiLongsMonoB
);
819 r
&= GetSymbol( AddLofiLongsStereoB
);
823 char buffer
[ 2 ] = "0";
825 GetVar( "PowerPC/UseDisable", buffer
, sizeof buffer
, 0 );
827 if( buffer
[ 0 ] == '1' )
833 Req( "The WarpUp variable 'PowerPC/UseDisable' must be '1'." );
835 AHIUnloadObject( PPCObject
);
837 MixBackend
= MB_NATIVE
;
842 Req( "Unable to fetch all symbols from ELF object." );
844 AHIUnloadObject( PPCObject
);
846 MixBackend
= MB_NATIVE
;
851 Req( "'ahi.device.elf' version %ld.%ld doesn't match "
852 "'ahi.device' version %ld.%ld.",
853 *version
, *revision
, VERSION
, REVISION
);
855 AHIUnloadObject( PPCObject
);
857 MixBackend
= MB_NATIVE
;
862 Req( "Unable to fetch version information from 'ahi.device.elf'." );
864 AHIUnloadObject( PPCObject
);
866 MixBackend
= MB_NATIVE
;
871 MixBackend
= MB_NATIVE
;
879 //MixBackend = MB_NATIVE;
882 OpenahiCatalog(NULL
, NULL
);
888 /******************************************************************************
889 ** CloseLibs *******************************************************************
890 ******************************************************************************/
892 // This function is called by DevExpunge() when the device is about to be
898 ahibug("[AHI:Device] %s()\n", __func__
);
902 #if defined( ENABLE_WARPUP )
903 if( PPCObject
!= NULL
)
905 AHIUnloadObject( PPCObject
);
908 CloseLibrary( PowerPCBase
);
912 DropInterface((struct Interface
*) IUtility
);
913 DropInterface((struct Interface
*) ITimer
);
914 DropInterface((struct Interface
*) ILocale
);
915 DropInterface((struct Interface
*) IIFFParse
);
916 DropInterface((struct Interface
*) IGadTools
);
917 DropInterface((struct Interface
*) IGraphics
);
918 DropInterface((struct Interface
*) IDOS
);
919 DropInterface((struct Interface
*) IIntuition
);
920 DropInterface((struct Interface
*) IAHI
);
923 #if defined(__AROS__)
924 CloseLibrary( (struct Library
*) StdCBase
);
926 CloseLibrary( (struct Library
*) UtilityBase
);
928 if( TimerIO
!= NULL
)
930 if( TimerBase
!= NULL
)
932 CloseDevice( (struct IORequest
*) TimerIO
);
935 FreeMem( TimerIO
, sizeof(struct timerequest
) );
938 CloseLibrary( (struct Library
*) LocaleBase
);
939 CloseLibrary( IFFParseBase
);
940 CloseLibrary( GadToolsBase
);
941 CloseLibrary( (struct Library
*) GfxBase
);
942 CloseLibrary( (struct Library
*) DOSBase
);
943 CloseLibrary( (struct Library
*) IntuitionBase
);