grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / devs / audio / audio_esys.c
blob1d6416aacf562f7d5362003acccb574cbff5a4b7
1 /*
2 Copyright 2010-2016, 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. Returns 1 if successful, 0 if failed.
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;