1.1.5.3.7 DRV_I2S_BufferStatusGet Function

DRV_I2S_BUFFER_EVENT DRV_I2S_BufferStatusGet

(

const DRV_I2S_BUFFER_HANDLE bufferHandle

)

Summary

Returns the transmit/receive request status.

Description

This function can be used to poll the status of the queued buffer request if the application doesn't prefer to use the event handler (callback) function to get notified.

Preconditions

DRV_I2S_Open must have been called to obtain a valid opened device handle.

Either the DRV_I2S_ReadBufferAdd or DRV_I2S_WriteBufferAdd function must have been called and a valid buffer handle returned.

Parameters

ParametersDescription
bufferhandleHandle for the buffer of which the processed number of bytes to be obtained.

Returns

The success or error event of the buffer.

Remarks

This function returns error event if the buffer handle is invalid.

Example

_// myAppObj is an application specific object._

MY_APP_OBJ myAppObj;

uint8_t mybuffer[MY_BUFFER_SIZE]; DRV_I2S_BUFFER_HANDLE bufferHandle;

DRV_I2S_BUFFER_EVENT event;

_// myI2SHandle is the handle returned_ _// by the DRV_I2S_Open function._

_// Client registers an event handler with driver. This is done once_

DRV_I2S_BufferEventHandlerSet( myI2SHandle, APP_I2SBufferEventHandle,

(uintptr_t)&myAppObj );

DRV_I2S_ReadBufferAdd( myI2Shandle, myBuffer, MY_BUFFER_SIZE, bufferHandle); if(DRV_I2S_BUFFER_HANDLE_INVALID == bufferHandle) {

_// Error handling here_

}

_//Check the status of the buffer_ _//This call can be used to wait until the buffer is processed._

event = DRV_I2S_BufferStatusGet(bufferHandle);

C

DRV_I2S_BUFFER_EVENT DRV_I2S_BufferStatusGet(const DRV_I2S_BUFFER_HANDLE bufferHandle);