treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156
[linux-block.git] / sound / core / seq / seq_clientmgr.h
CommitLineData
1a59d1b8 1/* SPDX-License-Identifier: GPL-2.0-or-later */
1da177e4
LT
2/*
3 * ALSA sequencer Client Manager
4 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
1da177e4
LT
5 */
6#ifndef __SND_SEQ_CLIENTMGR_H
7#define __SND_SEQ_CLIENTMGR_H
8
9#include <sound/seq_kernel.h>
10#include <linux/bitops.h>
11#include "seq_fifo.h"
12#include "seq_ports.h"
13#include "seq_lock.h"
14
15
16/* client manager */
17
c7e0b5bf 18struct snd_seq_user_client {
1da177e4
LT
19 struct file *file; /* file struct of client */
20 /* ... */
a1ce94d0 21 struct pid *owner;
1da177e4
LT
22
23 /* fifo */
c7e0b5bf 24 struct snd_seq_fifo *fifo; /* queue for incoming events */
1da177e4
LT
25 int fifo_pool_size;
26};
27
c7e0b5bf 28struct snd_seq_kernel_client {
1da177e4 29 /* ... */
a1ce94d0 30 struct snd_card *card;
1da177e4
LT
31};
32
33
c7e0b5bf 34struct snd_seq_client {
1da177e4
LT
35 snd_seq_client_type_t type;
36 unsigned int accept_input: 1,
37 accept_output: 1;
38 char name[64]; /* client name */
39 int number; /* client number */
40 unsigned int filter; /* filter flags */
41 DECLARE_BITMAP(event_filter, 256);
42 snd_use_lock_t use_lock;
43 int event_lost;
44 /* ports */
45 int num_ports; /* number of ports */
46 struct list_head ports_list_head;
47 rwlock_t ports_lock;
1a60d4c5 48 struct mutex ports_mutex;
b3defb79 49 struct mutex ioctl_mutex;
1da177e4
LT
50 int convert32; /* convert 32->64bit */
51
52 /* output pool */
c7e0b5bf 53 struct snd_seq_pool *pool; /* memory pool for this client */
1da177e4
LT
54
55 union {
c7e0b5bf
TI
56 struct snd_seq_user_client user;
57 struct snd_seq_kernel_client kernel;
1da177e4
LT
58 } data;
59};
60
61/* usage statistics */
c7e0b5bf 62struct snd_seq_usage {
1da177e4
LT
63 int cur;
64 int peak;
c7e0b5bf 65};
1da177e4
LT
66
67
c7e0b5bf
TI
68int client_init_data(void);
69int snd_sequencer_device_init(void);
70void snd_sequencer_device_done(void);
1da177e4
LT
71
72/* get locked pointer to client */
c7e0b5bf 73struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
1da177e4
LT
74
75/* unlock pointer to client */
76#define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
77
78/* dispatch event to client(s) */
c7e0b5bf 79int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
1da177e4 80
1da177e4 81int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
c7e0b5bf
TI
82int snd_seq_client_notify_subscription(int client, int port,
83 struct snd_seq_port_subscribe *info, int evtype);
1da177e4 84
6b580f52
TI
85/* only for OSS sequencer */
86bool snd_seq_client_ioctl_lock(int clientid);
87void snd_seq_client_ioctl_unlock(int clientid);
88
3b378e1f
89extern int seq_client_load[15];
90
1da177e4 91#endif