xref: /linux/include/sound/emu8000.h (revision 5eab6cb0)
1*1a59d1b8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
21da177e4SLinus Torvalds #ifndef __SOUND_EMU8000_H
31da177e4SLinus Torvalds #define __SOUND_EMU8000_H
41da177e4SLinus Torvalds /*
51da177e4SLinus Torvalds  *  Defines for the emu8000 (AWE32/64)
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  *  Copyright (C) 1999 Steve Ratcliffe
81da177e4SLinus Torvalds  *  Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de>
91da177e4SLinus Torvalds  */
101da177e4SLinus Torvalds 
11a1ce3928SDavid Howells #include <sound/emux_synth.h>
12a1ce3928SDavid Howells #include <sound/seq_kernel.h>
131da177e4SLinus Torvalds 
141da177e4SLinus Torvalds /*
151da177e4SLinus Torvalds  * Hardware parameters.
161da177e4SLinus Torvalds  */
171da177e4SLinus Torvalds #define EMU8000_MAX_DRAM (28 * 1024 * 1024) /* Max on-board mem is 28Mb ???*/
181da177e4SLinus Torvalds #define EMU8000_DRAM_OFFSET 0x200000	/* Beginning of on board ram */
191da177e4SLinus Torvalds #define EMU8000_CHANNELS   32	/* Number of hardware channels */
201da177e4SLinus Torvalds #define EMU8000_DRAM_VOICES	30	/* number of normal voices */
211da177e4SLinus Torvalds 
221da177e4SLinus Torvalds /* Flags to set a dma channel to read or write */
231da177e4SLinus Torvalds #define EMU8000_RAM_READ   0
241da177e4SLinus Torvalds #define EMU8000_RAM_WRITE  1
251da177e4SLinus Torvalds #define EMU8000_RAM_CLOSE  2
261da177e4SLinus Torvalds #define EMU8000_RAM_MODE_MASK	0x03
271da177e4SLinus Torvalds #define EMU8000_RAM_RIGHT	0x10	/* use 'right' DMA channel */
281da177e4SLinus Torvalds 
291da177e4SLinus Torvalds enum {
301da177e4SLinus Torvalds 	EMU8000_CONTROL_BASS = 0,
311da177e4SLinus Torvalds 	EMU8000_CONTROL_TREBLE,
321da177e4SLinus Torvalds 	EMU8000_CONTROL_CHORUS_MODE,
331da177e4SLinus Torvalds 	EMU8000_CONTROL_REVERB_MODE,
341da177e4SLinus Torvalds 	EMU8000_CONTROL_FM_CHORUS_DEPTH,
351da177e4SLinus Torvalds 	EMU8000_CONTROL_FM_REVERB_DEPTH,
361da177e4SLinus Torvalds 	EMU8000_NUM_CONTROLS,
371da177e4SLinus Torvalds };
381da177e4SLinus Torvalds 
391da177e4SLinus Torvalds /*
401da177e4SLinus Torvalds  * Structure to hold all state information for the emu8000 driver.
411da177e4SLinus Torvalds  *
421da177e4SLinus Torvalds  * Note 1: The chip supports 32 channels in hardware this is max_channels
431da177e4SLinus Torvalds  * some of the channels may be used for other things so max_channels is
441da177e4SLinus Torvalds  * the number in use for wave voices.
451da177e4SLinus Torvalds  */
46029d64b0STakashi Iwai struct snd_emu8000 {
471da177e4SLinus Torvalds 
48029d64b0STakashi Iwai 	struct snd_emux *emu;
491da177e4SLinus Torvalds 
501da177e4SLinus Torvalds 	int index;		/* sequencer client index */
511da177e4SLinus Torvalds 	int seq_ports;		/* number of sequencer ports */
521da177e4SLinus Torvalds 	int fm_chorus_depth;	/* FM OPL3 chorus depth */
531da177e4SLinus Torvalds 	int fm_reverb_depth;	/* FM OPL3 reverb depth */
541da177e4SLinus Torvalds 
551da177e4SLinus Torvalds 	int mem_size;		/* memory size */
561da177e4SLinus Torvalds 	unsigned long port1;	/* Port usually base+0 */
571da177e4SLinus Torvalds 	unsigned long port2;	/* Port usually at base+0x400 */
581da177e4SLinus Torvalds 	unsigned long port3;	/* Port usually at base+0x800 */
591da177e4SLinus Torvalds 	unsigned short last_reg;/* Last register command */
601da177e4SLinus Torvalds 	spinlock_t reg_lock;
611da177e4SLinus Torvalds 
621da177e4SLinus Torvalds 	int dram_checked;
631da177e4SLinus Torvalds 
64029d64b0STakashi Iwai 	struct snd_card *card;		/* The card that this belongs to */
651da177e4SLinus Torvalds 
661da177e4SLinus Torvalds 	int chorus_mode;
671da177e4SLinus Torvalds 	int reverb_mode;
681da177e4SLinus Torvalds 	int bass_level;
691da177e4SLinus Torvalds 	int treble_level;
701da177e4SLinus Torvalds 
71029d64b0STakashi Iwai 	struct snd_util_memhdr *memhdr;
721da177e4SLinus Torvalds 
731da177e4SLinus Torvalds 	spinlock_t control_lock;
74029d64b0STakashi Iwai 	struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS];
751da177e4SLinus Torvalds 
76029d64b0STakashi Iwai 	struct snd_pcm *pcm; /* pcm on emu8000 wavetable */
771da177e4SLinus Torvalds 
78029d64b0STakashi Iwai };
791da177e4SLinus Torvalds 
801da177e4SLinus Torvalds /* sequencer device id */
811da177e4SLinus Torvalds #define SNDRV_SEQ_DEV_ID_EMU8000	"emu8000-synth"
821da177e4SLinus Torvalds 
831da177e4SLinus Torvalds 
841da177e4SLinus Torvalds /* exported functions */
85029d64b0STakashi Iwai int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports,
86029d64b0STakashi Iwai 		    struct snd_seq_device **ret);
87029d64b0STakashi Iwai void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
881da177e4SLinus Torvalds 		      unsigned int val);
89029d64b0STakashi Iwai unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port,
901da177e4SLinus Torvalds 				unsigned int reg);
91029d64b0STakashi Iwai void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
921da177e4SLinus Torvalds 			 unsigned int val);
93029d64b0STakashi Iwai unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port,
941da177e4SLinus Torvalds 				 unsigned int reg);
95029d64b0STakashi Iwai void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode);
961da177e4SLinus Torvalds 
97029d64b0STakashi Iwai void snd_emu8000_init_fm(struct snd_emu8000 *emu);
981da177e4SLinus Torvalds 
99029d64b0STakashi Iwai void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu);
100029d64b0STakashi Iwai void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu);
101029d64b0STakashi Iwai void snd_emu8000_update_equalizer(struct snd_emu8000 *emu);
102029d64b0STakashi Iwai int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
103029d64b0STakashi Iwai int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
1041da177e4SLinus Torvalds 
1051da177e4SLinus Torvalds #endif /* __SOUND_EMU8000_H */
106