| James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 1 | /*  | 
 | 2 |  *  Copyright 10/16/2005 Tilman Kranz <tilde@tk-sls.de> | 
 | 3 |  *  Creative Audio MIDI, for the CA0106 Driver | 
 | 4 |  *  Version: 0.0.1 | 
 | 5 |  * | 
 | 6 |  *  Changelog: | 
 | 7 |  *    See ca_midi.c | 
 | 8 |  * | 
 | 9 |  *   This program is free software; you can redistribute it and/or modify | 
 | 10 |  *   it under the terms of the GNU General Public License as published by | 
 | 11 |  *   the Free Software Foundation; either version 2 of the License, or | 
 | 12 |  *   (at your option) any later version. | 
 | 13 |  * | 
 | 14 |  *   This program is distributed in the hope that it will be useful, | 
 | 15 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 16 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 17 |  *   GNU General Public License for more details. | 
 | 18 |  * | 
 | 19 |  *   You should have received a copy of the GNU General Public License | 
 | 20 |  *   along with this program; if not, write to the Free Software | 
 | 21 |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA | 
 | 22 |  * | 
 | 23 |  */ | 
 | 24 |  | 
| Michal Piotrowski | 609bb2e | 2007-08-02 14:15:05 +0200 | [diff] [blame] | 25 | #include <linux/spinlock.h> | 
 | 26 | #include <sound/rawmidi.h> | 
 | 27 | #include <sound/mpu401.h> | 
| James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 28 |  | 
 | 29 | #define CA_MIDI_MODE_INPUT	MPU401_MODE_INPUT | 
 | 30 | #define CA_MIDI_MODE_OUTPUT	MPU401_MODE_OUTPUT | 
 | 31 |  | 
| Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 32 | struct snd_ca_midi { | 
| James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 33 |  | 
| Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 34 | 	struct snd_rawmidi *rmidi; | 
 | 35 | 	struct snd_rawmidi_substream *substream_input; | 
 | 36 | 	struct snd_rawmidi_substream *substream_output; | 
| James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 37 |  | 
 | 38 | 	void *dev_id; | 
 | 39 |  | 
 | 40 | 	spinlock_t input_lock; | 
 | 41 | 	spinlock_t output_lock; | 
 | 42 | 	spinlock_t open_lock; | 
 | 43 |  | 
 | 44 | 	unsigned int channel; | 
 | 45 |  | 
 | 46 | 	unsigned int midi_mode; | 
 | 47 | 	int port; | 
 | 48 | 	int tx_enable, rx_enable; | 
 | 49 | 	int ipr_tx, ipr_rx;             | 
 | 50 | 	 | 
 | 51 | 	int input_avail, output_ready; | 
 | 52 | 	int ack, reset, enter_uart; | 
 | 53 |  | 
| Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 54 | 	void (*interrupt)(struct snd_ca_midi *midi, unsigned int status); | 
 | 55 | 	void (*interrupt_enable)(struct snd_ca_midi *midi, int intr); | 
 | 56 | 	void (*interrupt_disable)(struct snd_ca_midi *midi, int intr); | 
| James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 57 |  | 
| Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 58 | 	unsigned char (*read)(struct snd_ca_midi *midi, int idx); | 
 | 59 | 	void (*write)(struct snd_ca_midi *midi, int data, int idx); | 
| James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 60 |  | 
 | 61 | 	/* get info from dev_id */ | 
| Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 62 | 	struct snd_card *(*get_dev_id_card)(void *dev_id); | 
| James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 63 | 	int (*get_dev_id_port)(void *dev_id); | 
 | 64 | }; | 
 | 65 |  | 
| Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 66 | int ca_midi_init(void *card, struct snd_ca_midi *midi, int device, char *name); |