Driver Entry Points audio_engine_open(9E)
NAME
audio_engine_open, audio_engine_close - open or close an
audio engineSYNOPSIS
#include
int prefix_open(void *state, int flag, unsigned *nframes
caddr_t *bufp);
void prefix_close(void *state);
PARAMETERS
state pointer to driver supplied soft state flag integer mask of flags indicating mode of theengine. ENGINE_INPUT indicates the engine is
opened for recording. ENGINE_OUTPUT indicates the
engine is opened for playback. All other possible bits are reserved and should be ignored by the driver. nframes pointer to an unsigned integer to receive the number of frames the associated buffer can hold bufp pointer to receive the address of the buffer for the engine. The buffer is allocated by the engine, and is a circular FIFO big enough to hold all of the frames configured. The driver has theresponsibility for managing any resources associ-
ated with the buffer. The driver should not make any assumptions about the type of accesses to the buffer made by the framework or application. Therefore, it should be configured withDDI_NEVERSWAP_ACC if the buffer is allocated
using ddi_dma_mem_alloc(9F).
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI)DESCRIPTION
The audio_engine_open() function opens and initializes the
DMA engine and configures any associated hardware (such as sample rate or format conversion logic) for the device.SunOS 5.11 Last change: 16 Apr 2010 1
Driver Entry Points audio_engine_open(9E)
The audio_engine_open() function also ensures that resources
for the data buffer are properly allocated and that the cir-
cular buffer is primed and ready for use by the framework and audio clients.The audio_engine_open() function does not actually start any
data transfer, but merely does much of the initializationwork. It can perform expensive operations, including sleep-
ing allocations or blocking on resources.The audio_engine_close() function undoes the effects of
audio_engine_open()and may deallocate resources that were
allocated during audio_engine_open(). The framework ensures
that audio_engine_stop(9E) is issued on any running engine
before calling audio_engine_close().
Once audio_engine_close() returns, the frame counter for the
engine must be reset to 0. The framework will not access the device buffer for an engine that is not open, so buffer resources may be released at this point.RETURN VALUES
The audio_engine_open() function returns 0 on success or an
error number on failure. See open(2) for possible error numbers.CONTEXT
The audio_engine_open() and audio_engine_close() functions
are called from user or kernel context only.ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
SEE ALSO
open(2), attributes(5), audio_engine_stop(9E),
ddi_dma_mem_alloc(9F), audio_engine_ops(9S)
SunOS 5.11 Last change: 16 Apr 2010 2