aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/info.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/sound/info.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/sound/info.h')
-rw-r--r--include/sound/info.h193
1 files changed, 193 insertions, 0 deletions
diff --git a/include/sound/info.h b/include/sound/info.h
new file mode 100644
index 000000000000..1d76bf3cb05e
--- /dev/null
+++ b/include/sound/info.h
@@ -0,0 +1,193 @@
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 */
28struct 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
37typedef struct snd_info_buffer snd_info_buffer_t;
38
39#define SNDRV_INFO_CONTENT_TEXT 0
40#define SNDRV_INFO_CONTENT_DATA 1
41
42struct snd_info_entry;
43
44struct snd_info_entry_text {
45 unsigned long read_size;
46 unsigned long write_size;
47 void (*read) (snd_info_entry_t *entry, snd_info_buffer_t * buffer);
48 void (*write) (snd_info_entry_t *entry, snd_info_buffer_t * buffer);
49};
50
51struct snd_info_entry_ops {
52 int (*open) (snd_info_entry_t *entry,
53 unsigned short mode, void **file_private_data);
54 int (*release) (snd_info_entry_t * entry,
55 unsigned short mode, void *file_private_data);
56 long (*read) (snd_info_entry_t *entry, void *file_private_data,
57 struct file * file, char __user *buf,
58 unsigned long count, unsigned long pos);
59 long (*write) (snd_info_entry_t *entry, void *file_private_data,
60 struct file * file, const char __user *buf,
61 unsigned long count, unsigned long pos);
62 long long (*llseek) (snd_info_entry_t *entry, void *file_private_data,
63 struct file * file, long long offset, int orig);
64 unsigned int (*poll) (snd_info_entry_t *entry, void *file_private_data,
65 struct file * file, poll_table * wait);
66 int (*ioctl) (snd_info_entry_t *entry, void *file_private_data,
67 struct file * file, unsigned int cmd, unsigned long arg);
68 int (*mmap) (snd_info_entry_t *entry, void *file_private_data,
69 struct inode * inode, struct file * file,
70 struct vm_area_struct * vma);
71};
72
73struct snd_info_entry {
74 const char *name;
75 mode_t mode;
76 long size;
77 unsigned short content;
78 unsigned short disconnected: 1;
79 union {
80 struct snd_info_entry_text text;
81 struct snd_info_entry_ops *ops;
82 } c;
83 snd_info_entry_t *parent;
84 snd_card_t *card;
85 struct module *module;
86 void *private_data;
87 void (*private_free)(snd_info_entry_t *entry);
88 struct proc_dir_entry *p;
89 struct semaphore access;
90};
91
92extern int snd_info_check_reserved_words(const char *str);
93
94#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
95extern int snd_info_minor_register(void);
96extern int snd_info_minor_unregister(void);
97#else
98#define snd_info_minor_register() /* NOP */
99#define snd_info_minor_unregister() /* NOP */
100#endif
101
102
103#ifdef CONFIG_PROC_FS
104
105extern snd_info_entry_t *snd_seq_root;
106#ifdef CONFIG_SND_OSSEMUL
107extern snd_info_entry_t *snd_oss_root;
108#else
109#define snd_oss_root NULL
110#endif
111
112int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3)));
113int snd_info_init(void);
114int snd_info_done(void);
115
116int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len);
117char *snd_info_get_str(char *dest, char *src, int len);
118snd_info_entry_t *snd_info_create_module_entry(struct module * module,
119 const char *name,
120 snd_info_entry_t * parent);
121snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card,
122 const char *name,
123 snd_info_entry_t * parent);
124void snd_info_free_entry(snd_info_entry_t * entry);
125int snd_info_store_text(snd_info_entry_t * entry);
126int snd_info_restore_text(snd_info_entry_t * entry);
127
128int snd_info_card_create(snd_card_t * card);
129int snd_info_card_register(snd_card_t * card);
130int snd_info_card_free(snd_card_t * card);
131int snd_info_register(snd_info_entry_t * entry);
132int snd_info_unregister(snd_info_entry_t * entry);
133
134/* for card drivers */
135int snd_card_proc_new(snd_card_t *card, const char *name, snd_info_entry_t **entryp);
136
137static inline void snd_info_set_text_ops(snd_info_entry_t *entry,
138 void *private_data,
139 long read_size,
140 void (*read)(snd_info_entry_t *, snd_info_buffer_t *))
141{
142 entry->private_data = private_data;
143 entry->c.text.read_size = read_size;
144 entry->c.text.read = read;
145}
146
147
148#else
149
150#define snd_seq_root NULL
151#define snd_oss_root NULL
152
153static inline int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) { return 0; }
154static inline int snd_info_init(void) { return 0; }
155static inline int snd_info_done(void) { return 0; }
156
157static inline int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len) { return 0; }
158static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
159static inline snd_info_entry_t *snd_info_create_module_entry(struct module * module, const char *name, snd_info_entry_t * parent) { return NULL; }
160static inline snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, const char *name, snd_info_entry_t * parent) { return NULL; }
161static inline void snd_info_free_entry(snd_info_entry_t * entry) { ; }
162
163static inline int snd_info_card_create(snd_card_t * card) { return 0; }
164static inline int snd_info_card_register(snd_card_t * card) { return 0; }
165static inline int snd_info_card_free(snd_card_t * card) { return 0; }
166static inline int snd_info_register(snd_info_entry_t * entry) { return 0; }
167static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; }
168
169#define snd_card_proc_new(card,name,entryp) 0 /* always success */
170#define snd_info_set_text_ops(entry,private_data,read_size,read) /*NOP*/
171
172#endif
173
174/*
175 * OSS info part
176 */
177
178#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
179
180#define SNDRV_OSS_INFO_DEV_AUDIO 0
181#define SNDRV_OSS_INFO_DEV_SYNTH 1
182#define SNDRV_OSS_INFO_DEV_MIDI 2
183#define SNDRV_OSS_INFO_DEV_TIMERS 4
184#define SNDRV_OSS_INFO_DEV_MIXERS 5
185
186#define SNDRV_OSS_INFO_DEV_COUNT 6
187
188extern int snd_oss_info_register(int dev, int num, char *string);
189#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL)
190
191#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */
192
193#endif /* __SOUND_INFO_H */