1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * OSS compatible sequencer driver 4 * 5 * seq_oss_event.h - OSS event queue record 6 * 7 * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de> 8 */ 9 10 #ifndef __SEQ_OSS_EVENT_H 11 #define __SEQ_OSS_EVENT_H 12 13 #include "seq_oss_device.h" 14 15 #define SHORT_EVENT_SIZE 4 16 #define LONG_EVENT_SIZE 8 17 18 /* short event (4bytes) */ 19 struct evrec_short { 20 unsigned char code; 21 unsigned char parm1; 22 unsigned char dev; 23 unsigned char parm2; 24 }; 25 26 /* short note events (4bytes) */ 27 struct evrec_note { 28 unsigned char code; 29 unsigned char chn; 30 unsigned char note; 31 unsigned char vel; 32 }; 33 34 /* long timer events (8bytes) */ 35 struct evrec_timer { 36 unsigned char code; 37 unsigned char cmd; 38 unsigned char dummy1, dummy2; 39 unsigned int time; 40 }; 41 42 /* long extended events (8bytes) */ 43 struct evrec_extended { 44 unsigned char code; 45 unsigned char cmd; 46 unsigned char dev; 47 unsigned char chn; 48 unsigned char p1, p2, p3, p4; 49 }; 50 51 /* long channel events (8bytes) */ 52 struct evrec_long { 53 unsigned char code; 54 unsigned char dev; 55 unsigned char cmd; 56 unsigned char chn; 57 unsigned char p1, p2; 58 unsigned short val; 59 }; 60 61 /* channel voice events (8bytes) */ 62 struct evrec_voice { 63 unsigned char code; 64 unsigned char dev; 65 unsigned char cmd; 66 unsigned char chn; 67 unsigned char note, parm; 68 unsigned short dummy; 69 }; 70 71 /* sysex events (8bytes) */ 72 struct evrec_sysex { 73 unsigned char code; 74 unsigned char dev; 75 unsigned char buf[6]; 76 }; 77 78 /* event record */ 79 union evrec { 80 struct evrec_short s; 81 struct evrec_note n; 82 struct evrec_long l; 83 struct evrec_voice v; 84 struct evrec_timer t; 85 struct evrec_extended e; 86 struct evrec_sysex x; 87 unsigned int echo; 88 unsigned char c[LONG_EVENT_SIZE]; 89 }; 90 91 #define ev_is_long(ev) ((ev)->s.code >= 128) 92 #define ev_length(ev) ((ev)->s.code >= 128 ? LONG_EVENT_SIZE : SHORT_EVENT_SIZE) 93 94 int snd_seq_oss_process_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev); 95 int snd_seq_oss_process_timer_event(struct seq_oss_timer *rec, union evrec *q); 96 int snd_seq_oss_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop); 97 98 99 #endif /* __SEQ_OSS_EVENT_H */ 100