diff options
Diffstat (limited to 'misc')
77 files changed, 4676 insertions, 0 deletions
diff --git a/misc/.nomake b/misc/.nomake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/misc/.nomake diff --git a/misc/man1m/soundoff.man b/misc/man1m/soundoff.man new file mode 100644 index 0000000..c7b4cb5 --- /dev/null +++ b/misc/man1m/soundoff.man @@ -0,0 +1,36 @@ +NAME +soundoff - Stop Open Sound System + +DESCRIPTION + +The soundoff command can be used to stop Open Sound System and to unload the +kernel modules related with it. + +There are no command line arguments. Only the super user (root) can use this +command. + +Open Sound System can be loaded by executing the soundon command. + +SAVING THE MIXER AND CONTROL PANEL SETTINGS AUTOMATICALLY + +By default soundoff will save the current mixer and control panel settings +automatically each time soundoff is executed. The saved settings will be +restored automatically when soundon is executed next time. + +This automatic save feature can be disabled by editing /usr/lib/oss/etc/userdefs +and by changing the line containing "autosave_mixer yes" to +"autosave_mixer no". After this the mixer settings will only be saved when +the savemixer command is executed (by super user). + +FILES +/usr/lib/oss/etc/userdefs +/usr/sbin/soundoff +/usr/lib/oss/etc/installed_drivers. + +SEE ALSO +soundon(1) +ossdetect(1) +ossdevlinks(1) + +AUTHOR +4Front Technologies diff --git a/misc/man1m/soundon.man b/misc/man1m/soundon.man new file mode 100644 index 0000000..a0e138d --- /dev/null +++ b/misc/man1m/soundon.man @@ -0,0 +1,26 @@ +NAME +soundon - Start Open Sound System + +DESCRIPTION + +The soundon command is used to load the OSS core module (osscore) and the +low level drivers for the sound devices detected in ths system (by ossdetect). +The list of low level sound device drivers to load is located in +/usr/lib/oss/etc/installed_drivers which is maintained by the ossdetect command. + +There are no command line arguments. Only the super user (root) can use this +command. + +Open Sound System can be unloaded by executing the soundoff command. + +FILES +/usr/sbin/soundon +/usr/lib/oss/etc/installed_drivers. + +SEE ALSO +soundoff(1) +ossdetect(1) +ossdevlinks(1) + +AUTHOR +4Front Technologies diff --git a/misc/man7/dsp.man b/misc/man7/dsp.man new file mode 100644 index 0000000..c7f9dad --- /dev/null +++ b/misc/man7/dsp.man @@ -0,0 +1,66 @@ +NAME +dsp - Open Sound System audio devices + +DESCRIPTION +/dev/dsp is the default audio device in the system. It's connected to the +main speakers and the primary recording source (such as microphone). The system +administrator can set /dev/dsp to be a symbolic link to the desired default +device. The ossinfo utility can be used to list the available audio devices +in the system. + +/dev/dsp_mmap, /dev/dsp_ac3, /dev/dsp_multich and /dev/dsp_spdifout are +default audio devices for specific applications such as games or media (DVD) +players. + +DIRECT ACCESS AUDIO DEVICE FILES +OSS 4.0 (and later) will create audio devices under /dev/oss/<device> directory. +For example /dev/oss/sblive0/pcm0 is the first audio device that belongs to the +first Sound Blaster Live! or Audigy card in the system. These direct devices +are used when an application needs to access specific audio device (instead of +the default one). + +You can use the ossinfo(1) utility with the -a option to get a list of the +available audio devices in the system. + +LEGACY AUDIO DEVICE FILES +Traditionally OSS has created device files like /dev/dsp0 to /dev/dspN for +each audio device in the system. OSS 4.0 still supports this legacy naming. +These files are symbolic links to the actual device files located under +/dev/oss. The ossdevlinks(8) utility is used to manage these links and it +will be automatically invoked when OSS is started. + +COMPATIBILITY +o The /dev/dsp (default() audio device file will be supported by all OSS +implementations and versions. +o The special purpose audio default devices (such as /dev/dsp_mmap) are only +supported by OSS 4.0 and later. +o The legacy audio device files (such as /dev/dsp1) are supported by all OSS +versions and implementations. +o New style audio device files (under /dev/oss) are only supported by OSS 4.0 +and later. However some independent OSS implementations may only support +the legacy naming even they are otherwise OSS 4.0 compatible. +o /dev/dsp0 doesn't exist in all Linux systems which use /dev/dsp for the same +purpose. In such systems /dev/dsp points to the first audio device and +/dev/dsp1 to the second. + +PROGRAMMING INFORMATION +See the Audio Programming section of the OSS Programmer's Guide (DSP(2)) for +more info. + +OPTIONS +None + +FILES +o /dev/dsp Default audio device +o /dev/dsp_mmap Default audio device for applications using mmap(2) +o /dev/dsp_ac3 Default audio device for applications sending Dolby + Digital (AC3) audio to an external receiver. +o /dev/dsp_multich Default multichannel (4.0-7.1) audio output device +o /dev/dsp_spdifout Default digital audio (S/PDIF) output device +o /dev/oss/<driver>/pcmN Direct access device files for individual audio + devices. +o /dev/dsp0 to /dev/dspN Legacy style direct access audio device files. + +AUTHOR +4Front Technologies + diff --git a/misc/man7/midi.man b/misc/man7/midi.man new file mode 100644 index 0000000..8ea1eeb --- /dev/null +++ b/misc/man7/midi.man @@ -0,0 +1,20 @@ +NAME +midi - Open Sound System MIDI devices + +DESCRIPTION +MIDI support is not included in OSS 4.0. It will be introduced in the future OSS +versions. + +PROGRAMMING INFORMATION +See the OSS MIDI Programming section of the OSS Programmer's Guide (MIDI(2)) +for more info. + +OPTIONS +None + +FILES +/dev/midi is the default MIDI device file in the system. + +AUTHOR +4Front Technologies + diff --git a/misc/man7/mixer.man b/misc/man7/mixer.man new file mode 100644 index 0000000..c2f9849 --- /dev/null +++ b/misc/man7/mixer.man @@ -0,0 +1,20 @@ +NAME +mixer - Open Sound System mixer (control panel) device + +DESCRIPTION +Mixer devices are used by control panel and mixer programs (such as ossxmix(1)) +to change volumes and other settings of the sound cards in the system. + +PROGRAMMING INFORMATION +See the OSS Mixer Programming section of the OSS Programmer's Guide (MIXER(2)) +for more info. + +OPTIONS +None + +FILES +/dev/mixer is the default mixer device file in the system. + +AUTHOR +4Front Technologies + diff --git a/misc/man7/sndstat.man b/misc/man7/sndstat.man new file mode 100644 index 0000000..ab2789b --- /dev/null +++ b/misc/man7/sndstat.man @@ -0,0 +1,68 @@ +NAME +sndstat - Open Sound System status device + +DESCRIPTION +/dev/sndstat is a text formatted device special file that returns information +about available (OSS) sound devices. This device file is obsolete and the +ossinfo(1) utility should be used instead. + +Notice that the device numbering used in this file is different that the +official numbering used by ossinfo(1) and some other utilities. /dev/sndstat +uses device numbers that match the "legacy" /dev/dspN, /dev/midiN and +/dev/mixerN device files. + +Application programs should not use /dev/sndstat to obtain information about the +sound devices. The format of this file may change in the future and /dev/sndstat +may even be removed from OSS in distant future. OSS 4.0 and later has an +ioctl interface for getting detailed and reliable information about the +devices. + +AUDIO USAGE HISTORY + +/dev/sndstat reports some history information about previously run audio +applications. This section is a debugging aid for application developers and +it will be moved to the ossinfo program in the future. + +For example: + + History: + /dev/oss/hdaudio0/pcm0.10: pid 6326 cmd 'error_test' OUT Play events:01009:2 Rec events:01002:0 + /dev/oss/hdaudio0/pcm0.10: pid 6329 cmd 'mpg123' OUT + /dev/oss/hdaudio0/pcm0.10: pid 6329 cmd 'mpg123' OUT + /dev/oss/hdaudio0/pcm0.10: pid 6329 cmd 'mpg123' OUT + +Each line will show the the device name, PID and name of the application +(if known) and access mode (IN and/or OUT). There may also be additional +info about buffer underruns/overruns and other recording and playback +related events. + +Each Play and rec events consist of 5-6 digit event code and a parameter +separated by a colon. A list of defined event codes and their explanations +can be found from http://manuals.opensound.com/developer/oss_error_codes.html. +Purpose of these events is to inform application developers by potential +problems in their code. + +COMPATIBILITY +/dev/sndstat has been available in all OSS versions. However in OSS 4.0 and +later this device file should only be used by applications written for earlier +OSS versions. + +OPTIONS +None + +PROGRAMMING INFORMATION +Some applications use /dev/sndstat to find the audio devices available +in the system. This method is no longer recommended. Applications should use +the SNDCTL_AUDIOINFO(2) ioctl call to find the devices. + +SEE ALSO +o dsp(7) - Audio device files +o mixer(7) - Mixer (control panel) device files +o midi(7) - MIDI device files + +FILES +/dev/sndstat + +AUTHOR +4Front Technologies + diff --git a/misc/man9ossddk/TODO b/misc/man9ossddk/TODO new file mode 100644 index 0000000..d08e980 --- /dev/null +++ b/misc/man9ossddk/TODO @@ -0,0 +1,13 @@ +ossddk_create_stringlist.9ossddk # For rec/play src/target names + +ossddk_mixer_create_control.9ossddk +ossddk_mixer_set_strings.9ossddk +ossddk_mixer_touch.9ossddk +ossddk_mixer_truncate.9ossddk + +ossddk_ac97_install.9ossddk +ossddk_ac97_is_varrate.9ossddk +ossddk_ac97_remove.9ossddk +ossddk_ac97_set_ext_init.9ossddk +ossddk_ac97_set_playrate.9ossddk +ossddk_ac97_set_recrate.9ossddk diff --git a/misc/man9ossddk/ossddk_ac97_install.9ossddk b/misc/man9ossddk/ossddk_ac97_install.9ossddk new file mode 100644 index 0000000..0469fe7 --- /dev/null +++ b/misc/man9ossddk/ossddk_ac97_install.9ossddk @@ -0,0 +1,78 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_ac97_install 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_ac97_install \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_ac97_install(\fBac97_handle_t *\fI*ac97handle\fP, \fBchar *\fIname\fP, \fBac97_readfunc_t \fIreadfn\fP, \fBac97_writefunc_t \fIwritefn\fP, \fBvoid *\fIhostparms\fP, \fBoss_device_t * \fIosdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fI*ac97handle\fR +.in +16n +.rt +TODO *ac97handle +.in -16n +.sp +.ne 2 +.mk +\fB\fIname\fR +.in +16n +.rt +TODO name +.in -16n +.sp +.ne 2 +.mk +\fB\fIreadfn\fR +.in +16n +.rt +TODO readfn +.in -16n +.sp +.ne 2 +.mk +\fB\fIwritefn\fR +.in +16n +.rt +TODO writefn +.in -16n +.sp +.ne 2 +.mk +\fB\fIhostparms\fR +.in +16n +.rt +TODO hostparms +.in -16n +.sp +.ne 2 +.mk +\fB\fIosdev\fR +.in +16n +.rt +OSS device handle. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_ac97_is_varrate.9ossddk b/misc/man9ossddk/ossddk_ac97_is_varrate.9ossddk new file mode 100644 index 0000000..a6221d3 --- /dev/null +++ b/misc/man9ossddk/ossddk_ac97_is_varrate.9ossddk @@ -0,0 +1,38 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_ac97_is_varrate 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_ac97_is_varrate \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_ac97_is_varrate(\fBac97_handle_t * \fIac97handle\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIac97handle\fR +.in +16n +.rt +AC97 device handle returned by ossddk_ac97_install(9ossddk). +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_ac97_remove.9ossddk b/misc/man9ossddk/ossddk_ac97_remove.9ossddk new file mode 100644 index 0000000..8ca68c2 --- /dev/null +++ b/misc/man9ossddk/ossddk_ac97_remove.9ossddk @@ -0,0 +1,38 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_ac97_remove 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_ac97_remove \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_ac97_remove(\fBac97_handle_t * \fIac97handle\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIac97handle\fR +.in +16n +.rt +AC97 device handle returned by ossddk_ac97_install(9ossddk). +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_ac97_set_ext_init.9ossddk b/misc/man9ossddk/ossddk_ac97_set_ext_init.9ossddk new file mode 100644 index 0000000..a10a68c --- /dev/null +++ b/misc/man9ossddk/ossddk_ac97_set_ext_init.9ossddk @@ -0,0 +1,54 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_ac97_set_ext_init 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_ac97_set_ext_init \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_ac97_set_ext_init(\fBac97_handle_t * \fIac97handle\fP, \fBmixer_create_controls_t \fIfunc\fP, \fBint \fInextra\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIac97handle\fR +.in +16n +.rt +AC97 device handle returned by ossddk_ac97_install(9ossddk). +.in -16n +.sp +.ne 2 +.mk +\fB\fIfunc\fR +.in +16n +.rt +TODO func +.in -16n +.sp +.ne 2 +.mk +\fB\fInextra\fR +.in +16n +.rt +TODO nextra +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_ac97_set_playrate.9ossddk b/misc/man9ossddk/ossddk_ac97_set_playrate.9ossddk new file mode 100644 index 0000000..6db1bb5 --- /dev/null +++ b/misc/man9ossddk/ossddk_ac97_set_playrate.9ossddk @@ -0,0 +1,46 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_ac97_set_playrate 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_ac97_set_playrate \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_ac97_set_playrate(\fBac97_handle_t * \fIac97handle\fP, \fBint \fIsrate\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIac97handle\fR +.in +16n +.rt +AC97 device handle returned by ossddk_ac97_install(9ossddk). +.in -16n +.sp +.ne 2 +.mk +\fB\fIsrate\fR +.in +16n +.rt +Sampling rate in HZ. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_ac97_set_recrate.9ossddk b/misc/man9ossddk/ossddk_ac97_set_recrate.9ossddk new file mode 100644 index 0000000..af08710 --- /dev/null +++ b/misc/man9ossddk/ossddk_ac97_set_recrate.9ossddk @@ -0,0 +1,46 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_ac97_set_recrate 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_ac97_set_recrate \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_ac97_set_recrate(\fBac97_handle_t * \fIac97handle\fP, \fBint \fIsrate\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIac97handle\fR +.in +16n +.rt +AC97 device handle returned by ossddk_ac97_install(9ossddk). +.in -16n +.sp +.ne 2 +.mk +\fB\fIsrate\fR +.in +16n +.rt +Sampling rate in HZ. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_get_devc.9ossddk b/misc/man9ossddk/ossddk_adev_get_devc.9ossddk new file mode 100644 index 0000000..39abbf3 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_get_devc.9ossddk @@ -0,0 +1,47 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_get_devc 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_get_devc \- Returns the devc pointer for this audio device +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid*\fR ossddk_adev_get_devc(\fBint \fIdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS device number. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function returns the devc pointer used when creating this audio device using +ossddk_install_audiodev(9ossddk). +.PP +CAUTION! Extreme care must be taken in drivers that drive both mixer and audio +device files. Both types of devices have different functions for getting +the devc pointer. Drivers must use ossddk_adev_get_devc with audio device +numbers and ossddk_mixer_get_devc with mixer device numbers. +.PP +.SH "RETURN VALUES" +The devc pointer. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_get_dmapin.9ossddk b/misc/man9ossddk/ossddk_adev_get_dmapin.9ossddk new file mode 100644 index 0000000..80b5beb --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_get_dmapin.9ossddk @@ -0,0 +1,50 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_get_dmapin 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_get_dmapin \- Returns the input (recording) dmap handle +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBdmap_t*\fR ossddk_adev_get_dmapin(\fBint \fIdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This funmction returns the dmap handle used for recording with this device. The dmap +object contains recording and/or playback related parameters. Use the ossddk_dmap_get_* +and ossddk_dmap_set_* methods to access the fields of this object. +.PP +Note that the dmap objects are only valid when the device is open. There are separate +dmap objects for recording and playback directions if the device was created with +ADEV_DUPLEX. However with all other audio devices both dmaps may point to the +same actual dmap object. Unused dmap objects may be NULL too. Drivers should make +sure they access the right dmap object. +.PP +.SH "RETURN VALUES" +The dmap object or NULL if no dmap object is allocated. Getting NULL from this +call means that the driver did the call at wrong moment. Another possible reason is +that it tried to access wrong dmap object (input instead of output or vice versa). +.PP +.SH "SEE ALSO" +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_get_dmapout.9ossddk b/misc/man9ossddk/ossddk_adev_get_dmapout.9ossddk new file mode 100644 index 0000000..7ad9d2e --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_get_dmapout.9ossddk @@ -0,0 +1,51 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_get_dmapout 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_get_dmapout \- Returns the output (playback) dmap handle +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBdmap_t*\fR ossddk_adev_get_dmapout(\fBint \fIdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This funmction returns the dmap handle used for playback with this device. The dmap +object contains recording and/or playback related parameters. Use the ossddk_dmap_get_* +and ossddk_dmap_set_* methods to access the fields of this object. +.PP +Note that the dmap objects are only valid when the device is open. There are separate +dmap objects for recording and playback directions if the device was created with +ADEV_DUPLEX. However with all other audio devices both dmaps may point to the +same actual dmap object. Unused dmap objects may be NULL too. Drivers should make +sure they access the right dmap object. +.PP +.SH "RETURN VALUES" +The dmap object or NULL if no dmap object is allocated. Getting NULL from this +call means that the driver did the call at wrong moment. Another possible reason is +that it tried to access wrong dmap object (input instead of output or vice versa). +.PP +.SH "SEE ALSO" +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_get_label.9ossddk b/misc/man9ossddk/ossddk_adev_get_label.9ossddk new file mode 100644 index 0000000..30c3ce3 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_get_label.9ossddk @@ -0,0 +1,51 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_get_label 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_get_label \- Get stream label currently assigned to this device +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBchar*\fR ossddk_adev_get_label(\fBint \fIdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS ausio device number. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Stream labels are short (up to 15 character) mnemonic names that the \fIsource\fR of the +stream can set. The ossddk_adev_get_label function can be used by playback devices to +check if the application playing through the device has set it. For example a driver +for an audio tape recorder can use it as the reel name stored on the tape. Also some +digital audio links may have support for reel names or source names. Third possiblility +is that the label information is shown as the treck name on mixing consoles or other +kind of devices. +.PP +.SH "RETURN VALUES" +This function returns a pointer to the character string containing the label. Empty +string means there is no label assigned. The driver must not modify the string returned. +.PP +.SH "SEE ALSO" +.PP +\fIossddk_adev_set_label(9ossddk)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_get_portc.9ossddk b/misc/man9ossddk/ossddk_adev_get_portc.9ossddk new file mode 100644 index 0000000..e8d3034 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_get_portc.9ossddk @@ -0,0 +1,66 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_get_portc 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_get_portc, ossddk_adev_get_portc_play, ossddk_adev_get_portc_record, ossddk_adev_set_portc, ossddk_adev_set_portc_play, ossddk_adev_set_portc_record \- Get/set the portc pointers of an audio device +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid*\fR ossddk_adev_get_portc(\fBint \fIdev\fP); +.LP +\fBvoid*\fR ossddk_adev_get_portc_play(\fBint \fIdev\fP); +.LP +\fBvoid*\fR ossddk_adev_get_portc_record(\fBint \fIdev\fP); +.LP +\fBvoid\fR ossddk_adev_set_portc(\fBint \fIdev\fP, \fBvoid *\fIportc\fP); +.LP +\fBvoid\fR ossddk_adev_set_portc_play(\fBint \fIdev\fP, \fBvoid *\fIportc\fP); +.LP +\fBvoid\fR ossddk_adev_set_portc_record(\fBint \fIdev\fP, \fBvoid *\fIportc\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIportc\fR +.in +16n +.rt +Pointer to the portc structure created by the driver. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +OSS audio drivers can have three per-audiodevice pointers that the low level +driver can use as it likes. Most drivers use only the common portc structure. However +spme drivers may need to use separate portc structures for recording and playback. +.PP +The driver allocates the port structures when initializing the device and registers them +after installing the audio device. Later the driver can obtain the portc pointer(s) from +OSS. +.PP +.SH "RETURN VALUES" +The get functions return the portc pointer or NULL if no portc pointer has been set. +There are no error returns. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_get_portc_play.9ossddk b/misc/man9ossddk/ossddk_adev_get_portc_play.9ossddk new file mode 100644 index 0000000..b7ae55c --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_get_portc_play.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_adev_get_portc.9ossddk diff --git a/misc/man9ossddk/ossddk_adev_get_portc_record.9ossddk b/misc/man9ossddk/ossddk_adev_get_portc_record.9ossddk new file mode 100644 index 0000000..b7ae55c --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_get_portc_record.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_adev_get_portc.9ossddk diff --git a/misc/man9ossddk/ossddk_adev_get_songname.9ossddk b/misc/man9ossddk/ossddk_adev_get_songname.9ossddk new file mode 100644 index 0000000..191290a --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_get_songname.9ossddk @@ -0,0 +1,49 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_get_songname 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_get_songname \- Get the song name assigned to an audio stream +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBchar*\fR ossddk_adev_get_songname(\fBint \fIdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Song name is free formatted string describing the content of the audio stream. Source +of the stream (for example the application playing to the device) can assign the name. +The driver can obtain this string and forward it to the device. For example if the +device has a LCD display the driver can show the song name in it. +.PP +.SH "RETURN VALUES" +This function returns a pointer to a string containing 0 to 63 characters. An empty +string means there is no song name assigned to the stream. The driver must not +modify the string. +.PP +.SH "SEE ALSO" +.PP +\fIossddk_adev_set_songname(9ossddk)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_buflimits.9ossddk b/misc/man9ossddk/ossddk_adev_set_buflimits.9ossddk new file mode 100644 index 0000000..408d6cb --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_buflimits.9ossddk @@ -0,0 +1,76 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_buflimits 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_buflimits \- Set fragment size constraints +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_buflimits(\fBint \fIdev\fP, \fBint \fImin_fragment\fP, \fBint \fImax_fragment\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fImin_fragment\fR +.in +16n +.rt +Minimum fragment size (in bytes) supported by the device. Value of 0 means no limit. +.in -16n +.sp +.ne 2 +.mk +\fB\fImax_fragment\fR +.in +16n +.rt +Maximum fragment size (in bytes) supported by the device. Value of 0 means no limit. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Fragment size of an audio stream is the number of bytes (not samples) to be played +or recorded between interrupts genererated by the device. In other words the device +will generate an interrupt exactly at the fragment boundaries. The audio core of OSS +will select the fragment size. However if the device has any size restrictions it can +inform the audio core about them. In most cases there are no restrictions and the driver +should not call this function at all. +The minimum fragment size must be smaller or equal to the maximum. +.PP +For example many devices can not support fragment sizes larger than one 4k page. In +this case the driver can call \fIossddk_adev_set_buflimits(device_num, 0, 4096)\fR. +.PP +This function can be called immediately after installing the audio device using +\fIossddk_install_audiodev(9ossddk)\fR. Alternatively it can be called in driver's open, +set_speed, set_channels and/or set_format entry points. If the latter method is used +then the open entry point must restore the default value. +.PP +Changing the fragment size limits when (or after) the prepare_for_output/prepare_for_input +entry point is called doesn't have any effect. If the fragment size depends on the +sampling rate or the other parameters then the set_speed, set_channels and set_format +driver entgry points must update the fragment size limits depending on the situation. +.PP +The limits should preferably be powers of 2 but this is not an absolute requirement. +Both limits can be the same if the device supports fixed fragment size. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_caps.9ossddk b/misc/man9ossddk/ossddk_adev_set_caps.9ossddk new file mode 100644 index 0000000..5ac92c2 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_caps.9ossddk @@ -0,0 +1,56 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_caps 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_caps \- Set device capabilities +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_caps(\fBint \fIdev\fP, \fBunsigned int \fIcaps\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIcaps\fR +.in +16n +.rt +A bit mask containing the device capabilities. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function sets the initial values for the device capabilities to be returned by +\fISNDCTL_AUDIOINFO(2oss)\fR ioctl call. While most of the capability bits will be +set automatically by the OSS audio core the driver can set some of them itself. +At this moment the driver can only set the preferred channel configuration +(DSP_CH_ANY, DSP_CH_MONO, DSP_CH_STEREO or DSP_CH_MULTI). Other capability +bits should not be set. +.PP +The driver can call this function whenever it wants. +.PP +.SH "SEE ALSO" +.PP +\fISNDCTL_AUDIOINFO(2oss)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_channels.9ossddk b/misc/man9ossddk/ossddk_adev_set_channels.9ossddk new file mode 100644 index 0000000..fb1cf57 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_channels.9ossddk @@ -0,0 +1,63 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_channels 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_channels \- Set the supported channel configuration +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_channels(\fBint \fIdev\fP, \fBint \fImin_channels\fP, \fBint \fImax_channels\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fImin_channels\fR +.in +16n +.rt +Minimum number of channels (should be at least 1). +.in -16n +.sp +.ne 2 +.mk +\fB\fImax_channels\fR +.in +16n +.rt +Maximum number of channels supported. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function sets meta information that can be read using the \fISNDCTL_AUDIOINFO(2oss)\fR ioctl call. It is recommended that the driver calls this function after installing +the audio device. +.PP +This call sets only the bounds to the number of channels supported by the device. It's +possible that the device doesn't support all possible channel configurations between +these limits. For example it may support 2 and 8 channels but not anything between +them. This is OK and the driver developer should not worry about this. +.PP +.SH "SEE ALSO" +.PP +\fISNDCTL_AUDIOINFO(2oss)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_devc.9ossddk b/misc/man9ossddk/ossddk_adev_set_devc.9ossddk new file mode 100644 index 0000000..5daa7ae --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_devc.9ossddk @@ -0,0 +1,50 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_devc 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_devc \- Set the devc pointer of an audio device +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_devc(\fBint \fIdev\fP, \fBvoid *\fIdevc\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIdevc\fR +.in +16n +.rt +Pointer to driver defined device instance data. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +The devc pointer of an audio device points to the data structure where the driver +stores it's per-card information. The driver can store a pointer to this structure +in the audio device and obtain it later in the callback functions. +Usually the driver sets the devc pointer when calling ossddk_install_audiodev. However +it is possible to change this pointer later with this function. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_enable_flag.9ossddk b/misc/man9ossddk/ossddk_adev_set_enable_flag.9ossddk new file mode 100644 index 0000000..1c72fe6 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_enable_flag.9ossddk @@ -0,0 +1,52 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_enable_flag 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_enable_flag \- Set or reset the device enabled flag. +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_enable_flag(\fBint \fIdev\fP, \fBint \fIstate\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIstate\fR +.in +16n +.rt +Device enabled flag (1=available and 0=unavailable). +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Drivers for hot pluggable/unpluggable devices (such as USB or Firewire) can set this +flag at the moment when the device gets unplugged and turn it of when it becomes +available again. By defalt the device is available. Drivers for noh-pluggable devices +(PCI, ISA) must not care about this flag. +.PP +This information is used to prevent OSS from opening a device when it's not present. However this doesn't guarantee that no driver calls are made. The driver must check itself +if the device is really present before doing any operations. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_formats.9ossddk b/misc/man9ossddk/ossddk_adev_set_formats.9ossddk new file mode 100644 index 0000000..4e4cafa --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_formats.9ossddk @@ -0,0 +1,67 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_formats 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_formats \- report the supported sample formats +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_formats(\fBint \fIdev\fP, \fBunsigned int \fIoformats\fP, \fBunsigned int \fIiformats\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIoformats\fR +.in +16n +.rt +Bit mask containing the formats the device supports in playback direction. +.in -16n +.sp +.ne 2 +.mk +\fB\fIiformats\fR +.in +16n +.rt +Bit mask containing the formats the device supports in recording direction. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Applications using audio can ask what formats the device supports using various +ioctl calls. The driver must provide this information. Usually it sets the format mask +when installing the device using \fIossddk_install_audiodev(9ossddk)\fR. However it +may be necessary to change this information later if a change in device's mode of +operation also changes the formats it currently supports. Another situation when +this function should be called is when the device supports different formats +for recording and playback. +.PP +.SH "SEE ALSO" +.PP +\fISNDCTL_AUDIOINFO(2oss)\fR +.LP +\fISNDCTL_DSP_GETFMTS(2oss)\fR +.LP +\fISNDCTL_DSP_SETFMT(2oss)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_label.9ossddk b/misc/man9ossddk/ossddk_adev_set_label.9ossddk new file mode 100644 index 0000000..a939ac9 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_label.9ossddk @@ -0,0 +1,63 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_label 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_label \- Assign a label to an audio stream +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_label(\fBint \fIdev\fP, \fBchar *\fIlabel\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIlabel\fR +.in +16n +.rt +A pointer to a character string containing 0 to 15 characters. An empty string +means there is no label. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Stream labels are short (up to 15 character) mnemonic names that the \fIsource\fR of the +stream can set. ossddk_adev_set_label assigns a label to an audio stream. The driver +can set the label to an recording stream when this information is available from the +device. For example a driver for a tape recorder or a digital audio link may obtain +the reel name from the device and pass it to the application recording from the +device. Setting the label of an output stream doesn't make any sense. +.PP +It's very important that drivers set the label only if that information is really +available from the device. It doesn't make any sense to assign any kind of dummy labels +such as "Unknown" or "default". +.PP +The driver must not expect that \fIossddk_adev_get_label\fR returns the same label +that the driver had previously set with \fIossddk_adev_set_label\fR. This is +certainly not the case. +.PP +.SH "SEE ALSO" +.PP +\fIossddk_adev_get_label(9ossddk)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_magic.9ossddk b/misc/man9ossddk/ossddk_adev_set_magic.9ossddk new file mode 100644 index 0000000..cecd5c5 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_magic.9ossddk @@ -0,0 +1,57 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_magic 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_magic \- Set the device magic number +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_magic(\fBint \fIdev\fP, \fBint \fImagic\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fImagic\fR +.in +16n +.rt +The magic number. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Some devices may require use of dedicated configuration or setup tools. In such cases +the driver must provide some kind of magic number which the utilities can use +to find out the right device (using \fISNDCTL_AUDIOINFO(2oss)\fR). +.PP +If an magic number is needed for some device driver you must contact support@opensound.com to get a free number. Drivers developers must not use self geterated magic numbers +because they may conflict with other devices. +.PP +Using device specific utilities is not recommended but that method can be used if there +is no other choice. +.PP +.SH "SEE ALSO" +.PP +\fISNDCTL_AUDIOINFO(2oss)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_mixer.9ossddk b/misc/man9ossddk/ossddk_adev_set_mixer.9ossddk new file mode 100644 index 0000000..44373e1 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_mixer.9ossddk @@ -0,0 +1,54 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_mixer 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_mixer \- Set the mixer device related with an audio device +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_mixer(\fBint \fIdev\fP, \fBint \fImixer_dev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS ausio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fImixer_dev\fR +.in +16n +.rt +Mixer device number of the mixer related with this audio device. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Some audio applications want to perform certain mixer operations. Audio drivers can +use this functuon to assign the right mixer device to an audio device. +.PP +Older audio applications written for previous OSS versions still use the mixer interface +to do certain operations such as playback/recording volume control or recording +source selection. OSS 4.0 and later has some new aidio ioctl calls such as +SNDCTL_DSP_SETRECVOL and SNDCTL_DSP_GETRECVOL which do the same more reliably. +New audio drivers should implement these functions in their ioctl entry points. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_portc.9ossddk b/misc/man9ossddk/ossddk_adev_set_portc.9ossddk new file mode 100644 index 0000000..b7ae55c --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_portc.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_adev_get_portc.9ossddk diff --git a/misc/man9ossddk/ossddk_adev_set_portc_play.9ossddk b/misc/man9ossddk/ossddk_adev_set_portc_play.9ossddk new file mode 100644 index 0000000..b7ae55c --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_portc_play.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_adev_get_portc.9ossddk diff --git a/misc/man9ossddk/ossddk_adev_set_portc_record.9ossddk b/misc/man9ossddk/ossddk_adev_set_portc_record.9ossddk new file mode 100644 index 0000000..b7ae55c --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_portc_record.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_adev_get_portc.9ossddk diff --git a/misc/man9ossddk/ossddk_adev_set_portnum.9ossddk b/misc/man9ossddk/ossddk_adev_set_portnum.9ossddk new file mode 100644 index 0000000..33e5c68 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_portnum.9ossddk @@ -0,0 +1,48 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_portnum 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_portnum \- Set the audio port number within a device +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_portnum(\fBint \fIdev\fP, \fBint \fIportnum\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIportnum\fR +.in +16n +.rt +Audio port number (0 to N). +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Some sound cards may have multiple audio devices. In such cases the driver should +call this function to set the port number. Port number 0 is the first port and so on. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_rates.9ossddk b/misc/man9ossddk/ossddk_adev_set_rates.9ossddk new file mode 100644 index 0000000..a24d8a1 --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_rates.9ossddk @@ -0,0 +1,87 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_rates 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_rates \- Set the supported sampling rates +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_rates(\fBint \fIdev\fP, \fBint \fImin_rate\fP, \fBint \fImax_rate\fP, \fBint \fInrates\fP, \fBint \fIrates[20]\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fImin_rate\fR +.in +16n +.rt +The minimum sampling rate supported by the device. +.in -16n +.sp +.ne 2 +.mk +\fB\fImax_rate\fR +.in +16n +.rt +The maximum sampling rate supported by the device. +.in -16n +.sp +.ne 2 +.mk +\fB\fInrates\fR +.in +16n +.rt +Number of discrete rates (0 to 20). +.in -16n +.sp +.ne 2 +.mk +\fB\fIrates[20]\fR +.in +16n +.rt +Pointer to an array containing up to 20 sampling rates (in ascending order). +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function sets meta information that applications may obtain using the +\fISNDCTL_AUDIOINFO(2oss)\fR ioctl call. There are three ways how this function can be +called. In both cases the min_rate and max_rate parameters must be set properly. +.PP +1) If the device supports any rates between the minimum and maximum the nrates parameter +must be set to 0. The rates parameter can be null. +.LP +2) If the device supports just few rates (up to 20) you should pass the number of +supported rates in \fInrates\fR and pointer to an array (of int) in the \fIrates\fR +parameter. Rates stoored in the array must be in increasing order. +.LP +3) If there are more than 20 possible rates you should set nrates=0 and rates=NULL. +.PP +The driver can change the supported rate information whenever necessary. For example if +a change in device's operating mode changes the supported rates too. +.PP +.SH "SEE ALSO" +.PP +\fISNDCTL_AUDIOINFO(2oss)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_ratesource.9ossddk b/misc/man9ossddk/ossddk_adev_set_ratesource.9ossddk new file mode 100644 index 0000000..d12bb8b --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_ratesource.9ossddk @@ -0,0 +1,71 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_ratesource 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_ratesource \- Sets the rate source +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_ratesource(\fBint \fIdev\fP, \fBint \fIrate_source\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIrate_source\fR +.in +16n +.rt +Audio device number of the rate source. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +In some cases the sampling rate of an audio device is locked with some other device. +This information may be usefull to some applications that support multiple +simultaneous devices. Knowing that the devices are rate locked together makes it +possible to bypass any synchronization mechanisms that are normally required. +.PP +The driver can set this parameter in the followinng cases: +.PP +1) The device is a virtual device that works on top of some other (real) device. +In that case the master device should be reported as the rate source. +.LP +2) If a sound card has multiple audio engines (recording or playback) then the +subsequent ones should report the first one as their rate source. However this should +only be done if all the engines use the same sample rate clock. +.LP +3) There may be multiple devices (cards) of the same type which are connected together +using some kind of sync cable. If the driver knows this it can use the first audio device +of the first card (or the mown master card) as the rate source for the other audio devices. +.PP +Sometimes several cards of different type may be syncronized together using +word clock or some other methods. In such cases the drivers should not try to +set the rate sources based on that. This situation will be handled by the upper +layers of OSS (in some future OSS versions). + +.PP +.SH "SEE ALSO" +.PP +\fISNDCTL_AUDIOINFO(2oss)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_adev_set_songname.9ossddk b/misc/man9ossddk/ossddk_adev_set_songname.9ossddk new file mode 100644 index 0000000..842f4cb --- /dev/null +++ b/misc/man9ossddk/ossddk_adev_set_songname.9ossddk @@ -0,0 +1,60 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_adev_set_songname 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_adev_set_songname \- Assign song name to an audio stream +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_adev_set_songname(\fBint \fIdev\fP, \fBchar *\fIsong\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIsong\fR +.in +16n +.rt +Pointer to a string containing 0 to 63 characters. An empty string means that +there is no song name information available. The string should only contain printable +(8 bit ISO-8859-x) characters. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Song name is free formatted string describing the content of the audio stream. Source +of the stream (for example the driver of an input device) can assign the name. The +application recording from the device can obtain the name using +\fISNDCTL_AUDIOINFO(2oss)\fR. For example a driver of an RDS radio receiver can +obtain the song name from the RDS information sent by the radio station. +.PP +The song name string can contain any other information about the stream if the song +name is not available. However the driver must not send this info unless it has some +information that is really important. In general the song name should NOT be something +generated automatically by the driver. +.PP +.SH "SEE ALSO" +.PP +\fIossddk_adev_get_songname(9ossddk)\fR +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_audio_inputintr.9ossddk b/misc/man9ossddk/ossddk_audio_inputintr.9ossddk new file mode 100644 index 0000000..a91adc3 --- /dev/null +++ b/misc/man9ossddk/ossddk_audio_inputintr.9ossddk @@ -0,0 +1,48 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_audio_inputintr 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_audio_inputintr \- Recording interrupt callback +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_audio_inputintr(\fBint \fIdev\fP, \fBint \fIintr_flags\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIintr_flags\fR +.in +16n +.rt +Currently not used. Should always be set to 0. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function should be called by the interrupt handler of an audio driver on fragment +boundaries (for a recording device). The OSS audio core will the update it's internal +pointers and wake up the application if necessary. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_audio_outputintr.9ossddk b/misc/man9ossddk/ossddk_audio_outputintr.9ossddk new file mode 100644 index 0000000..ac892e1 --- /dev/null +++ b/misc/man9ossddk/ossddk_audio_outputintr.9ossddk @@ -0,0 +1,48 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_audio_outputintr 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_audio_outputintr \- Audio output interrupt callback +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_audio_outputintr(\fBint \fIdev\fP, \fBint \fIintr_flags\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS audio device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIintr_flags\fR +.in +16n +.rt +Currently not used. Should always be set to 0. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function should be called by the interrupt handler of an audio driver on fragment +boundaries (for a playback device). The OSS audio core will the update it's internal +pointers and wake up the application if necessary. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_disable_device.9ossddk b/misc/man9ossddk/ossddk_disable_device.9ossddk new file mode 100644 index 0000000..ea2bde6 --- /dev/null +++ b/misc/man9ossddk/ossddk_disable_device.9ossddk @@ -0,0 +1,45 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_disable_device 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_disable_device \- Disables the device if possible prior unloading the driver +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_disable_device(\fBoss_device_t *\fIosdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIosdev\fR +.in +16n +.rt +OSS device handle. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Drivers should call \fIossddk_disable_device\fR function in the beginning of their +detach routine. This function checks if the driver can be safely unloaded and prevents +OSS from accessing the driver any more. +.PP +.SH "RETURN VALUES" +This function returns a negative value (-errno) if the device cannot be disabled at +this moment. In this case the driver should refuse to detach. Value of 0 means that +the device was successfully disabled and the driver can proceed the detach operation. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_get_buffsize.9ossddk b/misc/man9ossddk/ossddk_dmap_get_buffsize.9ossddk new file mode 100644 index 0000000..e943985 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_buffsize.9ossddk @@ -0,0 +1,61 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_set_buffsize 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_get_buffsize, ossddk_dmap_set_buffsize \- Get/set the DMA buffer size +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_dmap_get_buffsize(\fBdmap_t *\fIdmap\fP); +\fBvoid\fR ossddk_dmap_set_buffsize(\fBdmap_t *\fIdmap\fP, \fBint \fIsize\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.sp +.ne 2 +.mk +\fB\fIsize\fR +.in +16n +.rt +Buffer size in bytes. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +If the deriver allocates the DMA buffer itself it can set the buffer size +by calling \fIossddk_dmap_set_buffsize\fR. However if the buffer is allocated +by OSS (the driver has no alloc_buffer/free_buffer entry points) the size +will be set automatically by OSS. +.PP +The \fIossddk_dmap_get_buffsize\fR function can be used to get the size of +the allocated DMA buffer. However drivers rarely have any use of this, Instead +they should use \fIossddk_dmap_get_buffused\fR which returns the number of bytes +of the buffer that are actually in use. +.PP +.SH "RETURN VALUES" +The \fIossddk_dmap_get_buffsize\fR function returns the size of the audio +buffer (in bytes). Value of 0 will be returned if no buffer is allocated for +this dmap. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_get_buffused.9ossddk b/misc/man9ossddk/ossddk_dmap_get_buffused.9ossddk new file mode 100644 index 0000000..d33001c --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_buffused.9ossddk @@ -0,0 +1,46 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_get_buffused 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_get_buffused \- Returns the size of buffer that is actually in use +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_dmap_get_buffused(\fBdmap_t *\fIdmap\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +OSS audio devices have a DMA buffer with the maximum size returned by +\fIossddk_dmap_get_buffsize\fR. However in most cases just part of the available +buffer is actually in use. The driver can call \fIossddk_dmap_get_buffused\fR +to find out the transfer count to be programmed in the device registers. +.PP +.SH "RETURN VALUES" +Amount of buffer currently in use (in bytes). This value equals to +fragment_size*num_fragments. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_get_dmabuf.9ossddk b/misc/man9ossddk/ossddk_dmap_get_dmabuf.9ossddk new file mode 100644 index 0000000..bb0ac54 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_dmabuf.9ossddk @@ -0,0 +1,46 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_get_dmabuf 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_get_dmabuf \- Get (kernel) address of the DMA buffer +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBunsigned char*\fR ossddk_dmap_get_dmabuf(\fBdmap_t *\fIdmap\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function returns the kernel virtual address of the DMA buffer allocated +for this dmap, However in most drivers this value has no use. Instead they +should use \fIossddk_dmap_set_phys(9ossddk)\fR to get the memory/bus address +of the buffer. +.PP +.SH "RETURN VALUES" +Kernel virtual address of the DMA buffer (first byte) or NULL if no buffer +is currently allocated. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_get_fragsize.9ossddk b/misc/man9ossddk/ossddk_dmap_get_fragsize.9ossddk new file mode 100644 index 0000000..1096b9d --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_fragsize.9ossddk @@ -0,0 +1,77 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_get_fragsize 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_get_fragsize, ossddk_dmap_set_fragsize, ossddk_dmap_get_numfrags, ossddk_dmap_set_numfrags \- Set/get DMA buffer partitioning parameters +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_dmap_get_fragsize(\fBdmap_t *\fIdmap\fP); +\fBint\fR ossddk_dmap_get_numfrags(\fBdmap_t *\fIdmap\fP); +\fBvoid\fR ossddk_dmap_set_fragsize(\fBdmap_t *\fIdmap\fP, \fBint \fIsize\fP); +\fBvoid\fR ossddk_dmap_set_numfrags(\fBdmap_t *\fIdmap\fP, \fBint \fInfrags\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.sp +.ne 2 +.mk +\fB\fInfrags\fR +.in +16n +.rt +Number of fragments. +.in -16n +.sp +.ne 2 +.mk +\fB\fIsize\fR +.in +16n +.rt +Fragment size in bytes. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +The DMA buffer maintained by OSS audio core is divided to number of fragments +with equal size. The driver should program the device to raice an interrupt +on every fragment boundary. The driver can get the fragment size (in bytes) by +calling \fIossddk_dmap_get_fragsize\fR. If the number of fragments is needed it +can be obtained with \fIossddk_dmap_get_numfrags\fR. +.PP +It is also possible to set these parameters but it should be avoided if +possible. Changing these parameters may cause unpredictable problems and is +bot supported by 4Front Technologies. If the driver changes these parameters it must ensure that fragment_size*num_fragments doesn't (even temporarily) become +larger than the total size of the allocated buffer. Otherwise the result will be +something else than what was intended by the driver. These parameters can only +be changed in the prepare_for_input and prepare_for_output methods of the +driver. As a side effect the value returned by \fIossddk_dmap_get_buffused(9ossddk)\fR will also get changed automatically. An undesired side effect is that +the fragment size possibly reported to the application will no longer be valid +which probably breaks some incorrectly designed applications. +.PP +.SH "RETURN VALUES" +\fIossddk_dmap_get_fragsize\fR returns the current fragment size in bytes. +.LP +\fIossddk_dmap_get_numfrags\fR returns the number of fragments currently in use. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_get_numfrags.9ossddk b/misc/man9ossddk/ossddk_dmap_get_numfrags.9ossddk new file mode 100644 index 0000000..ba2979a --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_numfrags.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_dmap_get_fragsize.9ossddk diff --git a/misc/man9ossddk/ossddk_dmap_get_phys.9ossddk b/misc/man9ossddk/ossddk_dmap_get_phys.9ossddk new file mode 100644 index 0000000..3862d28 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_phys.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_dmap_set_phys.9ossddk diff --git a/misc/man9ossddk/ossddk_dmap_get_private.9ossddk b/misc/man9ossddk/ossddk_dmap_get_private.9ossddk new file mode 100644 index 0000000..2be70fc --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_private.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_dmap_set_private.9ossddk diff --git a/misc/man9ossddk/ossddk_dmap_get_qhead.9ossddk b/misc/man9ossddk/ossddk_dmap_get_qhead.9ossddk new file mode 100644 index 0000000..93a8271 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_qhead.9ossddk @@ -0,0 +1,50 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_get_qhead 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_get_qhead, ossddk_dmap_get_qtail \- Return the DMA buffer head/tail fragment numbers. +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_dmap_get_qhead(\fBdmap_t *\fIdmap\fP); +\fBint\fR ossddk_dmap_get_qtail(\fBdmap_t *\fIdmap\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Some drivers need to know which fragment it should copy to/from the device. +The \fIossddk_dmap_get_qhead\fR function can be used to get the current +fragment number during playback. The \fIossddk_dmap_get_qtail\fR function +returns the current fragment the device is expected to fill in next during +recording. The fragment number will be in range 0 to num_fragments-1. +.PP +Pointer to the current fragment can be computed using formula +\fptr =d mabuf_address + Ifragment_number*fragment_size\fR. +.PP +.SH "RETURN VALUES" +These functions return the current fragment number. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_get_qtail.9ossddk b/misc/man9ossddk/ossddk_dmap_get_qtail.9ossddk new file mode 100644 index 0000000..8934eb3 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_get_qtail.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_dmap_get_qhead.9ossddk diff --git a/misc/man9ossddk/ossddk_dmap_set_buffsize.9ossddk b/misc/man9ossddk/ossddk_dmap_set_buffsize.9ossddk new file mode 100644 index 0000000..8e684dc --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_buffsize.9ossddk @@ -0,0 +1 @@ +.so ossddk_dmap_get_buffsize.9ossddk diff --git a/misc/man9ossddk/ossddk_dmap_set_callback.9ossddk b/misc/man9ossddk/ossddk_dmap_set_callback.9ossddk new file mode 100644 index 0000000..729d7f7 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_callback.9ossddk @@ -0,0 +1,56 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_set_callback 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_set_callback \- Reserved for future use +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_dmap_set_callback(\fBdmap_t *\fIdmap\fP, \fBoss_audio_callback_t \fIcb\fP, \fBint \fIarg\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.sp +.ne 2 +.mk +\fB\fIcb\fR +.in +16n +.rt +TODO cb +.in -16n +.sp +.ne 2 +.mk +\fB\fIarg\fR +.in +16n +.rt +TODO arg +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function is reserved for future use. Normal OSS DDK drivers should not use +it. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_set_dmabuf.9ossddk b/misc/man9ossddk/ossddk_dmap_set_dmabuf.9ossddk new file mode 100644 index 0000000..94c0259 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_dmabuf.9ossddk @@ -0,0 +1,56 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_set_dmabuf 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_set_dmabuf \- Set the DMA buffer virtual address +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_dmap_set_dmabuf(\fBdmap_t *\fIdmap\fP, \fBunsigned char *\fIbuf\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.sp +.ne 2 +.mk +\fB\fIbuf\fR +.in +16n +.rt +Kernel virtual address of the DMA buffer. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +If an audio driver manages the DMA buffer itself (it has the alloc_buffer and +free_buffer methods in it's callback table) it can set the DMA buffer address +using \fIossddk_dmap_set_dmabuf\fR. The buffer size can be set using +\fIossddk_dmap_set_buffsize(9ossddk)\fR. +.PP +In addition to the virtual address the driver should usually set the physical +memory/bus address too using \fIossddk_dmap_set_phys(9ossddk)\fR. +.PP +.SH "SEE ALSO" +.PP +\fIossddk_dmap_set_phys(9ossddk)\fR. +\fIossddk_dmap_set_buffsize(9ossddk)\fR. +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_set_fragsize.9ossddk b/misc/man9ossddk/ossddk_dmap_set_fragsize.9ossddk new file mode 100644 index 0000000..ba2979a --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_fragsize.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_dmap_get_fragsize.9ossddk diff --git a/misc/man9ossddk/ossddk_dmap_set_numfrags.9ossddk b/misc/man9ossddk/ossddk_dmap_set_numfrags.9ossddk new file mode 100644 index 0000000..ba2979a --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_numfrags.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_dmap_get_fragsize.9ossddk diff --git a/misc/man9ossddk/ossddk_dmap_set_phys.9ossddk b/misc/man9ossddk/ossddk_dmap_set_phys.9ossddk new file mode 100644 index 0000000..10ed701 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_phys.9ossddk @@ -0,0 +1,61 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_set_phys 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_set_phys, ossddk_dmap_get_phys \- Set/get the physical address of the DMA buffer. +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_dmap_set_phys(\fBdmap_t *\fIdmap\fP, \fBunsigned long \fIaddr\fP); +\fBunsigned long\fR ossddk_dmap_get_phys(\fBdmap_t *\fIdmap\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.sp +.ne 2 +.mk +\fB\fIaddr\fR +.in +16n +.rt +The physical memory/bus address of the DMA buffer (byte 0). +.in -16n +.PP +.SH "DESCRIPTION" +.PP +The buffer physical address is the +address to be written to device's DMA pointer register. While the driver can +manage this information locally it's possible that OSS core needs it also +for some purposes (such as mmaping the buffer to user's address space under +some operating systems). +.PP +The driver doesn't need to set this physical address if the buffer is +not mapped to the physical memory/bus address space. +.PP +.SH "RETURN VALUES" +\fIossddk_dmap_get_phys\fR returns the physical address as set by the driver +or 0 if no physical address is set. +.PP +.SH "SEE ALSO" +.PP +\fIossddk_dmap_set_dmabuf(9ossddk)\fR. +.LP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_set_playerror.9ossddk b/misc/man9ossddk/ossddk_dmap_set_playerror.9ossddk new file mode 100644 index 0000000..e6cd185 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_playerror.9ossddk @@ -0,0 +1,54 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_set_playerror 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_set_playerror \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_dmap_set_playerror(\fBdmap_t *\fIdmap\fP, \fBint \fIerr\fP, \fBint \fIparm\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.sp +.ne 2 +.mk +\fB\fIerr\fR +.in +16n +.rt +TODO err +.in -16n +.sp +.ne 2 +.mk +\fB\fIparm\fR +.in +16n +.rt +TODO parm +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_set_private.9ossddk b/misc/man9ossddk/ossddk_dmap_set_private.9ossddk new file mode 100644 index 0000000..3e62cb1 --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_private.9ossddk @@ -0,0 +1,53 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_dmap_set_private 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_dmap_set_private, ossddk_dmap_get_private, ossddk_dmap_set_playerror, ossddk_dmap_set_recerror, ossddk_dmap_set_callback \- Misc helper functions +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_dmap_set_private(\fBdmap_t *\fIdmap\fP, \fBvoid *\fIptr\fP); +\fBvoid*\fR ossddk_dmap_get_private(\fBdmap_t *\fIdmap\fP); +\fBvoid\fR ossddk_dmap_set_playerror(\fBdmap_t *\fIdmap\fP, \fBint \fIerr\fP, \fBint \fIparm\fP); +\fBvoid\fR ossddk_dmap_set_recerror(\fBdmap_t *\fIdmap\fP, \fBint \fIerr\fP, \fBint \fIparm\fP); +\fBvoid\fR ossddk_dmap_set_callback(\fBdmap_t *\fIdmap\fP, \fBoss_audio_callback_t \fIcb\fP, \fBint \fIarg\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdmap\fR +.in +16n +.rt +Audio buffer handle. +.in -16n +.sp +.ne 2 +.mk +\fB\fIptr\fR +.in +16n +.rt +TODO ptr +.in -16n +.PP +.SH "DESCRIPTION" +.PP +These functions are included in the current OSS DDK version just for +future compatibility. They don't exist in current versions and must not +be used by drivers written for this version of OSS DDK. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +.LP +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_dmap_set_recerror.9ossddk b/misc/man9ossddk/ossddk_dmap_set_recerror.9ossddk new file mode 100644 index 0000000..2be70fc --- /dev/null +++ b/misc/man9ossddk/ossddk_dmap_set_recerror.9ossddk @@ -0,0 +1 @@ +.so man9ossddk/ossddk_dmap_set_private.9ossddk diff --git a/misc/man9ossddk/ossddk_install_audiodev.9ossddk b/misc/man9ossddk/ossddk_install_audiodev.9ossddk new file mode 100644 index 0000000..f5c3c79 --- /dev/null +++ b/misc/man9ossddk/ossddk_install_audiodev.9ossddk @@ -0,0 +1,242 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_install_audiodev 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_install_audiodev \- Install an audio device +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_install_audiodev(\fBint \fIvers\fP, \fBoss_device_t * \fIosdev\fP, \fBoss_device_t * \fImaster_osdev\fP, \fBchar *\fIname\fP, \fBconst audiodrv_t *\fIdriver\fP, \fBint \fIdriver_size\fP, \fBint \fIflags\fP, \fBunsigned int \fIformat_mask\fP, \fBvoid *\fIdevc\fP, \fBint \fIparent\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIvers\fR +.in +16n +.rt +Audio driver interface version. Must be set to OSS_AUDIO_DRIVER_VERSION. +.in -16n +.sp +.ne 2 +.mk +\fB\fIosdev\fR +.in +16n +.rt +OSS device handle. Returned by ossddk_register_device. +.in -16n +.sp +.ne 2 +.mk +\fB\fImaster_osdev\fR +.in +16n +.rt +OSS device handle for the master device. Usually same as \fIosdev\fR but +virtual drivers have to give the osdev handle of the master/physical device here. +OSS uses this parameter for example to get the right iblock_cookie. +.in -16n +.sp +.ne 2 +.mk +\fB\fIname\fR +.in +16n +.rt +Name of the device. This name will be reported in /dev/sndstat as well as to +the applications using SNDCTL_AUDIOINFO(2oss) ioctl (such as ossinfo). +.in -16n +.sp +.ne 2 +.mk +\fB\fIdriver\fR +.in +16n +.rt +Pointer to the audio_driver structure that defines the entry points for +this low level audio driver. +.in -16n +.sp +.ne 2 +.mk +\fB\fIdriver_size\fR +.in +16n +.rt +Size of the driver structure. Pass sizeof(audiodrv_t) in this parameter. +.in -16n +.sp +.ne 2 +.mk +\fB\fIflags\fR +.in +16n +.rt +Audio device flags (see the description below). +.in -16n +.sp +.ne 2 +.mk +\fB\fIformat_mask\fR +.in +16n +.rt +Bit mask describing the sample formats supported by the device. See the \fISupported Audio Formats\fR section of OSS v4.0 API reference for more info. For example +\fBAFMT_S16_LE|AFMT_U8\fR tells that the driver supports the industry standard 8 and 16 +bit audio formats. +.PP +If the device supports different formats for recording and playback the driver should use the \fIossddk_adev_set_formats(9ossddk)\fR routine to set the masks. +.in -16n +.sp +.ne 2 +.mk +\fB\fIdevc\fR +.in +16n +.rt +Pointer to driver defined device instance data. +.in -16n +.sp +.ne 2 +.mk +\fB\fIparent\fR +.in +16n +.rt +Reserved for future use. Set to -1. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +\fIossddk_install_audiodev\fR creates an audio device file (/dev/dsp0 to /dev/dspN) and installs its driver callbacks. By default the device will be input/output capable. + +Behaviour of the driver can be modified using the \fIflags\fR parameter in the following way: +.PP +.sp +.ne 2 +.mk +\fBADEV_DUPLEX\fR +.in +30n +.rt +Give this flag if this device supports full duplex (simultaneous recording and playback). +.in -30n +.sp +.ne 2 +.mk +\fBADEV_NOINPUT\fR +.in +30n +.rt +Set this flag if the device doesn't do recording (ie it's playback only). +.in -30n +.sp +.ne 2 +.mk +\fBADEV_NOOUTPUT\fR +.in +30n +.rt +Set this flag if the device doesn't do playback (ie it's recording only). +.in -30n +.sp +All new OSS drivers should create separate device files for input and output. Earlier OSS versions created just a single input/output device file with \fBADEV_DUPLEX\fR flag. +However this approach doesn't work with all device so it should not be used any more. +.sp +.ne 2 +.mk +\fBADEV_VIRTUAL\fR +.in +30n +.rt +This flag tells that this device is virtual which means that it doesn't drive any +real hardware device. Instead it performs some software-only processing or works on +top of some other device. This flag is used to prevent chaining multiple virtual +drivers. Also some applications using SNDCTL_AUDIOINFO(2oss) may use this flag +for some purposes. +.in -30n +.sp +.ne 2 +.mk +\fBADEV_NOCONVERT\fR +.in +30n +.rt +This flag prevents the audio core from doing any automatic sample rate or format +conversions with this device. This flag should be set only if there is some strong +reason to prevent the conversions. +.in -30n +.sp +.ne 2 +.mk +\fBADEV_HIDDEN\fR +.in +30n +.rt +This flag means that the device serves some very special purpose and it should +be hidden from ordinary audio applications. It will not be visible in +device selection lists shown by applications. Instead the user/administrator +should know the device file to use. +.in -30n +.sp +.ne 2 +.mk +\fBADEV_SHADOW\fR +.in +30n +.rt +Some devices have multiple audio playback engines that are functionally identical +(in theory this kind of input devices are possible too but). An OSS audio driver +is supposed to create one audio device file for each of the available engines. All but +the first one should have this flag set. +.in -30n +.sp +.ne 2 +.mk +\fBADEV_NOSRC\fR +.in +30n +.rt +This flag disables automatic sample rate conversions performed by the audio core of OSS. +It's similar than the \fBADEV_NOCONVERT\fR flag but doesn't disable other kind of +format conversions. Usually used with rofessional audio devices (digital ones in +particular) to prevent lossy sample rate conversions. + +.in -30n +.sp +.ne 2 +.mk +\fBADEV_SPECIAL\fR +.in +30n +.rt +Use this flag with devices that should not be used to play system sounds (warning beeps, +etc). For example multi channel only or digital (AES/EBU or S/PDIF) devices should +specify this flag. +.in -30n +.sp +.ne 2 +.mk +\fBADEV_NOMMAP\fR +.in +30n +.rt +Use this flag if the device doesn't support mmap (direct access to the DMA buffer) for +some reason. +.in -30n +.sp +.ne 2 +.mk +\fBADEV_DISABLE_VIRTUAL\fR +.in +30n +.rt +Use this flag if the device is not suitable to be used as a master device of some +virtual driver. This flag should be set for example when the interrupt routine of +this device uses large amounts of stack (which may cause a stack overflow when +the virtual driver gets invoked). +.in -30n +.sp +.ne 2 +.mk +.PP +.SH "RETURN VALUES" +.PP +Negative value is an error code (-errno). Zero or positive is the audio device +number created. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_install_mixer.9ossddk b/misc/man9ossddk/ossddk_install_mixer.9ossddk new file mode 100644 index 0000000..c6509d0 --- /dev/null +++ b/misc/man9ossddk/ossddk_install_mixer.9ossddk @@ -0,0 +1,95 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_install_mixer 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_install_mixer \- Creates an mixer device. +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_install_mixer(\fBint \fIvers\fP, \fBoss_device_t * \fIosdev\fP, \fBoss_device_t * \fImaster_osdev\fP, \fBconst char *\fIname\fP, \fBmixer_driver_t *\fIdriver\fP, \fBint \fIdriver_size\fP, \fBvoid *\fIdevc\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIvers\fR +.in +16n +.rt +The OSSDDK mixer interface version. Pass OSS_MIXER_DRIVER_VERSION in this parameter. +.in -16n +.sp +.ne 2 +.mk +\fB\fIosdev\fR +.in +16n +.rt +OSS device handle from ossddk_register_device(9ossddk). +.in -16n +.sp +.ne 2 +.mk +\fB\fImaster_osdev\fR +.in +16n +.rt +OSS device handle for the master device. Usually same as \fIosdev\fR but +virtual drivers have to give the osdev handle of the master/physical device here. +OSS uses this parameter for example to get the right iblock_cookie. +.in -16n +.sp +.ne 2 +.mk +\fB\fIname\fR +.in +16n +.rt +Name of the mixer device to be shown in /dev/sndstat. Also returned by the +SNDCTL_MIXERINFO(2oss) ioctl call. +.in -16n +.sp +.ne 2 +.mk +\fB\fIdriver\fR +.in +16n +.rt +Pointer to the mixer driver callback table (mixer_driver_t). +.in -16n +.sp +.ne 2 +.mk +\fB\fIdriver_size\fR +.in +16n +.rt +Set to sizeof(mixer_driver_t). +.in -16n +.sp +.ne 2 +.mk +\fB\fIdevc\fR +.in +16n +.rt +Pointer to driver defined device instance data. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This call creates a mixer device file (/dev/mixer#) and returns the mixer +device number. +.PP +.SH "RETURN VALUES" +.PP +Negative value is an error code (-errno). Zero or positive is the mixer device +number created. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_mixer_create_control.9ossddk b/misc/man9ossddk/ossddk_mixer_create_control.9ossddk new file mode 100644 index 0000000..f7113b9 --- /dev/null +++ b/misc/man9ossddk/ossddk_mixer_create_control.9ossddk @@ -0,0 +1,94 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_mixer_create_control 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_mixer_create_control \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_mixer_create_control(\fBint \fIdev\fP, \fBint \fIparent\fP, \fBint \fIctrl\fP, \fBmixer_ext_fn \fIfunc\fP, \fBint \fItype\fP, \fBconst char *\fIid\fP, \fBint \fImaxvalue\fP, \fBint \fIflags\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIparent\fR +.in +16n +.rt +TODO parent +.in -16n +.sp +.ne 2 +.mk +\fB\fIctrl\fR +.in +16n +.rt +TODO ctrl +.in -16n +.sp +.ne 2 +.mk +\fB\fIfunc\fR +.in +16n +.rt +TODO func +.in -16n +.sp +.ne 2 +.mk +\fB\fItype\fR +.in +16n +.rt +TODO type +.in -16n +.sp +.ne 2 +.mk +\fB\fIid\fR +.in +16n +.rt +TODO id +.in -16n +.sp +.ne 2 +.mk +\fB\fImaxvalue\fR +.in +16n +.rt +TODO maxvalue +.in -16n +.sp +.ne 2 +.mk +\fB\fIflags\fR +.in +16n +.rt +TODO flags +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_mixer_create_group.9ossddk b/misc/man9ossddk/ossddk_mixer_create_group.9ossddk new file mode 100644 index 0000000..69e5a32 --- /dev/null +++ b/misc/man9ossddk/ossddk_mixer_create_group.9ossddk @@ -0,0 +1,56 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_mixer_create_group 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_mixer_create_group \- Create a new mixer group (window frame). +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_mixer_create_group(\fBint \fIdev\fP, \fBint \fIparent\fP, \fBconst char *\fIid\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS mixer device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIparent\fR +.in +16n +.rt +Control number of the parent group. 0 means the device root group. +.in -16n +.sp +.ne 2 +.mk +\fB\fIid\fR +.in +16n +.rt +Short name for the group (at most 15 characters). +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This function creates a new mixer group under the given parent group. +See the mixer extension programming section of OSS 4.0 API Specification +for more info about mixer groups. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_mixer_get_devc.9ossddk b/misc/man9ossddk/ossddk_mixer_get_devc.9ossddk new file mode 100644 index 0000000..483b186 --- /dev/null +++ b/misc/man9ossddk/ossddk_mixer_get_devc.9ossddk @@ -0,0 +1,48 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_mixer_get_devc 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_mixer_get_devc \- Get the devc pointer assigned to a mixer device. +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid*\fR ossddk_mixer_get_devc(\fBint \fIdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS device number. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Mixer drivers can give a pointer to their private devc structure when installing +the themselves. This function makes it possible to obtain this pointer when +necessary. +.PP +CAUTION! Extreme care must be taken in drivers that drive both mixer and audio +device files. Both types of devices have different functions for getting +the devc pointer. Drivers must use ossddk_adev_get_devc with audio device +numbers and ossddk_mixer_get_devc with mixer device numbers. +.PP +.SH "RETURN VALUES" +This function returns a poiner to the devc structure created by this driver. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_mixer_set_strings.9ossddk b/misc/man9ossddk/ossddk_mixer_set_strings.9ossddk new file mode 100644 index 0000000..39c9a98 --- /dev/null +++ b/misc/man9ossddk/ossddk_mixer_set_strings.9ossddk @@ -0,0 +1,62 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_mixer_set_strings 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_mixer_set_strings \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_mixer_set_strings(\fBint \fIdev\fP, \fBint \fIctl\fP, \fBconst char *\fIs\fP, \fBint \fIversion\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIctl\fR +.in +16n +.rt +TODO ctl +.in -16n +.sp +.ne 2 +.mk +\fB\fIs\fR +.in +16n +.rt +TODO s +.in -16n +.sp +.ne 2 +.mk +\fB\fIversion\fR +.in +16n +.rt +TODO version +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_mixer_touch.9ossddk b/misc/man9ossddk/ossddk_mixer_touch.9ossddk new file mode 100644 index 0000000..c3b5529 --- /dev/null +++ b/misc/man9ossddk/ossddk_mixer_touch.9ossddk @@ -0,0 +1,38 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_mixer_touch 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_mixer_touch \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_mixer_touch(\fBint \fIdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS device number. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_mixer_truncate.9ossddk b/misc/man9ossddk/ossddk_mixer_truncate.9ossddk new file mode 100644 index 0000000..03bbeef --- /dev/null +++ b/misc/man9ossddk/ossddk_mixer_truncate.9ossddk @@ -0,0 +1,46 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_mixer_truncate 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_mixer_truncate \- TODO +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBint\fR ossddk_mixer_truncate(\fBint \fIdev\fP, \fBint \fIindex\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIdev\fR +.in +16n +.rt +OSS device number. +.in -16n +.sp +.ne 2 +.mk +\fB\fIindex\fR +.in +16n +.rt +TODO index +.in -16n +.PP +.SH "DESCRIPTION" +.PP +TODO +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_osdev_get_devc.9ossddk b/misc/man9ossddk/ossddk_osdev_get_devc.9ossddk new file mode 100644 index 0000000..5e8ccb4 --- /dev/null +++ b/misc/man9ossddk/ossddk_osdev_get_devc.9ossddk @@ -0,0 +1,42 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_osdev_get_devc 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_osdev_get_devc \- Get the devc pointer registered for the osdev handle. +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid*\fR ossddk_osdev_get_devc(\fBoss_device_t *\fIosdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIosdev\fR +.in +16n +.rt +OSS device handle. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +Driver can use this function to get the devc structure it used when calling +ossddk_register_device(9ossddk). +.PP +.SH "RETURN VALUES" +This function always returns the devc pointer. There are no error codes. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_register_device.9ossddk b/misc/man9ossddk/ossddk_register_device.9ossddk new file mode 100644 index 0000000..5d891f9 --- /dev/null +++ b/misc/man9ossddk/ossddk_register_device.9ossddk @@ -0,0 +1,104 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_register_device 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_register_device \- Registers a driver with OSS +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBoss_device_t*\fR ossddk_register_device(\fBint \fIddkvers\fP, \fBdev_info_t *\fIdip\fP, \fBint \fIdrvtype\fP, \fBint \fIinstance\fP, \fBconst char *\fInick\fP, \fBddi_iblock_cookie_t \fIiblock_cookie\fP, \fBvoid *\fIdevc\fP, \fBconst char *\fIlongname\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIddkvers\fR +.in +16n +.rt +OSS DDK version. Set to OSSDDK_VERSION. Registering the driver will fail if the +version numbers are incompatible. +.in -16n +.sp +.ne 2 +.mk +\fB\fIdip\fR +.in +16n +.rt +This is the \fIdip\fR parameter given by Solaris as the argument of driver's +attach routine. +.in -16n +.sp +.ne 2 +.mk +\fB\fIdrvtype\fR +.in +16n +.rt +Bus type of the device. OSS DDK needs this parameter for some internal purposes. +Possible values are: DRV_PCI, DRV_USB and DRV_VIRTUAL. Some other values may be defined +in ossddk.h but they are not supported by the current version of OSS DDK. +.in -16n +.sp +.ne 2 +.mk +\fB\fIinstance\fR +.in +16n +.rt +This is the instance number of this driver (see ddi_get_instance(9F)). +.in -16n +.sp +.ne 2 +.mk +\fB\fInick\fR +.in +16n +.rt +Nick is a short name of the driver. Usually same as the name of the driver module. +.in -16n +.sp +.ne 2 +.mk +\fB\fIiblock_cookie\fR +.in +16n +.rt +The iblock cookie for the device. Should be set to NULL if the driver is a pseudo +one or if there is no iblock cookie for some other reason. +.in -16n +.sp +.ne 2 +.mk +\fB\fIdevc\fR +.in +16n +.rt +Pointer to driver defined device instance data. The driver can use this memory area +to store whatever information it wants. +.sp +.ne 2 +.mk +\fB\fIlongname\fR +.in +16n +.rt +Full name of the device. For example manufacturer and model. Keep as short as possible +since too long names will be truncated. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This routine registers the device with OSS and returns the \fIosdev\fR handle. The call +must be made omce in driver's attach routine before any other OSS DDK calls are made. +.PP +.SH "RETURN VALUES" +This routine returns the osdev handle or NULL if the call failed. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/man9ossddk/ossddk_unregister_device.9ossddk b/misc/man9ossddk/ossddk_unregister_device.9ossddk new file mode 100644 index 0000000..aeb54e1 --- /dev/null +++ b/misc/man9ossddk/ossddk_unregister_device.9ossddk @@ -0,0 +1,40 @@ +'\" te +.\" Copyright (c) 2005, 4Front Technologies 2005\&. +.TH ossddk_unregister_device 9ossddk "12 Sep 2005" "SunOS 5.10" "OSS DDK Services" +.SH "NAME" +ossddk_unregister_device \- Disconnects the driver from OSS DDK +.PP +.SH "SYNOPSIS" +.nf +#include <sys/soundcard.h> +.LP +#include <sys/ossddk/ossddk.h> +.fi +.LP +\fBvoid\fR ossddk_unregister_device(\fBoss_device_t *\fIosdev\fP); +.PP +.SH "INTERFACE LEVEL" +.PP +Open Sound System specific (OSS 4.0 DDK)\&. +.PP +.SH "ARGUMENTS" +.PP +.sp +.ne 2 +.mk +\fB\fIosdev\fR +.in +16n +.rt +OSS device handle. +.in -16n +.PP +.SH "DESCRIPTION" +.PP +This routine disconnects the driver from OSS DDK and disables all the services +(device files) created by the driver. This call must be made once in driver's detach +routine. No subsequent OSS DDK calls can be made after this moment. +.PP +.SH "SEE ALSO" +.PP +\fIWriting Sound Device Drivers with OSS DDK\fR +\fIOpen Sound System Programmer's Guide\fR diff --git a/misc/samples/ddksample/Makefile b/misc/samples/ddksample/Makefile new file mode 100644 index 0000000..1a688e7 --- /dev/null +++ b/misc/samples/ddksample/Makefile @@ -0,0 +1,18 @@ +OBJECTS=ddksample.o ddksample_audio.o ddksample_mixer.o ddksample_misc.o +CFLAGS=-D_KERNEL + +all: ddksample + +ddksample: $(OBJECTS) + ld -dy -r -Ndrv/osscore $(OBJECTS) -o ddksample +# ld -64 -dy -r -Ndrv/osscore $(OBJECTS) -o ddksample # For 64 bit kernels + +install: ddksample + cp ddksample /kernel/drv/ddksample + cp ddksample.conf /kernel/drv/ddksample.conf + -rem_drv ddksample + add_drv ddksample + ossdetect -d + +clean: + rm -f ddksample *.o x y z core *~ diff --git a/misc/samples/ddksample/ddksample.c b/misc/samples/ddksample/ddksample.c new file mode 100644 index 0000000..df7fd64 --- /dev/null +++ b/misc/samples/ddksample/ddksample.c @@ -0,0 +1,282 @@ +/* + * ddksample.c: OSS DDK sample driver - attach/detach + */ +/* + * + * This file is part of Open Sound System. + * + * Copyright (C) 4Front Technologies 1996-2008. + * + * This this source file is released under GPL v2 license (no other versions). + * See the COPYING file included in the main directory of this source + * distribution for the license terms and conditions. + * + */ + + +/* + * Solaris DDI includes + */ +#include <sys/types.h> +#include <sys/modctl.h> +#include <sys/kmem.h> +#include <sys/conf.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> + +/* + * OSS specific includes + */ +#include <sys/soundcard.h> +#include <sys/ossddk/ossddk.h> + +/*************************************************** + * Private types and variables + */ + +#define DRIVER_NICK "ddksample" +#define DRIVER_FULLNAME "OSS DDK sample device" +#define DRIVER_TYPE DRV_VIRTUAL + +#include "ddksample.h" + +/**************************************************/ + +static int ddksample_getinfo (dev_info_t *, ddi_info_cmd_t, void *, void **); +static int ddksample_attach (dev_info_t *, ddi_attach_cmd_t); +static int ddksample_detach (dev_info_t *, ddi_detach_cmd_t); + +/* Entry points structure */ +static struct cb_ops ddksample_cb_ops = { + oss_open, + oss_close, + nodev, /* not a block driver */ + nodev, /* no print routine */ + nodev, /* no dump routine */ + oss_read, + oss_write, + oss_ioctl, + nodev, /* no devmap routine */ + oss_mmap, /* mmap routine */ + nodev, /* no segmap routine */ + oss_chpoll, /* no chpoll routine */ + ddi_prop_op, + 0, /* not a STREAMS driver */ + D_NEW | D_MP | D_64BIT, /* safe for multi-thread/multi-processor */ + CB_REV +}; + +static struct dev_ops ddksample_dev_ops = { + DEVO_REV, /* devo_rev */ + 0, /* devo_refcnt */ + ddksample_getinfo, /* devo_getinfo */ + nulldev, /* devo_identify - obsolete */ +#if DRIVER_TYPE==DRV_ISA + ddksample_probe, +#else + nulldev, /* devo_probe */ +#endif + ddksample_attach, /* devo_attach */ + ddksample_detach, /* devo_detach */ + nodev, /* devo_reset */ +#if DRIVER_TYPE==DRV_STREAMS + &ddksample_streams_cb_ops, /* devi_cb_ops */ +#else + &ddksample_cb_ops, /* devi_cb_ops */ +#endif + NULL, /* devo_bus_ops */ + NULL /* devo_power */ +}; + +static struct modldrv ddksample_modldrv = { + &mod_driverops, /* drv_modops */ + "Sample OSS DDK virtual driver", /* String "OSS" must be included in the name */ + &ddksample_dev_ops, /* drv_dev_ops */ +}; + +static struct modlinkage ddksample_modlinkage = { + MODREV_1, /* ml_rev */ + (void *) &ddksample_modldrv, /* ml_linkage */ + NULL /* NULL terminates the list */ +}; + +/* + * _init, _info, and _fini support loading and unloading the driver. + */ +int +_init (void) +{ + int error; + + error = mod_install (&ddksample_modlinkage); + + return error; +} + +int +_fini (void) +{ + int error; + + error = mod_remove (&ddksample_modlinkage); + return error; +} + +int +_info (struct modinfo *modinfop) +{ + int error; + + error = mod_info (&ddksample_modlinkage, modinfop); + + return error; +} + +/**************************************************/ + + +static int +ddksample_attach (dev_info_t * dip, ddi_attach_cmd_t cmd) +{ + int instance, err; + oss_device_t *osdev; + ddi_iblock_cookie_t iblock_cookie; + ddksample_devc *devc; + + if (cmd != DDI_ATTACH) + { + cmn_err (CE_WARN, "bad attach cmd %d\n", cmd); + return 0; + } + + if (dip == NULL) + { + cmn_err (CE_WARN, "ddksample_attach: dip==NULL\n"); + return DDI_FAILURE; + } + + instance = ddi_get_instance (dip); + cmn_err (CE_CONT, "Attach started " DRIVER_NICK "%d\n", instance); + +#if 0 + // Pseudo drivers don't have any iblock_cookie + + if ((err = ddi_get_iblock_cookie (dip, 0, iblock_cookie)) != DDI_SUCCESS) + { + cmn_err (CE_WARN, "Cannot get iblock cookie (%d)\n", err); + return DDI_FAILURE; + } +#endif + + devc = kmem_zalloc (sizeof (*devc), KM_SLEEP); + + mutex_init (&devc->mutex, NULL, MUTEX_DRIVER, NULL /* iblock_cookie */ ); + + if ((osdev = + ossddk_register_device (OSSDDK_VERSION, dip, DRIVER_TYPE, instance, + DRIVER_NICK, iblock_cookie, devc, + DRIVER_FULLNAME)) == NULL) + { + cmn_err (CE_WARN, "Registering OSS DDK driver failed\n"); + return DDI_FAILURE; + } + + devc->osdev = osdev; + + ddksample_mixer_init (devc); /* From ddksample_mixer.c */ + ddksample_audio_init (devc); /* From ddksample_audio.c */ + + ddi_set_driver_private (dip, (caddr_t) osdev); + ddi_report_dev (dip); + + return DDI_SUCCESS; +} + +static int +ddksample_detach (dev_info_t * dip, ddi_detach_cmd_t cmd) +{ + oss_device_t *osdev; + int err; + + ddksample_devc *devc; + + if (cmd != DDI_DETACH) + { + cmn_err (CE_WARN, "bad attach cmd %d\n", cmd); + return 0; + } + + if (dip == NULL) + { + cmn_err (CE_WARN, "ddksample_detach: dip==NULL\n"); + return DDI_FAILURE; + } + + cmn_err (CE_CONT, "Detach started " DRIVER_NICK "\n"); + if ((osdev = ddi_get_driver_private (dip)) == NULL) + { + cmn_err (CE_WARN, "ddi_get_driver_private() failed\n"); + return DDI_SUCCESS; + } + +/* + * Check if the device can be removed (not busy) and make sure it will not be + * opened any more. + */ + if ((err = ossddk_disable_device (osdev)) < 0) + return DDI_FAILURE; + + devc = ossddk_osdev_get_devc (osdev); + +/* + * Stop the device and make sure it will not raise any + * interrupts any morfe. + */ + + ossddk_unregister_device (osdev); + + mutex_destroy (&devc->mutex); + kmem_free (devc, sizeof (*devc)); + + return DDI_SUCCESS; +} + +/* + * Misc routines + */ + +static int +ddksample_getinfo (dev_info_t * dip, ddi_info_cmd_t cmd, void *arg, + void **result) +{ + dev_t dev; + register int error; + int minor_num, instance; + + if (dip == NULL) + { + cmn_err (CE_WARN, "ddksample_getinfo: dip==NULL\n"); + return DDI_FAILURE; + } + + dev = (dev_t) arg; + minor_num = getminor (dev); + instance = ddi_get_instance (dip); + + switch (cmd) + { + case DDI_INFO_DEVT2DEVINFO: + *result = dip; + error = DDI_SUCCESS; + break; + case DDI_INFO_DEVT2INSTANCE: + *result = (void *) instance; + error = DDI_SUCCESS; + break; + default: + *result = NULL; + error = DDI_FAILURE; + } + + return (error); +} diff --git a/misc/samples/ddksample/ddksample.conf b/misc/samples/ddksample/ddksample.conf new file mode 100644 index 0000000..c7e9997 --- /dev/null +++ b/misc/samples/ddksample/ddksample.conf @@ -0,0 +1 @@ +name="ddksample" parent="pseudo" instance=0; diff --git a/misc/samples/ddksample/ddksample.h b/misc/samples/ddksample/ddksample.h new file mode 100644 index 0000000..a0257f5 --- /dev/null +++ b/misc/samples/ddksample/ddksample.h @@ -0,0 +1,49 @@ +#ifndef _DDKSAMPLE_H +#define _DDKSAMPLE_H + +// Audio engine (port) control structure. + +#define MAX_SUBDEVICE 4 + +typedef struct +{ + int dev; + int open_mode; /* OPEN_READ | OPEN_WRITE */ + + int speed; + int channels; + int format, bits; + + int prepare_flags; + int audio_active; + + int timeout_value; + timeout_id_t timeout_id; + + int left_volume, right_volume; + int mute; +#define DDKSAMPLE_MAX_VOL 100 + + int left_peak, right_peak; +} ddksample_portc; + +// Device control structure +typedef struct +{ + oss_device_t *osdev; + kmutex_t mutex; + + int mixer_dev; + int mainvol_left, mainvol_right; + + int num_portc; + ddksample_portc portc[MAX_SUBDEVICE]; + int audio_open_count; /* Number of channels currently opened */ + +} ddksample_devc; + +extern int ddksample_mixer_init (ddksample_devc * devc); +extern int ddksample_audio_init (ddksample_devc * devc); +extern void ddksample_do_math (ddksample_portc * portc, void *buf, int len); + +#endif diff --git a/misc/samples/ddksample/ddksample_audio.c b/misc/samples/ddksample/ddksample_audio.c new file mode 100644 index 0000000..4330f6b --- /dev/null +++ b/misc/samples/ddksample/ddksample_audio.c @@ -0,0 +1,524 @@ +/* + * ddksample_audio.c - OSS DDK sample driver - Audio functionality + * + * Description: + * + * This simple audio driver implements an OSS audio device similar to + * /dev/zero. The output will be just discarded. Recording will return + * silence. In addition the sample parameters (rate, channels and format) + * is emulated. Timeout callbacks are used to keep the device running + * at the right rate (approximately). + * + * To demonstrate mixer functionality (together with ddksample_mixer.c) this + * driver also computes the peak levels from the output data. Also output + * volume controls are implemented. + */ +/* + * + * This file is part of Open Sound System. + * + * Copyright (C) 4Front Technologies 1996-2008. + * + * This this source file is released under GPL v2 license (no other versions). + * See the COPYING file included in the main directory of this source + * distribution for the license terms and conditions. + * + */ + + +/* + * Solaris DDI includes + */ +#include <sys/types.h> +#include <sys/modctl.h> +#include <sys/kmem.h> +#include <sys/conf.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> + +/* + * OSS specific includes + */ +#include <sys/soundcard.h> +#include <sys/ossddk/ossddk.h> + +/*************************************************** + * Private types and variables + */ + +#include "ddksample.h" + +/**************************************************/ + +/* + * This driver emulates periodic interrupts on fragment boundaries using + * the timeout(9f) mechanism. Ordinary drivers use device interrupts + * for this. + */ + +static void +ddksample_intr (void *arg) +{ + ddksample_portc *portc = arg; + + if (portc->audio_active & PCM_ENABLE_OUTPUT) + { +#if 1 +/* + * We will first do some computations on the output data. This is not + * necessary in normal drivers. It's here just to make the mixer section + * to behave like the mixer of some real device. + */ + int pos; + unsigned char *buf; + dmap_t *dmap; + + dmap = ossddk_adev_get_dmapout (portc->dev); + buf = ossddk_dmap_get_dmabuf (dmap); + + /* + * Compute the current playback position (beginning of the + * fragment we have just finished). + */ + pos = ossddk_dmap_get_qhead (dmap) * ossddk_dmap_get_fragsize (dmap); + + buf = buf + pos; + ddksample_do_math (portc, buf, ossddk_dmap_get_fragsize (dmap)); +#endif + + + + + ossddk_audio_outputintr (portc->dev, 0); /* Acknowledge one fragment */ + } + + if (portc->audio_active & PCM_ENABLE_INPUT) + { + ossddk_audio_inputintr (portc->dev); /* Acknowledge one fragment */ + } + + portc->timeout_id = timeout (ddksample_intr, portc, portc->timeout_value); +} + +static int +ddksample_set_rate (int dev, int arg) +{ + ddksample_portc *portc = ossddk_adev_get_portc (dev); + + if (arg == 0) /* Query - return the current rate */ + return portc->speed; + +/* + * If the requested rate is not supported the driver may just return the + * current rate. Or preferably it may select the rate that is closest to the + * requested one. In this sample driver we use the easy way. + */ + + if (arg != 16000 && arg != 24000 && arg != 48000) + return portc->speed; + +/* + * The rate was OK so write it down and report it back. + */ + + return portc->speed = arg; +} + +static short +ddksample_set_channels (int dev, short arg) +{ + ddksample_portc *portc = ossddk_adev_get_portc (dev); + + if (arg == 0) /* Query - return the current setting */ + return portc->channels; + +/* + * Assume 2 channels (stereo) if something incorrect is + * requested. + */ + + if (arg != 1 && arg != 2) + return 2; + + return portc->channels = arg; +} + +static unsigned int +ddksample_set_format (int dev, unsigned int arg) +{ + ddksample_portc *portc = ossddk_adev_get_portc (dev); + + if (arg == 0) /* Query */ + return portc->format; + +/* + * Fall back to 16 bits (native endianess) if some unsupported + * rate is requested. + */ + + if (arg != AFMT_S16_NE && arg != AFMT_S32_NE) + return AFMT_S16_NE; + + if (arg == AFMT_S32_NE) + portc->bits = 32; + else + portc->bits = 16; + + return portc->format = arg; +} + +static int +ddksample_ioctl (int dev, unsigned int cmd, int *arg) +{ +// TODO + return -EINVAL; +} + +static void ddksample_trigger (int dev, int state); + +static void +ddksample_reset (int dev) +{ + ddksample_trigger (dev, 0); +} + +static int +ddksample_open (int dev, int mode, int open_flags) +{ + ddksample_portc *portc = ossddk_adev_get_portc (dev); + ddksample_devc *devc = ossddk_adev_get_devc (dev); + + mutex_enter (&devc->mutex); + + if (portc->open_mode != 0) /* Device busy */ + { + mutex_exit (&devc->mutex); + return -EBUSY; + } + + portc->open_mode = mode; + devc->audio_open_count++; + mutex_exit (&devc->mutex); + + return 0; +} + +static void +ddksample_close (int dev, int mode) +{ + ddksample_portc *portc = ossddk_adev_get_portc (dev); + ddksample_devc *devc = ossddk_adev_get_devc (dev); + + ddksample_reset (dev); + + mutex_enter (&devc->mutex); + portc->open_mode = 0; + devc->audio_open_count--; + mutex_exit (&devc->mutex); +} + +static void +ddksample_trigger (int dev, int state) +{ + ddksample_portc *portc = ossddk_adev_get_portc (dev); + + if (portc->open_mode & OPEN_WRITE) + { + if ((state & PCM_ENABLE_OUTPUT) + && (portc->prepare_flags & PCM_ENABLE_OUTPUT)) + { + portc->prepare_flags &= ~PCM_ENABLE_OUTPUT; + + /* + * Arm the timeout if it was not started yet. + */ + if (portc->audio_active == 0) + portc->timeout_id = + timeout (ddksample_intr, portc, portc->timeout_value); + portc->audio_active |= PCM_ENABLE_OUTPUT; + } + else + if (!(state & PCM_ENABLE_OUTPUT) + && (portc->audio_active & PCM_ENABLE_OUTPUT)) + { + portc->audio_active &= ~PCM_ENABLE_OUTPUT; + if (portc->audio_active == 0) + untimeout (portc->timeout_id); + portc->timeout_id = 0; + } + } + + if (portc->open_mode & OPEN_READ) + { + if ((state & PCM_ENABLE_INPUT) + && (portc->prepare_flags & PCM_ENABLE_INPUT)) + { + portc->prepare_flags &= ~PCM_ENABLE_INPUT; + + /* + * Arm the timeout if it was not started yet. + */ + if (portc->audio_active == 0) + portc->timeout_id = + timeout (ddksample_intr, portc, portc->timeout_value); + portc->audio_active |= PCM_ENABLE_INPUT; + } + else + if (!(state & PCM_ENABLE_INPUT) + && (portc->audio_active & PCM_ENABLE_INPUT)) + { + portc->audio_active &= ~PCM_ENABLE_INPUT; + if (portc->audio_active == 0) + untimeout (portc->timeout_id); + portc->timeout_id = 0; + } + } +} + +static int +ddksample_prepare_for_input (int dev, int fragsize, int numfrags) +{ + ddksample_portc *portc = ossddk_adev_get_portc (dev); + int datarate, intrate, tmout; + + cmn_err (CE_CONT, "Input, rate=%d, channels=%d, format=0x%x, bits=%d\n", + portc->speed, portc->channels, portc->format, portc->bits); + +/* + * Compute the number of lbolt ticks between interrupts. This value is needed + * for timeout(9f). + */ + + datarate = portc->speed * portc->channels * portc->bits / 8; /* Bytes per second */ + intrate = datarate * 10 / fragsize; + tmout = hz * 1000 / intrate; + + cmn_err (CE_CONT, "Datarate %d, fragsize %d\n", datarate, fragsize); + cmn_err (CE_CONT, "Intrate %d.%d interrupts / sec.\n", intrate / 10, + intrate % 10); + cmn_err (CE_CONT, "Timeout %d.%02d ticks\n", tmout / 100, tmout % 100); + + tmout = (tmout + 50) / 100; /* Round to the nearest integer value */ + if (tmout < 1) + tmout = 1; + + portc->timeout_value = tmout; + portc->prepare_flags |= PCM_ENABLE_INPUT; + return 0; +} + +static int +ddksample_prepare_for_output (int dev, int fragsize, int numfrags) +{ + ddksample_portc *portc = ossddk_adev_get_portc (dev); + int datarate, intrate, tmout; + + cmn_err (CE_CONT, "Output, rate=%d, channels=%d, format=0x%x, bits=%d\n", + portc->speed, portc->channels, portc->format, portc->bits); + +/* + * Compute the number of lbolt ticks between interrupts. This value is needed + * for timeout(9f). + */ + + datarate = portc->speed * portc->channels * portc->bits / 8; /* Bytes per second */ + intrate = datarate * 10 / fragsize; + tmout = hz * 1000 / intrate; + + cmn_err (CE_CONT, "Datarate %d, fragsize %d\n", datarate, fragsize); + cmn_err (CE_CONT, "Intrate %d.%d interrupts / sec.\n", intrate / 10, + intrate % 10); + cmn_err (CE_CONT, "Timeout %d.%02d ticks\n", tmout / 100, tmout % 100); + + tmout = (tmout + 50) / 100; /* Round to the nearest integer value */ + if (tmout < 1) + tmout = 1; + + portc->timeout_value = tmout; + portc->prepare_flags |= PCM_ENABLE_OUTPUT; + return 0; +} + +static int +ddksample_alloc_buffer (int dev, dmap_t * dmap, int direction) +{ +#define MY_BUFFSIZE (64*1024) + if (ossddk_dmap_get_dmabuf (dmap) != NULL) + return 0; + ossddk_dmap_set_phys (dmap, 0); /* Not mmap() capable */ + ossddk_dmap_set_dmabuf (dmap, kmem_zalloc (MY_BUFFSIZE, KM_SLEEP)); + if (ossddk_dmap_get_dmabuf (dmap) == NULL) /* Alloc failed */ + return -ENOSPC; + ossddk_dmap_set_buffsize (dmap, MY_BUFFSIZE); + + return 0; +} + +static int +ddksample_free_buffer (int dev, dmap_t * dmap, int direction) +{ + if (ossddk_dmap_get_dmabuf (dmap) == NULL) + return 0; + kmem_free (ossddk_dmap_get_dmabuf (dmap), MY_BUFFSIZE); + + ossddk_dmap_set_dmabuf (dmap, NULL); + return 0; +} + +#if 0 +static int +ddksample_get_buffer_pointer (int dev, dmap_t * dmap, int direction) +{ + return 0; +} +#endif + +static audiodrv_t ddksample_audio_driver = { + ddksample_open, + ddksample_close, + NULL, // output_block + NULL, // start_input + ddksample_ioctl, + ddksample_prepare_for_input, + ddksample_prepare_for_output, + ddksample_reset, + NULL, + NULL, + NULL, + NULL, + ddksample_trigger, + ddksample_set_rate, + ddksample_set_format, + ddksample_set_channels, + NULL, + NULL, + NULL, + NULL, + ddksample_alloc_buffer, + ddksample_free_buffer, + NULL, + NULL, + NULL /* ddksample_get_buffer_pointer */ +}; + +int +ddksample_audio_init (ddksample_devc * devc) +{ + int dev; + int i; + static int rates[] = { 16000, 24000, 48000 }; + + for (i = 0; i < MAX_SUBDEVICE; i++) + { + ddksample_portc *portc; + int flags; + + flags = ADEV_VIRTUAL | ADEV_DUPLEX; + + if (i > 0) + flags |= ADEV_SHADOW; + + if ((dev = ossddk_install_audiodev (OSS_AUDIO_DRIVER_VERSION, + devc->osdev, + devc->osdev, + "OSS DDK sample device", + &ddksample_audio_driver, + sizeof (audiodrv_t), + flags, + AFMT_S16_NE | AFMT_S32_NE, + devc, -1)) < 0) + return dev; + + portc = &devc->portc[devc->num_portc++]; + + portc->dev = dev; + portc->speed = 48000; + portc->channels = 2; + portc->format = AFMT_S16_NE; + portc->bits = 16; + portc->open_mode = 0; + portc->timeout_id = 0; + portc->left_volume = DDKSAMPLE_MAX_VOL; + portc->right_volume = DDKSAMPLE_MAX_VOL; + portc->left_peak = 0; + portc->right_peak = 0; + portc->mute = 0; + + ossddk_adev_set_portc (dev, portc); + ossddk_adev_set_portnum (dev, i); + ossddk_adev_set_mixer (dev, devc->mixer_dev); + + ossddk_adev_set_rates (dev, 16000, 48000, 3, rates); + ossddk_adev_set_channels (dev, 1, 2); /* Mono and stereo are supported */ + + /* + * Usually the list of supported audio formats is set when calling + * ossddk_install_audiodev(). However in some cases it may be + * necessary to change the format list later. Changing it is + * also necessary if recording formats are fdifferent than the + * playback formats. + * + * The next lines demonstrates how to do that. Normal drivers should + * never do that. + */ + ossddk_adev_set_formats (dev, AFMT_S32_NE | AFMT_S16_NE, // 16 and 32 bit playback + AFMT_S16_NE); // Only 16 bit recording + + + /* + * Report stereo as the preferred channel configuration. + */ + ossddk_adev_set_caps (dev, DSP_CH_STEREO); + +#if 0 + /* + * Many devices have some limits for the fragment size. For + * example it's common that the fragment must fit in a single + * memory page. In such cases setting the fragment size limits is + * necessary. Otherwise the driver should not care about them. + * + * Both the upper and lower limits are set using the same call. + * Value of 0 means no limit. + * + * Here we set the upper limit to PAGE_SIZE and no lower limit. + */ + ossddk_adev_set_buflimits (dev, 0, PAGE_SIZE); +#endif + +#if 0 + /* + * In some cases the device may be rate clocked with some other + * device that provides the sample clock. For example there may + * be some special cable connected between the devices. When the + * driver knows this it can report the device which controls + * the sampling rate. Otherwise this information must be left + * untouched. + * + * Knowing that two or more devices have their rates locked will + * make work of some future OSS subsystems more reliable. However + * false information will probably break things in the hard way. + */ + ossddk_adev_set_ratesource (dev, devc->some_known_device_number); +#endif + +#if 0 + /* + * If the device requires some kind of proprietary control program + * it's necessary to assign some magic number for the device. + * The control program can find the right device by looking at + * the magic field returned by SNDCTL_AUDIOINFO. + * + * Normal devices must not report any kind of magic numbers. In + * particular this feature must not be used to help "client" + * programs to detect what kind of device is being used. + * + * CAUTION! To avoid conflicts between two drivers using the same + * magic it's necessary to request the magic number from + * 4Front Technologies (support@opensound.com). + */ + ossddk_adev_set_magic (dev, magic_number_assigned_for_this_driver); +#endif + } + + return 0; +} diff --git a/misc/samples/ddksample/ddksample_misc.c b/misc/samples/ddksample/ddksample_misc.c new file mode 100644 index 0000000..8876a2c --- /dev/null +++ b/misc/samples/ddksample/ddksample_misc.c @@ -0,0 +1,179 @@ +/* + * ddksample_audio.c - OSS DDK sample driver - misc routines + * + * Description: + * This file contains routines that are not related with the + * OSS DDK interface. To understand how OSS DDK works you don't need to + * pay any attention on these routines. They are here just to produce + * some data for the mixer routines (ddksample_mixer.c). + * + * ddksample_misc.c emulates some arbitrary audio device. It does + * volume scaling to the output data and computes the peak meters from the + * result of the scaling. + */ +/* + * + * This file is part of Open Sound System. + * + * Copyright (C) 4Front Technologies 1996-2008. + * + * This this source file is released under GPL v2 license (no other versions). + * See the COPYING file included in the main directory of this source + * distribution for the license terms and conditions. + * + */ + + +/* + * Solaris DDI includes + */ +#include <sys/types.h> +#include <sys/modctl.h> +#include <sys/kmem.h> +#include <sys/conf.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> + +/* + * OSS specific includes + */ +#include <sys/soundcard.h> +#include <sys/ossddk/ossddk.h> + +#include "ddksample.h" + +/**************************************************/ +void +ddksample_do_math (ddksample_portc * portc, void *buf, int len) +{ + int i; + ddksample_devc *devc = ossddk_adev_get_devc (portc->dev); + + switch (portc->bits + portc->channels) + { + case 16 + 1: /* 16 bits / mono */ + { + int val; + int peak = 0; + short *p = buf; + + len /= sizeof (*p); + + for (i = 0; i < len; i++) + { + /* Do volume computations */ + + val = *p++ << 8; /* Scale up to 24 bits */ + + val = (val * portc->left_volume) / DDKSAMPLE_MAX_VOL; + + /* + * Note that legacy mixer volume max is always + * 100. + */ + val = (val * devc->mainvol_left) / 100; + + /* + * Now we have the sample value after volume control. + * This driver doesn't store this value anywhere but + * if necessary this functionality can be added here. + + /* + * Next compute the peak value + */ + + if (val < 0) + val = -val; /* Absolute value */ + + if (val > peak) + peak = val; + } + + if (peak > portc->left_peak) + portc->left_peak = peak; + if (peak > portc->right_peak) + portc->right_peak = peak; + } + break; + + case 16 + 2: /* 16 bits / stereo */ + { + int val; + int left_peak = 0, right_peak = 0; + short *p = buf; + + len /= sizeof (*p); + + for (i = 0; i < len; i += 2) /* Each stereo sa,ple pair */ + { + /* + * Left channel + */ + + /* Do volume computations */ + + val = (*p++) << 8; /* Scale up to 24 bits */ + + val = (val * portc->left_volume) / DDKSAMPLE_MAX_VOL; + + /* + * Note that legacy mixer volume max is always + * 100. + */ + val = (val * devc->mainvol_left) / 100; + + /* + * Now we have the sample value after volume control. + * This driver doesn't store this value anywhere but + * if necessary this functionality can be added here. + + /* + * Next compute the peak value + */ + + if (val < 0) + val = -val; /* Absolute value */ + + if (val > left_peak) + left_peak = val; + + /* + * Right channel + */ + + /* Do volume computations */ + + val = (*p++) << 8; /* Scale up to 24 bits */ + + val = (val * portc->left_volume) / DDKSAMPLE_MAX_VOL; + + /* + * Note that legacy mixer volume max is always + * 100. + */ + val = (val * devc->mainvol_left) / 100; + + /* + * Now we have the sample value after volume control. + * This driver doesn't store this value anywhere but + * if necessary this functionality can be added here. + + /* + * Next compute the peak value + */ + + if (val < 0) + val = -val; /* Absolute value */ + + if (val > right_peak) + right_peak = val; + } + + if (left_peak > portc->left_peak) + portc->left_peak = left_peak; + if (right_peak > portc->right_peak) + portc->right_peak = right_peak; + } + break; + } +} diff --git a/misc/samples/ddksample/ddksample_mixer.c b/misc/samples/ddksample/ddksample_mixer.c new file mode 100644 index 0000000..3dc5518 --- /dev/null +++ b/misc/samples/ddksample/ddksample_mixer.c @@ -0,0 +1,375 @@ +/* + * ddksample_audio.c: OSS DDK sample driver - Mixer functionality + * + * Description: + * This source module implements the mixer functionality of the sample + * driver. The devc and portc fields used by the mixer are actually used + * in the ddksample_misc.c module which emulates some audio hardware. + */ +/* + * + * This file is part of Open Sound System. + * + * Copyright (C) 4Front Technologies 1996-2008. + * + * This this source file is released under GPL v2 license (no other versions). + * See the COPYING file included in the main directory of this source + * distribution for the license terms and conditions. + * + */ + + +/* + * Solaris DDI includes + */ +#include <sys/types.h> +#include <sys/modctl.h> +#include <sys/kmem.h> +#include <sys/conf.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> + +/* + * OSS specific includes + */ +#include <sys/soundcard.h> +#include <sys/ossddk/ossddk.h> + +/*************************************************** + * Private types and variables + */ + +#include "ddksample.h" + +/**************************************************/ +static const unsigned char peak_cnv[256] = { + 0, 18, 29, 36, 42, 47, 51, 54, 57, 60, 62, 65, 67, 69, 71, 72, + 74, 75, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 89, 90, + 91, 92, 93, 93, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 100, 101, + 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, + 108, + 109, 109, 110, 110, 110, 111, 111, 111, 112, 112, 113, 113, 113, 114, 114, + 114, + 115, 115, 115, 115, 116, 116, 116, 117, 117, 117, 118, 118, 118, 118, 119, + 119, + 119, 119, 120, 120, 120, 121, 121, 121, 121, 122, 122, 122, 122, 122, 123, + 123, + 123, 123, 124, 124, 124, 124, 125, 125, 125, 125, 125, 126, 126, 126, 126, + 126, + 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, + 130, + 130, 130, 130, 130, 130, 131, 131, 131, 131, 131, 131, 132, 132, 132, 132, + 132, + 132, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 135, + 135, + 135, 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, 136, 137, 137, 137, + 137, + 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, + 139, + 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, + 141, + 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 142, 142, 142, 143, 143, + 143, + 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, +}; + +static int +peak_cb (int dev, int ctl_id, unsigned int cmd, int value) +{ + ddksample_devc *devc = ossddk_mixer_get_devc (dev); + + if (ctl_id < 0 || ctl_id >= devc->num_portc) + return -EINVAL; + + if (cmd == SNDCTL_MIX_READ) + { + ddksample_portc *portc = &devc->portc[ctl_id]; + int val, left, right; + + /* + * Truncate the peak counters to 8 bits (signed range). + */ + left = portc->left_peak >> 15; + right = portc->right_peak >> 15; + + if (left > 255) + left = 255; + if (right > 255) + right = 255; + + /* + * Convert to logarithmic (dB) scale + */ + left = peak_cnv[left]; + right = peak_cnv[right]; + + val = left | (right << 8); + + portc->left_peak = portc->right_peak = 0; /* Reset */ + + return val; + } + + + return -EINVAL; +} + +static int +mute_cb (int dev, int ctl_id, unsigned int cmd, int value) +{ + ddksample_devc *devc = ossddk_mixer_get_devc (dev); + + if (ctl_id < 0 || ctl_id >= devc->num_portc) + return -EINVAL; + + if (cmd == SNDCTL_MIX_WRITE) + { + ddksample_portc *portc = &devc->portc[ctl_id]; + + return portc->mute = (value != 0); + } + + if (cmd == SNDCTL_MIX_READ) + { + ddksample_portc *portc = &devc->portc[ctl_id]; + + return portc->mute; + } + + return -EINVAL; +} + +static int +gain_cb (int dev, int ctl_id, unsigned int cmd, int value) +{ + ddksample_devc *devc = ossddk_mixer_get_devc (dev); + + if (ctl_id < 0 || ctl_id >= devc->num_portc) + return -EINVAL; + + if (cmd == SNDCTL_MIX_WRITE) + { + int left, right; + ddksample_portc *portc = &devc->portc[ctl_id]; + + left = value & 0xff; + right = (value >> 8) & 0xff; + + if (left < 0) + left = 0; + if (left > DDKSAMPLE_MAX_VOL) + left = DDKSAMPLE_MAX_VOL; + if (right < 0) + right = 0; + if (right > DDKSAMPLE_MAX_VOL) + right = DDKSAMPLE_MAX_VOL; + + portc->left_volume = left; + portc->right_volume = right; + + return left | (right << 8); + } + + if (cmd == SNDCTL_MIX_READ) + { + ddksample_portc *portc = &devc->portc[ctl_id]; + return portc->left_volume | (portc->right_volume << 8); + } + + return -EINVAL; +} + +static int +ddksample_create_controls (int dev) +{ + ddksample_devc *devc = ossddk_mixer_get_devc (dev); + int group, top, i; + int ctl; + + /* + * Create the top level group + * + * By convention all controls specific to /dev/dsp# device files + * are grouped under a group called "/dev". + */ + + if ((top = ossddk_mixer_create_group (dev, // Mixer device number + OSSDDK_MIXER_ROOT, // Parent group + "/dev")) < 0) // Name + return top; + + for (i = 0; i < devc->num_portc; i++) + { + char name[16]; + + ddksample_portc *portc = &devc->portc[i]; + + /* + * Create a special group for each /dev/dsp# device. + * Control/group names staring with "@pcm" have special function. + * GUI mixers will replace them with the application name using + * the corresponding /dev/dsp# device. In this way the mixer + * interface is more intuitive. + * + * In our case we create a group for each audio device and + * place the controls under them. + * + * We have both a volume slider and a peak meter for each device + * file. The convention is that the volume slider will be shown first + * if it affects the peak meter (such as in case). Otherwise the + * peak meter will be first. + */ + sprintf (name, "@pcm%d", portc->dev); + + if ((group = ossddk_mixer_create_group (dev, // Mixer device number + top, // Parent group + name)) < 0) // Name + return group; + + if ((ctl = ossddk_mixer_create_control (dev, // Mixer device number + group, // Parent group + i, // Controller id + gain_cb, // Callback function + MIXT_STEREOSLIDER, // Control type + "-", // Name (no name) + DDKSAMPLE_MAX_VOL, // Maximum value + MIXF_READABLE | MIXF_WRITEABLE)) < 0) // Protection + return ctl; + + if ((ctl = ossddk_mixer_create_control (dev, // Mixer device number + group, // Parent group + i, // Controller id + peak_cb, // Callback function + MIXT_STEREOPEAK, // Control type + "-", // Name (no name) + 144, // Maximum value + MIXF_READABLE)) < 0) // Protection + return ctl; + + if ((ctl = ossddk_mixer_create_control (dev, // Mixer device number + group, // Parent group + i, // Controller id + mute_cb, // Callback function + MIXT_ONOFF, // Control type + "MUTE", // Name + 2, // ONOFF controls should have 2 here + MIXF_READABLE | MIXF_WRITEABLE)) < 0) // Protection + return ctl; + } + + return OSSDDK_OK; +} + +/**************************************************/ + +static int +ddksample_legacy_mixer_ioctl (int dev, int audiodev, unsigned int cmd, + int *arg) +{ + int vol, left, right; + ddksample_devc *devc = ossddk_mixer_get_devc (dev); + + switch (cmd) + { + case SOUND_MIXER_READ_DEVMASK: + case SOUND_MIXER_READ_STEREODEVS: + *arg = SOUND_MASK_VOLUME | SOUND_MASK_MIC | SOUND_MASK_RECLEV; + return OSSDDK_OK; + break; + + case SOUND_MIXER_READ_RECMASK: + case SOUND_MIXER_READ_RECSRC: + case SOUND_MIXER_WRITE_RECSRC: + *arg = SOUND_MASK_MIC; + return OSSDDK_OK; + break; + + case SOUND_MIXER_READ_VOLUME: + *arg = devc->mainvol_left | (devc->mainvol_right << 8); + return OSSDDK_OK; + break; + + case SOUND_MIXER_WRITE_VOLUME: + vol = *arg; + left = vol & 0xff; + right = (vol >> 8) & 0xff; + + if (left < 0) + left = 0; + if (left > 100) + left = 100; + if (right < 0) + right = 0; + if (right > 100) + right = 100; + + devc->mainvol_left = left; + devc->mainvol_right = right; + + *arg = devc->mainvol_left | (devc->mainvol_right << 8); + return OSSDDK_OK; + break; + + case SOUND_MIXER_READ_MIC: + case SOUND_MIXER_WRITE_MIC: + *arg = 100 | (100 << 8); /* Always full volume */ + return OSSDDK_OK; + break; + + case SOUND_MIXER_READ_RECLEV: + case SOUND_MIXER_WRITE_RECLEV: + *arg = 100 | (100 << 8); /* Always full volume */ + return OSSDDK_OK; + break; + + default: + return -EINVAL; + } +} + +static mixer_driver_t ddksample_mixer_driver = { + ddksample_legacy_mixer_ioctl, + MAX_SUBDEVICE * 4, /* Number of mixer elements we need */ + ddksample_create_controls +}; + +int +ddksample_mixer_init (ddksample_devc * devc) +{ + devc->mainvol_left = 100; + devc->mainvol_right = 100; + + if ((devc->mixer_dev = ossddk_install_mixer (OSS_MIXER_DRIVER_VERSION, + devc->osdev, + devc->osdev, + "OSS DDK sample mixer", + &ddksample_mixer_driver, + sizeof (mixer_driver_t), + devc)) >= 0) + return devc->mixer_dev; /* Error code */ + +#if 0 + /* + * By default OSS will delay creation of the mixer controls + * until the mixer is actually used by some application. This means + * that in some cases the mixer doesn't get created at all before + * the driver gets unloaded again. + * + * The driver can force the mixer to be created and the creation + * callback (ddksample_create_controls in our case) to be called + * immediately by calling ossddk_mixer_touch(). This is necessary only + * if the creation function performs initializations that must be + * done immediately. Otherwise the touch_mixer() routine must not be + * called. + * + * In this driver ossddk_mixer_touch() must not be called. Mixer + * initialization is designed to be invoked after audio devices are + * initialized. Otherwise devc->num_portc will not have right value + * and mixer initialization will fail. + */ + ossddk_mixer_touch (devc->mixer_dev); +#endif + + return OSSDDK_OK; +} |