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