11da177e4SLinus Torvalds #ifndef __SOUND_CORE_H 21da177e4SLinus Torvalds #define __SOUND_CORE_H 31da177e4SLinus Torvalds 41da177e4SLinus Torvalds /* 51da177e4SLinus Torvalds * Main header file for the ALSA driver 61da177e4SLinus Torvalds * Copyright (c) 1994-2001 by Jaroslav Kysela <perex@suse.cz> 71da177e4SLinus Torvalds * 81da177e4SLinus Torvalds * 91da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify 101da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by 111da177e4SLinus Torvalds * the Free Software Foundation; either version 2 of the License, or 121da177e4SLinus Torvalds * (at your option) any later version. 131da177e4SLinus Torvalds * 141da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful, 151da177e4SLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of 161da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 171da177e4SLinus Torvalds * GNU General Public License for more details. 181da177e4SLinus Torvalds * 191da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License 201da177e4SLinus Torvalds * along with this program; if not, write to the Free Software 211da177e4SLinus Torvalds * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 221da177e4SLinus Torvalds * 231da177e4SLinus Torvalds */ 241da177e4SLinus Torvalds 251da177e4SLinus Torvalds #include <linux/sched.h> /* wake_up() */ 261a60d4c5SIngo Molnar #include <linux/mutex.h> /* struct mutex */ 271da177e4SLinus Torvalds #include <linux/rwsem.h> /* struct rw_semaphore */ 281da177e4SLinus Torvalds #include <linux/workqueue.h> /* struct workqueue_struct */ 291da177e4SLinus Torvalds #include <linux/pm.h> /* pm_message_t */ 301da177e4SLinus Torvalds 311da177e4SLinus Torvalds /* forward declarations */ 321da177e4SLinus Torvalds #ifdef CONFIG_PCI 331da177e4SLinus Torvalds struct pci_dev; 341da177e4SLinus Torvalds #endif 351da177e4SLinus Torvalds #ifdef CONFIG_SBUS 361da177e4SLinus Torvalds struct sbus_dev; 371da177e4SLinus Torvalds #endif 381da177e4SLinus Torvalds 391da177e4SLinus Torvalds /* device allocation stuff */ 401da177e4SLinus Torvalds 411da177e4SLinus Torvalds #define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 421da177e4SLinus Torvalds 43512bbd6aSTakashi Iwai typedef int __bitwise snd_device_type_t; 44512bbd6aSTakashi Iwai #define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0) 45512bbd6aSTakashi Iwai #define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1) 46512bbd6aSTakashi Iwai #define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2) 47512bbd6aSTakashi Iwai #define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000) 48512bbd6aSTakashi Iwai #define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001) 49512bbd6aSTakashi Iwai #define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002) 50512bbd6aSTakashi Iwai #define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003) 51512bbd6aSTakashi Iwai #define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004) 52512bbd6aSTakashi Iwai #define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005) 53512bbd6aSTakashi Iwai #define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006) 54512bbd6aSTakashi Iwai #define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 55512bbd6aSTakashi Iwai #define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 56512bbd6aSTakashi Iwai #define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 571da177e4SLinus Torvalds 58512bbd6aSTakashi Iwai typedef int __bitwise snd_device_state_t; 59512bbd6aSTakashi Iwai #define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0) 60512bbd6aSTakashi Iwai #define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1) 61512bbd6aSTakashi Iwai #define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2) 621da177e4SLinus Torvalds 63512bbd6aSTakashi Iwai typedef int __bitwise snd_device_cmd_t; 64512bbd6aSTakashi Iwai #define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0) 65512bbd6aSTakashi Iwai #define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1) 66512bbd6aSTakashi Iwai #define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2) 671da177e4SLinus Torvalds 68512bbd6aSTakashi Iwai struct snd_device; 691da177e4SLinus Torvalds 70512bbd6aSTakashi Iwai struct snd_device_ops { 71512bbd6aSTakashi Iwai int (*dev_free)(struct snd_device *dev); 72512bbd6aSTakashi Iwai int (*dev_register)(struct snd_device *dev); 73512bbd6aSTakashi Iwai int (*dev_disconnect)(struct snd_device *dev); 74512bbd6aSTakashi Iwai }; 751da177e4SLinus Torvalds 76512bbd6aSTakashi Iwai struct snd_device { 771da177e4SLinus Torvalds struct list_head list; /* list of registered devices */ 78512bbd6aSTakashi Iwai struct snd_card *card; /* card which holds this device */ 791da177e4SLinus Torvalds snd_device_state_t state; /* state of the device */ 801da177e4SLinus Torvalds snd_device_type_t type; /* device type */ 811da177e4SLinus Torvalds void *device_data; /* device structure */ 82512bbd6aSTakashi Iwai struct snd_device_ops *ops; /* operations */ 831da177e4SLinus Torvalds }; 841da177e4SLinus Torvalds 85512bbd6aSTakashi Iwai #define snd_device(n) list_entry(n, struct snd_device, list) 861da177e4SLinus Torvalds 871da177e4SLinus Torvalds /* monitor files for graceful shutdown (hotplug) */ 881da177e4SLinus Torvalds 891da177e4SLinus Torvalds struct snd_monitor_file { 901da177e4SLinus Torvalds struct file *file; 911da177e4SLinus Torvalds struct snd_monitor_file *next; 921da177e4SLinus Torvalds }; 931da177e4SLinus Torvalds 94d5750f67SHenrik Kretzschmar struct snd_shutdown_f_ops; /* define it later in init.c */ 951da177e4SLinus Torvalds 961da177e4SLinus Torvalds /* main structure for soundcard */ 971da177e4SLinus Torvalds 98512bbd6aSTakashi Iwai struct snd_card { 99d5750f67SHenrik Kretzschmar int number; /* number of soundcard (index to 100d5750f67SHenrik Kretzschmar snd_cards) */ 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds char id[16]; /* id string of this card */ 1031da177e4SLinus Torvalds char driver[16]; /* driver name */ 1041da177e4SLinus Torvalds char shortname[32]; /* short name of this soundcard */ 1051da177e4SLinus Torvalds char longname[80]; /* name of this soundcard */ 1061da177e4SLinus Torvalds char mixername[80]; /* mixer name */ 107d5750f67SHenrik Kretzschmar char components[80]; /* card components delimited with 108d5750f67SHenrik Kretzschmar space */ 1091da177e4SLinus Torvalds struct module *module; /* top-level module */ 1101da177e4SLinus Torvalds 1111da177e4SLinus Torvalds void *private_data; /* private data for soundcard */ 112512bbd6aSTakashi Iwai void (*private_free) (struct snd_card *card); /* callback for freeing of 113d5750f67SHenrik Kretzschmar private data */ 1141da177e4SLinus Torvalds struct list_head devices; /* devices */ 1151da177e4SLinus Torvalds 1161da177e4SLinus Torvalds unsigned int last_numid; /* last used numeric ID */ 1171da177e4SLinus Torvalds struct rw_semaphore controls_rwsem; /* controls list lock */ 1181da177e4SLinus Torvalds rwlock_t ctl_files_rwlock; /* ctl_files list lock */ 1191da177e4SLinus Torvalds int controls_count; /* count of all controls */ 1201da177e4SLinus Torvalds int user_ctl_count; /* count of all user controls */ 1211da177e4SLinus Torvalds struct list_head controls; /* all controls for this card */ 1221da177e4SLinus Torvalds struct list_head ctl_files; /* active control files */ 1231da177e4SLinus Torvalds 124512bbd6aSTakashi Iwai struct snd_info_entry *proc_root; /* root for soundcard specific files */ 125512bbd6aSTakashi Iwai struct snd_info_entry *proc_id; /* the card id */ 1261da177e4SLinus Torvalds struct proc_dir_entry *proc_root_link; /* number link to real id */ 1271da177e4SLinus Torvalds 1281da177e4SLinus Torvalds struct snd_monitor_file *files; /* all files associated to this card */ 129d5750f67SHenrik Kretzschmar struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown 130d5750f67SHenrik Kretzschmar state */ 1311da177e4SLinus Torvalds spinlock_t files_lock; /* lock the files for this card */ 1321da177e4SLinus Torvalds int shutdown; /* this card is going down */ 133*c461482cSTakashi Iwai int free_on_last_close; /* free in context of file_release */ 1341da177e4SLinus Torvalds wait_queue_head_t shutdown_sleep; 1351da177e4SLinus Torvalds struct work_struct free_workq; /* for free in workqueue */ 1361da177e4SLinus Torvalds struct device *dev; 1371da177e4SLinus Torvalds 1381da177e4SLinus Torvalds #ifdef CONFIG_PM 1391da177e4SLinus Torvalds unsigned int power_state; /* power state */ 1401a60d4c5SIngo Molnar struct mutex power_lock; /* power lock */ 1411da177e4SLinus Torvalds wait_queue_head_t power_sleep; 1421da177e4SLinus Torvalds #endif 1431da177e4SLinus Torvalds 1441da177e4SLinus Torvalds #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 145512bbd6aSTakashi Iwai struct snd_mixer_oss *mixer_oss; 1461da177e4SLinus Torvalds int mixer_oss_change_count; 1471da177e4SLinus Torvalds #endif 1481da177e4SLinus Torvalds }; 1491da177e4SLinus Torvalds 1501da177e4SLinus Torvalds #ifdef CONFIG_PM 151512bbd6aSTakashi Iwai static inline void snd_power_lock(struct snd_card *card) 1521da177e4SLinus Torvalds { 1531a60d4c5SIngo Molnar mutex_lock(&card->power_lock); 1541da177e4SLinus Torvalds } 1551da177e4SLinus Torvalds 156512bbd6aSTakashi Iwai static inline void snd_power_unlock(struct snd_card *card) 1571da177e4SLinus Torvalds { 1581a60d4c5SIngo Molnar mutex_unlock(&card->power_lock); 1591da177e4SLinus Torvalds } 1601da177e4SLinus Torvalds 161512bbd6aSTakashi Iwai static inline unsigned int snd_power_get_state(struct snd_card *card) 1621da177e4SLinus Torvalds { 1631da177e4SLinus Torvalds return card->power_state; 1641da177e4SLinus Torvalds } 1651da177e4SLinus Torvalds 166512bbd6aSTakashi Iwai static inline void snd_power_change_state(struct snd_card *card, unsigned int state) 1671da177e4SLinus Torvalds { 1681da177e4SLinus Torvalds card->power_state = state; 1691da177e4SLinus Torvalds wake_up(&card->power_sleep); 1701da177e4SLinus Torvalds } 171d5750f67SHenrik Kretzschmar 172d5750f67SHenrik Kretzschmar /* init.c */ 173cbac4b0cSTakashi Iwai int snd_power_wait(struct snd_card *card, unsigned int power_state); 174d5750f67SHenrik Kretzschmar 1751da177e4SLinus Torvalds #else /* ! CONFIG_PM */ 1761da177e4SLinus Torvalds 1771da177e4SLinus Torvalds #define snd_power_lock(card) do { (void)(card); } while (0) 1781da177e4SLinus Torvalds #define snd_power_unlock(card) do { (void)(card); } while (0) 1796fdb94bdSLinus Torvalds static inline int snd_power_wait(struct snd_card *card, unsigned int state) { return 0; } 1801da177e4SLinus Torvalds #define snd_power_get_state(card) SNDRV_CTL_POWER_D0 1811da177e4SLinus Torvalds #define snd_power_change_state(card, state) do { (void)(card); } while (0) 1821da177e4SLinus Torvalds 1831da177e4SLinus Torvalds #endif /* CONFIG_PM */ 1841da177e4SLinus Torvalds 185512bbd6aSTakashi Iwai struct snd_minor { 1862af677fcSClemens Ladisch int type; /* SNDRV_DEVICE_TYPE_XXX */ 1876983b724SClemens Ladisch int card; /* card number */ 1881da177e4SLinus Torvalds int device; /* device number */ 18999ac48f5SArjan van de Ven const struct file_operations *f_ops; /* file operations */ 190f87135f5SClemens Ladisch void *private_data; /* private data for f_ops->open */ 1911da177e4SLinus Torvalds }; 1921da177e4SLinus Torvalds 1931da177e4SLinus Torvalds /* sound.c */ 1941da177e4SLinus Torvalds 195f1902860SClemens Ladisch extern int snd_major; 1961da177e4SLinus Torvalds extern int snd_ecards_limit; 1971da177e4SLinus Torvalds 1981da177e4SLinus Torvalds void snd_request_card(int card); 1991da177e4SLinus Torvalds 2002af677fcSClemens Ladisch int snd_register_device(int type, struct snd_card *card, int dev, 20199ac48f5SArjan van de Ven const struct file_operations *f_ops, void *private_data, 202f87135f5SClemens Ladisch const char *name); 203512bbd6aSTakashi Iwai int snd_unregister_device(int type, struct snd_card *card, int dev); 204f87135f5SClemens Ladisch void *snd_lookup_minor_data(unsigned int minor, int type); 2051da177e4SLinus Torvalds 2061da177e4SLinus Torvalds #ifdef CONFIG_SND_OSSEMUL 2072af677fcSClemens Ladisch int snd_register_oss_device(int type, struct snd_card *card, int dev, 20899ac48f5SArjan van de Ven const struct file_operations *f_ops, void *private_data, 209f87135f5SClemens Ladisch const char *name); 210512bbd6aSTakashi Iwai int snd_unregister_oss_device(int type, struct snd_card *card, int dev); 211f87135f5SClemens Ladisch void *snd_lookup_oss_minor_data(unsigned int minor, int type); 2121da177e4SLinus Torvalds #endif 2131da177e4SLinus Torvalds 2141da177e4SLinus Torvalds int snd_minor_info_init(void); 2151da177e4SLinus Torvalds int snd_minor_info_done(void); 2161da177e4SLinus Torvalds 2171da177e4SLinus Torvalds /* sound_oss.c */ 2181da177e4SLinus Torvalds 2191da177e4SLinus Torvalds #ifdef CONFIG_SND_OSSEMUL 2201da177e4SLinus Torvalds int snd_minor_info_oss_init(void); 2211da177e4SLinus Torvalds int snd_minor_info_oss_done(void); 2221da177e4SLinus Torvalds #else 2231da177e4SLinus Torvalds #define snd_minor_info_oss_init() /*NOP*/ 2241da177e4SLinus Torvalds #define snd_minor_info_oss_done() /*NOP*/ 2251da177e4SLinus Torvalds #endif 2261da177e4SLinus Torvalds 2271da177e4SLinus Torvalds /* memory.c */ 2281da177e4SLinus Torvalds 2291da177e4SLinus Torvalds int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); 2301da177e4SLinus Torvalds int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); 2311da177e4SLinus Torvalds 2321da177e4SLinus Torvalds /* init.c */ 2331da177e4SLinus Torvalds 234512bbd6aSTakashi Iwai extern struct snd_card *snd_cards[SNDRV_CARDS]; 235746df948STakashi Iwai int snd_card_locked(int card); 2361da177e4SLinus Torvalds #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 2371da177e4SLinus Torvalds #define SND_MIXER_OSS_NOTIFY_REGISTER 0 2381da177e4SLinus Torvalds #define SND_MIXER_OSS_NOTIFY_DISCONNECT 1 2391da177e4SLinus Torvalds #define SND_MIXER_OSS_NOTIFY_FREE 2 240512bbd6aSTakashi Iwai extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd); 2411da177e4SLinus Torvalds #endif 2421da177e4SLinus Torvalds 243512bbd6aSTakashi Iwai struct snd_card *snd_card_new(int idx, const char *id, 2441da177e4SLinus Torvalds struct module *module, int extra_size); 245512bbd6aSTakashi Iwai int snd_card_disconnect(struct snd_card *card); 246512bbd6aSTakashi Iwai int snd_card_free(struct snd_card *card); 247*c461482cSTakashi Iwai int snd_card_free_when_closed(struct snd_card *card); 248512bbd6aSTakashi Iwai int snd_card_free_in_thread(struct snd_card *card); 249512bbd6aSTakashi Iwai int snd_card_register(struct snd_card *card); 2501da177e4SLinus Torvalds int snd_card_info_init(void); 2511da177e4SLinus Torvalds int snd_card_info_done(void); 252512bbd6aSTakashi Iwai int snd_component_add(struct snd_card *card, const char *component); 253512bbd6aSTakashi Iwai int snd_card_file_add(struct snd_card *card, struct file *file); 254512bbd6aSTakashi Iwai int snd_card_file_remove(struct snd_card *card, struct file *file); 2551da177e4SLinus Torvalds 2561da177e4SLinus Torvalds #ifndef snd_card_set_dev 2571da177e4SLinus Torvalds #define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) 2581da177e4SLinus Torvalds #endif 2591da177e4SLinus Torvalds 2601da177e4SLinus Torvalds /* device.c */ 2611da177e4SLinus Torvalds 262512bbd6aSTakashi Iwai int snd_device_new(struct snd_card *card, snd_device_type_t type, 263512bbd6aSTakashi Iwai void *device_data, struct snd_device_ops *ops); 264512bbd6aSTakashi Iwai int snd_device_register(struct snd_card *card, void *device_data); 265512bbd6aSTakashi Iwai int snd_device_register_all(struct snd_card *card); 266512bbd6aSTakashi Iwai int snd_device_disconnect(struct snd_card *card, void *device_data); 267512bbd6aSTakashi Iwai int snd_device_disconnect_all(struct snd_card *card); 268512bbd6aSTakashi Iwai int snd_device_free(struct snd_card *card, void *device_data); 269512bbd6aSTakashi Iwai int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd); 2701da177e4SLinus Torvalds 2711da177e4SLinus Torvalds /* isadma.c */ 2721da177e4SLinus Torvalds 273276bd31cSAl Viro #ifdef CONFIG_ISA_DMA_API 2741da177e4SLinus Torvalds #define DMA_MODE_NO_ENABLE 0x0100 2751da177e4SLinus Torvalds 2761da177e4SLinus Torvalds void snd_dma_program(unsigned long dma, unsigned long addr, unsigned int size, unsigned short mode); 2771da177e4SLinus Torvalds void snd_dma_disable(unsigned long dma); 2781da177e4SLinus Torvalds unsigned int snd_dma_pointer(unsigned long dma, unsigned int size); 279276bd31cSAl Viro #endif 2801da177e4SLinus Torvalds 2811da177e4SLinus Torvalds /* misc.c */ 282b709e574STakashi Iwai struct resource; 283b1d5776dSTakashi Iwai void release_and_free_resource(struct resource *res); 2841da177e4SLinus Torvalds 2851da177e4SLinus Torvalds #ifdef CONFIG_SND_VERBOSE_PRINTK 2861da177e4SLinus Torvalds void snd_verbose_printk(const char *file, int line, const char *format, ...) 2871da177e4SLinus Torvalds __attribute__ ((format (printf, 3, 4))); 2881da177e4SLinus Torvalds #endif 2891da177e4SLinus Torvalds #if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK) 2901da177e4SLinus Torvalds void snd_verbose_printd(const char *file, int line, const char *format, ...) 2911da177e4SLinus Torvalds __attribute__ ((format (printf, 3, 4))); 2921da177e4SLinus Torvalds #endif 2931da177e4SLinus Torvalds 2941da177e4SLinus Torvalds /* --- */ 2951da177e4SLinus Torvalds 2961da177e4SLinus Torvalds #ifdef CONFIG_SND_VERBOSE_PRINTK 2971da177e4SLinus Torvalds /** 2981da177e4SLinus Torvalds * snd_printk - printk wrapper 2991da177e4SLinus Torvalds * @fmt: format string 3001da177e4SLinus Torvalds * 3011da177e4SLinus Torvalds * Works like print() but prints the file and the line of the caller 3021da177e4SLinus Torvalds * when configured with CONFIG_SND_VERBOSE_PRINTK. 3031da177e4SLinus Torvalds */ 3041da177e4SLinus Torvalds #define snd_printk(fmt, args...) \ 3051da177e4SLinus Torvalds snd_verbose_printk(__FILE__, __LINE__, fmt ,##args) 3061da177e4SLinus Torvalds #else 3071da177e4SLinus Torvalds #define snd_printk(fmt, args...) \ 3081da177e4SLinus Torvalds printk(fmt ,##args) 3091da177e4SLinus Torvalds #endif 3101da177e4SLinus Torvalds 3111da177e4SLinus Torvalds #ifdef CONFIG_SND_DEBUG 3121da177e4SLinus Torvalds 3131da177e4SLinus Torvalds #define __ASTRING__(x) #x 3141da177e4SLinus Torvalds 3151da177e4SLinus Torvalds #ifdef CONFIG_SND_VERBOSE_PRINTK 3161da177e4SLinus Torvalds /** 3171da177e4SLinus Torvalds * snd_printd - debug printk 3180863afb3SMartin Waitz * @fmt: format string 3191da177e4SLinus Torvalds * 3201da177e4SLinus Torvalds * Compiled only when Works like snd_printk() for debugging purpose. 3211da177e4SLinus Torvalds * Ignored when CONFIG_SND_DEBUG is not set. 3221da177e4SLinus Torvalds */ 3231da177e4SLinus Torvalds #define snd_printd(fmt, args...) \ 3241da177e4SLinus Torvalds snd_verbose_printd(__FILE__, __LINE__, fmt ,##args) 3251da177e4SLinus Torvalds #else 3261da177e4SLinus Torvalds #define snd_printd(fmt, args...) \ 3271da177e4SLinus Torvalds printk(fmt ,##args) 3281da177e4SLinus Torvalds #endif 3291da177e4SLinus Torvalds /** 330d5750f67SHenrik Kretzschmar * snd_assert - run-time assertion macro 3311da177e4SLinus Torvalds * @expr: expression 3321da177e4SLinus Torvalds * 3331da177e4SLinus Torvalds * This macro checks the expression in run-time and invokes the commands 3341da177e4SLinus Torvalds * given in the rest arguments if the assertion is failed. 3351da177e4SLinus Torvalds * When CONFIG_SND_DEBUG is not set, the expression is executed but 3361da177e4SLinus Torvalds * not checked. 3371da177e4SLinus Torvalds */ 3381da177e4SLinus Torvalds #define snd_assert(expr, args...) do { \ 3391da177e4SLinus Torvalds if (unlikely(!(expr))) { \ 3407c22f1aaSTakashi Iwai snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \ 3417c22f1aaSTakashi Iwai dump_stack(); \ 3421da177e4SLinus Torvalds args; \ 3431da177e4SLinus Torvalds } \ 3441da177e4SLinus Torvalds } while (0) 3457c22f1aaSTakashi Iwai 3467c22f1aaSTakashi Iwai #define snd_BUG() do { \ 3477c22f1aaSTakashi Iwai snd_printk(KERN_ERR "BUG?\n"); \ 3487c22f1aaSTakashi Iwai dump_stack(); \ 3491da177e4SLinus Torvalds } while (0) 3501da177e4SLinus Torvalds 3511da177e4SLinus Torvalds #else /* !CONFIG_SND_DEBUG */ 3521da177e4SLinus Torvalds 3531da177e4SLinus Torvalds #define snd_printd(fmt, args...) /* nothing */ 3541da177e4SLinus Torvalds #define snd_assert(expr, args...) (void)(expr) 3557c22f1aaSTakashi Iwai #define snd_BUG() /* nothing */ 3561da177e4SLinus Torvalds 3571da177e4SLinus Torvalds #endif /* CONFIG_SND_DEBUG */ 3581da177e4SLinus Torvalds 3591da177e4SLinus Torvalds #ifdef CONFIG_SND_DEBUG_DETECT 3601da177e4SLinus Torvalds /** 3611da177e4SLinus Torvalds * snd_printdd - debug printk 3621da177e4SLinus Torvalds * @format: format string 3631da177e4SLinus Torvalds * 3641da177e4SLinus Torvalds * Compiled only when Works like snd_printk() for debugging purpose. 3651da177e4SLinus Torvalds * Ignored when CONFIG_SND_DEBUG_DETECT is not set. 3661da177e4SLinus Torvalds */ 3671da177e4SLinus Torvalds #define snd_printdd(format, args...) snd_printk(format, ##args) 3681da177e4SLinus Torvalds #else 3691da177e4SLinus Torvalds #define snd_printdd(format, args...) /* nothing */ 3701da177e4SLinus Torvalds #endif 3711da177e4SLinus Torvalds 3721da177e4SLinus Torvalds 3731da177e4SLinus Torvalds #define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */ 3741da177e4SLinus Torvalds 3751da177e4SLinus Torvalds /* for easier backward-porting */ 3761da177e4SLinus Torvalds #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) 3771da177e4SLinus Torvalds #ifndef gameport_set_dev_parent 3781da177e4SLinus Torvalds #define gameport_set_dev_parent(gp,xdev) ((gp)->dev.parent = (xdev)) 3791da177e4SLinus Torvalds #define gameport_set_port_data(gp,r) ((gp)->port_data = (r)) 3801da177e4SLinus Torvalds #define gameport_get_port_data(gp) (gp)->port_data 3811da177e4SLinus Torvalds #endif 3821da177e4SLinus Torvalds #endif 3831da177e4SLinus Torvalds 384512bbd6aSTakashi Iwai #include "typedefs.h" 385512bbd6aSTakashi Iwai 3861da177e4SLinus Torvalds #endif /* __SOUND_CORE_H */ 387