blob: cf82d69e274791ca24d0420f8cc5a5fc53f29873 [file] [log] [blame]
Markus Grabner705ecec2009-02-27 19:43:04 -08001/*
Chris Rorvickc078a4a2015-01-20 02:20:50 -06002 * Line 6 Linux USB driver
Markus Grabner705ecec2009-02-27 19:43:04 -08003 *
Markus Grabner1027f4762010-08-12 01:35:30 +02004 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
Markus Grabner705ecec2009-02-27 19:43:04 -08005 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
9 *
10 */
11
12#ifndef MIDI_H
13#define MIDI_H
14
Markus Grabner705ecec2009-02-27 19:43:04 -080015#include <sound/rawmidi.h>
16
17#include "midibuf.h"
18
Markus Grabner705ecec2009-02-27 19:43:04 -080019#define MIDI_BUFFER_SIZE 1024
20
Greg Kroah-Hartmana49e4832009-02-27 21:09:55 -080021struct snd_line6_midi {
Takashi Iwaicddbd4f2015-01-28 14:43:11 +010022 /* Pointer back to the Line 6 driver data structure */
Markus Grabner705ecec2009-02-27 19:43:04 -080023 struct usb_line6 *line6;
24
Takashi Iwaicddbd4f2015-01-28 14:43:11 +010025 /* MIDI substream for receiving (or NULL if not active) */
Markus Grabner705ecec2009-02-27 19:43:04 -080026 struct snd_rawmidi_substream *substream_receive;
27
Takashi Iwaicddbd4f2015-01-28 14:43:11 +010028 /* MIDI substream for transmitting (or NULL if not active) */
Markus Grabner705ecec2009-02-27 19:43:04 -080029 struct snd_rawmidi_substream *substream_transmit;
30
Takashi Iwaicddbd4f2015-01-28 14:43:11 +010031 /* Number of currently active MIDI send URBs */
Markus Grabner705ecec2009-02-27 19:43:04 -080032 int num_active_send_urbs;
33
Takashi Iwaicddbd4f2015-01-28 14:43:11 +010034 /* Spin lock to protect MIDI buffer handling */
Takashi Iwaibc518ba2015-01-23 12:39:11 +010035 spinlock_t lock;
Markus Grabner705ecec2009-02-27 19:43:04 -080036
Takashi Iwaicddbd4f2015-01-28 14:43:11 +010037 /* Wait queue for MIDI transmission */
Markus Grabner705ecec2009-02-27 19:43:04 -080038 wait_queue_head_t send_wait;
39
Takashi Iwaicddbd4f2015-01-28 14:43:11 +010040 /* Buffer for incoming MIDI stream */
Stefan Hajnoczi269edc82013-01-11 23:08:09 +010041 struct midi_buffer midibuf_in;
Markus Grabner705ecec2009-02-27 19:43:04 -080042
Takashi Iwaicddbd4f2015-01-28 14:43:11 +010043 /* Buffer for outgoing MIDI stream */
Stefan Hajnoczi269edc82013-01-11 23:08:09 +010044 struct midi_buffer midibuf_out;
Markus Grabner705ecec2009-02-27 19:43:04 -080045};
46
Markus Grabner705ecec2009-02-27 19:43:04 -080047extern int line6_init_midi(struct usb_line6 *line6);
Greg Kroah-Hartmana49e4832009-02-27 21:09:55 -080048extern void line6_midi_receive(struct usb_line6 *line6, unsigned char *data,
49 int length);
Markus Grabner705ecec2009-02-27 19:43:04 -080050
Markus Grabner705ecec2009-02-27 19:43:04 -080051#endif