Thomas Gleixner | 1a59d1b8 | 2019-05-27 08:55:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 10/16/2005 Tilman Kranz <tilde@tk-sls.de> |
| 4 | * Creative Audio MIDI, for the CA0106 Driver |
| 5 | * Version: 0.0.1 |
| 6 | * |
| 7 | * Changelog: |
| 8 | * See ca_midi.c |
James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 9 | */ |
| 10 | |
Michal Piotrowski | 609bb2e | 2007-08-02 14:15:05 +0200 | [diff] [blame] | 11 | #include <linux/spinlock.h> |
| 12 | #include <sound/rawmidi.h> |
| 13 | #include <sound/mpu401.h> |
James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 14 | |
| 15 | #define CA_MIDI_MODE_INPUT MPU401_MODE_INPUT |
| 16 | #define CA_MIDI_MODE_OUTPUT MPU401_MODE_OUTPUT |
| 17 | |
Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 18 | struct snd_ca_midi { |
James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 19 | |
Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 20 | struct snd_rawmidi *rmidi; |
| 21 | struct snd_rawmidi_substream *substream_input; |
| 22 | struct snd_rawmidi_substream *substream_output; |
James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 23 | |
| 24 | void *dev_id; |
| 25 | |
| 26 | spinlock_t input_lock; |
| 27 | spinlock_t output_lock; |
| 28 | spinlock_t open_lock; |
| 29 | |
| 30 | unsigned int channel; |
| 31 | |
| 32 | unsigned int midi_mode; |
| 33 | int port; |
| 34 | int tx_enable, rx_enable; |
| 35 | int ipr_tx, ipr_rx; |
| 36 | |
| 37 | int input_avail, output_ready; |
| 38 | int ack, reset, enter_uart; |
| 39 | |
Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 40 | void (*interrupt)(struct snd_ca_midi *midi, unsigned int status); |
| 41 | void (*interrupt_enable)(struct snd_ca_midi *midi, int intr); |
| 42 | void (*interrupt_disable)(struct snd_ca_midi *midi, int intr); |
James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 43 | |
Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 44 | unsigned char (*read)(struct snd_ca_midi *midi, int idx); |
| 45 | void (*write)(struct snd_ca_midi *midi, int data, int idx); |
James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 46 | |
| 47 | /* get info from dev_id */ |
Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 48 | struct snd_card *(*get_dev_id_card)(void *dev_id); |
James Courtier-Dutton | 8a5afd2 | 2005-10-20 22:57:51 +0200 | [diff] [blame] | 49 | int (*get_dev_id_port)(void *dev_id); |
| 50 | }; |
| 51 | |
Takashi Iwai | e4a3d14 | 2005-11-17 14:55:40 +0100 | [diff] [blame] | 52 | int ca_midi_init(void *card, struct snd_ca_midi *midi, int device, char *name); |