Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* 
0003  *  Copyright 10/16/2005 Tilman Kranz <tilde@tk-sls.de>
0004  *  Creative Audio MIDI, for the CA0106 Driver
0005  *  Version: 0.0.1
0006  *
0007  *  Changelog:
0008  *    See ca_midi.c
0009  */
0010 
0011 #include <linux/spinlock.h>
0012 #include <sound/rawmidi.h>
0013 #include <sound/mpu401.h>
0014 
0015 #define CA_MIDI_MODE_INPUT  MPU401_MODE_INPUT
0016 #define CA_MIDI_MODE_OUTPUT MPU401_MODE_OUTPUT
0017 
0018 struct snd_ca_midi {
0019 
0020     struct snd_rawmidi *rmidi;
0021     struct snd_rawmidi_substream *substream_input;
0022     struct snd_rawmidi_substream *substream_output;
0023 
0024     void *dev_id;
0025 
0026     spinlock_t input_lock;
0027     spinlock_t output_lock;
0028     spinlock_t open_lock;
0029 
0030     unsigned int channel;
0031 
0032     unsigned int midi_mode;
0033     int port;
0034     int tx_enable, rx_enable;
0035     int ipr_tx, ipr_rx;            
0036     
0037     int input_avail, output_ready;
0038     int ack, reset, enter_uart;
0039 
0040     void (*interrupt)(struct snd_ca_midi *midi, unsigned int status);
0041     void (*interrupt_enable)(struct snd_ca_midi *midi, int intr);
0042     void (*interrupt_disable)(struct snd_ca_midi *midi, int intr);
0043 
0044     unsigned char (*read)(struct snd_ca_midi *midi, int idx);
0045     void (*write)(struct snd_ca_midi *midi, int data, int idx);
0046 
0047     /* get info from dev_id */
0048     struct snd_card *(*get_dev_id_card)(void *dev_id);
0049     int (*get_dev_id_port)(void *dev_id);
0050 };
0051 
0052 int ca_midi_init(void *card, struct snd_ca_midi *midi, int device, char *name);