Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef __SOUND_EMU8000_H
0003 #define __SOUND_EMU8000_H
0004 /*
0005  *  Defines for the emu8000 (AWE32/64)
0006  *
0007  *  Copyright (C) 1999 Steve Ratcliffe
0008  *  Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de>
0009  */
0010 
0011 #include <sound/emux_synth.h>
0012 #include <sound/seq_kernel.h>
0013 
0014 /*
0015  * Hardware parameters.
0016  */
0017 #define EMU8000_MAX_DRAM (28 * 1024 * 1024) /* Max on-board mem is 28Mb ???*/
0018 #define EMU8000_DRAM_OFFSET 0x200000    /* Beginning of on board ram */
0019 #define EMU8000_CHANNELS   32   /* Number of hardware channels */
0020 #define EMU8000_DRAM_VOICES 30  /* number of normal voices */
0021 
0022 /* Flags to set a dma channel to read or write */
0023 #define EMU8000_RAM_READ   0
0024 #define EMU8000_RAM_WRITE  1
0025 #define EMU8000_RAM_CLOSE  2
0026 #define EMU8000_RAM_MODE_MASK   0x03
0027 #define EMU8000_RAM_RIGHT   0x10    /* use 'right' DMA channel */
0028 
0029 enum {
0030     EMU8000_CONTROL_BASS = 0,
0031     EMU8000_CONTROL_TREBLE,
0032     EMU8000_CONTROL_CHORUS_MODE,
0033     EMU8000_CONTROL_REVERB_MODE,
0034     EMU8000_CONTROL_FM_CHORUS_DEPTH,
0035     EMU8000_CONTROL_FM_REVERB_DEPTH,
0036     EMU8000_NUM_CONTROLS,
0037 };
0038 
0039 /*
0040  * Structure to hold all state information for the emu8000 driver.
0041  *
0042  * Note 1: The chip supports 32 channels in hardware this is max_channels
0043  * some of the channels may be used for other things so max_channels is
0044  * the number in use for wave voices.
0045  */
0046 struct snd_emu8000 {
0047 
0048     struct snd_emux *emu;
0049 
0050     int index;      /* sequencer client index */
0051     int seq_ports;      /* number of sequencer ports */
0052     int fm_chorus_depth;    /* FM OPL3 chorus depth */
0053     int fm_reverb_depth;    /* FM OPL3 reverb depth */
0054 
0055     int mem_size;       /* memory size */
0056     unsigned long port1;    /* Port usually base+0 */
0057     unsigned long port2;    /* Port usually at base+0x400 */
0058     unsigned long port3;    /* Port usually at base+0x800 */
0059     unsigned short last_reg;/* Last register command */
0060     spinlock_t reg_lock;
0061 
0062     int dram_checked;
0063 
0064     struct snd_card *card;      /* The card that this belongs to */
0065 
0066     int chorus_mode;
0067     int reverb_mode;
0068     int bass_level;
0069     int treble_level;
0070 
0071     struct snd_util_memhdr *memhdr;
0072 
0073     spinlock_t control_lock;
0074     struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS];
0075 
0076     struct snd_pcm *pcm; /* pcm on emu8000 wavetable */
0077 
0078 };
0079 
0080 /* sequencer device id */
0081 #define SNDRV_SEQ_DEV_ID_EMU8000    "emu8000-synth"
0082 
0083 
0084 /* exported functions */
0085 int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports,
0086             struct snd_seq_device **ret);
0087 void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
0088               unsigned int val);
0089 unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port,
0090                 unsigned int reg);
0091 void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
0092              unsigned int val);
0093 unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port,
0094                  unsigned int reg);
0095 void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode);
0096 
0097 void snd_emu8000_init_fm(struct snd_emu8000 *emu);
0098 
0099 void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu);
0100 void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu);
0101 void snd_emu8000_update_equalizer(struct snd_emu8000 *emu);
0102 int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
0103 int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
0104 
0105 #endif /* __SOUND_EMU8000_H */