Open Sound System
|Do you have problems with sound/audio application development? Don't panic! Click here for help!|
int (*adrv_prepare_for_input) (int dev, int fragsize, int nfrags);
The first paramater (
dev) is anways the audio engine number which is an index to the audio_engines table. The driver can use the audio_engines entry to find out some of the current parameters. In particular the devc, portc, portc_play and portc_record fields can be used to locate the driver defined structures for the audio engine.
Purpose of this audio driver method is to prepare the audio engine to be ready to start recording after a moment (however recording should not be started yet).
Audio core will call this function as the first action when the application has called read for the first time. It may also get called when an application calls SNDCTL_DSP_SETTRIGGER to start recording.
Typically this method initializes the device registers for sample rate, format and number of channels. In addition it should program the DMA related registers and set the interrupts to tick on fragment boundaries. If there are any problems with setting up the device this function can return negative error number (such as -EIO). Otherwise it should return 0.
After adrv_prepare_for_input the audio core will call adrv_start_input (if defined) and then adrv_trigger to finally trigger the device.
|Fragment size in bytes.|
|Number of fragments to transfer|
In addition to the above parameters this method may use fields of the adev_t structure (
audio_engines[dev]) and in particular the dmap_in descriptor (audio_engines[dev]->dmap_in). The following fields of dmap_in are most useful.
|Program the DMA start address register to point to this address.|
|Size of one buffer fragment (in bytes). Program the device raise an interrupt on every fragment boundary.|
|Number of bytes used from the DMA buffer. Parts of the allocated DMA buffer may be unused if the application has requested smalled buffer than the default. The driver should program this value to the DMA transfer size register (if the device has one).|
Audio driver entry point should return 0 if the call was successful. Negative return value (-errno) means that an error has occurred. However some of the functions have void type and they don't return any value.
|audio/oss_audio_core.c||Audio core functionality of OSS|
|include/ossddk.h||Source file oss-current/kernel/framework/include/ossddk/ossddk.h|