xref: /openbmc/linux/sound/usb/line6/midi.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*a10e763bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
261864d84STakashi Iwai /*
3c078a4aaSChris Rorvick  * Line 6 Linux USB driver
461864d84STakashi Iwai  *
561864d84STakashi Iwai  * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
661864d84STakashi Iwai  */
761864d84STakashi Iwai 
861864d84STakashi Iwai #ifndef MIDI_H
961864d84STakashi Iwai #define MIDI_H
1061864d84STakashi Iwai 
1161864d84STakashi Iwai #include <sound/rawmidi.h>
1261864d84STakashi Iwai 
1361864d84STakashi Iwai #include "midibuf.h"
1461864d84STakashi Iwai 
1561864d84STakashi Iwai #define MIDI_BUFFER_SIZE 1024
1661864d84STakashi Iwai 
1761864d84STakashi Iwai struct snd_line6_midi {
18cddbd4f1STakashi Iwai 	/* Pointer back to the Line 6 driver data structure */
1961864d84STakashi Iwai 	struct usb_line6 *line6;
2061864d84STakashi Iwai 
21cddbd4f1STakashi Iwai 	/* MIDI substream for receiving (or NULL if not active) */
2261864d84STakashi Iwai 	struct snd_rawmidi_substream *substream_receive;
2361864d84STakashi Iwai 
24cddbd4f1STakashi Iwai 	/* MIDI substream for transmitting (or NULL if not active) */
2561864d84STakashi Iwai 	struct snd_rawmidi_substream *substream_transmit;
2661864d84STakashi Iwai 
27cddbd4f1STakashi Iwai 	/* Number of currently active MIDI send URBs */
2861864d84STakashi Iwai 	int num_active_send_urbs;
2961864d84STakashi Iwai 
30cddbd4f1STakashi Iwai 	/* Spin lock to protect MIDI buffer handling */
31bc518ba4STakashi Iwai 	spinlock_t lock;
3261864d84STakashi Iwai 
33cddbd4f1STakashi Iwai 	/* Wait queue for MIDI transmission */
3461864d84STakashi Iwai 	wait_queue_head_t send_wait;
3561864d84STakashi Iwai 
36cddbd4f1STakashi Iwai 	/* Buffer for incoming MIDI stream */
3761864d84STakashi Iwai 	struct midi_buffer midibuf_in;
3861864d84STakashi Iwai 
39cddbd4f1STakashi Iwai 	/* Buffer for outgoing MIDI stream */
4061864d84STakashi Iwai 	struct midi_buffer midibuf_out;
4161864d84STakashi Iwai };
4261864d84STakashi Iwai 
4361864d84STakashi Iwai extern int line6_init_midi(struct usb_line6 *line6);
4461864d84STakashi Iwai extern void line6_midi_receive(struct usb_line6 *line6, unsigned char *data,
4561864d84STakashi Iwai 			       int length);
4661864d84STakashi Iwai 
4761864d84STakashi Iwai #endif
48