upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / staging / line6 / midi.h
1 /*
2  * Line6 Linux USB driver - 0.8.0
3  *
4  * Copyright (C) 2004-2009 Markus Grabner (grabner@icg.tugraz.at)
5  *
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
15
16 #include <sound/rawmidi.h>
17
18 #include "midibuf.h"
19
20
21 #define MIDI_BUFFER_SIZE 1024
22
23
24 struct snd_line6_midi {
25         /**
26                  Pointer back to the Line6 driver data structure.
27         */
28         struct usb_line6 *line6;
29
30         /**
31                  MIDI substream for receiving (or NULL if not active).
32         */
33         struct snd_rawmidi_substream *substream_receive;
34
35         /**
36                  MIDI substream for transmitting (or NULL if not active).
37         */
38         struct snd_rawmidi_substream *substream_transmit;
39
40         /**
41                  Number of currently active MIDI send URBs.
42         */
43         int num_active_send_urbs;
44
45         /**
46                  Spin lock to protect updates of send_urb.
47         */
48         spinlock_t send_urb_lock;
49
50         /**
51                  Spin lock to protect MIDI buffer handling.
52         */
53         spinlock_t midi_transmit_lock;
54
55         /**
56                  Wait queue for MIDI transmission.
57         */
58         wait_queue_head_t send_wait;
59
60         /**
61                  Bit mask for output MIDI channels.
62         */
63         int midi_mask_transmit;
64
65         /**
66                  Bit mask for input MIDI channels.
67         */
68         int midi_mask_receive;
69
70         /**
71                  Buffer for incoming MIDI stream.
72         */
73         struct MidiBuffer midibuf_in;
74
75         /**
76                  Buffer for outgoing MIDI stream.
77         */
78         struct MidiBuffer midibuf_out;
79 };
80
81
82 extern int line6_init_midi(struct usb_line6 *line6);
83 extern void line6_midi_receive(struct usb_line6 *line6, unsigned char *data,
84                                int length);
85
86
87 #endif