1 | #ifndef __SOUND_INFO_H
|
---|
2 | #define __SOUND_INFO_H
|
---|
3 |
|
---|
4 | /*
|
---|
5 | * Header file for info interface
|
---|
6 | * Copyright (c) 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 |
|
---|
25 | #include <linux/poll.h>
|
---|
26 |
|
---|
27 | /* buffer for information */
|
---|
28 | struct snd_info_buffer {
|
---|
29 | char *buffer; /* pointer to begin of buffer */
|
---|
30 | char *curr; /* current position in buffer */
|
---|
31 | unsigned long size; /* current size */
|
---|
32 | unsigned long len; /* total length of buffer */
|
---|
33 | int stop; /* stop flag */
|
---|
34 | int error; /* error code */
|
---|
35 | };
|
---|
36 |
|
---|
37 | #define SNDRV_INFO_CONTENT_TEXT 0
|
---|
38 | #define SNDRV_INFO_CONTENT_DATA 1
|
---|
39 |
|
---|
40 | struct snd_info_entry;
|
---|
41 |
|
---|
42 | struct snd_info_entry_text {
|
---|
43 | unsigned long read_size;
|
---|
44 | unsigned long write_size;
|
---|
45 | void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
|
---|
46 | void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
|
---|
47 | };
|
---|
48 |
|
---|
49 | struct snd_info_entry_ops {
|
---|
50 | int (*open) (struct snd_info_entry *entry,
|
---|
51 | unsigned short mode, void **file_private_data);
|
---|
52 | int (*release) (struct snd_info_entry * entry,
|
---|
53 | unsigned short mode, void *file_private_data);
|
---|
54 | long (*read) (struct snd_info_entry *entry, void *file_private_data,
|
---|
55 | struct file * file, char __user *buf,
|
---|
56 | unsigned long count, unsigned long pos);
|
---|
57 | long (*write) (struct snd_info_entry *entry, void *file_private_data,
|
---|
58 | struct file * file, const char __user *buf,
|
---|
59 | unsigned long count, unsigned long pos);
|
---|
60 | long long (*llseek) (struct snd_info_entry *entry, void *file_private_data,
|
---|
61 | struct file * file, long long offset, int orig);
|
---|
62 | unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data,
|
---|
63 | struct file * file, poll_table * wait);
|
---|
64 | int (*ioctl) (struct snd_info_entry *entry, void *file_private_data,
|
---|
65 | struct file * file, unsigned int cmd, unsigned long arg);
|
---|
66 | int (*mmap) (struct snd_info_entry *entry, void *file_private_data,
|
---|
67 | struct inode * inode, struct file * file,
|
---|
68 | struct vm_area_struct * vma);
|
---|
69 | };
|
---|
70 |
|
---|
71 | struct snd_info_entry {
|
---|
72 | const char *name;
|
---|
73 | mode_t mode;
|
---|
74 | long size;
|
---|
75 | unsigned short content;
|
---|
76 | unsigned short disconnected: 1;
|
---|
77 | union {
|
---|
78 | struct snd_info_entry_text text;
|
---|
79 | struct snd_info_entry_ops *ops;
|
---|
80 | } c;
|
---|
81 | struct snd_info_entry *parent;
|
---|
82 | struct snd_card *card;
|
---|
83 | struct module *module;
|
---|
84 | void *private_data;
|
---|
85 | void (*private_free)(struct snd_info_entry *entry);
|
---|
86 | struct proc_dir_entry *p;
|
---|
87 | struct semaphore access;
|
---|
88 | };
|
---|
89 |
|
---|
90 | int snd_info_check_reserved_words(const char *str);
|
---|
91 |
|
---|
92 | #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
|
---|
93 | int snd_info_minor_register(void);
|
---|
94 | int snd_info_minor_unregister(void);
|
---|
95 | #else
|
---|
96 | #define snd_info_minor_register() /* NOP */
|
---|
97 | #define snd_info_minor_unregister() /* NOP */
|
---|
98 | #endif
|
---|
99 |
|
---|
100 |
|
---|
101 | #ifdef CONFIG_PROC_FS
|
---|
102 |
|
---|
103 | extern struct snd_info_entry *snd_seq_root;
|
---|
104 | #ifdef CONFIG_SND_OSSEMUL
|
---|
105 | extern struct snd_info_entry *snd_oss_root;
|
---|
106 | #else
|
---|
107 | #define snd_oss_root NULL
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...);
|
---|
111 | int snd_info_init(void);
|
---|
112 | int snd_info_done(void);
|
---|
113 |
|
---|
114 | int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len);
|
---|
115 | char *snd_info_get_str(char *dest, char *src, int len);
|
---|
116 | struct snd_info_entry *snd_info_create_module_entry(struct module * module,
|
---|
117 | const char *name,
|
---|
118 | struct snd_info_entry * parent);
|
---|
119 | struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card,
|
---|
120 | const char *name,
|
---|
121 | struct snd_info_entry * parent);
|
---|
122 | void snd_info_free_entry(struct snd_info_entry * entry);
|
---|
123 | int snd_info_store_text(struct snd_info_entry * entry);
|
---|
124 | int snd_info_restore_text(struct snd_info_entry * entry);
|
---|
125 |
|
---|
126 | int snd_info_card_create(struct snd_card * card);
|
---|
127 | int snd_info_card_register(struct snd_card * card);
|
---|
128 | int snd_info_card_free(struct snd_card * card);
|
---|
129 | int snd_info_register(struct snd_info_entry * entry);
|
---|
130 | int snd_info_unregister(struct snd_info_entry * entry);
|
---|
131 |
|
---|
132 | /* for card drivers */
|
---|
133 | int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp);
|
---|
134 |
|
---|
135 | static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
|
---|
136 | void *private_data,
|
---|
137 | long read_size,
|
---|
138 | void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
|
---|
139 | {
|
---|
140 | entry->private_data = private_data;
|
---|
141 | entry->c.text.read_size = read_size;
|
---|
142 | entry->c.text.read = read;
|
---|
143 | }
|
---|
144 |
|
---|
145 |
|
---|
146 | #else
|
---|
147 |
|
---|
148 | #define snd_seq_root NULL
|
---|
149 | #define snd_oss_root NULL
|
---|
150 |
|
---|
151 | static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; }
|
---|
152 | static inline int snd_info_init(void) { return 0; }
|
---|
153 | static inline int snd_info_done(void) { return 0; }
|
---|
154 |
|
---|
155 | static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; }
|
---|
156 | static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
|
---|
157 | static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; }
|
---|
158 | static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; }
|
---|
159 | static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; }
|
---|
160 |
|
---|
161 | static inline int snd_info_card_create(struct snd_card * card) { return 0; }
|
---|
162 | static inline int snd_info_card_register(struct snd_card * card) { return 0; }
|
---|
163 | static inline int snd_info_card_free(struct snd_card * card) { return 0; }
|
---|
164 | static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
|
---|
165 | static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; }
|
---|
166 |
|
---|
167 | #define snd_card_proc_new(card,name,entryp) 0 /* always success */
|
---|
168 | #define snd_info_set_text_ops(entry,private_data,read_size,read) /*NOP*/
|
---|
169 |
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | /*
|
---|
173 | * OSS info part
|
---|
174 | */
|
---|
175 |
|
---|
176 | #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
|
---|
177 |
|
---|
178 | #define SNDRV_OSS_INFO_DEV_AUDIO 0
|
---|
179 | #define SNDRV_OSS_INFO_DEV_SYNTH 1
|
---|
180 | #define SNDRV_OSS_INFO_DEV_MIDI 2
|
---|
181 | #define SNDRV_OSS_INFO_DEV_TIMERS 4
|
---|
182 | #define SNDRV_OSS_INFO_DEV_MIXERS 5
|
---|
183 |
|
---|
184 | #define SNDRV_OSS_INFO_DEV_COUNT 6
|
---|
185 |
|
---|
186 | int snd_oss_info_register(int dev, int num, char *string);
|
---|
187 | #define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL)
|
---|
188 |
|
---|
189 | #endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */
|
---|
190 |
|
---|
191 | #endif /* __SOUND_INFO_H */
|
---|