1
2 #ifndef __SOUND_SND_WAVEFRONT_H__
3 #define __SOUND_SND_WAVEFRONT_H__
4
5 #include <sound/mpu401.h>
6 #include <sound/hwdep.h>
7 #include <sound/rawmidi.h>
8 #include <sound/wavefront.h>
9
10
11
12 struct _snd_wavefront_midi;
13 struct _snd_wavefront_card;
14 struct _snd_wavefront;
15
16 typedef struct _snd_wavefront_midi snd_wavefront_midi_t;
17 typedef struct _snd_wavefront_card snd_wavefront_card_t;
18 typedef struct _snd_wavefront snd_wavefront_t;
19
20 typedef enum { internal_mpu = 0, external_mpu = 1 } snd_wavefront_mpu_id;
21
22 struct _snd_wavefront_midi {
23 unsigned long base;
24 char isvirtual;
25 char istimer;
26 snd_wavefront_mpu_id output_mpu;
27 snd_wavefront_mpu_id input_mpu;
28 unsigned int mode[2];
29 struct snd_rawmidi_substream *substream_output[2];
30 struct snd_rawmidi_substream *substream_input[2];
31 struct timer_list timer;
32 snd_wavefront_card_t *timer_card;
33 spinlock_t open;
34 spinlock_t virtual;
35 };
36
37 #define OUTPUT_READY 0x40
38 #define INPUT_AVAIL 0x80
39 #define MPU_ACK 0xFE
40 #define UART_MODE_ON 0x3F
41
42 extern const struct snd_rawmidi_ops snd_wavefront_midi_output;
43 extern const struct snd_rawmidi_ops snd_wavefront_midi_input;
44
45 extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *);
46 extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *);
47 extern void snd_wavefront_midi_interrupt (snd_wavefront_card_t *);
48 extern int snd_wavefront_midi_start (snd_wavefront_card_t *);
49
50 struct _snd_wavefront {
51 unsigned long irq;
52 unsigned long base;
53 struct resource *res_base;
54
55 #define mpu_data_port base
56 #define mpu_command_port base + 1
57 #define mpu_status_port base + 1
58 #define data_port base + 2
59 #define status_port base + 3
60 #define control_port base + 3
61 #define block_port base + 4
62 #define last_block_port base + 6
63
64
65
66
67
68
69
70 #define fx_status base + 8
71 #define fx_op base + 8
72 #define fx_lcr base + 9
73 #define fx_dsp_addr base + 0xa
74 #define fx_dsp_page base + 0xb
75 #define fx_dsp_lsb base + 0xc
76 #define fx_dsp_msb base + 0xd
77 #define fx_mod_addr base + 0xe
78 #define fx_mod_data base + 0xf
79
80 volatile int irq_ok;
81 volatile int irq_cnt;
82 char debug;
83 int freemem;
84
85 char fw_version[2];
86 char hw_version[2];
87 char israw;
88 char has_fx;
89 char fx_initialized;
90 char prog_status[WF_MAX_PROGRAM];
91 char patch_status[WF_MAX_PATCH];
92 char sample_status[WF_MAX_SAMPLE];
93 int samples_used;
94 char interrupts_are_midi;
95 char rom_samples_rdonly;
96 spinlock_t irq_lock;
97 wait_queue_head_t interrupt_sleeper;
98 snd_wavefront_midi_t midi;
99 struct snd_card *card;
100 };
101
102 struct _snd_wavefront_card {
103 snd_wavefront_t wavefront;
104 #ifdef CONFIG_PNP
105 struct pnp_dev *wss;
106 struct pnp_dev *ctrl;
107 struct pnp_dev *mpu;
108 struct pnp_dev *synth;
109 #endif
110 };
111
112 extern void snd_wavefront_internal_interrupt (snd_wavefront_card_t *card);
113 extern int snd_wavefront_detect_irq (snd_wavefront_t *dev) ;
114 extern int snd_wavefront_check_irq (snd_wavefront_t *dev, int irq);
115 extern int snd_wavefront_restart (snd_wavefront_t *dev);
116 extern int snd_wavefront_start (snd_wavefront_t *dev);
117 extern int snd_wavefront_detect (snd_wavefront_card_t *card);
118 extern int snd_wavefront_config_midi (snd_wavefront_t *dev) ;
119 extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *,
120 unsigned char *);
121
122 extern int snd_wavefront_synth_ioctl (struct snd_hwdep *,
123 struct file *,
124 unsigned int cmd,
125 unsigned long arg);
126 extern int snd_wavefront_synth_open (struct snd_hwdep *, struct file *);
127 extern int snd_wavefront_synth_release (struct snd_hwdep *, struct file *);
128
129
130
131 extern int snd_wavefront_fx_start (snd_wavefront_t *);
132 extern int snd_wavefront_fx_detect (snd_wavefront_t *);
133 extern int snd_wavefront_fx_ioctl (struct snd_hwdep *,
134 struct file *,
135 unsigned int cmd,
136 unsigned long arg);
137 extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *);
138 extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *);
139
140
141
142 #define LOGNAME "WaveFront: "
143
144 #endif