2019-05-27 09:55:05 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* ALSA sequencer Client Manager
|
|
|
|
* Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
|
|
|
|
*/
|
|
|
|
#ifndef __SND_SEQ_CLIENTMGR_H
|
|
|
|
#define __SND_SEQ_CLIENTMGR_H
|
|
|
|
|
|
|
|
#include <sound/seq_kernel.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include "seq_fifo.h"
|
|
|
|
#include "seq_ports.h"
|
|
|
|
#include "seq_lock.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* client manager */
|
|
|
|
|
2005-11-17 16:04:02 +03:00
|
|
|
struct snd_seq_user_client {
|
2005-04-17 02:20:36 +04:00
|
|
|
struct file *file; /* file struct of client */
|
|
|
|
/* ... */
|
2016-03-02 21:26:28 +03:00
|
|
|
struct pid *owner;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* fifo */
|
2005-11-17 16:04:02 +03:00
|
|
|
struct snd_seq_fifo *fifo; /* queue for incoming events */
|
2005-04-17 02:20:36 +04:00
|
|
|
int fifo_pool_size;
|
|
|
|
};
|
|
|
|
|
2005-11-17 16:04:02 +03:00
|
|
|
struct snd_seq_kernel_client {
|
2005-04-17 02:20:36 +04:00
|
|
|
/* ... */
|
2016-03-02 21:26:28 +03:00
|
|
|
struct snd_card *card;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-11-17 16:04:02 +03:00
|
|
|
struct snd_seq_client {
|
2005-04-17 02:20:36 +04:00
|
|
|
snd_seq_client_type_t type;
|
|
|
|
unsigned int accept_input: 1,
|
|
|
|
accept_output: 1;
|
|
|
|
char name[64]; /* client name */
|
|
|
|
int number; /* client number */
|
|
|
|
unsigned int filter; /* filter flags */
|
|
|
|
DECLARE_BITMAP(event_filter, 256);
|
|
|
|
snd_use_lock_t use_lock;
|
|
|
|
int event_lost;
|
|
|
|
/* ports */
|
|
|
|
int num_ports; /* number of ports */
|
|
|
|
struct list_head ports_list_head;
|
|
|
|
rwlock_t ports_lock;
|
2006-01-16 18:29:08 +03:00
|
|
|
struct mutex ports_mutex;
|
2018-01-10 01:11:03 +03:00
|
|
|
struct mutex ioctl_mutex;
|
2005-04-17 02:20:36 +04:00
|
|
|
int convert32; /* convert 32->64bit */
|
|
|
|
|
|
|
|
/* output pool */
|
2005-11-17 16:04:02 +03:00
|
|
|
struct snd_seq_pool *pool; /* memory pool for this client */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
union {
|
2005-11-17 16:04:02 +03:00
|
|
|
struct snd_seq_user_client user;
|
|
|
|
struct snd_seq_kernel_client kernel;
|
2005-04-17 02:20:36 +04:00
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* usage statistics */
|
2005-11-17 16:04:02 +03:00
|
|
|
struct snd_seq_usage {
|
2005-04-17 02:20:36 +04:00
|
|
|
int cur;
|
|
|
|
int peak;
|
2005-11-17 16:04:02 +03:00
|
|
|
};
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
|
2005-11-17 16:04:02 +03:00
|
|
|
int client_init_data(void);
|
|
|
|
int snd_sequencer_device_init(void);
|
|
|
|
void snd_sequencer_device_done(void);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* get locked pointer to client */
|
2005-11-17 16:04:02 +03:00
|
|
|
struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* unlock pointer to client */
|
|
|
|
#define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
|
|
|
|
|
|
|
|
/* dispatch event to client(s) */
|
2005-11-17 16:04:02 +03:00
|
|
|
int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
|
2005-11-17 16:04:02 +03:00
|
|
|
int snd_seq_client_notify_subscription(int client, int port,
|
|
|
|
struct snd_seq_port_subscribe *info, int evtype);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2019-04-12 13:44:39 +03:00
|
|
|
/* only for OSS sequencer */
|
|
|
|
bool snd_seq_client_ioctl_lock(int clientid);
|
|
|
|
void snd_seq_client_ioctl_unlock(int clientid);
|
|
|
|
|
2007-12-14 14:59:50 +03:00
|
|
|
extern int seq_client_load[15];
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|