1 | #ifndef __EMU8000_H
|
---|
2 | #define __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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #include "driver.h"
|
---|
25 | #include "emux_synth.h"
|
---|
26 | #include "seq_kernel.h"
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * Hardware parameters.
|
---|
30 | */
|
---|
31 | #define EMU8000_MAX_DRAM (28 * 1024 * 1024) /* Max on-board mem is 28Mb ???*/
|
---|
32 | #define EMU8000_DRAM_OFFSET 0x200000 /* Beginning of on board ram */
|
---|
33 | #define EMU8000_CHANNELS 32 /* Number of hardware channels */
|
---|
34 | #define EMU8000_DRAM_VOICES 30 /* number of normal voices */
|
---|
35 |
|
---|
36 | /* Flags to set a dma channel to read or write */
|
---|
37 | #define EMU8000_RAM_READ 0
|
---|
38 | #define EMU8000_RAM_WRITE 1
|
---|
39 | #define EMU8000_RAM_CLOSE 2
|
---|
40 | #define EMU8000_RAM_MODE_MASK 0x03
|
---|
41 | #define EMU8000_RAM_RIGHT 0x10 /* use 'right' DMA channel */
|
---|
42 |
|
---|
43 | enum {
|
---|
44 | EMU8000_CONTROL_BASS = 0,
|
---|
45 | EMU8000_CONTROL_TREBLE,
|
---|
46 | EMU8000_CONTROL_CHORUS_MODE,
|
---|
47 | EMU8000_CONTROL_REVERB_MODE,
|
---|
48 | EMU8000_CONTROL_FM_CHORUS_DEPTH,
|
---|
49 | EMU8000_CONTROL_FM_REVERB_DEPTH,
|
---|
50 | EMU8000_NUM_CONTROLS,
|
---|
51 | };
|
---|
52 |
|
---|
53 | /*
|
---|
54 | * Structure to hold all state information for the emu8000 driver.
|
---|
55 | *
|
---|
56 | * Note 1: The chip supports 32 channels in hardware this is max_channels
|
---|
57 | * some of the channels may be used for other things so max_channels is
|
---|
58 | * the number in use for wave voices.
|
---|
59 | */
|
---|
60 | typedef struct snd_emu8000 {
|
---|
61 |
|
---|
62 | snd_emux_t *emu;
|
---|
63 |
|
---|
64 | int index; /* sequencer client index */
|
---|
65 | int seq_ports; /* number of sequencer ports */
|
---|
66 | int fm_chorus_depth; /* FM OPL3 chorus depth */
|
---|
67 | int fm_reverb_depth; /* FM OPL3 reverb depth */
|
---|
68 |
|
---|
69 | int mem_size; /* memory size */
|
---|
70 | unsigned long port1; /* Port usually base+0 */
|
---|
71 | unsigned long port2; /* Port usually at base+0x400 */
|
---|
72 | unsigned long port3; /* Port usually at base+0x800 */
|
---|
73 | struct resource *res_port1;
|
---|
74 | struct resource *res_port2;
|
---|
75 | struct resource *res_port3;
|
---|
76 | unsigned short last_reg;/* Last register command */
|
---|
77 | spinlock_t reg_lock;
|
---|
78 |
|
---|
79 | int dram_checked;
|
---|
80 |
|
---|
81 | snd_card_t *card; /* The card that this belongs to */
|
---|
82 |
|
---|
83 | int chorus_mode;
|
---|
84 | int reverb_mode;
|
---|
85 | int bass_level;
|
---|
86 | int treble_level;
|
---|
87 |
|
---|
88 | snd_util_memhdr_t *memhdr;
|
---|
89 |
|
---|
90 | spinlock_t control_lock;
|
---|
91 | snd_kcontrol_t *controls[EMU8000_NUM_CONTROLS];
|
---|
92 | snd_pcm_t *pcm; /* pcm on emu8000 wavetable */
|
---|
93 |
|
---|
94 | } emu8000_t;
|
---|
95 |
|
---|
96 | /* sequencer device id */
|
---|
97 | #define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth"
|
---|
98 |
|
---|
99 |
|
---|
100 | /* exported functions */
|
---|
101 | int snd_emu8000_new(snd_card_t *card, int device, long port, int seq_ports, snd_seq_device_t **ret);
|
---|
102 | void snd_emu8000_poke(emu8000_t *emu, unsigned int port, unsigned int reg,
|
---|
103 | unsigned int val);
|
---|
104 | unsigned short snd_emu8000_peek(emu8000_t *emu, unsigned int port,
|
---|
105 | unsigned int reg);
|
---|
106 | void snd_emu8000_poke_dw(emu8000_t *emu, unsigned int port, unsigned int reg,
|
---|
107 | unsigned int val);
|
---|
108 | unsigned int snd_emu8000_peek_dw(emu8000_t *emu, unsigned int port,
|
---|
109 | unsigned int reg);
|
---|
110 | void snd_emu8000_dma_chan(emu8000_t *emu, int ch, int mode);
|
---|
111 |
|
---|
112 | void snd_emu8000_init_fm(emu8000_t *emu);
|
---|
113 |
|
---|
114 | void snd_emu8000_update_chorus_mode(emu8000_t *emu);
|
---|
115 | void snd_emu8000_update_reverb_mode(emu8000_t *emu);
|
---|
116 | void snd_emu8000_update_equalizer(emu8000_t *emu);
|
---|
117 | int snd_emu8000_load_chorus_fx(emu8000_t *emu, int mode, const void *buf, long len);
|
---|
118 | int snd_emu8000_load_reverb_fx(emu8000_t *emu, int mode, const void *buf, long len);
|
---|
119 |
|
---|
120 |
|
---|
121 | #endif
|
---|