^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __SOUND_SEQ_KERNEL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __SOUND_SEQ_KERNEL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Main kernel header file for the ALSA sequencer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/time.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <sound/asequencer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) typedef struct snd_seq_real_time snd_seq_real_time_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) typedef union snd_seq_timestamp snd_seq_timestamp_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /* maximum number of queues */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define SNDRV_SEQ_MAX_QUEUES 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /* max number of concurrent clients */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define SNDRV_SEQ_MAX_CLIENTS 192
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* max number of concurrent ports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define SNDRV_SEQ_MAX_PORTS 254
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* max number of events in memory pool */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define SNDRV_SEQ_MAX_EVENTS 2000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* default number of events in memory pool */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define SNDRV_SEQ_DEFAULT_EVENTS 500
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /* max number of events in memory pool for one client (outqueue) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define SNDRV_SEQ_MAX_CLIENT_EVENTS 2000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* default number of events in memory pool for one client (outqueue) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* max delivery path length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define SNDRV_SEQ_MAX_HOPS 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* max size of event size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* call-backs for kernel port */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct snd_seq_port_callback {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) void (*private_free)(void *private_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /*...*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /* interface for kernel client */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) __printf(3, 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) const char *name_fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) int snd_seq_delete_kernel_client(int client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct file *file, bool blocking);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define SNDRV_SEQ_EXT_MASK 0xc0000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define SNDRV_SEQ_EXT_USRPTR 0x80000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define SNDRV_SEQ_EXT_CHAINED 0x40000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) int in_kernel, int size_aligned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) int snd_seq_dump_var_event(const struct snd_seq_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) snd_seq_dump_func_t func, void *private_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* interface for OSS emulation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* port callback routines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) void snd_port_init_callback(struct snd_seq_port_callback *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) struct snd_seq_port_callback *snd_port_alloc_callback(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* port attach/detach */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) int cap, int type, int midi_channels, int midi_voices, char *portname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) int snd_seq_event_port_detach(int client, int port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #ifdef CONFIG_MODULES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) void snd_seq_autoload_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) void snd_seq_autoload_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define snd_seq_autoload_init()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #define snd_seq_autoload_exit()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #endif /* __SOUND_SEQ_KERNEL_H */