162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci#ifndef __SOUND_SEQ_KERNEL_H 362306a36Sopenharmony_ci#define __SOUND_SEQ_KERNEL_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci/* 662306a36Sopenharmony_ci * Main kernel header file for the ALSA sequencer 762306a36Sopenharmony_ci * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci#include <linux/time.h> 1062306a36Sopenharmony_ci#include <sound/asequencer.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_citypedef struct snd_seq_real_time snd_seq_real_time_t; 1362306a36Sopenharmony_citypedef union snd_seq_timestamp snd_seq_timestamp_t; 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* maximum number of queues */ 1662306a36Sopenharmony_ci#define SNDRV_SEQ_MAX_QUEUES 32 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* max number of concurrent clients */ 1962306a36Sopenharmony_ci#define SNDRV_SEQ_MAX_CLIENTS 192 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/* max number of concurrent ports */ 2262306a36Sopenharmony_ci#define SNDRV_SEQ_MAX_PORTS 254 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci/* max number of events in memory pool */ 2562306a36Sopenharmony_ci#define SNDRV_SEQ_MAX_EVENTS 2000 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/* default number of events in memory pool */ 2862306a36Sopenharmony_ci#define SNDRV_SEQ_DEFAULT_EVENTS 500 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/* max number of events in memory pool for one client (outqueue) */ 3162306a36Sopenharmony_ci#define SNDRV_SEQ_MAX_CLIENT_EVENTS 2000 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci/* default number of events in memory pool for one client (outqueue) */ 3462306a36Sopenharmony_ci#define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci/* max delivery path length */ 3762306a36Sopenharmony_ci/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */ 3862306a36Sopenharmony_ci#define SNDRV_SEQ_MAX_HOPS 8 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci/* max size of event size */ 4162306a36Sopenharmony_ci#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* call-backs for kernel port */ 4462306a36Sopenharmony_cistruct snd_seq_port_callback { 4562306a36Sopenharmony_ci struct module *owner; 4662306a36Sopenharmony_ci void *private_data; 4762306a36Sopenharmony_ci int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info); 4862306a36Sopenharmony_ci int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info); 4962306a36Sopenharmony_ci int (*use)(void *private_data, struct snd_seq_port_subscribe *info); 5062306a36Sopenharmony_ci int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info); 5162306a36Sopenharmony_ci int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop); 5262306a36Sopenharmony_ci void (*private_free)(void *private_data); 5362306a36Sopenharmony_ci /*...*/ 5462306a36Sopenharmony_ci}; 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci/* interface for kernel client */ 5762306a36Sopenharmony_ci__printf(3, 4) 5862306a36Sopenharmony_ciint snd_seq_create_kernel_client(struct snd_card *card, int client_index, 5962306a36Sopenharmony_ci const char *name_fmt, ...); 6062306a36Sopenharmony_ciint snd_seq_delete_kernel_client(int client); 6162306a36Sopenharmony_ciint snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, 6262306a36Sopenharmony_ci struct file *file, bool blocking); 6362306a36Sopenharmony_ciint snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop); 6462306a36Sopenharmony_ciint snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#define SNDRV_SEQ_EXT_MASK 0xc0000000 6762306a36Sopenharmony_ci#define SNDRV_SEQ_EXT_USRPTR 0x80000000 6862306a36Sopenharmony_ci#define SNDRV_SEQ_EXT_CHAINED 0x40000000 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_citypedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count); 7162306a36Sopenharmony_ciint snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf, 7262306a36Sopenharmony_ci int in_kernel, int size_aligned); 7362306a36Sopenharmony_ciint snd_seq_expand_var_event_at(const struct snd_seq_event *event, int count, 7462306a36Sopenharmony_ci char *buf, int offset); 7562306a36Sopenharmony_ciint snd_seq_dump_var_event(const struct snd_seq_event *event, 7662306a36Sopenharmony_ci snd_seq_dump_func_t func, void *private_data); 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci/* size of the event packet; it can be greater than snd_seq_event size */ 7962306a36Sopenharmony_cistatic inline size_t snd_seq_event_packet_size(struct snd_seq_event *ev) 8062306a36Sopenharmony_ci{ 8162306a36Sopenharmony_ci if (snd_seq_ev_is_ump(ev)) 8262306a36Sopenharmony_ci return sizeof(struct snd_seq_ump_event); 8362306a36Sopenharmony_ci return sizeof(struct snd_seq_event); 8462306a36Sopenharmony_ci} 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci/* interface for OSS emulation */ 8762306a36Sopenharmony_ciint snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo); 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci/* port callback routines */ 9062306a36Sopenharmony_civoid snd_port_init_callback(struct snd_seq_port_callback *p); 9162306a36Sopenharmony_cistruct snd_seq_port_callback *snd_port_alloc_callback(void); 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci/* port attach/detach */ 9462306a36Sopenharmony_ciint snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp, 9562306a36Sopenharmony_ci int cap, int type, int midi_channels, int midi_voices, char *portname); 9662306a36Sopenharmony_ciint snd_seq_event_port_detach(int client, int port); 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci#ifdef CONFIG_MODULES 9962306a36Sopenharmony_civoid snd_seq_autoload_init(void); 10062306a36Sopenharmony_civoid snd_seq_autoload_exit(void); 10162306a36Sopenharmony_ci#else 10262306a36Sopenharmony_ci#define snd_seq_autoload_init() 10362306a36Sopenharmony_ci#define snd_seq_autoload_exit() 10462306a36Sopenharmony_ci#endif 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci#endif /* __SOUND_SEQ_KERNEL_H */ 107