Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Drivers / SoundBlasterAWE / test.c
blob703cfad5a2c65596f61529ebb28e0bdddd7a01a5
2 #include <resources/isapnp.h>
4 #include <proto/exec.h>
5 #include <proto/isapnp.h>
7 #include <unistd.h>
8 #include <stdio.h>
10 struct Library* ISAPNPBase;
12 void
13 play( UWORD r1,
14 UWORD r2,
15 UWORD r3 );
17 int main( void )
19 struct ISAPNP_Device* dev[2];
20 APTR lock;
21 UWORD ioregs[ 3 ] = { 0, 0, 0 };
22 struct ISAPNP_IOResource* r;
23 int o;
25 ISAPNPBase = OpenResource( ISAPNPNAME );
27 if( ISAPNPBase == NULL )
29 printf( "No " ISAPNPNAME ".\n" );
30 exit( 20 );
33 dev[ 0 ] = ISAPNP_FindDevice( NULL,
34 ISAPNP_MAKE_ID( 'C', 'T', 'L' ),
35 2, 1 );
37 if( dev[ 0 ] == NULL )
39 printf( "SB AWE Wavetable device found.\n" );
40 exit( 20 );
43 dev[ 1 ] = NULL;
45 lock = ISAPNP_LockDevicesA( ISAPNP_LOCKF_NONE, dev );
47 if( lock == NULL )
49 printf( "Unable to lock device?\n" );
50 exit( 20 );
54 for( r = (struct ISAPNP_IOResource*) dev[ 0 ]->isapnpd_Resources.mlh_Head, o = 0;
55 r->isapnpior_MinNode.mln_Succ != NULL;
56 r = (struct ISAPNP_IOResource*) r->isapnpior_MinNode.mln_Succ, ++o )
58 if( o > 2 )
60 printf( "Unexpected number of io registers!\n" );
61 break;
64 ioregs[ o ] = r->isapnpior_MinBase;
67 if( ioregs[ 2 ] != 0 )
69 play( ioregs[ 0 ], ioregs[ 1 ], ioregs[ 2 ] );
72 ISAPNP_UnlockDevices( lock );
74 return 0;
77 void
78 play( UWORD r1,
79 UWORD r2,
80 UWORD r3 )
82 printf( "1: %04lx; 2: %04lx; 3: %04lx\n", r1, r2, r3 );