1 | /* $Id: ossidc.h 153 2000-07-23 16:21:57Z sandervl $ */
|
---|
2 |
|
---|
3 | //******************************************************************************
|
---|
4 | // Header for idc definitions & declarations
|
---|
5 | //
|
---|
6 | // Copyright 2000 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | //
|
---|
8 | // This program is free software; you can redistribute it and/or
|
---|
9 | // modify it under the terms of the GNU General Public License as
|
---|
10 | // published by the Free Software Foundation; either version 2 of
|
---|
11 | // the License, or (at your option) any later version.
|
---|
12 | //
|
---|
13 | // This program is distributed in the hope that it will be useful,
|
---|
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | // GNU General Public License for more details.
|
---|
17 | //
|
---|
18 | // You should have received a copy of the GNU General Public
|
---|
19 | // License along with this program; if not, write to the Free
|
---|
20 | // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
---|
21 | // USA.
|
---|
22 | //
|
---|
23 | //******************************************************************************
|
---|
24 | #ifndef __OSSIDC_H__
|
---|
25 | #define __OSSIDC_H__
|
---|
26 |
|
---|
27 | #include <ossdefos2.h>
|
---|
28 | #include <osssound.h>
|
---|
29 |
|
---|
30 | typedef BOOL (FAR48 __cdecl *IDC16_HANDLER)(ULONG cmd, ULONG param);
|
---|
31 |
|
---|
32 | extern IDC16_HANDLER idc16_PddHandler;
|
---|
33 |
|
---|
34 | //IDC communication packet
|
---|
35 | typedef struct
|
---|
36 | {
|
---|
37 | union {
|
---|
38 | struct {
|
---|
39 | ULONG handler16; //16:16 address of pdd idc handler
|
---|
40 | } init;
|
---|
41 | struct {
|
---|
42 | ULONG irqnr;
|
---|
43 | } irq;
|
---|
44 | struct {
|
---|
45 | ULONG streamtype;
|
---|
46 | } open;
|
---|
47 | struct {
|
---|
48 | ULONG streamtype;
|
---|
49 | ULONG streamid;
|
---|
50 | } close;
|
---|
51 | struct {
|
---|
52 | ULONG streamtype;
|
---|
53 | ULONG streamid;
|
---|
54 | ULONG cmd;
|
---|
55 | ULONG ioctl_param;
|
---|
56 | } ioctl;
|
---|
57 | struct {
|
---|
58 | ULONG streamtype;
|
---|
59 | ULONG streamid;
|
---|
60 | } startstop;
|
---|
61 | struct {
|
---|
62 | ULONG streamtype;
|
---|
63 | ULONG streamid;
|
---|
64 | ULONG buffer; //0:32 address of mmpm/2 buffer
|
---|
65 | ULONG size;
|
---|
66 | } buffer;
|
---|
67 | struct {
|
---|
68 | ULONG streamtype;
|
---|
69 | ULONG streamid;
|
---|
70 | ULONG cmd;
|
---|
71 | ULONG volume;
|
---|
72 | } mixer;
|
---|
73 | struct {
|
---|
74 | ULONG streamtype;
|
---|
75 | ULONG streamid;
|
---|
76 | ULONG midiByte;
|
---|
77 | } midiwrite;
|
---|
78 | struct {
|
---|
79 | ULONG streamtype;
|
---|
80 | ULONG streamid;
|
---|
81 | ULONG buffer;
|
---|
82 | ULONG bufsize;
|
---|
83 | } midiread;
|
---|
84 | struct {
|
---|
85 | ULONG streamtype;
|
---|
86 | ULONG streamid;
|
---|
87 | } getspace;
|
---|
88 | struct {
|
---|
89 | ULONG param1;
|
---|
90 | ULONG param2;
|
---|
91 | ULONG param3;
|
---|
92 | ULONG param4;
|
---|
93 | ULONG fileid;
|
---|
94 | };
|
---|
95 | };
|
---|
96 | } IDC32_PACKET, NEAR *PIDC32_PACKET;
|
---|
97 |
|
---|
98 | typedef struct
|
---|
99 | {
|
---|
100 | union {
|
---|
101 | struct {
|
---|
102 | ULONG devid;
|
---|
103 | ULONG pResource; //16:16 resource structure pointer
|
---|
104 | } finddev;
|
---|
105 | struct {
|
---|
106 | ULONG irqnr;
|
---|
107 | } irq;
|
---|
108 | struct {
|
---|
109 | ULONG size;
|
---|
110 | } malloc;
|
---|
111 | struct {
|
---|
112 | ULONG addr; //16:16 address returned by malloc at start of memory block
|
---|
113 | } free;
|
---|
114 | struct {
|
---|
115 | ULONG type;
|
---|
116 | ULONG streamid;
|
---|
117 | } process;
|
---|
118 | struct {
|
---|
119 | ULONG param1;
|
---|
120 | ULONG param2;
|
---|
121 | };
|
---|
122 | };
|
---|
123 | } IDC16_PACKET;
|
---|
124 |
|
---|
125 | //IDC commands (16->32 bits)
|
---|
126 | #define IDC32_INIT 0
|
---|
127 | #define IDC32_EXIT 1
|
---|
128 | #define IDC32_IRQ 2
|
---|
129 | #define IDC32_STREAM_OPEN 3
|
---|
130 | #define IDC32_STREAM_CLOSE 4
|
---|
131 | #define IDC32_STREAM_ADDBUFFER 5
|
---|
132 | #define IDC32_STREAM_START 6
|
---|
133 | #define IDC32_STREAM_STOP 7
|
---|
134 | #define IDC32_STREAM_RESET 8
|
---|
135 | #define IDC32_STREAM_PAUSE 9
|
---|
136 | #define IDC32_STREAM_IOCTL 10
|
---|
137 | #define IDC32_STREAM_MIXER 11
|
---|
138 | #define IDC32_MIDI_WRITE 12
|
---|
139 | #define IDC32_MIDI_READ 13
|
---|
140 | #define IDC32_STREAM_GETSPACE 14
|
---|
141 |
|
---|
142 | #define MIX_SETMASTERVOL 0
|
---|
143 | #define MIX_SETWAVEVOL 1
|
---|
144 | #define MIX_SETMIDIVOL 2
|
---|
145 | #define MIX_SETINPUTSRC 3
|
---|
146 | #define MIX_SETINPUTGAIN 4
|
---|
147 | #define MIX_SETLINEINVOL 5
|
---|
148 | #define MIX_SETLINEINMUTE 6
|
---|
149 | #define MIX_SETMICVOL 7
|
---|
150 | #define MIX_SETMICMUTE 8
|
---|
151 | #define MIX_SETCDVOL 9
|
---|
152 | #define MIX_SETCDMUTE 10
|
---|
153 | #define MIX_SETSPDIFVOL 11
|
---|
154 | #define MIX_SETSPDIFMUTE 12
|
---|
155 | #define MIX_SETBASS 13
|
---|
156 | #define MIX_SETTREBLE 14
|
---|
157 | #define MIX_SETVIDEOVOL 15
|
---|
158 | #define MIX_SETVIDEOMUTE 16
|
---|
159 | #define MIX_SETAUXVOL 17
|
---|
160 | #define MIX_SETAUXMUTE 18
|
---|
161 |
|
---|
162 | #define MAKE_VOLUME_LR(l, r) ((r << 8) | l)
|
---|
163 |
|
---|
164 | #define MIX_RECSRC_MIC 0
|
---|
165 | #define MIX_RECSRC_CD 1
|
---|
166 | #define MIX_RECSRC_LINE 2
|
---|
167 | #define MIX_RECSRC_VIDEO 3
|
---|
168 | #define MIX_RECSRC_MIXER 4
|
---|
169 | #define MIX_RECSRC_AUX 5
|
---|
170 |
|
---|
171 | #define IDC16_INIT 0
|
---|
172 | #define IDC16_EXIT 1
|
---|
173 | #define IDC16_SETIRQ 2
|
---|
174 | #define IDC16_FREEIRQ 3
|
---|
175 | #define IDC16_WAVEOUT_BUFFER_DONE 4
|
---|
176 | #define IDC16_WAVEIN_BUFFER_DONE 5
|
---|
177 | #define IDC16_FIND_PCIDEVICE 6
|
---|
178 | #define IDC16_FIND_PNPDEVICE 7
|
---|
179 | #define IDC16_MALLOC 8
|
---|
180 | #define IDC16_FREE 9
|
---|
181 | #define IDC16_VMALLOC 10
|
---|
182 | #define IDC16_VMFREE 11
|
---|
183 | #define IDC16_PROCESS 12
|
---|
184 |
|
---|
185 | #define IDC16_WAVEIN_IRQ 0
|
---|
186 | #define IDC16_WAVEOUT_IRQ 1
|
---|
187 | #define IDC16_MIDI_IRQ 2
|
---|
188 |
|
---|
189 | #define MAX_RES_IRQ 2
|
---|
190 | #define MAX_RES_DMA 2
|
---|
191 | #define MAX_RES_IO 8
|
---|
192 | #define MAX_RES_MEM 4
|
---|
193 |
|
---|
194 | #define SOUND_MIXER_VOLUME 0
|
---|
195 | #define SOUND_MIXER_BASS 1
|
---|
196 | #define SOUND_MIXER_TREBLE 2
|
---|
197 | #define SOUND_MIXER_SYNTH 3
|
---|
198 | #define SOUND_MIXER_PCM 4
|
---|
199 | #define SOUND_MIXER_SPEAKER 5
|
---|
200 | #define SOUND_MIXER_LINE 6
|
---|
201 | #define SOUND_MIXER_MIC 7
|
---|
202 | #define SOUND_MIXER_CD 8
|
---|
203 | #define SOUND_MIXER_IMIX 9 /* Recording monitor */
|
---|
204 | #define SOUND_MIXER_ALTPCM 10
|
---|
205 | #define SOUND_MIXER_RECLEV 11 /* Recording level */
|
---|
206 | #define SOUND_MIXER_IGAIN 12 /* Input gain */
|
---|
207 | #define SOUND_MIXER_OGAIN 13 /* Output gain */
|
---|
208 | #define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
|
---|
209 | #define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
|
---|
210 | #define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
|
---|
211 | #define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */
|
---|
212 | #define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */
|
---|
213 | #define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */
|
---|
214 | #define SOUND_MIXER_PHONEIN 20 /* Phone input */
|
---|
215 | #define SOUND_MIXER_PHONEOUT 21 /* Phone output */
|
---|
216 | #define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
|
---|
217 | #define SOUND_MIXER_RADIO 23 /* Radio in */
|
---|
218 | #define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */
|
---|
219 | #define SOUND_MIXER_NRDEVICES 25
|
---|
220 |
|
---|
221 | typedef struct
|
---|
222 | {
|
---|
223 | USHORT irq[MAX_RES_IRQ];
|
---|
224 | USHORT dma[MAX_RES_DMA];
|
---|
225 | USHORT io[MAX_RES_IO];
|
---|
226 | USHORT iolength[MAX_RES_IO];
|
---|
227 | ULONG mem[MAX_RES_MEM];
|
---|
228 | ULONG memlength[MAX_RES_MEM];
|
---|
229 | } IDC_RESOURCE;
|
---|
230 |
|
---|
231 | typedef struct {
|
---|
232 | ULONG ulSampleRate;
|
---|
233 | ULONG ulBitsPerSample;
|
---|
234 | ULONG ulNumChannels;
|
---|
235 | ULONG ulDataType;
|
---|
236 | } FORMAT_INFO;
|
---|
237 |
|
---|
238 | #define IOCTL_SETFORMAT 0
|
---|
239 | #define IOCTL_GETPOS 1
|
---|
240 | #define IOCTL_SETFRAGMENT 2
|
---|
241 |
|
---|
242 | #ifdef __cplusplus
|
---|
243 | extern "C" {
|
---|
244 | #endif
|
---|
245 |
|
---|
246 | //32 bits IDC procedures
|
---|
247 | //16 bits pdd calls this during init. OSS_InitDriver calls init_module
|
---|
248 | BOOL OSS32_InitDriver();
|
---|
249 | void OSS32_RemoveDriver();
|
---|
250 | BOOL OSS32_SetIrq(int irq, ULONG handler);
|
---|
251 | BOOL OSS32_FreeIrq(int irq);
|
---|
252 |
|
---|
253 | ULONG OSS32_StreamOpen(ULONG streamtype);
|
---|
254 | ULONG OSS32_StreamClose(ULONG streamtype, ULONG streamid);
|
---|
255 | ULONG OSS32_StreamTrigger(ULONG streamtype, ULONG streamid, ULONG __near *fStart);
|
---|
256 | ULONG OSS32_StreamReset(ULONG streamtype, ULONG streamid);
|
---|
257 | ULONG OSS32_StreamIOCtl(ULONG streamtype, ULONG streamid, ULONG cmd, char __near *buffer);
|
---|
258 | ULONG OSS32_StreamSetFormat(ULONG streamtype, ULONG streamid, ULONG cmd, FORMAT_INFO __near *pFormatInfo);
|
---|
259 | ULONG OSS32_StreamAddBuffer(ULONG streamtype, ULONG streamid, ULONG buffer, ULONG size);
|
---|
260 | ULONG OSS32_SetVolume(ULONG streamtype, ULONG streamid, ULONG cmd, ULONG volume);
|
---|
261 | ULONG OSS32_StreamMidiWrite(ULONG streamid, ULONG midiByte);
|
---|
262 | ULONG OSS32_StreamMidiRead(ULONG streamid, char NEAR *buffer, ULONG bufsize);
|
---|
263 | ULONG OSS32_StreamGetSpace(ULONG streamtype, ULONG streamid);
|
---|
264 |
|
---|
265 | //Sets file id in current task structure
|
---|
266 | ULONG OSS32_SetFileId(ULONG fileid);
|
---|
267 |
|
---|
268 | #ifdef TARGET_OS216
|
---|
269 | BOOL OSS16_StartStream(STREAM *stream);
|
---|
270 | BOOL OSS16_PauseStream(STREAM *stream);
|
---|
271 | BOOL OSS16_StopStream(STREAM *stream);
|
---|
272 | BOOL OSS16_StreamReset(STREAM *stream);
|
---|
273 | BOOL OSS16_StreamSetFormat(STREAM *stream, ULONG param1);
|
---|
274 | ULONG OSS16_StreamAddBuffer(STREAM *stream, ULONG buffer, ULONG size);
|
---|
275 | BOOL OSS16_StreamGetPos(STREAM *stream, ULONG FAR *pos);
|
---|
276 | BOOL OSS16_SetMasterVol(STREAM *stream, ULONG volume);
|
---|
277 | BOOL OSS16_SetWaveOutVol(STREAM *stream, ULONG volume);
|
---|
278 | BOOL OSS16_SetVolume(STREAM *stream, USHORT line, ULONG volume);
|
---|
279 | BOOL OSS16_SetGlobalVol(ULONG ulSysFileNum, USHORT line, ULONG volume);
|
---|
280 | BOOL OSS16_StreamSetFragment(STREAM *stream, ULONG fragsize);
|
---|
281 | ULONG OSS16_StreamGetSpace(STREAM *stream);
|
---|
282 | BOOL OSS16_AttachToPdd();
|
---|
283 | void OSS16_DetachFromPdd();
|
---|
284 | ULONG OSS16_OpenStream(STREAM *stream);
|
---|
285 | void OSS16_CloseStream(STREAM *stream);
|
---|
286 | typedef enum {
|
---|
287 | MIDI_RECEIVE = 0,
|
---|
288 | MIDI_SEND
|
---|
289 | } MIDITYPE;
|
---|
290 | ULONG OSS16_OpenMidiStream(MIDITYPE midiType);
|
---|
291 | void OSS16_CloseMidiStream(MIDITYPE midiType, ULONG streamid);
|
---|
292 | BOOL OSS16_WriteMidiByte(ULONG streamid, BYTE midiByte);
|
---|
293 | int OSS16_ReadMidiBytes(ULONG streamid, char far *buffer, int bufsize);
|
---|
294 |
|
---|
295 | #endif //TARGET_OS216
|
---|
296 |
|
---|
297 | //16 bits IDC procedures
|
---|
298 | BOOL CallOSS16(ULONG cmd, ULONG param1, ULONG param2);
|
---|
299 |
|
---|
300 | //Used to call into the 32 bits OSS driver
|
---|
301 | ULONG CallOSS32(USHORT cmd, ULONG fileid, ULONG param1, ULONG param2, ULONG param3, ULONG param4);
|
---|
302 |
|
---|
303 | #ifdef __cplusplus
|
---|
304 | }
|
---|
305 | #endif
|
---|
306 |
|
---|
307 | #endif
|
---|