Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 33 | struct snd_seq_user_client { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | struct file *file; /* file struct of client */ |
| 35 | /* ... */ |
| 36 | |
| 37 | /* fifo */ |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 38 | struct snd_seq_fifo *fifo; /* queue for incoming events */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | int fifo_pool_size; |
| 40 | }; |
| 41 | |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 42 | struct snd_seq_kernel_client { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* ... */ |
| 44 | }; |
| 45 | |
| 46 | |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 47 | struct snd_seq_client { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | snd_seq_client_type_t type; |
| 49 | unsigned int accept_input: 1, |
| 50 | accept_output: 1; |
| 51 | char name[64]; /* client name */ |
| 52 | int number; /* client number */ |
| 53 | unsigned int filter; /* filter flags */ |
| 54 | DECLARE_BITMAP(event_filter, 256); |
| 55 | snd_use_lock_t use_lock; |
| 56 | int event_lost; |
| 57 | /* ports */ |
| 58 | int num_ports; /* number of ports */ |
| 59 | struct list_head ports_list_head; |
| 60 | rwlock_t ports_lock; |
Ingo Molnar | 1a60d4c | 2006-01-16 16:29:08 +0100 | [diff] [blame] | 61 | struct mutex ports_mutex; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | int convert32; /* convert 32->64bit */ |
| 63 | |
| 64 | /* output pool */ |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 65 | struct snd_seq_pool *pool; /* memory pool for this client */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
| 67 | union { |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 68 | struct snd_seq_user_client user; |
| 69 | struct snd_seq_kernel_client kernel; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | } data; |
| 71 | }; |
| 72 | |
| 73 | /* usage statistics */ |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 74 | struct snd_seq_usage { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | int cur; |
| 76 | int peak; |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 77 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
| 79 | |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 80 | int client_init_data(void); |
| 81 | int snd_sequencer_device_init(void); |
| 82 | void snd_sequencer_device_done(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
| 84 | /* get locked pointer to client */ |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 85 | struct snd_seq_client *snd_seq_client_use_ptr(int clientid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
| 87 | /* unlock pointer to client */ |
| 88 | #define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock) |
| 89 | |
| 90 | /* dispatch event to client(s) */ |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 91 | int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | |
| 93 | /* exported to other modules */ |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 94 | int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop); |
| 95 | int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev, |
| 96 | struct file *file, int atomic, int hop); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait); |
Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 98 | int snd_seq_client_notify_subscription(int client, int port, |
| 99 | struct snd_seq_port_subscribe *info, int evtype); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
| 101 | #endif |