Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef __SOUND_SEQ_KERNEL_H
0003 #define __SOUND_SEQ_KERNEL_H
0004 
0005 /*
0006  *  Main kernel header file for the ALSA sequencer
0007  *  Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
0008  */
0009 #include <linux/time.h>
0010 #include <sound/asequencer.h>
0011 
0012 typedef struct snd_seq_real_time snd_seq_real_time_t;
0013 typedef union snd_seq_timestamp snd_seq_timestamp_t;
0014 
0015 /* maximum number of queues */
0016 #define SNDRV_SEQ_MAX_QUEUES        32
0017 
0018 /* max number of concurrent clients */
0019 #define SNDRV_SEQ_MAX_CLIENTS       192
0020 
0021 /* max number of concurrent ports */
0022 #define SNDRV_SEQ_MAX_PORTS         254
0023 
0024 /* max number of events in memory pool */
0025 #define SNDRV_SEQ_MAX_EVENTS        2000
0026 
0027 /* default number of events in memory pool */
0028 #define SNDRV_SEQ_DEFAULT_EVENTS    500
0029 
0030 /* max number of events in memory pool for one client (outqueue) */
0031 #define SNDRV_SEQ_MAX_CLIENT_EVENTS 2000
0032 
0033 /* default number of events in memory pool for one client (outqueue) */
0034 #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
0035 
0036 /* max delivery path length */
0037 /* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
0038 #define SNDRV_SEQ_MAX_HOPS      8
0039 
0040 /* max size of event size */
0041 #define SNDRV_SEQ_MAX_EVENT_LEN     0x3fffffff
0042 
0043 /* call-backs for kernel port */
0044 struct snd_seq_port_callback {
0045     struct module *owner;
0046     void *private_data;
0047     int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
0048     int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
0049     int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
0050     int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
0051     int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
0052     void (*private_free)(void *private_data);
0053     /*...*/
0054 };
0055 
0056 /* interface for kernel client */
0057 __printf(3, 4)
0058 int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
0059                  const char *name_fmt, ...);
0060 int snd_seq_delete_kernel_client(int client);
0061 int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
0062                   struct file *file, bool blocking);
0063 int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
0064 int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
0065 
0066 #define SNDRV_SEQ_EXT_MASK  0xc0000000
0067 #define SNDRV_SEQ_EXT_USRPTR    0x80000000
0068 #define SNDRV_SEQ_EXT_CHAINED   0x40000000
0069 
0070 typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
0071 int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
0072                  int in_kernel, int size_aligned);
0073 int snd_seq_dump_var_event(const struct snd_seq_event *event,
0074                snd_seq_dump_func_t func, void *private_data);
0075 
0076 /* interface for OSS emulation */
0077 int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
0078 
0079 /* port callback routines */
0080 void snd_port_init_callback(struct snd_seq_port_callback *p);
0081 struct snd_seq_port_callback *snd_port_alloc_callback(void);
0082 
0083 /* port attach/detach */
0084 int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
0085                   int cap, int type, int midi_channels, int midi_voices, char *portname);
0086 int snd_seq_event_port_detach(int client, int port);
0087 
0088 #ifdef CONFIG_MODULES
0089 void snd_seq_autoload_init(void);
0090 void snd_seq_autoload_exit(void);
0091 #else
0092 #define snd_seq_autoload_init()
0093 #define snd_seq_autoload_exit()
0094 #endif
0095 
0096 #endif /* __SOUND_SEQ_KERNEL_H */