Date: Sat, 11 Jan 1997 23:27:56 -0500 (EST) From: John Fieber <jfieber@indiana.edu> To: Julian Elischer <julian@whistle.com> Cc: hackers@freebsd.org Subject: sound driver/devfs change, round 2 Message-ID: <Pine.BSI.3.95.970111231457.262B-100000@fallout.campusview.indiana.edu> In-Reply-To: <32D85F07.52BFA1D7@whistle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Okay, I've learn a bit in the last couple hours and the patches below, like the last ones, do work with my soundblaster 16. They now store the devfs tokens and theoretically handle multiple cards. To avoid further confusion with the unusual use of `unit' in the sndattach funcion, I've renamed the old unit variable to voxunit, and the current unit variable is what you expect it to be (dev->id_unit).. I've also changed the default ownership and permission to root.wheel and 0600, respectively, assuming that the "correct" settings will be applied in a startup script. Next question, currently there are unnumbered aliases for unit zero, eg audio -> audio0. Should that also be left to a startup script? -john *** soundcard.c.orig Fri Jan 10 22:56:00 1997 --- soundcard.c Sat Jan 11 23:22:35 1997 *************** *** 323,342 **** sndattach (struct isa_device *dev) { int unit; static int midi_initialized = 0; static int seq_initialized = 0; unsigned long mem_start = 0xefffffffUL; struct address_info hw_config; ! unit = driver_to_voxunit(dev->id_driver); hw_config.io_base = dev->id_iobase; hw_config.irq = ipri_to_irq (dev->id_irq); hw_config.dma = dev->id_drq; hw_config.dma_read = dev->id_flags; /* misuse the flags field for read dma*/ ! if(!unit) return FALSE; ! if (!sndtable_init_card (unit, &hw_config)) { printf (" <Driver not configured>"); return FALSE; --- 323,345 ---- sndattach (struct isa_device *dev) { int unit; + int minor; + int voxunit; static int midi_initialized = 0; static int seq_initialized = 0; unsigned long mem_start = 0xefffffffUL; struct address_info hw_config; ! unit = dev->id_unit; ! voxunit = driver_to_voxunit(dev->id_driver); hw_config.io_base = dev->id_iobase; hw_config.irq = ipri_to_irq (dev->id_irq); hw_config.dma = dev->id_drq; hw_config.dma_read = dev->id_flags; /* misuse the flags field for read dma*/ ! if(!voxunit) return FALSE; ! if (!sndtable_init_card (voxunit, &hw_config)) { printf (" <Driver not configured>"); return FALSE; *************** *** 382,435 **** #endif #ifdef DEVFS - /* XXX */ /* find out where to store the tokens.. */ /* XXX */ /* should only create devices if that card has them */ #define SND_UID 0 ! #define SND_GID 13 ! snd_devfs_token[unit]= ! devfs_add_devswf(&snd_cdevsw, (unit << 4)+SND_DEV_CTL, DV_CHR, ! SND_UID, SND_GID, 0660, "mixer%d", unit); #ifndef EXCLUDE_SEQUENCER ! snd_devfs_token[unit]= ! devfs_add_devswf(&snd_cdevsw, (unit << 4)+SND_DEV_SEQ, DV_CHR, ! SND_UID, SND_GID, 0660, "sequencer%d", unit); ! snd_devfs_token[unit]= ! devfs_add_devswf(&snd_cdevsw, (unit << 4)+SND_DEV_SEQ2, DV_CHR, ! SND_UID, SND_GID, 0660, "music%d", unit); #endif #ifndef EXCLUDE_MIDI ! snd_devfs_token[unit]= ! devfs_add_devswf(&snd_cdevsw, (unit << 4)+SND_DEV_MIDIN, ! DV_CHR, SND_UID, SND_GID, 0660, "midi%d", ! unit); #endif #ifndef EXCLUDE_AUDIO ! snd_devfs_token[unit]= ! devfs_add_devswf(&snd_cdevsw, (unit << 4)+SND_DEV_DSP, DV_CHR, ! SND_UID, SND_GID, 0660, "dsp%d", unit); ! snd_devfs_token[unit]= ! devfs_add_devswf(&snd_cdevsw, (unit << 4)+SND_DEV_AUDIO, ! DV_CHR, SND_UID, SND_GID, 0660, "audio%d", ! unit); ! snd_devfs_token[unit]= ! devfs_add_devswf(&snd_cdevsw, (unit << 4)+SND_DEV_DSP16, ! DV_CHR, SND_UID, SND_GID, 0660, "dspW%d", ! unit); ! #endif ! ! snd_devfs_token[unit]= ! devfs_add_devswf(&snd_cdevsw, (unit << 4)+SND_DEV_SNDPROC, ! DV_CHR, SND_UID, SND_GID, 0660, "pss%d", ! unit); ! ! if ( ! sndstat_devfs_token) { ! sndstat_devfs_token = ! devfs_add_devswf(&snd_cdevsw, 6, DV_CHR, SND_UID, SND_GID, ! 0660, "sndstat"); } #endif /* DEVFS */ return TRUE; --- 385,485 ---- #endif #ifdef DEVFS /* XXX */ /* should only create devices if that card has them */ #define SND_UID 0 ! #define SND_GID 0 ! if ( ! sndstat_devfs_token) ! { ! sndstat_devfs_token = ! devfs_add_devswf(&snd_cdevsw, SND_DEV_STATUS, DV_CHR, SND_UID, ! SND_GID, 0600, "sndstat"); ! } ! ! minor = (unit << 4)+SND_DEV_CTL; ! if ( ! snd_devfs_token[minor]) ! { ! snd_devfs_token[minor] = ! devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, SND_UID, ! SND_GID, 0600, "mixer%d", unit); ! if (unit == 0) ! devfs_link(snd_devfs_token[minor], "mixer"); ! } #ifndef EXCLUDE_SEQUENCER ! minor = (unit << 4)+SND_DEV_SEQ; ! if ( ! snd_devfs_token[minor]) ! { ! snd_devfs_token[minor] = ! devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, SND_UID, ! SND_GID, 0600, "sequencer%d", unit); ! if (unit == 0) ! devfs_link(snd_devfs_token[minor], "sequencer"); ! } ! ! minor = (unit << 4)+SND_DEV_SEQ2; ! if ( ! snd_devfs_token[minor]) ! { ! snd_devfs_token[minor] = ! devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, SND_UID, ! SND_GID, 0600, "music%d", unit); ! if (unit == 0) ! devfs_link(snd_devfs_token[minor], "music"); ! } #endif #ifndef EXCLUDE_MIDI ! minor = (unit << 4)+SND_DEV_MIDIN; ! if ( ! snd_devfs_token[minor]) ! { ! snd_devfs_token[minor] = ! devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, SND_UID, ! SND_GID, 0600, "midi%d", unit); ! if (unit == 0) ! devfs_link(snd_devfs_token[minor], "midi"); ! } #endif #ifndef EXCLUDE_AUDIO ! minor = (unit << 4)+SND_DEV_DSP; ! if ( ! snd_devfs_token[minor]) ! { ! snd_devfs_token[minor] = ! devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, SND_UID, ! SND_GID, 0600, "dsp%d", unit); ! if (unit == 0) ! devfs_link(snd_devfs_token[minor], "dsp"); ! } ! ! minor = (unit << 4)+SND_DEV_AUDIO; ! if ( ! snd_devfs_token[minor]) ! { ! snd_devfs_token[minor] = ! devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, SND_UID, ! SND_GID, 0600, "audio%d", unit); ! if (unit == 0) ! devfs_link(snd_devfs_token[minor], "audio"); ! } ! ! minor = (unit << 4)+SND_DEV_DSP16; ! if ( ! snd_devfs_token[minor]) ! { ! snd_devfs_token[minor] = ! devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, SND_UID, ! SND_GID, 0600, "dspW%d", unit); ! if (unit == 0) ! devfs_link(snd_devfs_token[minor], "dspW"); ! } ! #endif ! ! minor = (unit << 4)+SND_DEV_SNDPROC; ! if ( ! snd_devfs_token[minor]) ! { ! snd_devfs_token[minor] = ! devfs_add_devswf(&snd_cdevsw, minor, DV_CHR, SND_UID, ! SND_GID, 0600, "pss%d", unit); ! if (unit == 0) ! devfs_link(snd_devfs_token[minor], "pss"); } #endif /* DEVFS */ return TRUE;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.95.970111231457.262B-100000>