Merge tag 'mm-hotfixes-stable-2023-05-03-16-27' of git://git.kernel.org/pub/scm/linux...
[linux-block.git] / include / sound / seq_kernel.h
CommitLineData
1a59d1b8 1/* SPDX-License-Identifier: GPL-2.0-or-later */
1da177e4
LT
2#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>
1da177e4
LT
8 */
9#include <linux/time.h>
a1ce3928 10#include <sound/asequencer.h>
1da177e4 11
c7e0b5bf
TI
12typedef struct snd_seq_real_time snd_seq_real_time_t;
13typedef union snd_seq_timestamp snd_seq_timestamp_t;
1da177e4 14
1da177e4 15/* maximum number of queues */
1001fb81 16#define SNDRV_SEQ_MAX_QUEUES 32
1da177e4
LT
17
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
1da177e4
LT
27/* 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 */
3510c7aa
TI
37/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
38#define SNDRV_SEQ_MAX_HOPS 8
1da177e4
LT
39
40/* max size of event size */
41#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
42
1da177e4 43/* call-backs for kernel port */
c7e0b5bf 44struct snd_seq_port_callback {
1da177e4
LT
45 struct module *owner;
46 void *private_data;
c7e0b5bf
TI
47 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);
1da177e4 53 /*...*/
c7e0b5bf 54};
1da177e4
LT
55
56/* interface for kernel client */
b9075fa9 57__printf(3, 4)
7b6d9245 58int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
b9075fa9 59 const char *name_fmt, ...);
c7e0b5bf 60int snd_seq_delete_kernel_client(int client);
6740ea67
TI
61int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
62 struct file *file, bool blocking);
c7e0b5bf
TI
63int 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);
1da177e4
LT
65
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);
c7e0b5bf
TI
71int 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);
1da177e4
LT
75
76/* interface for OSS emulation */
c7e0b5bf 77int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
1da177e4
LT
78
79/* port callback routines */
c7e0b5bf
TI
80void snd_port_init_callback(struct snd_seq_port_callback *p);
81struct snd_seq_port_callback *snd_port_alloc_callback(void);
1da177e4
LT
82
83/* port attach/detach */
c7e0b5bf 84int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
1da177e4
LT
85 int cap, int type, int midi_channels, int midi_voices, char *portname);
86int snd_seq_event_port_detach(int client, int port);
87
ee2da997 88#ifdef CONFIG_MODULES
68ab6108 89void snd_seq_autoload_init(void);
54a721ab 90void snd_seq_autoload_exit(void);
1da177e4 91#else
68ab6108
TI
92#define snd_seq_autoload_init()
93#define snd_seq_autoload_exit()
1da177e4
LT
94#endif
95
96#endif /* __SOUND_SEQ_KERNEL_H */