Linux Audio

Check our new training course

Embedded Linux training

Mar 31-Apr 8, 2025
Register
Loading...
v5.9
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2/*
 3 *   ALSA sequencer Client Manager
 4 *   Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
18struct snd_seq_user_client {
19	struct file *file;	/* file struct of client */
20	/* ... */
21	struct pid *owner;
22	
23	/* fifo */
24	struct snd_seq_fifo *fifo;	/* queue for incoming events */
25	int fifo_pool_size;
26};
27
28struct snd_seq_kernel_client {
29	/* ... */
30	struct snd_card *card;
31};
32
33
34struct snd_seq_client {
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;
48	struct mutex ports_mutex;
49	struct mutex ioctl_mutex;
50	int convert32;		/* convert 32->64bit */
51
52	/* output pool */
53	struct snd_seq_pool *pool;		/* memory pool for this client */
54
55	union {
56		struct snd_seq_user_client user;
57		struct snd_seq_kernel_client kernel;
58	} data;
59};
60
61/* usage statistics */
62struct snd_seq_usage {
63	int cur;
64	int peak;
65};
66
67
68int client_init_data(void);
69int snd_sequencer_device_init(void);
70void snd_sequencer_device_done(void);
71
72/* get locked pointer to client */
73struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
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) */
79int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
80
 
 
 
 
81int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
82int snd_seq_client_notify_subscription(int client, int port,
83				       struct snd_seq_port_subscribe *info, int evtype);
84
85/* only for OSS sequencer */
86bool snd_seq_client_ioctl_lock(int clientid);
87void snd_seq_client_ioctl_unlock(int clientid);
88
89extern int seq_client_load[15];
90
91#endif
v4.10.11
 
  1/*
  2 *   ALSA sequencer Client Manager
  3 *   Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
  4 *
  5 *
  6 *   This program is free software; you can redistribute it and/or modify
  7 *   it under the terms of the GNU General Public License as published by
  8 *   the Free Software Foundation; either version 2 of the License, or
  9 *   (at your option) any later version.
 10 *
 11 *   This program is distributed in the hope that it will be useful,
 12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14 *   GNU General Public License for more details.
 15 *
 16 *   You should have received a copy of the GNU General Public License
 17 *   along with this program; if not, write to the Free Software
 18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 19 *
 20 */
 21#ifndef __SND_SEQ_CLIENTMGR_H
 22#define __SND_SEQ_CLIENTMGR_H
 23
 24#include <sound/seq_kernel.h>
 25#include <linux/bitops.h>
 26#include "seq_fifo.h"
 27#include "seq_ports.h"
 28#include "seq_lock.h"
 29
 30
 31/* client manager */
 32
 33struct snd_seq_user_client {
 34	struct file *file;	/* file struct of client */
 35	/* ... */
 36	struct pid *owner;
 37	
 38	/* fifo */
 39	struct snd_seq_fifo *fifo;	/* queue for incoming events */
 40	int fifo_pool_size;
 41};
 42
 43struct snd_seq_kernel_client {
 44	/* ... */
 45	struct snd_card *card;
 46};
 47
 48
 49struct snd_seq_client {
 50	snd_seq_client_type_t type;
 51	unsigned int accept_input: 1,
 52		accept_output: 1;
 53	char name[64];		/* client name */
 54	int number;		/* client number */
 55	unsigned int filter;	/* filter flags */
 56	DECLARE_BITMAP(event_filter, 256);
 57	snd_use_lock_t use_lock;
 58	int event_lost;
 59	/* ports */
 60	int num_ports;		/* number of ports */
 61	struct list_head ports_list_head;
 62	rwlock_t ports_lock;
 63	struct mutex ports_mutex;
 
 64	int convert32;		/* convert 32->64bit */
 65
 66	/* output pool */
 67	struct snd_seq_pool *pool;		/* memory pool for this client */
 68
 69	union {
 70		struct snd_seq_user_client user;
 71		struct snd_seq_kernel_client kernel;
 72	} data;
 73};
 74
 75/* usage statistics */
 76struct snd_seq_usage {
 77	int cur;
 78	int peak;
 79};
 80
 81
 82int client_init_data(void);
 83int snd_sequencer_device_init(void);
 84void snd_sequencer_device_done(void);
 85
 86/* get locked pointer to client */
 87struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
 88
 89/* unlock pointer to client */
 90#define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
 91
 92/* dispatch event to client(s) */
 93int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
 94
 95/* exported to other modules */
 96int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
 97int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
 98					   struct file *file, int atomic, int hop);
 99int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
100int snd_seq_client_notify_subscription(int client, int port,
101				       struct snd_seq_port_subscribe *info, int evtype);
 
 
 
 
102
103extern int seq_client_load[15];
104
105#endif