1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2/*
3 * Main header file for the ALSA sequencer
4 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
5 * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
6 */
7#ifndef _UAPI__SOUND_ASEQUENCER_H
8#define _UAPI__SOUND_ASEQUENCER_H
9
10#include <sound/asound.h>
11
12/** version of the sequencer */
13#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 5)
14
15/**
16 * definition of sequencer event types
17 */
18
19/** system messages
20 * event data type = #snd_seq_result
21 */
22#define SNDRV_SEQ_EVENT_SYSTEM 0
23#define SNDRV_SEQ_EVENT_RESULT 1
24
25/** note messages (channel specific)
26 * event data type = #snd_seq_ev_note
27 */
28#define SNDRV_SEQ_EVENT_NOTE 5
29#define SNDRV_SEQ_EVENT_NOTEON 6
30#define SNDRV_SEQ_EVENT_NOTEOFF 7
31#define SNDRV_SEQ_EVENT_KEYPRESS 8
32
33/** control messages (channel specific)
34 * event data type = #snd_seq_ev_ctrl
35 */
36#define SNDRV_SEQ_EVENT_CONTROLLER 10
37#define SNDRV_SEQ_EVENT_PGMCHANGE 11
38#define SNDRV_SEQ_EVENT_CHANPRESS 12
39#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
40#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
41#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
42#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
43
44/** synchronisation messages
45 * event data type = #snd_seq_ev_ctrl
46 */
47#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
48#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
49#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
50#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
51#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
52
53/** timer messages
54 * event data type = snd_seq_ev_queue_control
55 */
56#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
57#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
58#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
59#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
60#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
61#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
62#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
63#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
64#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
65
66/** others
67 * event data type = none
68 */
69#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
70#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
71#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
72
73/** echo back, kernel private messages
74 * event data type = any type
75 */
76#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
77#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
78
79/** system status messages (broadcast for subscribers)
80 * event data type = snd_seq_addr
81 */
82#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
83#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
84#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
85#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
86#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
87#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
88
89/** port connection changes
90 * event data type = snd_seq_connect
91 */
92#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
93#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
94
95#define SNDRV_SEQ_EVENT_UMP_EP_CHANGE 68 /* UMP EP info has changed */
96#define SNDRV_SEQ_EVENT_UMP_BLOCK_CHANGE 69 /* UMP block info has changed */
97
98/* 70-89: synthesizer events - obsoleted */
99
100/** user-defined events with fixed length
101 * event data type = any
102 */
103#define SNDRV_SEQ_EVENT_USR0 90
104#define SNDRV_SEQ_EVENT_USR1 91
105#define SNDRV_SEQ_EVENT_USR2 92
106#define SNDRV_SEQ_EVENT_USR3 93
107#define SNDRV_SEQ_EVENT_USR4 94
108#define SNDRV_SEQ_EVENT_USR5 95
109#define SNDRV_SEQ_EVENT_USR6 96
110#define SNDRV_SEQ_EVENT_USR7 97
111#define SNDRV_SEQ_EVENT_USR8 98
112#define SNDRV_SEQ_EVENT_USR9 99
113
114/* 100-118: instrument layer - obsoleted */
115/* 119-129: reserved */
116
117/* 130-139: variable length events
118 * event data type = snd_seq_ev_ext
119 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
120 */
121#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
122#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
123/* 132-134: reserved */
124#define SNDRV_SEQ_EVENT_USR_VAR0 135
125#define SNDRV_SEQ_EVENT_USR_VAR1 136
126#define SNDRV_SEQ_EVENT_USR_VAR2 137
127#define SNDRV_SEQ_EVENT_USR_VAR3 138
128#define SNDRV_SEQ_EVENT_USR_VAR4 139
129
130/* 150-151: kernel events with quote - DO NOT use in user clients */
131#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
132#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */
133
134/* 152-191: reserved */
135
136/* 192-254: hardware specific events */
137
138/* 255: special event */
139#define SNDRV_SEQ_EVENT_NONE 255
140
141
142typedef unsigned char snd_seq_event_type_t;
143
144/** event address */
145struct snd_seq_addr {
146 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
147 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
148};
149
150/** port connection */
151struct snd_seq_connect {
152 struct snd_seq_addr sender;
153 struct snd_seq_addr dest;
154};
155
156
157#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
158#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
159#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
160#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
161
162 /* event mode flag - NOTE: only 8 bits available! */
163#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
164#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
165#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
166
167#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
168#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
169#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
170
171#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
172#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
173#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
174#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
175
176#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
177#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
178#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
179
180#define SNDRV_SEQ_EVENT_UMP (1<<5) /* event holds a UMP packet */
181
182 /* note event */
183struct snd_seq_ev_note {
184 unsigned char channel;
185 unsigned char note;
186 unsigned char velocity;
187 unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
188 unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
189};
190
191 /* controller event */
192struct snd_seq_ev_ctrl {
193 unsigned char channel;
194 unsigned char unused1, unused2, unused3; /* pad */
195 unsigned int param;
196 signed int value;
197};
198
199 /* generic set of bytes (12x8 bit) */
200struct snd_seq_ev_raw8 {
201 unsigned char d[12]; /* 8 bit value */
202};
203
204 /* generic set of integers (3x32 bit) */
205struct snd_seq_ev_raw32 {
206 unsigned int d[3]; /* 32 bit value */
207};
208
209 /* external stored data */
210struct snd_seq_ev_ext {
211 unsigned int len; /* length of data */
212 void *ptr; /* pointer to data (note: maybe 64-bit) */
213} __packed;
214
215struct snd_seq_result {
216 int event; /* processed event type */
217 int result;
218};
219
220
221struct snd_seq_real_time {
222 unsigned int tv_sec; /* seconds */
223 unsigned int tv_nsec; /* nanoseconds */
224};
225
226typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
227
228union snd_seq_timestamp {
229 snd_seq_tick_time_t tick;
230 struct snd_seq_real_time time;
231};
232
233struct snd_seq_queue_skew {
234 unsigned int value;
235 unsigned int base;
236};
237
238 /* queue timer control */
239struct snd_seq_ev_queue_control {
240 unsigned char queue; /* affected queue */
241 unsigned char pad[3]; /* reserved */
242 union {
243 signed int value; /* affected value (e.g. tempo) */
244 union snd_seq_timestamp time; /* time */
245 unsigned int position; /* sync position */
246 struct snd_seq_queue_skew skew;
247 unsigned int d32[2];
248 unsigned char d8[8];
249 } param;
250};
251
252 /* quoted event - inside the kernel only */
253struct snd_seq_ev_quote {
254 struct snd_seq_addr origin; /* original sender */
255 unsigned short value; /* optional data */
256 struct snd_seq_event *event; /* quoted event */
257} __packed;
258
259 /* UMP info change notify */
260struct snd_seq_ev_ump_notify {
261 unsigned char client; /**< Client number */
262 unsigned char block; /**< Block number (optional) */
263};
264
265union snd_seq_event_data { /* event data... */
266 struct snd_seq_ev_note note;
267 struct snd_seq_ev_ctrl control;
268 struct snd_seq_ev_raw8 raw8;
269 struct snd_seq_ev_raw32 raw32;
270 struct snd_seq_ev_ext ext;
271 struct snd_seq_ev_queue_control queue;
272 union snd_seq_timestamp time;
273 struct snd_seq_addr addr;
274 struct snd_seq_connect connect;
275 struct snd_seq_result result;
276 struct snd_seq_ev_quote quote;
277 struct snd_seq_ev_ump_notify ump_notify;
278};
279
280 /* sequencer event */
281struct snd_seq_event {
282 snd_seq_event_type_t type; /* event type */
283 unsigned char flags; /* event flags */
284 char tag;
285
286 unsigned char queue; /* schedule queue */
287 union snd_seq_timestamp time; /* schedule time */
288
289 struct snd_seq_addr source; /* source address */
290 struct snd_seq_addr dest; /* destination address */
291
292 union snd_seq_event_data data;
293};
294
295 /* (compatible) event for UMP-capable clients */
296struct snd_seq_ump_event {
297 snd_seq_event_type_t type; /* event type */
298 unsigned char flags; /* event flags */
299 char tag;
300 unsigned char queue; /* schedule queue */
301 union snd_seq_timestamp time; /* schedule time */
302 struct snd_seq_addr source; /* source address */
303 struct snd_seq_addr dest; /* destination address */
304
305 union {
306 union snd_seq_event_data data;
307 unsigned int ump[4];
308 };
309};
310
311/*
312 * bounce event - stored as variable size data
313 */
314struct snd_seq_event_bounce {
315 int err;
316 struct snd_seq_event event;
317 /* external data follows here. */
318};
319
320
321 /* system information */
322struct snd_seq_system_info {
323 int queues; /* maximum queues count */
324 int clients; /* maximum clients count */
325 int ports; /* maximum ports per client */
326 int channels; /* maximum channels per port */
327 int cur_clients; /* current clients */
328 int cur_queues; /* current queues */
329 char reserved[24];
330};
331
332
333 /* system running information */
334struct snd_seq_running_info {
335 unsigned char client; /* client id */
336 unsigned char big_endian; /* 1 = big-endian */
337 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
338 unsigned char pad; /* reserved */
339 unsigned char reserved[12];
340};
341
342
343 /* known client numbers */
344#define SNDRV_SEQ_CLIENT_SYSTEM 0
345 /* internal client numbers */
346#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
347#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
348
349
350 /* client types */
351typedef int __bitwise snd_seq_client_type_t;
352#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
353#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
354#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
355
356 /* event filter flags */
357#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
358#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */
359#define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */
360#define SNDRV_SEQ_FILTER_NO_CONVERT (1U<<30) /* don't convert UMP events */
361#define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */
362
363struct snd_seq_client_info {
364 int client; /* client number to inquire */
365 snd_seq_client_type_t type; /* client type */
366 char name[64]; /* client name */
367 unsigned int filter; /* filter flags */
368 unsigned char multicast_filter[8]; /* multicast filter bitmap */
369 unsigned char event_filter[32]; /* event filter bitmap */
370 int num_ports; /* RO: number of ports */
371 int event_lost; /* number of lost events */
372 int card; /* RO: card number[kernel] */
373 int pid; /* RO: pid[user] */
374 unsigned int midi_version; /* MIDI version */
375 unsigned int group_filter; /* UMP group filter bitmap
376 * (bit 0 = groupless messages,
377 * bit 1-16 = messages for groups 1-16)
378 */
379 char reserved[48]; /* for future use */
380};
381
382/* MIDI version numbers in client info */
383#define SNDRV_SEQ_CLIENT_LEGACY_MIDI 0 /* Legacy client */
384#define SNDRV_SEQ_CLIENT_UMP_MIDI_1_0 1 /* UMP MIDI 1.0 */
385#define SNDRV_SEQ_CLIENT_UMP_MIDI_2_0 2 /* UMP MIDI 2.0 */
386
387/* client pool size */
388struct snd_seq_client_pool {
389 int client; /* client number to inquire */
390 int output_pool; /* outgoing (write) pool size */
391 int input_pool; /* incoming (read) pool size */
392 int output_room; /* minimum free pool size for select/blocking mode */
393 int output_free; /* unused size */
394 int input_free; /* unused size */
395 char reserved[64];
396};
397
398
399/* Remove events by specified criteria */
400
401#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
402#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
403#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
404#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
405#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
406#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
407#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
408#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
409#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
410#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
411
412struct snd_seq_remove_events {
413 unsigned int remove_mode; /* Flags that determine what gets removed */
414
415 union snd_seq_timestamp time;
416
417 unsigned char queue; /* Queue for REMOVE_DEST */
418 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
419 unsigned char channel; /* Channel for REMOVE_DEST */
420
421 int type; /* For REMOVE_EVENT_TYPE */
422 char tag; /* Tag for REMOVE_TAG */
423
424 int reserved[10]; /* To allow for future binary compatibility */
425
426};
427
428
429 /* known port numbers */
430#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
431#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
432
433 /* port capabilities (32 bits) */
434#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
435#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
436
437#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
438#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
439
440#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
441
442#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
443#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
444#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
445#define SNDRV_SEQ_PORT_CAP_INACTIVE (1<<8) /* inactive port */
446#define SNDRV_SEQ_PORT_CAP_UMP_ENDPOINT (1<<9) /* MIDI 2.0 UMP Endpoint port */
447
448 /* port type */
449#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
450#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
451#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
452#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
453#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
454#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
455#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
456#define SNDRV_SEQ_PORT_TYPE_MIDI_UMP (1<<7) /* UMP */
457
458/* other standards...*/
459#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
460#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
461#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
462/*...*/
463#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
464#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
465#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
466#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
467#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
468
469/* misc. conditioning flags */
470#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
471#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
472#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
473
474#define SNDRV_SEQ_PORT_FLG_IS_MIDI1 (1<<3) /* Keep MIDI 1.0 protocol */
475
476/* port direction */
477#define SNDRV_SEQ_PORT_DIR_UNKNOWN 0
478#define SNDRV_SEQ_PORT_DIR_INPUT 1
479#define SNDRV_SEQ_PORT_DIR_OUTPUT 2
480#define SNDRV_SEQ_PORT_DIR_BIDIRECTION 3
481
482struct snd_seq_port_info {
483 struct snd_seq_addr addr; /* client/port numbers */
484 char name[64]; /* port name */
485
486 unsigned int capability; /* port capability bits */
487 unsigned int type; /* port type bits */
488 int midi_channels; /* channels per MIDI port */
489 int midi_voices; /* voices per MIDI port */
490 int synth_voices; /* voices per SYNTH port */
491
492 int read_use; /* R/O: subscribers for output (from this port) */
493 int write_use; /* R/O: subscribers for input (to this port) */
494
495 void *kernel; /* reserved for kernel use (must be NULL) */
496 unsigned int flags; /* misc. conditioning */
497 unsigned char time_queue; /* queue # for timestamping */
498 unsigned char direction; /* port usage direction (r/w/bidir) */
499 unsigned char ump_group; /* 0 = UMP EP (no conversion), 1-16 = UMP group number */
500 char reserved[57]; /* for future use */
501};
502
503
504/* queue flags */
505#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
506
507/* queue information */
508struct snd_seq_queue_info {
509 int queue; /* queue id */
510
511 /*
512 * security settings, only owner of this queue can start/stop timer
513 * etc. if the queue is locked for other clients
514 */
515 int owner; /* client id for owner of the queue */
516 unsigned locked:1; /* timing queue locked for other queues */
517 char name[64]; /* name of this queue */
518 unsigned int flags; /* flags */
519 char reserved[60]; /* for future use */
520
521};
522
523/* queue info/status */
524struct snd_seq_queue_status {
525 int queue; /* queue id */
526 int events; /* read-only - queue size */
527 snd_seq_tick_time_t tick; /* current tick */
528 struct snd_seq_real_time time; /* current time */
529 int running; /* running state of queue */
530 int flags; /* various flags */
531 char reserved[64]; /* for the future */
532};
533
534
535/* queue tempo */
536struct snd_seq_queue_tempo {
537 int queue; /* sequencer queue */
538 unsigned int tempo; /* current tempo, us/tick (or different time-base below) */
539 int ppq; /* time resolution, ticks/quarter */
540 unsigned int skew_value; /* queue skew */
541 unsigned int skew_base; /* queue skew base */
542 unsigned short tempo_base; /* tempo base in nsec unit; either 10 or 1000 */
543 char reserved[22]; /* for the future */
544};
545
546
547/* sequencer timer sources */
548#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
549#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
550#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
551
552/* queue timer info */
553struct snd_seq_queue_timer {
554 int queue; /* sequencer queue */
555 int type; /* source timer type */
556 union {
557 struct {
558 struct snd_timer_id id; /* ALSA's timer ID */
559 unsigned int resolution; /* resolution in Hz */
560 } alsa;
561 } u;
562 char reserved[64]; /* for the future use */
563};
564
565
566struct snd_seq_queue_client {
567 int queue; /* sequencer queue */
568 int client; /* sequencer client */
569 int used; /* queue is used with this client
570 (must be set for accepting events) */
571 /* per client watermarks */
572 char reserved[64]; /* for future use */
573};
574
575
576#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
577#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
578#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
579
580struct snd_seq_port_subscribe {
581 struct snd_seq_addr sender; /* sender address */
582 struct snd_seq_addr dest; /* destination address */
583 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
584 unsigned int flags; /* modes */
585 unsigned char queue; /* input time-stamp queue (optional) */
586 unsigned char pad[3]; /* reserved */
587 char reserved[64];
588};
589
590/* type of query subscription */
591#define SNDRV_SEQ_QUERY_SUBS_READ 0
592#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
593
594struct snd_seq_query_subs {
595 struct snd_seq_addr root; /* client/port id to be searched */
596 int type; /* READ or WRITE */
597 int index; /* 0..N-1 */
598 int num_subs; /* R/O: number of subscriptions on this port */
599 struct snd_seq_addr addr; /* R/O: result */
600 unsigned char queue; /* R/O: result */
601 unsigned int flags; /* R/O: result */
602 char reserved[64]; /* for future use */
603};
604
605/*
606 * UMP-specific information
607 */
608/* type of UMP info query */
609#define SNDRV_SEQ_CLIENT_UMP_INFO_ENDPOINT 0
610#define SNDRV_SEQ_CLIENT_UMP_INFO_BLOCK 1
611
612struct snd_seq_client_ump_info {
613 int client; /* client number to inquire/set */
614 int type; /* type to inquire/set */
615 unsigned char info[512]; /* info (either UMP ep or block info) */
616} __packed;
617
618/*
619 * IOCTL commands
620 */
621
622#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
623#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
624#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
625#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
626#define SNDRV_SEQ_IOCTL_USER_PVERSION _IOW('S', 0x04, int)
627
628#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
629#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
630#define SNDRV_SEQ_IOCTL_GET_CLIENT_UMP_INFO _IOWR('S', 0x12, struct snd_seq_client_ump_info)
631#define SNDRV_SEQ_IOCTL_SET_CLIENT_UMP_INFO _IOWR('S', 0x13, struct snd_seq_client_ump_info)
632
633#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
634#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
635#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
636#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
637
638#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
639#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
640
641#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
642#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
643#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
644#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
645#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
646#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
647#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
648#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
649#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
650#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
651#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
652#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
653#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
654#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
655#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
656#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
657#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
658#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
659#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
660
661#endif /* _UAPI__SOUND_ASEQUENCER_H */
662