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