This source file includes following definitions.
- ioctl_return
- dmasound_set_volume
- dmasound_set_bass
- dmasound_set_treble
- dmasound_set_gain
1
2 #ifndef _dmasound_h_
3
4
5
6
7
8
9
10
11
12
13
14 #define _dmasound_h_
15
16 #include <linux/types.h>
17
18 #define SND_NDEVS 256
19 #define SND_DEV_CTL 0
20 #define SND_DEV_SEQ 1
21
22 #define SND_DEV_MIDIN 2
23 #define SND_DEV_DSP 3
24 #define SND_DEV_AUDIO 4
25 #define SND_DEV_DSP16 5
26 #define SND_DEV_STATUS 6
27
28 #define SND_DEV_SEQ2 8
29 #define SND_DEV_SNDPROC 9
30 #define SND_DEV_PSS SND_DEV_SNDPROC
31
32
33 #define DEBUG_DMASOUND 1
34
35 #define MAX_AUDIO_DEV 5
36 #define MAX_MIXER_DEV 4
37 #define MAX_SYNTH_DEV 3
38 #define MAX_MIDI_DEV 6
39 #define MAX_TIMER_DEV 3
40
41 #define MAX_CATCH_RADIUS 10
42
43 #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff))
44 #define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
45
46 #define IOCTL_IN(arg, ret) \
47 do { int error = get_user(ret, (int __user *)(arg)); \
48 if (error) return error; \
49 } while (0)
50 #define IOCTL_OUT(arg, ret) ioctl_return((int __user *)(arg), ret)
51
52 static inline int ioctl_return(int __user *addr, int value)
53 {
54 return value < 0 ? value : put_user(value, addr);
55 }
56
57
58
59
60
61
62 #undef HAS_8BIT_TABLES
63
64 #if defined(CONFIG_DMASOUND_ATARI) || defined(CONFIG_DMASOUND_ATARI_MODULE) ||\
65 defined(CONFIG_DMASOUND_PAULA) || defined(CONFIG_DMASOUND_PAULA_MODULE) ||\
66 defined(CONFIG_DMASOUND_Q40) || defined(CONFIG_DMASOUND_Q40_MODULE)
67 #define HAS_8BIT_TABLES
68 #define MIN_BUFFERS 4
69 #define MIN_BUFSIZE (1<<12)
70 #define MIN_FRAG_SIZE 8
71 #define MAX_BUFSIZE (1<<17)
72 #define MAX_FRAG_SIZE 15
73
74 #else
75
76 #define MIN_BUFFERS 2
77 #define MIN_BUFSIZE (1<<8)
78 #define MIN_FRAG_SIZE 8
79 #define MAX_BUFSIZE (1<<18)
80 #define MAX_FRAG_SIZE 16
81 #endif
82
83 #define DEFAULT_N_BUFFERS 4
84 #define DEFAULT_BUFF_SIZE (1<<15)
85
86
87
88
89
90 extern int dmasound_init(void);
91 #ifdef MODULE
92 extern void dmasound_deinit(void);
93 #else
94 #define dmasound_deinit() do { } while (0)
95 #endif
96
97
98
99 typedef struct {
100 int format;
101 int stereo;
102 int size;
103 int speed;
104 } SETTINGS;
105
106
107
108
109
110 typedef struct {
111 const char *name;
112 const char *name2;
113 struct module *owner;
114 void *(*dma_alloc)(unsigned int, gfp_t);
115 void (*dma_free)(void *, unsigned int);
116 int (*irqinit)(void);
117 #ifdef MODULE
118 void (*irqcleanup)(void);
119 #endif
120 void (*init)(void);
121 void (*silence)(void);
122 int (*setFormat)(int);
123 int (*setVolume)(int);
124 int (*setBass)(int);
125 int (*setTreble)(int);
126 int (*setGain)(int);
127 void (*play)(void);
128 void (*record)(void);
129 void (*mixer_init)(void);
130 int (*mixer_ioctl)(u_int, u_long);
131 int (*write_sq_setup)(void);
132 int (*read_sq_setup)(void);
133 int (*sq_open)(fmode_t);
134 int (*state_info)(char *, size_t);
135 void (*abort_read)(void);
136 int min_dsp_speed;
137 int max_dsp_speed;
138 int version ;
139 int hardware_afmts ;
140
141 int capabilities ;
142 SETTINGS default_hard ;
143 SETTINGS default_soft ;
144 } MACHINE;
145
146
147
148
149
150 typedef struct {
151 ssize_t (*ct_ulaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
152 ssize_t (*ct_alaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
153 ssize_t (*ct_s8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
154 ssize_t (*ct_u8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
155 ssize_t (*ct_s16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
156 ssize_t (*ct_u16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
157 ssize_t (*ct_s16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
158 ssize_t (*ct_u16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
159 } TRANS;
160
161 struct sound_settings {
162 MACHINE mach;
163 SETTINGS hard;
164 SETTINGS soft;
165 SETTINGS dsp;
166 TRANS *trans_write;
167 int volume_left;
168 int volume_right;
169 int bass;
170 int treble;
171 int gain;
172 int minDev;
173 spinlock_t lock;
174 };
175
176 extern struct sound_settings dmasound;
177
178 #ifdef HAS_8BIT_TABLES
179 extern char dmasound_ulaw2dma8[];
180 extern char dmasound_alaw2dma8[];
181 #endif
182
183
184
185
186
187 static inline int dmasound_set_volume(int volume)
188 {
189 return dmasound.mach.setVolume(volume);
190 }
191
192 static inline int dmasound_set_bass(int bass)
193 {
194 return dmasound.mach.setBass ? dmasound.mach.setBass(bass) : 50;
195 }
196
197 static inline int dmasound_set_treble(int treble)
198 {
199 return dmasound.mach.setTreble ? dmasound.mach.setTreble(treble) : 50;
200 }
201
202 static inline int dmasound_set_gain(int gain)
203 {
204 return dmasound.mach.setGain ? dmasound.mach.setGain(gain) : 100;
205 }
206
207
208
209
210
211
212 struct sound_queue {
213
214 int numBufs;
215 int bufSize;
216 char **buffers;
217
218
219 int locked ;
220 int user_frags ;
221 int user_frag_size ;
222 int max_count;
223 int block_size;
224 int max_active;
225
226
227 int front, rear, count;
228 int rear_size;
229
230
231
232
233
234
235
236
237 int active;
238 wait_queue_head_t action_queue, open_queue, sync_queue;
239 int non_blocking;
240 int busy, syncing, xruns, died;
241 };
242
243 #define WAKE_UP(queue) (wake_up_interruptible(&queue))
244
245 extern struct sound_queue dmasound_write_sq;
246 #define write_sq dmasound_write_sq
247
248 extern int dmasound_catchRadius;
249 #define catchRadius dmasound_catchRadius
250
251
252
253
254 #define BS_VAL 1
255
256 #define SW_INPUT_VOLUME_SCALE 4
257 #define SW_INPUT_VOLUME_DEFAULT (128 / SW_INPUT_VOLUME_SCALE)
258
259 extern int expand_read_bal;
260 extern uint software_input_volume;
261
262 #endif