Back to home page

LXR

 
 

    


0001 /*
0002  *   ALSA sequencer Client Manager
0003  *   Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
0004  *
0005  *
0006  *   This program is free software; you can redistribute it and/or modify
0007  *   it under the terms of the GNU General Public License as published by
0008  *   the Free Software Foundation; either version 2 of the License, or
0009  *   (at your option) any later version.
0010  *
0011  *   This program is distributed in the hope that it will be useful,
0012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  *   GNU General Public License for more details.
0015  *
0016  *   You should have received a copy of the GNU General Public License
0017  *   along with this program; if not, write to the Free Software
0018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
0019  *
0020  */
0021 #ifndef __SND_SEQ_CLIENTMGR_H
0022 #define __SND_SEQ_CLIENTMGR_H
0023 
0024 #include <sound/seq_kernel.h>
0025 #include <linux/bitops.h>
0026 #include "seq_fifo.h"
0027 #include "seq_ports.h"
0028 #include "seq_lock.h"
0029 
0030 
0031 /* client manager */
0032 
0033 struct snd_seq_user_client {
0034     struct file *file;  /* file struct of client */
0035     /* ... */
0036     struct pid *owner;
0037     
0038     /* fifo */
0039     struct snd_seq_fifo *fifo;  /* queue for incoming events */
0040     int fifo_pool_size;
0041 };
0042 
0043 struct snd_seq_kernel_client {
0044     /* ... */
0045     struct snd_card *card;
0046 };
0047 
0048 
0049 struct snd_seq_client {
0050     snd_seq_client_type_t type;
0051     unsigned int accept_input: 1,
0052         accept_output: 1;
0053     char name[64];      /* client name */
0054     int number;     /* client number */
0055     unsigned int filter;    /* filter flags */
0056     DECLARE_BITMAP(event_filter, 256);
0057     snd_use_lock_t use_lock;
0058     int event_lost;
0059     /* ports */
0060     int num_ports;      /* number of ports */
0061     struct list_head ports_list_head;
0062     rwlock_t ports_lock;
0063     struct mutex ports_mutex;
0064     int convert32;      /* convert 32->64bit */
0065 
0066     /* output pool */
0067     struct snd_seq_pool *pool;      /* memory pool for this client */
0068 
0069     union {
0070         struct snd_seq_user_client user;
0071         struct snd_seq_kernel_client kernel;
0072     } data;
0073 };
0074 
0075 /* usage statistics */
0076 struct snd_seq_usage {
0077     int cur;
0078     int peak;
0079 };
0080 
0081 
0082 int client_init_data(void);
0083 int snd_sequencer_device_init(void);
0084 void snd_sequencer_device_done(void);
0085 
0086 /* get locked pointer to client */
0087 struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
0088 
0089 /* unlock pointer to client */
0090 #define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
0091 
0092 /* dispatch event to client(s) */
0093 int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
0094 
0095 /* exported to other modules */
0096 int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
0097 int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
0098                        struct file *file, int atomic, int hop);
0099 int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
0100 int snd_seq_client_notify_subscription(int client, int port,
0101                        struct snd_seq_port_subscribe *info, int evtype);
0102 
0103 extern int seq_client_load[15];
0104 
0105 #endif