Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / audio / audio_esys.c
blob7d9a19576868504d2b74fba07ae1b399c1565d49
1 /*
2 Copyright 2010, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*
7 * audio.device
9 * by Nexus Development 2003
10 * coded by Emanuele Cesaroni
12 * $Id$
15 #include "audio_intern.h"
16 #include <proto/dos.h>
19 * InitSLAVE
20 * -----------
22 * Initializes the slave process. Return 1 for successfull, 0 if fails.
26 STRPTR PROCESS_NAME = "audio.device slave";
28 BOOL InitSLAVE(struct IOAudio *ioaudio)
30 ULONG oldsignals;
32 struct TagItem NPTags[] =
34 { NP_Entry, (IPTR) & TaskBody },
35 { NP_Name, (IPTR) PROCESS_NAME },
36 { NP_Priority, 127 },
37 { NP_StackSize, PROCESS_STACK },
38 { TAG_DONE, 0 } };
40 ematsys = &ematsys0; // Here is inited the pointer.
41 ematsys->ts_slavetask = NULL;
42 ematsys->ts_initio = ioaudio; // This is the audioio used to wait the init signal from the slave process.
43 ematsys->ts_opentask = FindTask(NULL);
44 oldsignals = SetSignal(0, STOLEN_SIG);
46 if ((ematsys->ts_slavetask = (struct Task*) CreateNewProc(NPTags)))
48 Wait(STOLEN_SIG);
49 if (ioaudio->ioa_Request.io_Error == IONOERROR)
51 SetSignal(oldsignals, STOLEN_SIG);
52 return OKEY;
55 ematsys->ts_slavetask = NULL;
57 SetSignal(oldsignals, STOLEN_SIG);
58 return KEYO;
63 * FreeSLAVE
64 * -----------
66 * Frees the slave process.
69 VOID FreeSLAVE(struct IOAudio *ioaudio)
71 if (ematsys->ts_slavetask)
73 audio_CLOSE(ioaudio, global_eta);
77 WORD GetMultiple(WORD d0, WORD d1)
79 WORD d2;
81 d2 = d0;
82 d0 = d0 / d1;
83 d0 = d0 * d1;
85 if (d0 == d2)
87 return d0;
89 else
91 return d0 + d1;
97 * InitESYS
98 * ------------
100 * Initialize some needed things for the system.
101 * 0 success, 1 fail.
104 BOOL InitESYS( VOID)
106 emasys = &emasys0; // Here initilized the pointer.
108 return 1;
113 * FreeESYS
114 * ----------
116 * Simply frees all the ESYS resources.
120 VOID FreeESYS( VOID)
122 emasys = &emasys0;