forked from adiknoth/exboxuma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
midi.h
64 lines (51 loc) · 1.55 KB
/
midi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Linux driver for D.O.Tec EXBOX.UMA (PloyTec USB interface)
*
* Copyright 2015 (C) Google Inc.
*
* Authors: Adrian Knoth <[email protected]>
* Adrian Knoth <[email protected]>
*
* The driver is based on the 6fire driver.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef EXBOX_MIDI_H
#define EXBOX_MIDI_H
#include <linux/slab.h>
#include <sound/rawmidi.h>
#include "chip.h"
#define MIDI_N_URBS 1 /* Eight are also known to work */
int exbox_midi_init(struct exbox_chip *chip);
void exbox_midi_abort(struct exbox_chip *chip);
void exbox_midi_destroy(struct exbox_chip *chip);
int exbox_midi_stream_start(struct midi_runtime *rt);
void exbox_midi_stream_stop(struct midi_runtime *rt);
struct midi_urb {
struct exbox_chip *chip;
struct urb instance;
struct usb_anchor submitted;
u8 *buffer;
};
struct midi_runtime {
struct exbox_chip *chip;
struct snd_rawmidi *instance;
struct snd_rawmidi_substream *in;
char in_active;
spinlock_t in_lock;
spinlock_t out_lock;
struct snd_rawmidi_substream *out;
struct urb out_urb;
u8 *out_buffer;
int buffer_offset;
struct midi_urb in_urbs[MIDI_N_URBS];
struct mutex stream_mutex;
u8 stream_state; /* one of STREAM_XXX */
wait_queue_head_t stream_wait_queue;
bool stream_wait_cond;
bool panic; /* if set driver won't do anymore midi on device */
};
#endif /* EXBOX_MIDI_H */