0001
0002 #ifndef __SOUND_SND_WAVEFRONT_H__
0003 #define __SOUND_SND_WAVEFRONT_H__
0004
0005 #include <sound/mpu401.h>
0006 #include <sound/hwdep.h>
0007 #include <sound/rawmidi.h>
0008 #include <sound/wavefront.h> /* generic OSS/ALSA/user-level wavefront header */
0009
0010
0011
0012 struct _snd_wavefront_midi;
0013 struct _snd_wavefront_card;
0014 struct _snd_wavefront;
0015
0016 typedef struct _snd_wavefront_midi snd_wavefront_midi_t;
0017 typedef struct _snd_wavefront_card snd_wavefront_card_t;
0018 typedef struct _snd_wavefront snd_wavefront_t;
0019
0020 typedef enum { internal_mpu = 0, external_mpu = 1 } snd_wavefront_mpu_id;
0021
0022 struct _snd_wavefront_midi {
0023 unsigned long base;
0024 char isvirtual;
0025 char istimer;
0026 snd_wavefront_mpu_id output_mpu;
0027 snd_wavefront_mpu_id input_mpu;
0028 unsigned int mode[2];
0029 struct snd_rawmidi_substream *substream_output[2];
0030 struct snd_rawmidi_substream *substream_input[2];
0031 struct timer_list timer;
0032 snd_wavefront_card_t *timer_card;
0033 spinlock_t open;
0034 spinlock_t virtual;
0035 };
0036
0037 #define OUTPUT_READY 0x40
0038 #define INPUT_AVAIL 0x80
0039 #define MPU_ACK 0xFE
0040 #define UART_MODE_ON 0x3F
0041
0042 extern const struct snd_rawmidi_ops snd_wavefront_midi_output;
0043 extern const struct snd_rawmidi_ops snd_wavefront_midi_input;
0044
0045 extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *);
0046 extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *);
0047 extern void snd_wavefront_midi_interrupt (snd_wavefront_card_t *);
0048 extern int snd_wavefront_midi_start (snd_wavefront_card_t *);
0049
0050 struct _snd_wavefront {
0051 unsigned long irq;
0052 unsigned long base;
0053 struct resource *res_base;
0054
0055 #define mpu_data_port base
0056 #define mpu_command_port base + 1
0057 #define mpu_status_port base + 1
0058 #define data_port base + 2
0059 #define status_port base + 3
0060 #define control_port base + 3
0061 #define block_port base + 4
0062 #define last_block_port base + 6
0063
0064
0065
0066
0067
0068
0069
0070 #define fx_status base + 8
0071 #define fx_op base + 8
0072 #define fx_lcr base + 9
0073 #define fx_dsp_addr base + 0xa
0074 #define fx_dsp_page base + 0xb
0075 #define fx_dsp_lsb base + 0xc
0076 #define fx_dsp_msb base + 0xd
0077 #define fx_mod_addr base + 0xe
0078 #define fx_mod_data base + 0xf
0079
0080 volatile int irq_ok;
0081 volatile int irq_cnt;
0082 char debug;
0083 int freemem;
0084
0085 char fw_version[2];
0086 char hw_version[2];
0087 char israw;
0088 char has_fx;
0089 char fx_initialized;
0090 char prog_status[WF_MAX_PROGRAM];
0091 char patch_status[WF_MAX_PATCH];
0092 char sample_status[WF_MAX_SAMPLE];
0093 int samples_used;
0094 char interrupts_are_midi;
0095 char rom_samples_rdonly;
0096 spinlock_t irq_lock;
0097 wait_queue_head_t interrupt_sleeper;
0098 snd_wavefront_midi_t midi;
0099 struct snd_card *card;
0100 };
0101
0102 struct _snd_wavefront_card {
0103 snd_wavefront_t wavefront;
0104 #ifdef CONFIG_PNP
0105 struct pnp_dev *wss;
0106 struct pnp_dev *ctrl;
0107 struct pnp_dev *mpu;
0108 struct pnp_dev *synth;
0109 #endif
0110 };
0111
0112 extern void snd_wavefront_internal_interrupt (snd_wavefront_card_t *card);
0113 extern int snd_wavefront_detect_irq (snd_wavefront_t *dev) ;
0114 extern int snd_wavefront_check_irq (snd_wavefront_t *dev, int irq);
0115 extern int snd_wavefront_restart (snd_wavefront_t *dev);
0116 extern int snd_wavefront_start (snd_wavefront_t *dev);
0117 extern int snd_wavefront_detect (snd_wavefront_card_t *card);
0118 extern int snd_wavefront_config_midi (snd_wavefront_t *dev) ;
0119 extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *,
0120 unsigned char *);
0121
0122 extern int snd_wavefront_synth_ioctl (struct snd_hwdep *,
0123 struct file *,
0124 unsigned int cmd,
0125 unsigned long arg);
0126 extern int snd_wavefront_synth_open (struct snd_hwdep *, struct file *);
0127 extern int snd_wavefront_synth_release (struct snd_hwdep *, struct file *);
0128
0129
0130
0131 extern int snd_wavefront_fx_start (snd_wavefront_t *);
0132 extern int snd_wavefront_fx_detect (snd_wavefront_t *);
0133 extern int snd_wavefront_fx_ioctl (struct snd_hwdep *,
0134 struct file *,
0135 unsigned int cmd,
0136 unsigned long arg);
0137 extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *);
0138 extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *);
0139
0140
0141
0142 #define LOGNAME "WaveFront: "
0143
0144 #endif