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 | |
| 25 | #include<linux/spinlock.h> |
| 26 | #include<sound/rawmidi.h> |
| 27 | #include<sound/mpu401.h> |
| 28 | |
| 29 | #define CA_MIDI_MODE_INPUT MPU401_MODE_INPUT |
| 30 | #define CA_MIDI_MODE_OUTPUT MPU401_MODE_OUTPUT |
| 31 | |
| 32 | typedef struct ca_midi ca_midi_t; |
| 33 | struct ca_midi { |
| 34 | |
| 35 | snd_rawmidi_t *rmidi; |
| 36 | snd_rawmidi_substream_t *substream_input; |
| 37 | snd_rawmidi_substream_t *substream_output; |
| 38 | |
| 39 | void *dev_id; |
| 40 | |
| 41 | spinlock_t input_lock; |
| 42 | spinlock_t output_lock; |
| 43 | spinlock_t open_lock; |
| 44 | |
| 45 | unsigned int channel; |
| 46 | |
| 47 | unsigned int midi_mode; |
| 48 | int port; |
| 49 | int tx_enable, rx_enable; |
| 50 | int ipr_tx, ipr_rx; |
| 51 | |
| 52 | int input_avail, output_ready; |
| 53 | int ack, reset, enter_uart; |
| 54 | |
| 55 | void (*interrupt)(ca_midi_t *midi, unsigned int status); |
| 56 | void (*interrupt_enable)(ca_midi_t *midi, int intr); |
| 57 | void (*interrupt_disable)(ca_midi_t *midi, int intr); |
| 58 | |
| 59 | unsigned char (*read)(ca_midi_t *midi, int idx); |
| 60 | void (*write)(ca_midi_t *midi, int data, int idx); |
| 61 | |
| 62 | /* get info from dev_id */ |
| 63 | snd_card_t *(*get_dev_id_card)(void *dev_id); |
| 64 | int (*get_dev_id_port)(void *dev_id); |
| 65 | }; |
| 66 | |
| 67 | void ca_midi_interrupt(ca_midi_t *midi, unsigned int status); |
| 68 | |
| 69 | int __devinit ca_midi_init(void *card, ca_midi_t *midi, int device, char *name); |
| 70 | |
| 71 | void ca_midi_free(ca_midi_t *midi); |
| 72 | |