103 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2#ifndef __SOUND_SEQ_KERNEL_H3#define __SOUND_SEQ_KERNEL_H4 5/*6 * Main kernel header file for the ALSA sequencer7 * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>8 */9#include <linux/time.h>10#include <sound/asequencer.h>11 12typedef struct snd_seq_real_time snd_seq_real_time_t;13typedef union snd_seq_timestamp snd_seq_timestamp_t;14 15/* maximum number of queues */16#define SNDRV_SEQ_MAX_QUEUES 3217 18/* max number of concurrent clients */19#define SNDRV_SEQ_MAX_CLIENTS 19220 21/* max number of concurrent ports */22#define SNDRV_SEQ_MAX_PORTS 25423 24/* max number of events in memory pool */25#define SNDRV_SEQ_MAX_EVENTS 200026 27/* default number of events in memory pool */28#define SNDRV_SEQ_DEFAULT_EVENTS 50029 30/* max number of events in memory pool for one client (outqueue) */31#define SNDRV_SEQ_MAX_CLIENT_EVENTS 200032 33/* default number of events in memory pool for one client (outqueue) */34#define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 20035 36/* max delivery path length */37/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */38#define SNDRV_SEQ_MAX_HOPS 839 40/* max size of event size */41#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff42 43/* call-backs for kernel port */44struct snd_seq_port_callback {45 struct module *owner;46 void *private_data;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);53 /*...*/54};55 56/* interface for kernel client */57__printf(3, 4)58int snd_seq_create_kernel_client(struct snd_card *card, int client_index,59 const char *name_fmt, ...);60int snd_seq_delete_kernel_client(int client);61int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,62 struct file *file, bool blocking);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);65 66#define SNDRV_SEQ_EXT_MASK 0xc000000067#define SNDRV_SEQ_EXT_USRPTR 0x8000000068#define SNDRV_SEQ_EXT_CHAINED 0x4000000069 70typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);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_expand_var_event_at(const struct snd_seq_event *event, int count,74 char *buf, int offset);75int snd_seq_dump_var_event(const struct snd_seq_event *event,76 snd_seq_dump_func_t func, void *private_data);77 78/* size of the event packet; it can be greater than snd_seq_event size */79static inline size_t snd_seq_event_packet_size(struct snd_seq_event *ev)80{81 if (snd_seq_ev_is_ump(ev))82 return sizeof(struct snd_seq_ump_event);83 return sizeof(struct snd_seq_event);84}85 86/* interface for OSS emulation */87int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);88 89/* port attach/detach */90int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,91 int cap, int type, int midi_channels, int midi_voices, char *portname);92int snd_seq_event_port_detach(int client, int port);93 94#ifdef CONFIG_MODULES95void snd_seq_autoload_init(void);96void snd_seq_autoload_exit(void);97#else98#define snd_seq_autoload_init()99#define snd_seq_autoload_exit()100#endif101 102#endif /* __SOUND_SEQ_KERNEL_H */103