Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __SOUND_SND_WAVEFRONT_H__ |
| 2 | #define __SOUND_SND_WAVEFRONT_H__ |
| 3 | |
| 4 | #include "cs4231.h" |
| 5 | #include "mpu401.h" |
| 6 | #include "hwdep.h" |
| 7 | #include "rawmidi.h" |
| 8 | #include "wavefront.h" /* generic OSS/ALSA/user-level wavefront header */ |
| 9 | |
| 10 | /* MIDI interface */ |
| 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; /* I/O port address */ |
| 24 | char isvirtual; /* doing virtual MIDI stuff ? */ |
| 25 | char istimer; /* timer is used */ |
| 26 | snd_wavefront_mpu_id output_mpu; /* most-recently-used */ |
| 27 | snd_wavefront_mpu_id input_mpu; /* most-recently-used */ |
| 28 | unsigned int mode[2]; /* MPU401_MODE_XXX */ |
Takashi Iwai | 542172f | 2005-11-17 14:39:06 +0100 | [diff] [blame] | 29 | struct snd_rawmidi_substream *substream_output[2]; |
| 30 | struct snd_rawmidi_substream *substream_input[2]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | struct timer_list timer; |
| 32 | spinlock_t open; |
| 33 | spinlock_t virtual; /* protects isvirtual */ |
| 34 | }; |
| 35 | |
| 36 | #define OUTPUT_READY 0x40 |
| 37 | #define INPUT_AVAIL 0x80 |
| 38 | #define MPU_ACK 0xFE |
| 39 | #define UART_MODE_ON 0x3F |
| 40 | |
Takashi Iwai | 542172f | 2005-11-17 14:39:06 +0100 | [diff] [blame] | 41 | extern struct snd_rawmidi_ops snd_wavefront_midi_output; |
| 42 | extern struct snd_rawmidi_ops snd_wavefront_midi_input; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
| 44 | extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *); |
| 45 | extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *); |
| 46 | extern void snd_wavefront_midi_interrupt (snd_wavefront_card_t *); |
| 47 | extern int snd_wavefront_midi_start (snd_wavefront_card_t *); |
| 48 | |
| 49 | struct _snd_wavefront { |
| 50 | unsigned long irq; /* "you were one, one of the few ..." */ |
| 51 | unsigned long base; /* low i/o port address */ |
| 52 | struct resource *res_base; /* i/o port resource allocation */ |
| 53 | |
| 54 | #define mpu_data_port base |
| 55 | #define mpu_command_port base + 1 /* write semantics */ |
| 56 | #define mpu_status_port base + 1 /* read semantics */ |
| 57 | #define data_port base + 2 |
| 58 | #define status_port base + 3 /* read semantics */ |
| 59 | #define control_port base + 3 /* write semantics */ |
| 60 | #define block_port base + 4 /* 16 bit, writeonly */ |
| 61 | #define last_block_port base + 6 /* 16 bit, writeonly */ |
| 62 | |
| 63 | /* FX ports. These are mapped through the ICS2115 to the YS225. |
| 64 | The ICS2115 takes care of flipping the relevant pins on the |
| 65 | YS225 so that access to each of these ports does the right |
| 66 | thing. Note: these are NOT documented by Turtle Beach. |
| 67 | */ |
| 68 | |
| 69 | #define fx_status base + 8 |
| 70 | #define fx_op base + 8 |
| 71 | #define fx_lcr base + 9 |
| 72 | #define fx_dsp_addr base + 0xa |
| 73 | #define fx_dsp_page base + 0xb |
| 74 | #define fx_dsp_lsb base + 0xc |
| 75 | #define fx_dsp_msb base + 0xd |
| 76 | #define fx_mod_addr base + 0xe |
| 77 | #define fx_mod_data base + 0xf |
| 78 | |
| 79 | volatile int irq_ok; /* set by interrupt handler */ |
| 80 | volatile int irq_cnt; /* ditto */ |
| 81 | char debug; /* debugging flags */ |
| 82 | int freemem; /* installed RAM, in bytes */ |
| 83 | |
| 84 | char fw_version[2]; /* major = [0], minor = [1] */ |
| 85 | char hw_version[2]; /* major = [0], minor = [1] */ |
| 86 | char israw; /* needs Motorola microcode */ |
| 87 | char has_fx; /* has FX processor (Tropez+) */ |
| 88 | char prog_status[WF_MAX_PROGRAM]; /* WF_SLOT_* */ |
| 89 | char patch_status[WF_MAX_PATCH]; /* WF_SLOT_* */ |
| 90 | char sample_status[WF_MAX_SAMPLE]; /* WF_ST_* | WF_SLOT_* */ |
| 91 | int samples_used; /* how many */ |
| 92 | char interrupts_are_midi; /* h/w MPU interrupts enabled ? */ |
| 93 | char rom_samples_rdonly; /* can we write on ROM samples */ |
| 94 | spinlock_t irq_lock; |
| 95 | wait_queue_head_t interrupt_sleeper; |
| 96 | snd_wavefront_midi_t midi; /* ICS2115 MIDI interface */ |
| 97 | }; |
| 98 | |
| 99 | struct _snd_wavefront_card { |
| 100 | snd_wavefront_t wavefront; |
| 101 | #ifdef CONFIG_PNP |
| 102 | struct pnp_dev *wss; |
| 103 | struct pnp_dev *ctrl; |
| 104 | struct pnp_dev *mpu; |
| 105 | struct pnp_dev *synth; |
| 106 | #endif /* CONFIG_PNP */ |
| 107 | }; |
| 108 | |
| 109 | extern void snd_wavefront_internal_interrupt (snd_wavefront_card_t *card); |
| 110 | extern int snd_wavefront_detect_irq (snd_wavefront_t *dev) ; |
| 111 | extern int snd_wavefront_check_irq (snd_wavefront_t *dev, int irq); |
| 112 | extern int snd_wavefront_restart (snd_wavefront_t *dev); |
| 113 | extern int snd_wavefront_start (snd_wavefront_t *dev); |
| 114 | extern int snd_wavefront_detect (snd_wavefront_card_t *card); |
| 115 | extern int snd_wavefront_config_midi (snd_wavefront_t *dev) ; |
| 116 | extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *, |
| 117 | unsigned char *); |
| 118 | |
Takashi Iwai | 542172f | 2005-11-17 14:39:06 +0100 | [diff] [blame] | 119 | extern int snd_wavefront_synth_ioctl (struct snd_hwdep *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | struct file *, |
| 121 | unsigned int cmd, |
| 122 | unsigned long arg); |
Takashi Iwai | 542172f | 2005-11-17 14:39:06 +0100 | [diff] [blame] | 123 | extern int snd_wavefront_synth_open (struct snd_hwdep *, struct file *); |
| 124 | extern int snd_wavefront_synth_release (struct snd_hwdep *, struct file *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | |
| 126 | /* FX processor - see also yss225.[ch] */ |
| 127 | |
| 128 | extern int snd_wavefront_fx_start (snd_wavefront_t *); |
| 129 | extern int snd_wavefront_fx_detect (snd_wavefront_t *); |
Takashi Iwai | 542172f | 2005-11-17 14:39:06 +0100 | [diff] [blame] | 130 | extern int snd_wavefront_fx_ioctl (struct snd_hwdep *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | struct file *, |
| 132 | unsigned int cmd, |
| 133 | unsigned long arg); |
Takashi Iwai | 542172f | 2005-11-17 14:39:06 +0100 | [diff] [blame] | 134 | extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *); |
| 135 | extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | |
| 137 | /* prefix in all snd_printk() delivered messages */ |
| 138 | |
| 139 | #define LOGNAME "WaveFront: " |
| 140 | |
| 141 | #endif /* __SOUND_SND_WAVEFRONT_H__ */ |