#include <sys/audio/audio_driver.h> int prefix_open(void *state, int flag, unsigned *nframes caddr_t *bufp);
void prefix_close(void *state);
pointer to driver supplied soft state
integer mask of flags indicating mode of the engine. 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.
pointer to an unsigned integer to receive the number of frames the associated buffer can hold
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 the responsibility for managing any resources associated 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 with DDI_NEVERSWAP_ACC if the buffer is allocated using ddi_dma_mem_alloc(9F).
Solaris DDI specific (Solaris DDI)
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.
The audio_engine_open() function also ensures that resources for the data buffer are properly allocated and that the circular 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 initialization work. It can perform expensive operations, including sleeping 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.
The audio_engine_open() function returns 0 on success or an error number on failure. See open(2) for possible error numbers.
The audio_engine_open() and audio_engine_close() functions are called from user or kernel context only.
See attributes(5) for descriptions of the following attributes: