Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
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 /* MIDI interface */
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;        /* I/O port address */
0024     char                     isvirtual;   /* doing virtual MIDI stuff ? */
0025     char             istimer;     /* timer is used */
0026         snd_wavefront_mpu_id     output_mpu;  /* most-recently-used */
0027         snd_wavefront_mpu_id     input_mpu;   /* most-recently-used */
0028         unsigned int             mode[2];     /* MPU401_MODE_XXX */
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;     /* protects isvirtual */
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;   /* "you were one, one of the few ..." */
0052     unsigned long    base;  /* low i/o port address */
0053     struct resource  *res_base; /* i/o port resource allocation */
0054 
0055 #define mpu_data_port    base 
0056 #define mpu_command_port base + 1 /* write semantics */
0057 #define mpu_status_port  base + 1 /* read semantics */
0058 #define data_port        base + 2 
0059 #define status_port      base + 3 /* read semantics */
0060 #define control_port     base + 3 /* write semantics  */
0061 #define block_port       base + 4 /* 16 bit, writeonly */
0062 #define last_block_port  base + 6 /* 16 bit, writeonly */
0063 
0064     /* FX ports. These are mapped through the ICS2115 to the YS225.
0065        The ICS2115 takes care of flipping the relevant pins on the
0066        YS225 so that access to each of these ports does the right
0067        thing. Note: these are NOT documented by Turtle Beach.
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;               /* set by interrupt handler */
0081         volatile int irq_cnt;              /* ditto */
0082     char debug;                        /* debugging flags */
0083     int freemem;                       /* installed RAM, in bytes */ 
0084 
0085     char fw_version[2];                /* major = [0], minor = [1] */
0086     char hw_version[2];                /* major = [0], minor = [1] */
0087     char israw;                        /* needs Motorola microcode */
0088     char has_fx;                       /* has FX processor (Tropez+) */
0089     char fx_initialized;               /* FX's register pages initialized */
0090     char prog_status[WF_MAX_PROGRAM];  /* WF_SLOT_* */
0091     char patch_status[WF_MAX_PATCH];   /* WF_SLOT_* */
0092     char sample_status[WF_MAX_SAMPLE]; /* WF_ST_* | WF_SLOT_* */
0093     int samples_used;                  /* how many */
0094     char interrupts_are_midi;          /* h/w MPU interrupts enabled ? */
0095     char rom_samples_rdonly;           /* can we write on ROM samples */
0096     spinlock_t irq_lock;
0097     wait_queue_head_t interrupt_sleeper; 
0098     snd_wavefront_midi_t midi;         /* ICS2115 MIDI interface */
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 /* CONFIG_PNP */
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 /* FX processor - see also yss225.[ch] */
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 /* prefix in all snd_printk() delivered messages */
0141 
0142 #define LOGNAME "WaveFront: "
0143 
0144 #endif  /* __SOUND_SND_WAVEFRONT_H__ */