aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/gus.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/sound/gus.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/sound/gus.h')
-rw-r--r--include/sound/gus.h718
1 files changed, 718 insertions, 0 deletions
diff --git a/include/sound/gus.h b/include/sound/gus.h
new file mode 100644
index 000000000000..8b6287a6fff5
--- /dev/null
+++ b/include/sound/gus.h
@@ -0,0 +1,718 @@
1#ifndef __SOUND_GUS_H
2#define __SOUND_GUS_H
3
4/*
5 * Global structures used for GUS part of ALSA driver
6 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include "pcm.h"
26#include "rawmidi.h"
27#include "timer.h"
28#include "seq_midi_emul.h"
29#include "seq_device.h"
30#include "ainstr_iw.h"
31#include "ainstr_gf1.h"
32#include "ainstr_simple.h"
33#include <asm/io.h>
34
35#define SNDRV_SEQ_DEV_ID_GUS "gus-synth"
36
37/* IO ports */
38
39#define GUSP(gus, x) ((gus)->gf1.port + SNDRV_g_u_s_##x)
40
41#define SNDRV_g_u_s_MIDICTRL (0x320-0x220)
42#define SNDRV_g_u_s_MIDISTAT (0x320-0x220)
43#define SNDRV_g_u_s_MIDIDATA (0x321-0x220)
44
45#define SNDRV_g_u_s_GF1PAGE (0x322-0x220)
46#define SNDRV_g_u_s_GF1REGSEL (0x323-0x220)
47#define SNDRV_g_u_s_GF1DATALOW (0x324-0x220)
48#define SNDRV_g_u_s_GF1DATAHIGH (0x325-0x220)
49#define SNDRV_g_u_s_IRQSTAT (0x226-0x220)
50#define SNDRV_g_u_s_TIMERCNTRL (0x228-0x220)
51#define SNDRV_g_u_s_TIMERDATA (0x229-0x220)
52#define SNDRV_g_u_s_DRAM (0x327-0x220)
53#define SNDRV_g_u_s_MIXCNTRLREG (0x220-0x220)
54#define SNDRV_g_u_s_IRQDMACNTRLREG (0x22b-0x220)
55#define SNDRV_g_u_s_REGCNTRLS (0x22f-0x220)
56#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220)
57#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220)
58#define SNDRV_g_u_s_IVER (0x325-0x220)
59#define SNDRV_g_u_s_MIXDATAPORT (0x326-0x220)
60#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220)
61
62/* GF1 registers */
63
64/* global registers */
65#define SNDRV_GF1_GB_ACTIVE_VOICES 0x0e
66#define SNDRV_GF1_GB_VOICES_IRQ 0x0f
67#define SNDRV_GF1_GB_GLOBAL_MODE 0x19
68#define SNDRV_GF1_GW_LFO_BASE 0x1a
69#define SNDRV_GF1_GB_VOICES_IRQ_READ 0x1f
70#define SNDRV_GF1_GB_DRAM_DMA_CONTROL 0x41
71#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42
72#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43
73#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44
74#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL 0x45
75#define SNDRV_GF1_GB_ADLIB_TIMER_1 0x46
76#define SNDRV_GF1_GB_ADLIB_TIMER_2 0x47
77#define SNDRV_GF1_GB_RECORD_RATE 0x48
78#define SNDRV_GF1_GB_REC_DMA_CONTROL 0x49
79#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL 0x4b
80#define SNDRV_GF1_GB_RESET 0x4c
81#define SNDRV_GF1_GB_DRAM_DMA_HIGH 0x50
82#define SNDRV_GF1_GW_DRAM_IO16 0x51
83#define SNDRV_GF1_GW_MEMORY_CONFIG 0x52
84#define SNDRV_GF1_GB_MEMORY_CONTROL 0x53
85#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR 0x54
86#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55
87#define SNDRV_GF1_GW_FIFO_SIZE 0x56
88#define SNDRV_GF1_GW_INTERLEAVE 0x57
89#define SNDRV_GF1_GB_COMPATIBILITY 0x59
90#define SNDRV_GF1_GB_DECODE_CONTROL 0x5a
91#define SNDRV_GF1_GB_VERSION_NUMBER 0x5b
92#define SNDRV_GF1_GB_MPU401_CONTROL_A 0x5c
93#define SNDRV_GF1_GB_MPU401_CONTROL_B 0x5d
94#define SNDRV_GF1_GB_EMULATION_IRQ 0x60
95/* voice specific registers */
96#define SNDRV_GF1_VB_ADDRESS_CONTROL 0x00
97#define SNDRV_GF1_VW_FREQUENCY 0x01
98#define SNDRV_GF1_VW_START_HIGH 0x02
99#define SNDRV_GF1_VW_START_LOW 0x03
100#define SNDRV_GF1_VA_START SNDRV_GF1_VW_START_HIGH
101#define SNDRV_GF1_VW_END_HIGH 0x04
102#define SNDRV_GF1_VW_END_LOW 0x05
103#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH
104#define SNDRV_GF1_VB_VOLUME_RATE 0x06
105#define SNDRV_GF1_VB_VOLUME_START 0x07
106#define SNDRV_GF1_VB_VOLUME_END 0x08
107#define SNDRV_GF1_VW_VOLUME 0x09
108#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a
109#define SNDRV_GF1_VW_CURRENT_LOW 0x0b
110#define SNDRV_GF1_VA_CURRENT SNDRV_GF1_VW_CURRENT_HIGH
111#define SNDRV_GF1_VB_PAN 0x0c
112#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c
113#define SNDRV_GF1_VB_VOLUME_CONTROL 0x0d
114#define SNDRV_GF1_VB_UPPER_ADDRESS 0x10
115#define SNDRV_GF1_VW_EFFECT_HIGH 0x11
116#define SNDRV_GF1_VW_EFFECT_LOW 0x12
117#define SNDRV_GF1_VA_EFFECT SNDRV_GF1_VW_EFFECT_HIGH
118#define SNDRV_GF1_VW_OFFSET_LEFT 0x13
119#define SNDRV_GF1_VB_ACCUMULATOR 0x14
120#define SNDRV_GF1_VB_MODE 0x15
121#define SNDRV_GF1_VW_EFFECT_VOLUME 0x16
122#define SNDRV_GF1_VB_FREQUENCY_LFO 0x17
123#define SNDRV_GF1_VB_VOLUME_LFO 0x18
124#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL 0x1b
125#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL 0x1c
126#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d
127
128/* ICS registers */
129
130#define SNDRV_ICS_MIC_DEV 0
131#define SNDRV_ICS_LINE_DEV 1
132#define SNDRV_ICS_CD_DEV 2
133#define SNDRV_ICS_GF1_DEV 3
134#define SNDRV_ICS_NONE_DEV 4
135#define SNDRV_ICS_MASTER_DEV 5
136
137/* LFO */
138
139#define SNDRV_LFO_TREMOLO 0
140#define SNDRV_LFO_VIBRATO 1
141
142/* misc */
143
144#define SNDRV_GF1_DMA_UNSIGNED 0x80
145#define SNDRV_GF1_DMA_16BIT 0x40
146#define SNDRV_GF1_DMA_IRQ 0x20
147#define SNDRV_GF1_DMA_WIDTH16 0x04
148#define SNDRV_GF1_DMA_READ 0x02 /* read from GUS's DRAM */
149#define SNDRV_GF1_DMA_ENABLE 0x01
150
151/* ramp ranges */
152
153#define SNDRV_GF1_ATTEN(x) (snd_gf1_atten_table[x])
154#define SNDRV_GF1_MIN_VOLUME 1800
155#define SNDRV_GF1_MAX_VOLUME 4095
156#define SNDRV_GF1_MIN_OFFSET (SNDRV_GF1_MIN_VOLUME>>4)
157#define SNDRV_GF1_MAX_OFFSET 255
158#define SNDRV_GF1_MAX_TDEPTH 90
159
160/* defines for memory manager */
161
162#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001
163
164#define SNDRV_GF1_MEM_OWNER_DRIVER 0x0001
165#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002
166#define SNDRV_GF1_MEM_OWNER_WAVE_GF1 0x0003
167#define SNDRV_GF1_MEM_OWNER_WAVE_IWFFFF 0x0004
168
169/* constants for interrupt handlers */
170
171#define SNDRV_GF1_HANDLER_MIDI_OUT 0x00010000
172#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000
173#define SNDRV_GF1_HANDLER_TIMER1 0x00040000
174#define SNDRV_GF1_HANDLER_TIMER2 0x00080000
175#define SNDRV_GF1_HANDLER_VOICE 0x00100000
176#define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000
177#define SNDRV_GF1_HANDLER_DMA_READ 0x00400000
178#define SNDRV_GF1_HANDLER_ALL (0xffff0000&~SNDRV_GF1_HANDLER_VOICE)
179
180/* constants for DMA flags */
181
182#define SNDRV_GF1_DMA_TRIGGER 1
183
184/* --- */
185
186struct _snd_gus_card;
187typedef struct _snd_gus_card snd_gus_card_t;
188
189/* GF1 specific structure */
190
191typedef struct _snd_gf1_bank_info {
192 unsigned int address;
193 unsigned int size;
194} snd_gf1_bank_info_t;
195
196typedef struct _snd_gf1_mem_block {
197 unsigned short flags; /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */
198 unsigned short owner; /* owner - SNDRV_GF1_MEM_OWNER_XXXX */
199 unsigned int share; /* share count */
200 unsigned int share_id[4]; /* share ID */
201 unsigned int ptr;
202 unsigned int size;
203 char *name;
204 struct _snd_gf1_mem_block *next;
205 struct _snd_gf1_mem_block *prev;
206} snd_gf1_mem_block_t;
207
208typedef struct _snd_gf1_mem {
209 snd_gf1_bank_info_t banks_8[4];
210 snd_gf1_bank_info_t banks_16[4];
211 snd_gf1_mem_block_t *first;
212 snd_gf1_mem_block_t *last;
213 struct semaphore memory_mutex;
214} snd_gf1_mem_t;
215
216typedef struct snd_gf1_dma_block {
217 void *buffer; /* buffer in computer's RAM */
218 unsigned long buf_addr; /* buffer address */
219 unsigned int addr; /* address in onboard memory */
220 unsigned int count; /* count in bytes */
221 unsigned int cmd; /* DMA command (format) */
222 void (*ack)(snd_gus_card_t * gus, void *private_data);
223 void *private_data;
224 struct snd_gf1_dma_block *next;
225} snd_gf1_dma_block_t;
226
227typedef struct {
228 snd_midi_channel_set_t * chset;
229 snd_gus_card_t * gus;
230 int mode; /* operation mode */
231 int client; /* sequencer client number */
232 int port; /* sequencer port number */
233 unsigned int midi_has_voices: 1;
234} snd_gus_port_t;
235
236typedef struct _snd_gus_voice snd_gus_voice_t;
237
238typedef struct {
239 void (*sample_start)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_position_t position);
240 void (*sample_stop)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_stop_mode_t mode);
241 void (*sample_freq)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_frequency_t freq);
242 void (*sample_volume)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_ev_volume_t *volume);
243 void (*sample_loop)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_ev_loop_t *loop);
244 void (*sample_pos)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_position_t position);
245 void (*sample_private1)(snd_gus_card_t *card, snd_gus_voice_t *voice, unsigned char *data);
246} snd_gus_sample_ops_t;
247
248#define SNDRV_GF1_VOICE_TYPE_PCM 0
249#define SNDRV_GF1_VOICE_TYPE_SYNTH 1
250#define SNDRV_GF1_VOICE_TYPE_MIDI 2
251
252#define SNDRV_GF1_VFLG_RUNNING (1<<0)
253#define SNDRV_GF1_VFLG_EFFECT_TIMER1 (1<<1)
254#define SNDRV_GF1_VFLG_PAN (1<<2)
255
256typedef enum {
257 VENV_BEFORE,
258 VENV_ATTACK,
259 VENV_SUSTAIN,
260 VENV_RELEASE,
261 VENV_DONE,
262 VENV_VOLUME
263} snd_gus_volume_state_t;
264
265struct _snd_gus_voice {
266 int number;
267 unsigned int use: 1,
268 pcm: 1,
269 synth:1,
270 midi: 1;
271 unsigned int flags;
272 unsigned char client;
273 unsigned char port;
274 unsigned char index;
275 unsigned char pad;
276
277#ifdef CONFIG_SND_DEBUG
278 unsigned int interrupt_stat_wave;
279 unsigned int interrupt_stat_volume;
280#endif
281 void (*handler_wave) (snd_gus_card_t * gus, snd_gus_voice_t * voice);
282 void (*handler_volume) (snd_gus_card_t * gus, snd_gus_voice_t * voice);
283 void (*handler_effect) (snd_gus_card_t * gus, snd_gus_voice_t * voice);
284 void (*volume_change) (snd_gus_card_t * gus);
285
286 snd_gus_sample_ops_t *sample_ops;
287
288 snd_seq_instr_t instr;
289
290 /* running status / registers */
291
292 snd_seq_ev_volume_t sample_volume;
293
294 unsigned short fc_register;
295 unsigned short fc_lfo;
296 unsigned short gf1_volume;
297 unsigned char control;
298 unsigned char mode;
299 unsigned char gf1_pan;
300 unsigned char effect_accumulator;
301 unsigned char volume_control;
302 unsigned char venv_value_next;
303 snd_gus_volume_state_t venv_state;
304 snd_gus_volume_state_t venv_state_prev;
305 unsigned short vlo;
306 unsigned short vro;
307 unsigned short gf1_effect_volume;
308
309 /* --- */
310
311 void *private_data;
312 void (*private_free)(snd_gus_voice_t *voice);
313};
314
315struct _snd_gf1 {
316
317 unsigned int enh_mode:1, /* enhanced mode (GFA1) */
318 hw_lfo:1, /* use hardware LFO */
319 sw_lfo:1, /* use software LFO */
320 effect:1; /* use effect voices */
321
322 unsigned long port; /* port of GF1 chip */
323 struct resource *res_port1;
324 struct resource *res_port2;
325 int irq; /* IRQ number */
326 int dma1; /* DMA1 number */
327 int dma2; /* DMA2 number */
328 unsigned int memory; /* GUS's DRAM size in bytes */
329 unsigned int rom_memory; /* GUS's ROM size in bytes */
330 unsigned int rom_present; /* bitmask */
331 unsigned int rom_banks; /* GUS's ROM banks */
332
333 snd_gf1_mem_t mem_alloc;
334
335 /* registers */
336 unsigned short reg_page;
337 unsigned short reg_regsel;
338 unsigned short reg_data8;
339 unsigned short reg_data16;
340 unsigned short reg_irqstat;
341 unsigned short reg_dram;
342 unsigned short reg_timerctrl;
343 unsigned short reg_timerdata;
344 unsigned char ics_regs[6][2];
345 /* --------- */
346
347 unsigned char active_voices; /* active voices */
348 unsigned char active_voice; /* selected voice (GF1PAGE register) */
349
350 snd_gus_voice_t voices[32]; /* GF1 voices */
351
352 unsigned int default_voice_address;
353
354 unsigned short playback_freq; /* GF1 playback (mixing) frequency */
355 unsigned short mode; /* see to SNDRV_GF1_MODE_XXXX */
356 unsigned char volume_ramp;
357 unsigned char smooth_pan;
358 unsigned char full_range_pan;
359 unsigned char pad0;
360
361 unsigned char *lfos;
362
363 /* interrupt handlers */
364
365 void (*interrupt_handler_midi_out) (snd_gus_card_t * gus);
366 void (*interrupt_handler_midi_in) (snd_gus_card_t * gus);
367 void (*interrupt_handler_timer1) (snd_gus_card_t * gus);
368 void (*interrupt_handler_timer2) (snd_gus_card_t * gus);
369 void (*interrupt_handler_dma_write) (snd_gus_card_t * gus);
370 void (*interrupt_handler_dma_read) (snd_gus_card_t * gus);
371
372#ifdef CONFIG_SND_DEBUG
373 unsigned int interrupt_stat_midi_out;
374 unsigned int interrupt_stat_midi_in;
375 unsigned int interrupt_stat_timer1;
376 unsigned int interrupt_stat_timer2;
377 unsigned int interrupt_stat_dma_write;
378 unsigned int interrupt_stat_dma_read;
379 unsigned int interrupt_stat_voice_lost;
380#endif
381
382 /* synthesizer */
383
384 int seq_client;
385 snd_gus_port_t seq_ports[4];
386 snd_seq_kinstr_list_t *ilist;
387 snd_iwffff_ops_t iwffff_ops;
388 snd_gf1_ops_t gf1_ops;
389 snd_simple_ops_t simple_ops;
390
391 /* timer */
392
393 unsigned short timer_enabled;
394 snd_timer_t *timer1;
395 snd_timer_t *timer2;
396
397 /* midi */
398
399 unsigned short uart_cmd;
400 unsigned int uart_framing;
401 unsigned int uart_overrun;
402
403 /* dma operations */
404
405 unsigned int dma_flags;
406 unsigned int dma_shared;
407 snd_gf1_dma_block_t *dma_data_pcm;
408 snd_gf1_dma_block_t *dma_data_pcm_last;
409 snd_gf1_dma_block_t *dma_data_synth;
410 snd_gf1_dma_block_t *dma_data_synth_last;
411 void (*dma_ack)(snd_gus_card_t * gus, void *private_data);
412 void *dma_private_data;
413
414 /* pcm */
415 int pcm_channels;
416 int pcm_alloc_voices;
417 unsigned short pcm_volume_level_left;
418 unsigned short pcm_volume_level_right;
419 unsigned short pcm_volume_level_left1;
420 unsigned short pcm_volume_level_right1;
421
422 unsigned char pcm_rcntrl_reg;
423 unsigned char pad_end;
424};
425
426/* main structure for GUS card */
427
428struct _snd_gus_card {
429 snd_card_t *card;
430
431 unsigned int
432 initialized: 1, /* resources were initialized */
433 equal_irq:1, /* GF1 and CODEC shares IRQ (GUS MAX only) */
434 equal_dma:1, /* if dma channels are equal (not valid for daughter board) */
435 ics_flag:1, /* have we ICS mixer chip */
436 ics_flipped:1, /* ICS mixer have flipped some channels? */
437 codec_flag:1, /* have we CODEC chip? */
438 max_flag:1, /* have we GUS MAX card? */
439 max_ctrl_flag:1, /* have we original GUS MAX card? */
440 daughter_flag:1, /* have we daughter board? */
441 interwave:1, /* hey - we have InterWave card */
442 ess_flag:1, /* ESS chip found... GUS Extreme */
443 ace_flag:1, /* GUS ACE detected */
444 uart_enable:1; /* enable MIDI UART */
445 unsigned short revision; /* revision of chip */
446 unsigned short max_cntrl_val; /* GUS MAX control value */
447 unsigned short mix_cntrl_reg; /* mixer control register */
448 unsigned short joystick_dac; /* joystick DAC level */
449 int timer_dev; /* timer device */
450
451 struct _snd_gf1 gf1; /* gf1 specific variables */
452 snd_pcm_t *pcm;
453 snd_pcm_substream_t *pcm_cap_substream;
454 unsigned int c_dma_size;
455 unsigned int c_period_size;
456 unsigned int c_pos;
457
458 snd_rawmidi_t *midi_uart;
459 snd_rawmidi_substream_t *midi_substream_output;
460 snd_rawmidi_substream_t *midi_substream_input;
461
462 snd_seq_device_t *seq_dev;
463
464 spinlock_t reg_lock;
465 spinlock_t voice_alloc;
466 spinlock_t active_voice_lock;
467 spinlock_t event_lock;
468 spinlock_t dma_lock;
469 spinlock_t pcm_volume_level_lock;
470 spinlock_t uart_cmd_lock;
471 struct semaphore dma_mutex;
472 struct semaphore register_mutex;
473};
474
475/* I/O functions for GF1/InterWave chip - gus_io.c */
476
477static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice)
478{
479 unsigned long flags;
480
481 spin_lock_irqsave(&gus->active_voice_lock, flags);
482 if (voice != gus->gf1.active_voice) {
483 gus->gf1.active_voice = voice;
484 outb(voice, GUSP(gus, GF1PAGE));
485 }
486 spin_unlock_irqrestore(&gus->active_voice_lock, flags);
487}
488
489static inline void snd_gf1_uart_cmd(snd_gus_card_t * gus, unsigned char b)
490{
491 outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL));
492}
493
494static inline unsigned char snd_gf1_uart_stat(snd_gus_card_t * gus)
495{
496 return inb(GUSP(gus, MIDISTAT));
497}
498
499static inline void snd_gf1_uart_put(snd_gus_card_t * gus, unsigned char b)
500{
501 outb(b, GUSP(gus, MIDIDATA));
502}
503
504static inline unsigned char snd_gf1_uart_get(snd_gus_card_t * gus)
505{
506 return inb(GUSP(gus, MIDIDATA));
507}
508
509extern void snd_gf1_delay(snd_gus_card_t * gus);
510
511extern void snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg);
512
513extern void snd_gf1_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data);
514extern unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg);
515extern inline unsigned char snd_gf1_read8(snd_gus_card_t * gus, unsigned char reg)
516{
517 return snd_gf1_look8(gus, reg | 0x80);
518}
519extern void snd_gf1_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data);
520extern unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg);
521extern inline unsigned short snd_gf1_read16(snd_gus_card_t * gus, unsigned char reg)
522{
523 return snd_gf1_look16(gus, reg | 0x80);
524}
525extern void snd_gf1_adlib_write(snd_gus_card_t * gus, unsigned char reg, unsigned char data);
526extern void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr);
527extern void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data);
528extern unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr);
529extern void snd_gf1_pokew(snd_gus_card_t * gus, unsigned int addr, unsigned short data);
530extern unsigned short snd_gf1_peekw(snd_gus_card_t * gus, unsigned int addr);
531extern void snd_gf1_dram_setmem(snd_gus_card_t * gus, unsigned int addr, unsigned short value, unsigned int count);
532extern void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit);
533extern unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit);
534extern void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg);
535extern void snd_gf1_i_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data);
536extern unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg);
537extern void snd_gf1_i_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data);
538extern inline unsigned char snd_gf1_i_read8(snd_gus_card_t * gus, unsigned char reg)
539{
540 return snd_gf1_i_look8(gus, reg | 0x80);
541}
542extern unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg);
543extern inline unsigned short snd_gf1_i_read16(snd_gus_card_t * gus, unsigned char reg)
544{
545 return snd_gf1_i_look16(gus, reg | 0x80);
546}
547extern void snd_gf1_i_adlib_write(snd_gus_card_t * gus, unsigned char reg, unsigned char data);
548extern void snd_gf1_i_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit);
549extern unsigned int snd_gf1_i_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit);
550
551extern void snd_gf1_select_active_voices(snd_gus_card_t * gus);
552
553/* gus_lfo.c */
554
555struct _SND_IW_LFO_PROGRAM {
556 unsigned short freq_and_control;
557 unsigned char depth_final;
558 unsigned char depth_inc;
559 unsigned short twave;
560 unsigned short depth;
561};
562
563#if 0
564extern irqreturn_t snd_gf1_lfo_effect_interrupt(snd_gus_card_t * gus, snd_gf1_voice_t * voice);
565#endif
566extern void snd_gf1_lfo_init(snd_gus_card_t * gus);
567extern void snd_gf1_lfo_done(snd_gus_card_t * gus);
568extern void snd_gf1_lfo_program(snd_gus_card_t * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program);
569extern void snd_gf1_lfo_enable(snd_gus_card_t * gus, int voice, int lfo_type);
570extern void snd_gf1_lfo_disable(snd_gus_card_t * gus, int voice, int lfo_type);
571extern void snd_gf1_lfo_change_freq(snd_gus_card_t * gus, int voice, int lfo_type, int freq);
572extern void snd_gf1_lfo_change_depth(snd_gus_card_t * gus, int voice, int lfo_type, int depth);
573extern void snd_gf1_lfo_setup(snd_gus_card_t * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape);
574extern void snd_gf1_lfo_shutdown(snd_gus_card_t * gus, int voice, int lfo_type);
575#if 0
576extern void snd_gf1_lfo_command(snd_gus_card_t * gus, int voice, unsigned char *command);
577#endif
578
579/* gus_mem.c */
580
581void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup);
582int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block);
583snd_gf1_mem_block_t *snd_gf1_mem_look(snd_gf1_mem_t * alloc,
584 unsigned int address);
585snd_gf1_mem_block_t *snd_gf1_mem_share(snd_gf1_mem_t * alloc,
586 unsigned int *share_id);
587snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner,
588 char *name, int size, int w_16,
589 int align, unsigned int *share_id);
590int snd_gf1_mem_free(snd_gf1_mem_t * alloc, unsigned int address);
591int snd_gf1_mem_free_owner(snd_gf1_mem_t * alloc, int owner);
592int snd_gf1_mem_init(snd_gus_card_t * gus);
593int snd_gf1_mem_done(snd_gus_card_t * gus);
594
595/* gus_mem_proc.c */
596
597int snd_gf1_mem_proc_init(snd_gus_card_t * gus);
598
599/* gus_dma.c */
600
601int snd_gf1_dma_init(snd_gus_card_t * gus);
602int snd_gf1_dma_done(snd_gus_card_t * gus);
603int snd_gf1_dma_transfer_block(snd_gus_card_t * gus,
604 snd_gf1_dma_block_t * block,
605 int atomic,
606 int synth);
607
608/* gus_volume.c */
609
610unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol);
611unsigned int snd_gf1_gvol_to_lvol_raw(unsigned short gf1_vol);
612unsigned int snd_gf1_calc_ramp_rate(snd_gus_card_t * gus,
613 unsigned short start,
614 unsigned short end,
615 unsigned int us);
616unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq2);
617unsigned short snd_gf1_compute_pitchbend(unsigned short pitchbend, unsigned short sens);
618unsigned short snd_gf1_compute_freq(unsigned int freq,
619 unsigned int rate,
620 unsigned short mix_rate);
621
622/* gus_reset.c */
623
624void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what);
625void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice);
626void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice);
627void snd_gf1_clear_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max);
628void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max);
629snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, int port);
630void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice);
631int snd_gf1_start(snd_gus_card_t * gus);
632int snd_gf1_stop(snd_gus_card_t * gus);
633
634/* gus_mixer.c */
635
636int snd_gf1_new_mixer(snd_gus_card_t * gus);
637
638/* gus_pcm.c */
639
640int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pcm_t ** rpcm);
641
642#ifdef CONFIG_SND_DEBUG
643extern void snd_gf1_print_voice_registers(snd_gus_card_t * gus);
644extern void snd_gf1_print_global_registers(snd_gus_card_t * gus);
645extern void snd_gf1_print_setup_registers(snd_gus_card_t * gus);
646extern void snd_gf1_peek_print_block(snd_gus_card_t * gus, unsigned int addr, int count, int w_16bit);
647#endif
648
649/* gus.c */
650
651int snd_gus_use_inc(snd_gus_card_t * gus);
652void snd_gus_use_dec(snd_gus_card_t * gus);
653int snd_gus_create(snd_card_t * card,
654 unsigned long port,
655 int irq, int dma1, int dma2,
656 int timer_dev,
657 int voices,
658 int pcm_channels,
659 int effect,
660 snd_gus_card_t ** rgus);
661int snd_gus_initialize(snd_gus_card_t * gus);
662
663/* gus_irq.c */
664
665irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs);
666#ifdef CONFIG_SND_DEBUG
667void snd_gus_irq_profile_init(snd_gus_card_t *gus);
668#endif
669
670/* gus_uart.c */
671
672int snd_gf1_rawmidi_new(snd_gus_card_t * gus, int device, snd_rawmidi_t **rrawmidi);
673
674#if 0
675extern void snd_engine_instrument_register(unsigned short mode,
676 struct _SND_INSTRUMENT_VOICE_COMMANDS *voice_cmds,
677 struct _SND_INSTRUMENT_NOTE_COMMANDS *note_cmds,
678 struct _SND_INSTRUMENT_CHANNEL_COMMANDS *channel_cmds);
679extern int snd_engine_instrument_register_ask(unsigned short mode);
680#endif
681
682/* gus_dram.c */
683int snd_gus_dram_write(snd_gus_card_t *gus, char __user *ptr,
684 unsigned int addr, unsigned int size);
685int snd_gus_dram_read(snd_gus_card_t *gus, char __user *ptr,
686 unsigned int addr, unsigned int size, int rom);
687
688#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
689
690/* gus_sample.c */
691void snd_gus_sample_event(snd_seq_event_t *ev, snd_gus_port_t *p);
692
693/* gus_simple.c */
694void snd_gf1_simple_init(snd_gus_voice_t *voice);
695
696/* gus_instr.c */
697int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave,
698 char __user *data, long len, int atomic);
699int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave,
700 char __user *data, long len, int atomic);
701int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave,
702 int atomic);
703int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave,
704 char __user *data, long len, int atomic);
705int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave,
706 char __user *data, long len, int atomic);
707int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave,
708 int atomic);
709int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr,
710 char __user *data, long len, int atomic);
711int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr,
712 char __user *data, long len, int atomic);
713int snd_gus_simple_remove_sample(void *private_data, simple_instrument_t *instr,
714 int atomic);
715
716#endif /* CONFIG_SND_SEQUENCER */
717
718#endif /* __SOUND_GUS_H */