audio: add methods and structures for streamin MMAP mode

Bug: 33398120
Test: make marlin-eng with ENABLE_TREBLE true
Change-Id: I65c5c7ba0a94ba47dca78ace38ef3ae75ea7e3bf
This commit is contained in:
Eric Laurent
2016-12-15 09:33:53 -08:00
parent cd6300e957
commit ed9fa0ed01
2 changed files with 71 additions and 0 deletions

View File

@@ -227,4 +227,56 @@ interface IStream {
* @param fd dump file descriptor.
*/
debugDump(handle fd);
/*
* Called by the framework to start a stream operating in mmap mode.
* createMmapBuffer() must be called before calling start().
* Function only implemented by streams operating in mmap mode.
*
* @return retval OK in case the success.
* NOT_SUPPORTED on non mmap mode streams
* INVALID_STATE if called out of sequence
*/
start() generates (Result retval);
/**
* Called by the framework to stop a stream operating in mmap mode.
* Function only implemented by streams operating in mmap mode.
*
* @return retval OK in case the succes.
* NOT_SUPPORTED on non mmap mode streams
* INVALID_STATE if called out of sequence
*/
stop() generates (Result retval) ;
/*
* Called by the framework to retrieve information on the mmap buffer used for audio
* samples transfer.
* Function only implemented by streams operating in mmap mode.
*
* @param minSizeFrames minimum buffer size requested. The actual buffer
* size returned in struct MmapBufferInfo can be larger.
* @return retval OK in case the success.
* NOT_SUPPORTED on non mmap mode streams
* NOT_INITIALIZED in case of memory allocation error
* INVALID_ARGUMENTS if the requested buffer size is too large
* INVALID_STATE if called out of sequence
* @return info a MmapBufferInfo struct containing information on the MMMAP buffer created.
*/
createMmapBuffer(int32_t minSizeFrames)
generates (Result retval, MmapBufferInfo info);
/*
* Called by the framework to read current read/write position in the mmap buffer
* with associated time stamp.
* Function only implemented by streams operating in mmap mode.
*
* @return retval OK in case the success.
* NOT_SUPPORTED on non mmap mode streams
* INVALID_STATE if called out of sequence
* @return position a MmapPosition struct containing current HW read/write position in frames
* with associated time stamp.
*/
getMmapPosition()
generates (Result retval, MmapPosition position);
};

View File

@@ -70,3 +70,22 @@ struct DeviceAddress {
string busAddress; // used for BUS
string rSubmixAddress; // used for REMOTE_SUBMIX
};
/*
* Mmap buffer descriptor returned by IStream.createMmapBuffer().
* Used by streams opened in mmap mode.
*/
struct MmapBufferInfo {
memory sharedMemory; // mmap memory buffer
int32_t bufferSizeFrames; // total buffer size in frames
int32_t burstSizeFrames; // transfer size granularity in frames
};
/*
* Mmap buffer read/write position returned by IStream.getMmapPosition().
* Used by streams opened in mmap mode.
*/
struct MmapPosition {
int64_t timeNanoseconds; // time stamp in ns, CLOCK_MONOTONIC
int32_t positionFrames; // increasing 32 bit frame count reset when IStream.stop() is called
};