1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef _UAPI__SOUND_EMU10K1_H
24#define _UAPI__SOUND_EMU10K1_H
25
26#include <linux/types.h>
27#include <sound/asound.h>
28
29
30
31
32
33#define EMU10K1_CARD_CREATIVE 0x00000000
34#define EMU10K1_CARD_EMUAPS 0x00000001
35
36#define EMU10K1_FX8010_PCM_COUNT 8
37
38
39
40
41
42
43#define __EMU10K1_DECLARE_BITMAP(name,bits) \
44 unsigned long name[(bits) / (sizeof(unsigned long) * 8)]
45
46
47#define iMAC0 0x00
48#define iMAC1 0x01
49#define iMAC2 0x02
50#define iMAC3 0x03
51#define iMACINT0 0x04
52#define iMACINT1 0x05
53#define iACC3 0x06
54#define iMACMV 0x07
55#define iANDXOR 0x08
56#define iTSTNEG 0x09
57#define iLIMITGE 0x0a
58#define iLIMITLT 0x0b
59#define iLOG 0x0c
60#define iEXP 0x0d
61#define iINTERP 0x0e
62#define iSKIP 0x0f
63
64
65#define FXBUS(x) (0x00 + (x))
66#define EXTIN(x) (0x10 + (x))
67#define EXTOUT(x) (0x20 + (x))
68#define FXBUS2(x) (0x30 + (x))
69
70
71#define C_00000000 0x40
72#define C_00000001 0x41
73#define C_00000002 0x42
74#define C_00000003 0x43
75#define C_00000004 0x44
76#define C_00000008 0x45
77#define C_00000010 0x46
78#define C_00000020 0x47
79#define C_00000100 0x48
80#define C_00010000 0x49
81#define C_00080000 0x4a
82#define C_10000000 0x4b
83#define C_20000000 0x4c
84#define C_40000000 0x4d
85#define C_80000000 0x4e
86#define C_7fffffff 0x4f
87#define C_ffffffff 0x50
88#define C_fffffffe 0x51
89#define C_c0000000 0x52
90#define C_4f1bbcdc 0x53
91#define C_5a7ef9db 0x54
92#define C_00100000 0x55
93#define GPR_ACCU 0x56
94#define GPR_COND 0x57
95#define GPR_NOISE0 0x58
96#define GPR_NOISE1 0x59
97#define GPR_IRQ 0x5a
98#define GPR_DBAC 0x5b
99#define GPR(x) (FXGPREGBASE + (x))
100#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x))
101#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x))
102#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x))
103#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x))
104
105#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x))
106#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x))
107#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x))
108#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x))
109#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x))
110#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x))
111
112#define A_FXBUS(x) (0x00 + (x))
113#define A_EXTIN(x) (0x40 + (x))
114#define A_P16VIN(x) (0x50 + (x))
115#define A_EXTOUT(x) (0x60 + (x))
116#define A_FXBUS2(x) (0x80 + (x))
117#define A_EMU32OUTH(x) (0xa0 + (x))
118#define A_EMU32OUTL(x) (0xb0 + (x))
119#define A3_EMU32IN(x) (0x160 + (x))
120#define A3_EMU32OUT(x) (0x1E0 + (x))
121#define A_GPR(x) (A_FXGPREGBASE + (x))
122
123
124#define CC_REG_NORMALIZED C_00000001
125#define CC_REG_BORROW C_00000002
126#define CC_REG_MINUS C_00000004
127#define CC_REG_ZERO C_00000008
128#define CC_REG_SATURATE C_00000010
129#define CC_REG_NONZERO C_00000100
130
131
132#define FXBUS_PCM_LEFT 0x00
133#define FXBUS_PCM_RIGHT 0x01
134#define FXBUS_PCM_LEFT_REAR 0x02
135#define FXBUS_PCM_RIGHT_REAR 0x03
136#define FXBUS_MIDI_LEFT 0x04
137#define FXBUS_MIDI_RIGHT 0x05
138#define FXBUS_PCM_CENTER 0x06
139#define FXBUS_PCM_LFE 0x07
140#define FXBUS_PCM_LEFT_FRONT 0x08
141#define FXBUS_PCM_RIGHT_FRONT 0x09
142#define FXBUS_MIDI_REVERB 0x0c
143#define FXBUS_MIDI_CHORUS 0x0d
144#define FXBUS_PCM_LEFT_SIDE 0x0e
145#define FXBUS_PCM_RIGHT_SIDE 0x0f
146#define FXBUS_PT_LEFT 0x14
147#define FXBUS_PT_RIGHT 0x15
148
149
150#define EXTIN_AC97_L 0x00
151#define EXTIN_AC97_R 0x01
152#define EXTIN_SPDIF_CD_L 0x02
153#define EXTIN_SPDIF_CD_R 0x03
154#define EXTIN_ZOOM_L 0x04
155#define EXTIN_ZOOM_R 0x05
156#define EXTIN_TOSLINK_L 0x06
157#define EXTIN_TOSLINK_R 0x07
158#define EXTIN_LINE1_L 0x08
159#define EXTIN_LINE1_R 0x09
160#define EXTIN_COAX_SPDIF_L 0x0a
161#define EXTIN_COAX_SPDIF_R 0x0b
162#define EXTIN_LINE2_L 0x0c
163#define EXTIN_LINE2_R 0x0d
164
165
166#define EXTOUT_AC97_L 0x00
167#define EXTOUT_AC97_R 0x01
168#define EXTOUT_TOSLINK_L 0x02
169#define EXTOUT_TOSLINK_R 0x03
170#define EXTOUT_AC97_CENTER 0x04
171#define EXTOUT_AC97_LFE 0x05
172#define EXTOUT_HEADPHONE_L 0x06
173#define EXTOUT_HEADPHONE_R 0x07
174#define EXTOUT_REAR_L 0x08
175#define EXTOUT_REAR_R 0x09
176#define EXTOUT_ADC_CAP_L 0x0a
177#define EXTOUT_ADC_CAP_R 0x0b
178#define EXTOUT_MIC_CAP 0x0c
179#define EXTOUT_AC97_REAR_L 0x0d
180#define EXTOUT_AC97_REAR_R 0x0e
181#define EXTOUT_ACENTER 0x11
182#define EXTOUT_ALFE 0x12
183
184
185#define A_EXTIN_AC97_L 0x00
186#define A_EXTIN_AC97_R 0x01
187#define A_EXTIN_SPDIF_CD_L 0x02
188#define A_EXTIN_SPDIF_CD_R 0x03
189#define A_EXTIN_OPT_SPDIF_L 0x04
190#define A_EXTIN_OPT_SPDIF_R 0x05
191#define A_EXTIN_LINE2_L 0x08
192#define A_EXTIN_LINE2_R 0x09
193#define A_EXTIN_ADC_L 0x0a
194#define A_EXTIN_ADC_R 0x0b
195#define A_EXTIN_AUX2_L 0x0c
196#define A_EXTIN_AUX2_R 0x0d
197
198
199#define A_EXTOUT_FRONT_L 0x00
200#define A_EXTOUT_FRONT_R 0x01
201#define A_EXTOUT_CENTER 0x02
202#define A_EXTOUT_LFE 0x03
203#define A_EXTOUT_HEADPHONE_L 0x04
204#define A_EXTOUT_HEADPHONE_R 0x05
205#define A_EXTOUT_REAR_L 0x06
206#define A_EXTOUT_REAR_R 0x07
207#define A_EXTOUT_AFRONT_L 0x08
208#define A_EXTOUT_AFRONT_R 0x09
209#define A_EXTOUT_ACENTER 0x0a
210#define A_EXTOUT_ALFE 0x0b
211#define A_EXTOUT_ASIDE_L 0x0c
212#define A_EXTOUT_ASIDE_R 0x0d
213#define A_EXTOUT_AREAR_L 0x0e
214#define A_EXTOUT_AREAR_R 0x0f
215#define A_EXTOUT_AC97_L 0x10
216#define A_EXTOUT_AC97_R 0x11
217#define A_EXTOUT_ADC_CAP_L 0x16
218#define A_EXTOUT_ADC_CAP_R 0x17
219#define A_EXTOUT_MIC_CAP 0x18
220
221
222#define A_C_00000000 0xc0
223#define A_C_00000001 0xc1
224#define A_C_00000002 0xc2
225#define A_C_00000003 0xc3
226#define A_C_00000004 0xc4
227#define A_C_00000008 0xc5
228#define A_C_00000010 0xc6
229#define A_C_00000020 0xc7
230#define A_C_00000100 0xc8
231#define A_C_00010000 0xc9
232#define A_C_00000800 0xca
233#define A_C_10000000 0xcb
234#define A_C_20000000 0xcc
235#define A_C_40000000 0xcd
236#define A_C_80000000 0xce
237#define A_C_7fffffff 0xcf
238#define A_C_ffffffff 0xd0
239#define A_C_fffffffe 0xd1
240#define A_C_c0000000 0xd2
241#define A_C_4f1bbcdc 0xd3
242#define A_C_5a7ef9db 0xd4
243#define A_C_00100000 0xd5
244#define A_GPR_ACCU 0xd6
245#define A_GPR_COND 0xd7
246#define A_GPR_NOISE0 0xd8
247#define A_GPR_NOISE1 0xd9
248#define A_GPR_IRQ 0xda
249#define A_GPR_DBAC 0xdb
250#define A_GPR_DBACE 0xde
251
252
253#define EMU10K1_DBG_ZC 0x80000000
254#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000
255#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000
256#define EMU10K1_DBG_SINGLE_STEP 0x00008000
257#define EMU10K1_DBG_STEP 0x00004000
258#define EMU10K1_DBG_CONDITION_CODE 0x00003e00
259#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff
260
261
262#ifndef __KERNEL__
263#define TANKMEMADDRREG_ADDR_MASK 0x000fffff
264#define TANKMEMADDRREG_CLEAR 0x00800000
265#define TANKMEMADDRREG_ALIGN 0x00400000
266#define TANKMEMADDRREG_WRITE 0x00200000
267#define TANKMEMADDRREG_READ 0x00100000
268#endif
269
270struct snd_emu10k1_fx8010_info {
271 unsigned int internal_tram_size;
272 unsigned int external_tram_size;
273 char fxbus_names[16][32];
274 char extin_names[16][32];
275 char extout_names[32][32];
276 unsigned int gpr_controls;
277};
278
279#define EMU10K1_GPR_TRANSLATION_NONE 0
280#define EMU10K1_GPR_TRANSLATION_TABLE100 1
281#define EMU10K1_GPR_TRANSLATION_BASS 2
282#define EMU10K1_GPR_TRANSLATION_TREBLE 3
283#define EMU10K1_GPR_TRANSLATION_ONOFF 4
284
285struct snd_emu10k1_fx8010_control_gpr {
286 struct snd_ctl_elem_id id;
287 unsigned int vcount;
288 unsigned int count;
289 unsigned short gpr[32];
290 unsigned int value[32];
291 unsigned int min;
292 unsigned int max;
293 unsigned int translation;
294 const unsigned int *tlv;
295};
296
297
298struct snd_emu10k1_fx8010_control_old_gpr {
299 struct snd_ctl_elem_id id;
300 unsigned int vcount;
301 unsigned int count;
302 unsigned short gpr[32];
303 unsigned int value[32];
304 unsigned int min;
305 unsigned int max;
306 unsigned int translation;
307};
308
309struct snd_emu10k1_fx8010_code {
310 char name[128];
311
312 __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200);
313 __u32 __user *gpr_map;
314
315 unsigned int gpr_add_control_count;
316 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls;
317
318 unsigned int gpr_del_control_count;
319 struct snd_ctl_elem_id __user *gpr_del_controls;
320
321 unsigned int gpr_list_control_count;
322 unsigned int gpr_list_control_total;
323 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls;
324
325 __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100);
326 __u32 __user *tram_data_map;
327 __u32 __user *tram_addr_map;
328
329 __EMU10K1_DECLARE_BITMAP(code_valid, 1024);
330 __u32 __user *code;
331};
332
333struct snd_emu10k1_fx8010_tram {
334 unsigned int address;
335 unsigned int size;
336 unsigned int *samples;
337
338};
339
340struct snd_emu10k1_fx8010_pcm_rec {
341 unsigned int substream;
342 unsigned int res1;
343 unsigned int channels;
344 unsigned int tram_start;
345 unsigned int buffer_size;
346 unsigned short gpr_size;
347 unsigned short gpr_ptr;
348 unsigned short gpr_count;
349 unsigned short gpr_tmpcount;
350 unsigned short gpr_trigger;
351 unsigned short gpr_running;
352 unsigned char pad;
353 unsigned char etram[32];
354 unsigned int res2;
355};
356
357#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
358
359#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
360#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
361#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
362#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
363#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
364#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
365#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
366#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
367#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
368#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
369#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
370#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
371#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
372#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
373
374
375typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
376typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
377typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
378typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
379typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
380
381#endif
382