]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef __SOUND_SEQ_INSTR_H |
2 | #define __SOUND_SEQ_INSTR_H | |
3 | ||
4 | /* | |
5 | * Main kernel header file for the ALSA sequencer | |
6 | * Copyright (c) 1999 by Jaroslav Kysela <perex@suse.cz> | |
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 */ | |
27 | typedef struct _snd_seq_kcluster { | |
28 | snd_seq_instr_cluster_t cluster; | |
29 | char name[32]; | |
30 | int priority; | |
31 | struct _snd_seq_kcluster *next; | |
32 | } snd_seq_kcluster_t; | |
33 | ||
34 | /* return pointer to private data */ | |
35 | #define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(snd_seq_kinstr_t)) | |
36 | ||
37 | typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t; | |
38 | ||
39 | /* Instrument structure */ | |
40 | typedef struct _snd_seq_kinstr { | |
41 | snd_seq_instr_t instr; | |
42 | char name[32]; | |
43 | int type; /* instrument type */ | |
44 | int use; /* use count */ | |
45 | int busy; /* not useable */ | |
46 | int add_len; /* additional length */ | |
47 | snd_seq_kinstr_ops_t *ops; /* operations */ | |
48 | struct _snd_seq_kinstr *next; | |
49 | } snd_seq_kinstr_t; | |
50 | ||
51 | #define SNDRV_SEQ_INSTR_HASH_SIZE 32 | |
52 | ||
53 | /* Instrument flags */ | |
54 | #define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ | |
55 | ||
56 | /* List of all instruments */ | |
57 | typedef struct { | |
58 | snd_seq_kinstr_t *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; | |
59 | int count; /* count of all instruments */ | |
60 | ||
61 | snd_seq_kcluster_t *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; | |
62 | int ccount; /* count of all clusters */ | |
63 | ||
64 | int owner; /* current owner of the instrument list */ | |
65 | unsigned int flags; | |
66 | ||
67 | spinlock_t lock; | |
68 | spinlock_t ops_lock; | |
69 | struct semaphore ops_mutex; | |
70 | unsigned long ops_flags; | |
71 | } snd_seq_kinstr_list_t; | |
72 | ||
73 | #define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 | |
74 | #define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 | |
75 | ||
76 | struct snd_seq_kinstr_ops { | |
77 | void *private_data; | |
78 | long add_len; /* additional length */ | |
79 | char *instr_type; | |
80 | int (*info)(void *private_data, char *info_data, long len); | |
81 | int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, | |
82 | char __user *instr_data, long len, int atomic, int cmd); | |
83 | int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, | |
84 | char __user *instr_data, long len, int atomic, int cmd); | |
85 | int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); | |
86 | int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); | |
87 | void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); | |
88 | struct snd_seq_kinstr_ops *next; | |
89 | }; | |
90 | ||
91 | ||
92 | /* instrument operations */ | |
93 | snd_seq_kinstr_list_t *snd_seq_instr_list_new(void); | |
94 | void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list); | |
95 | int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, | |
96 | snd_seq_instr_header_t *ifree, | |
97 | int client, | |
98 | int atomic); | |
99 | snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, | |
100 | snd_seq_instr_t *instr, | |
101 | int exact, | |
102 | int follow_alias); | |
103 | void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, | |
104 | snd_seq_kinstr_t *instr); | |
105 | int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, | |
106 | snd_seq_kinstr_list_t *list, | |
107 | snd_seq_event_t *ev, | |
108 | int client, | |
109 | int atomic, | |
110 | int hop); | |
111 | ||
112 | #endif /* __SOUND_SEQ_INSTR_H */ |