Google
 

Open Sound System
The Hitchhiker's Guide to OSS 4.1 Internals

Do you have problems with sound/audio application development? Don't panic! Click here for help!

adrv_alloc_buffer

Audio driver method for allocating the DMA buffer

Usage

int (*adrv_alloc_buffer) (int dev, dmap_t * dmap, int direction);

Description

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.

Audio device drivers don't usually define this method. By default the audio core will allocate an audio DMA buffer using itäs default method. In such case the driver may need to set the dmabuf_alloc_flags and dmabuf_maxaddr fields of it's adev_t structure if the device doesn' support the default allocation parameters (such as full 32 bit (PCI) address space.

If this driver method is defined then also the adrv_free_buffer method must be defined. The driver should initialize the dmabuf, dmabuf_phys and buffer_size fields of the dmap parameter (dmap_t). The dmabuf_phys field should be set to 0 if the device doesn't support mmap() access to the device.

If the DMA buffer cannot be allocated then the above fields should be set to 0 (or NULL) and the function should return a negative error code such as -ENOSPC.

Parameters

ParameterDescription
dmap This is a pointer to the dmap_t structure for this direction (recording or playback).
direction This is the direction (record or playback) the buffer is to be allocated for. OPEN_READ means recording and OPEN_WRITE means playback.

Return value

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.

Referenced by

audio/oss_audio_core.cAudio core functionality of OSS
include/ossddk.hSource file oss-current/kernel/framework/include/ossddk/ossddk.h


Copyright (C) 4Front Technologies, 2007. All rights reserved.
Back to index OSS web site