blob: c8f66bde6d9580202b6a094e129e8c927a0ba385 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __SOUND_EMU8000_H
2#define __SOUND_EMU8000_H
3/*
4 * Defines for the emu8000 (AWE32/64)
5 *
6 * Copyright (C) 1999 Steve Ratcliffe
7 * Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de>
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#include "emux_synth.h"
25#include "seq_kernel.h"
26
27/*
28 * Hardware parameters.
29 */
30#define EMU8000_MAX_DRAM (28 * 1024 * 1024) /* Max on-board mem is 28Mb ???*/
31#define EMU8000_DRAM_OFFSET 0x200000 /* Beginning of on board ram */
32#define EMU8000_CHANNELS 32 /* Number of hardware channels */
33#define EMU8000_DRAM_VOICES 30 /* number of normal voices */
34
35/* Flags to set a dma channel to read or write */
36#define EMU8000_RAM_READ 0
37#define EMU8000_RAM_WRITE 1
38#define EMU8000_RAM_CLOSE 2
39#define EMU8000_RAM_MODE_MASK 0x03
40#define EMU8000_RAM_RIGHT 0x10 /* use 'right' DMA channel */
41
42enum {
43 EMU8000_CONTROL_BASS = 0,
44 EMU8000_CONTROL_TREBLE,
45 EMU8000_CONTROL_CHORUS_MODE,
46 EMU8000_CONTROL_REVERB_MODE,
47 EMU8000_CONTROL_FM_CHORUS_DEPTH,
48 EMU8000_CONTROL_FM_REVERB_DEPTH,
49 EMU8000_NUM_CONTROLS,
50};
51
52/*
53 * Structure to hold all state information for the emu8000 driver.
54 *
55 * Note 1: The chip supports 32 channels in hardware this is max_channels
56 * some of the channels may be used for other things so max_channels is
57 * the number in use for wave voices.
58 */
Takashi Iwai029d64b2005-11-17 14:34:36 +010059struct snd_emu8000 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Takashi Iwai029d64b2005-11-17 14:34:36 +010061 struct snd_emux *emu;
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
63 int index; /* sequencer client index */
64 int seq_ports; /* number of sequencer ports */
65 int fm_chorus_depth; /* FM OPL3 chorus depth */
66 int fm_reverb_depth; /* FM OPL3 reverb depth */
67
68 int mem_size; /* memory size */
69 unsigned long port1; /* Port usually base+0 */
70 unsigned long port2; /* Port usually at base+0x400 */
71 unsigned long port3; /* Port usually at base+0x800 */
72 struct resource *res_port1;
73 struct resource *res_port2;
74 struct resource *res_port3;
75 unsigned short last_reg;/* Last register command */
76 spinlock_t reg_lock;
77
78 int dram_checked;
79
Takashi Iwai029d64b2005-11-17 14:34:36 +010080 struct snd_card *card; /* The card that this belongs to */
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
82 int chorus_mode;
83 int reverb_mode;
84 int bass_level;
85 int treble_level;
86
Takashi Iwai029d64b2005-11-17 14:34:36 +010087 struct snd_util_memhdr *memhdr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070088
89 spinlock_t control_lock;
Takashi Iwai029d64b2005-11-17 14:34:36 +010090 struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS];
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
Takashi Iwai029d64b2005-11-17 14:34:36 +010092 struct snd_pcm *pcm; /* pcm on emu8000 wavetable */
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Takashi Iwai029d64b2005-11-17 14:34:36 +010094};
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
96/* sequencer device id */
97#define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth"
98
99
100/* exported functions */
Takashi Iwai029d64b2005-11-17 14:34:36 +0100101int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports,
102 struct snd_seq_device **ret);
103void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 unsigned int val);
Takashi Iwai029d64b2005-11-17 14:34:36 +0100105unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 unsigned int reg);
Takashi Iwai029d64b2005-11-17 14:34:36 +0100107void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 unsigned int val);
Takashi Iwai029d64b2005-11-17 14:34:36 +0100109unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 unsigned int reg);
Takashi Iwai029d64b2005-11-17 14:34:36 +0100111void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112
Takashi Iwai029d64b2005-11-17 14:34:36 +0100113void snd_emu8000_init_fm(struct snd_emu8000 *emu);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114
Takashi Iwai029d64b2005-11-17 14:34:36 +0100115void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu);
116void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu);
117void snd_emu8000_update_equalizer(struct snd_emu8000 *emu);
118int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
119int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120
121#endif /* __SOUND_EMU8000_H */