int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, int driver_size, int flags, unsigned int format_mask, void *devc, int dma1, int dma2) { struct audio_driver *d; struct audio_operations *op; int num; if (vers != AUDIO_DRIVER_VERSION || driver_size > sizeof(struct audio_driver)) { printk(KERN_ERR "Sound: Incompatible audio driver for %s\n", name); return -(EINVAL); } num = sound_alloc_audiodev(); if (num == -1) { printk(KERN_ERR "sound: Too many audio drivers\n"); return -(EBUSY); } d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver))); if (sound_nblocks < 1024) sound_nblocks++; op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations))); if (sound_nblocks < 1024) sound_nblocks++; if (d == NULL || op == NULL) { printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name); sound_unload_audiodev(num); return -(ENOMEM); } memset((char *) op, 0, sizeof(struct audio_operations)); init_waitqueue_head(&op->in_sleeper); init_waitqueue_head(&op->out_sleeper); init_waitqueue_head(&op->poll_sleeper); if (driver_size < sizeof(struct audio_driver)) memset((char *) d, 0, sizeof(struct audio_driver)); memcpy((char *) d, (char *) driver, driver_size); op->d = d; strlcpy(op->name, name, sizeof(op->name)); op->flags = flags; op->format_mask = format_mask; op->devc = devc; /* * Hardcoded defaults */ audio_devs[num] = op; DMAbuf_init(num, dma1, dma2); audio_init_devices(); return num; }
void soundcard_init (void) { #ifndef MODULE module_register_chrdev (sound_major, "sound", &sound_fops); chrdev_registered = 1; #endif soundcard_configured = 1; sndtable_init (); /* Initialize call tables and detect cards */ #ifdef CONFIG_LOWLEVEL_SOUND { extern void sound_init_lowlevel_drivers (void); sound_init_lowlevel_drivers (); } #endif if (sndtable_get_cardcount () == 0) return; /* No cards detected */ #ifdef CONFIG_AUDIO if (num_audiodevs) /* Audio devices present */ { DMAbuf_init (); audio_init (); } #endif #ifdef CONFIG_MIDI if (num_midis) MIDIbuf_init (); #endif #ifdef CONFIG_SEQUENCER if (num_midis + num_synths) sequencer_init (); #endif }
static void start_services() { int soundcards_installed; if (!(soundcards_installed = sndtable_get_cardcount())) return ; /* No cards detected */ #ifdef CONFIG_AUDIO if (num_audiodevs) /* Audio devices present */ DMAbuf_init(); #endif #ifdef CONFIG_MIDI if (num_midis) /* MIDIbuf_init(0) */; #endif #ifdef CONFIG_SEQUENCER if (num_midis + num_synths) sequencer_init(); #endif }