xref: /linux/sound/core/seq/seq_system.h (revision 2c8d2a510c15c003749e43ac2b8e1bc79a7a00d6)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  ALSA sequencer System Client
4  *  Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
5  */
6 #ifndef __SND_SEQ_SYSTEM_H
7 #define __SND_SEQ_SYSTEM_H
8 
9 #include <sound/seq_kernel.h>
10 
11 
12 /* entry points for broadcasting system events */
13 void snd_seq_system_broadcast(int client, int port, int type, bool atomic);
14 
15 /* normal system notification event broadcast */
16 #define notify_event(client, port, type) \
17 	snd_seq_system_broadcast(client, port, type, false)
18 
19 /* notify UMP EP/FB change event */
20 static inline void snd_seq_system_ump_notify(int client, int block, int type,
21 					     bool atomic)
22 {
23 	/* reuse the existing snd_seq_system_broadcast():
24 	 * struct snd_seq_ev_ump_notify is compatible with struct snd_seq_addr
25 	 */
26 	snd_seq_system_broadcast(client, block, type, atomic);
27 }
28 
29 #define snd_seq_system_client_ev_client_start(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_START)
30 #define snd_seq_system_client_ev_client_exit(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_EXIT)
31 #define snd_seq_system_client_ev_client_change(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_CHANGE)
32 #define snd_seq_system_client_ev_port_start(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_START)
33 #define snd_seq_system_client_ev_port_exit(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_EXIT)
34 #define snd_seq_system_client_ev_port_change(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE)
35 
36 int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev,
37 			  bool atomic);
38 
39 /* register our internal client */
40 int snd_seq_system_client_init(void);
41 
42 /* unregister our internal client */
43 void snd_seq_system_client_done(void);
44 
45 
46 #endif
47