| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __SOUND_SEQ_INSTR_H | 
|  | 2 | #define __SOUND_SEQ_INSTR_H | 
|  | 3 |  | 
|  | 4 | /* | 
|  | 5 | *  Main kernel header file for the ALSA sequencer | 
| Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 6 | *  Copyright (c) 1999 by Jaroslav Kysela <perex@perex.cz> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * | 
|  | 8 | * | 
|  | 9 | *   This program is free software; you can redistribute it and/or modify | 
|  | 10 | *   it under the terms of the GNU General Public License as published by | 
|  | 11 | *   the Free Software Foundation; either version 2 of the License, or | 
|  | 12 | *   (at your option) any later version. | 
|  | 13 | * | 
|  | 14 | *   This program is distributed in the hope that it will be useful, | 
|  | 15 | *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 16 | *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 17 | *   GNU General Public License for more details. | 
|  | 18 | * | 
|  | 19 | *   You should have received a copy of the GNU General Public License | 
|  | 20 | *   along with this program; if not, write to the Free Software | 
|  | 21 | *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA | 
|  | 22 | * | 
|  | 23 | */ | 
|  | 24 | #include "seq_kernel.h" | 
|  | 25 |  | 
|  | 26 | /* Instrument cluster */ | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 27 | struct snd_seq_kcluster { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | snd_seq_instr_cluster_t cluster; | 
|  | 29 | char name[32]; | 
|  | 30 | int priority; | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 31 | struct snd_seq_kcluster *next; | 
|  | 32 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 |  | 
|  | 34 | /* return pointer to private data */ | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 35 | #define KINSTR_DATA(kinstr)	(void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr)) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 |  | 
|  | 37 | /* Instrument structure */ | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 38 | struct snd_seq_kinstr { | 
|  | 39 | struct snd_seq_instr instr; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | char name[32]; | 
|  | 41 | int type;			/* instrument type */ | 
|  | 42 | int use;			/* use count */ | 
|  | 43 | int busy;			/* not useable */ | 
|  | 44 | int add_len;			/* additional length */ | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 45 | struct snd_seq_kinstr_ops *ops;	/* operations */ | 
|  | 46 | struct snd_seq_kinstr *next; | 
|  | 47 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 |  | 
|  | 49 | #define SNDRV_SEQ_INSTR_HASH_SIZE		32 | 
|  | 50 |  | 
|  | 51 | /* Instrument flags */ | 
|  | 52 | #define SNDRV_SEQ_INSTR_FLG_DIRECT	(1<<0)	/* accept only direct events */ | 
|  | 53 |  | 
|  | 54 | /* List of all instruments */ | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 55 | struct snd_seq_kinstr_list { | 
|  | 56 | struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | int count;			/* count of all instruments */ | 
|  | 58 |  | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 59 | struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | int ccount;			/* count of all clusters */ | 
|  | 61 |  | 
|  | 62 | int owner;			/* current owner of the instrument list */ | 
|  | 63 | unsigned int flags; | 
|  | 64 |  | 
|  | 65 | spinlock_t lock; | 
|  | 66 | spinlock_t ops_lock; | 
| Ingo Molnar | 1a60d4c | 2006-01-16 16:29:08 +0100 | [diff] [blame] | 67 | struct mutex ops_mutex; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | unsigned long ops_flags; | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 69 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 |  | 
|  | 71 | #define SNDRV_SEQ_INSTR_NOTIFY_REMOVE	0 | 
|  | 72 | #define SNDRV_SEQ_INSTR_NOTIFY_CHANGE	1 | 
|  | 73 |  | 
|  | 74 | struct snd_seq_kinstr_ops { | 
|  | 75 | void *private_data; | 
|  | 76 | long add_len;			/* additional length */ | 
|  | 77 | char *instr_type; | 
|  | 78 | int (*info)(void *private_data, char *info_data, long len); | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 79 | int (*put)(void *private_data, struct snd_seq_kinstr *kinstr, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | char __user *instr_data, long len, int atomic, int cmd); | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 81 | int (*get)(void *private_data, struct snd_seq_kinstr *kinstr, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | char __user *instr_data, long len, int atomic, int cmd); | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 83 | int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size); | 
|  | 84 | int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic); | 
|  | 85 | void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | struct snd_seq_kinstr_ops *next; | 
|  | 87 | }; | 
|  | 88 |  | 
|  | 89 |  | 
|  | 90 | /* instrument operations */ | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 91 | struct snd_seq_kinstr_list *snd_seq_instr_list_new(void); | 
|  | 92 | void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list); | 
|  | 93 | int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list, | 
|  | 94 | struct snd_seq_instr_header *ifree, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | int client, | 
|  | 96 | int atomic); | 
| Takashi Iwai | c7e0b5b | 2005-11-17 14:04:02 +0100 | [diff] [blame] | 97 | struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list, | 
|  | 98 | struct snd_seq_instr *instr, | 
|  | 99 | int exact, | 
|  | 100 | int follow_alias); | 
|  | 101 | void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list, | 
|  | 102 | struct snd_seq_kinstr *instr); | 
|  | 103 | int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops, | 
|  | 104 | struct snd_seq_kinstr_list *list, | 
|  | 105 | struct snd_seq_event *ev, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | int client, | 
|  | 107 | int atomic, | 
|  | 108 | int hop); | 
|  | 109 |  | 
|  | 110 | #endif /* __SOUND_SEQ_INSTR_H */ |