22 #include <linux/slab.h>
23 #include <linux/errno.h>
24 #include <linux/string.h>
25 #include <linux/module.h>
39 #define ST_SYSEX ST_SPECIAL
61 static struct status_event_list {
101 static struct extra_event_list {
162 spin_unlock_irqrestore(&dev->
lock, flags);
171 spin_unlock_irqrestore(&dev->
lock, flags);
193 unsigned char *new_buf, *old_buf;
206 spin_unlock_irqrestore(&dev->
lock, flags);
224 while (count-- > 0) {
263 if ((c & 0xf0) == 0xf0)
266 dev->
type = (c >> 4) & 0x07;
268 dev->
qlen = status_event[dev->
type].qlen;
278 dev->
qlen = status_event[dev->
type].qlen - 1;
282 if (dev->
qlen == 0) {
283 ev->
type = status_event[dev->
type].event;
286 if (status_event[dev->
type].encode)
287 status_event[dev->
type].encode(dev, ev);
307 spin_unlock_irqrestore(&dev->
lock, flags);
365 for (type = 0; type <
ARRAY_SIZE(status_event); type++) {
366 if (ev->
type == status_event[type].event)
369 for (type = 0; type <
ARRAY_SIZE(extra_event); type++) {
370 if (ev->
type == extra_event[type].event)
371 return extra_event[
type].decode(dev, buf, count, ev);
380 cmd = 0x80 | (type << 4) | (ev->
data.
note.channel & 0x0f);
388 unsigned char xbuf[4];
392 if ((cmd & 0xf0) == 0xf0 || dev->
lastcmd != cmd || dev->
nostat) {
394 spin_unlock_irqrestore(&dev->
lock, flags);
396 if (status_event[type].decode)
397 status_event[
type].decode(ev, xbuf + 1);
398 qlen = status_event[
type].qlen + 1;
400 spin_unlock_irqrestore(&dev->
lock, flags);
401 if (status_event[type].decode)
402 status_event[
type].decode(ev, xbuf + 0);
403 qlen = status_event[
type].qlen;
417 buf[1] = ev->
data.
note.velocity & 0x7f;
430 buf[0] = value & 0x7f;
431 buf[1] = (value >> 7) & 0x7f;
459 if (dev->
nostat && count < 6)
487 static int extra_decode_xrpn(
struct snd_midi_event *dev,
unsigned char *buf,
500 unsigned char bytes[4];
505 if (dev->
nostat && count < 12)
518 for (
i = 0;
i < 4;
i++) {
521 buf[idx++] = cbytes[
i];
522 buf[idx++] = bytes[
i];
540 static int __init alsa_seq_midi_event_init(
void)
545 static void __exit alsa_seq_midi_event_exit(
void)