revert between 56095 -> 55830 in arch
[AROS.git] / workbench / devs / AHI / Drivers / EMU10kx / test_ac97.c
blobd2d096fa8be38b150b74c1f18917fac818b4f00a
2 #include <config.h>
4 #include <proto/dos.h>
5 #include <proto/exec.h>
7 #include "emu10kx-ac97.h"
8 #include "linuxsupport.h"
10 #define VERSION 6
12 int
13 main( void )
15 struct Library* EMU10kxBase;
16 struct EMU10kxAC97* EMU10kxAC97;
17 ULONG value;
19 EMU10kxBase = OpenLibrary( "DEVS:AHI/emu10kx.audio", VERSION );
21 if( EMU10kxBase == NULL )
23 Printf( "Unable to open DEVS:AHI/emu10kx.audio version %ld.\n", VERSION );
24 return RETURN_FAIL;
27 Forbid();
28 EMU10kxAC97 = (struct EMU10kxAC97*) FindSemaphore( EMU10KX_AC97_SEMAPHORE );
29 if( EMU10kxAC97 != NULL )
31 ObtainSemaphore( &EMU10kxAC97->Semaphore );
33 Permit();
35 if( EMU10kxAC97 == NULL )
37 CloseLibrary( EMU10kxBase );
38 Printf( "Unable to find semaphore '%s'.\n", (ULONG) EMU10KX_AC97_SEMAPHORE );
39 return RETURN_FAIL;
42 Printf( "%ld EMU10kx cards found.\n", EMU10kxAC97->Cards );
44 value = CallHook( &EMU10kxAC97->GetFunc, (Object*) EMU10kxBase,
45 0, AC97_CD_VOL );
47 Printf( "CD volume on card 0 is 0x%04lx\n", value );
49 Printf( "Setting it to 0x0000.\n" );
50 CallHook( &EMU10kxAC97->SetFunc, (Object*) EMU10kxBase, 0, AC97_CD_VOL, 0 );
52 Delay( 3 * 50 );
54 Printf( "Restoring it.\n" );
55 CallHook( &EMU10kxAC97->SetFunc, (Object*) EMU10kxBase, 0, AC97_CD_VOL, value );
57 Printf( "Exiting.\n" );
59 if( EMU10kxAC97 != NULL )
61 ReleaseSemaphore( &EMU10kxAC97->Semaphore );
64 CloseLibrary( EMU10kxBase );
66 return RETURN_OK;