blob: 658911926f3ab8004c82143a3bb69873742eefa7 [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef __SOUND_SEQ_KERNEL_H
3#define __SOUND_SEQ_KERNEL_H
4
5/*
6 * Main kernel header file for the ALSA sequencer
7 * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
9#include <linux/time.h>
David Howellsa1ce3922012-10-02 18:01:25 +010010#include <sound/asequencer.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010012typedef struct snd_seq_real_time snd_seq_real_time_t;
13typedef union snd_seq_timestamp snd_seq_timestamp_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Linus Torvalds1da177e2005-04-16 15:20:36 -070015/* maximum number of queues */
Clemens Ladisch1001fb82015-01-25 14:36:46 +010016#define SNDRV_SEQ_MAX_QUEUES 32
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18/* max number of concurrent clients */
19#define SNDRV_SEQ_MAX_CLIENTS 192
20
21/* max number of concurrent ports */
22#define SNDRV_SEQ_MAX_PORTS 254
23
24/* max number of events in memory pool */
25#define SNDRV_SEQ_MAX_EVENTS 2000
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027/* default number of events in memory pool */
28#define SNDRV_SEQ_DEFAULT_EVENTS 500
29
30/* max number of events in memory pool for one client (outqueue) */
31#define SNDRV_SEQ_MAX_CLIENT_EVENTS 2000
32
33/* default number of events in memory pool for one client (outqueue) */
34#define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
35
36/* max delivery path length */
Takashi Iwai3510c7a2017-11-06 20:16:50 +010037/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
38#define SNDRV_SEQ_MAX_HOPS 8
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40/* max size of event size */
41#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043/* call-backs for kernel port */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010044struct snd_seq_port_callback {
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 struct module *owner;
46 void *private_data;
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010047 int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
48 int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
49 int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
50 int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
51 int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
52 void (*private_free)(void *private_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 /*...*/
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010054};
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
56/* interface for kernel client */
Joe Perchesb9075fa2011-10-31 17:11:33 -070057__printf(3, 4)
Clemens Ladisch7b6d9242005-12-12 09:33:37 +010058int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
Joe Perchesb9075fa2011-10-31 17:11:33 -070059 const char *name_fmt, ...);
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010060int snd_seq_delete_kernel_client(int client);
Takashi Iwai6740ea62019-04-12 12:10:14 +020061int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
62 struct file *file, bool blocking);
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010063int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
64int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
66#define SNDRV_SEQ_EXT_MASK 0xc0000000
67#define SNDRV_SEQ_EXT_USRPTR 0x80000000
68#define SNDRV_SEQ_EXT_CHAINED 0x40000000
69
70typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010071int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
72 int in_kernel, int size_aligned);
73int snd_seq_dump_var_event(const struct snd_seq_event *event,
74 snd_seq_dump_func_t func, void *private_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
76/* interface for OSS emulation */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010077int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
79/* port callback routines */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010080void snd_port_init_callback(struct snd_seq_port_callback *p);
81struct snd_seq_port_callback *snd_port_alloc_callback(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
83/* port attach/detach */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010084int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 int cap, int type, int midi_channels, int midi_voices, char *portname);
86int snd_seq_event_port_detach(int client, int port);
87
Johannes Bergee2da992008-07-09 10:28:41 +020088#ifdef CONFIG_MODULES
Takashi Iwai68ab6102014-10-15 14:06:25 +020089void snd_seq_autoload_init(void);
Takashi Iwai54a721a2015-02-12 14:20:24 +010090void snd_seq_autoload_exit(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070091#else
Takashi Iwai68ab6102014-10-15 14:06:25 +020092#define snd_seq_autoload_init()
93#define snd_seq_autoload_exit()
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#endif
95
96#endif /* __SOUND_SEQ_KERNEL_H */