Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *   ALSA sequencer Client Manager
0004  *   Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
0005  */
0006 #ifndef __SND_SEQ_CLIENTMGR_H
0007 #define __SND_SEQ_CLIENTMGR_H
0008 
0009 #include <sound/seq_kernel.h>
0010 #include <linux/bitops.h>
0011 #include "seq_fifo.h"
0012 #include "seq_ports.h"
0013 #include "seq_lock.h"
0014 
0015 
0016 /* client manager */
0017 
0018 struct snd_seq_user_client {
0019     struct file *file;  /* file struct of client */
0020     /* ... */
0021     struct pid *owner;
0022     
0023     /* fifo */
0024     struct snd_seq_fifo *fifo;  /* queue for incoming events */
0025     int fifo_pool_size;
0026 };
0027 
0028 struct snd_seq_kernel_client {
0029     /* ... */
0030     struct snd_card *card;
0031 };
0032 
0033 
0034 struct snd_seq_client {
0035     snd_seq_client_type_t type;
0036     unsigned int accept_input: 1,
0037         accept_output: 1;
0038     char name[64];      /* client name */
0039     int number;     /* client number */
0040     unsigned int filter;    /* filter flags */
0041     DECLARE_BITMAP(event_filter, 256);
0042     snd_use_lock_t use_lock;
0043     int event_lost;
0044     /* ports */
0045     int num_ports;      /* number of ports */
0046     struct list_head ports_list_head;
0047     rwlock_t ports_lock;
0048     struct mutex ports_mutex;
0049     struct mutex ioctl_mutex;
0050     int convert32;      /* convert 32->64bit */
0051 
0052     /* output pool */
0053     struct snd_seq_pool *pool;      /* memory pool for this client */
0054 
0055     union {
0056         struct snd_seq_user_client user;
0057         struct snd_seq_kernel_client kernel;
0058     } data;
0059 };
0060 
0061 /* usage statistics */
0062 struct snd_seq_usage {
0063     int cur;
0064     int peak;
0065 };
0066 
0067 
0068 int client_init_data(void);
0069 int snd_sequencer_device_init(void);
0070 void snd_sequencer_device_done(void);
0071 
0072 /* get locked pointer to client */
0073 struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
0074 
0075 /* unlock pointer to client */
0076 #define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
0077 
0078 /* dispatch event to client(s) */
0079 int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
0080 
0081 int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
0082 int snd_seq_client_notify_subscription(int client, int port,
0083                        struct snd_seq_port_subscribe *info, int evtype);
0084 
0085 /* only for OSS sequencer */
0086 bool snd_seq_client_ioctl_lock(int clientid);
0087 void snd_seq_client_ioctl_unlock(int clientid);
0088 
0089 extern int seq_client_load[15];
0090 
0091 #endif