USBD_Audio_OS_RingBufQLockAcquire

Description

Wait for a stream ring buffer queue to become available and acquire its lock.

Files

usbd_audio_os.h / usbd_audio_os.c

Prototype

void  USBD_Audio_OS_RingBufQLockAcquire (CPU_INT08U   as_if_nbr,
                                         CPU_INT16U   timeout_ms,
                                         USBD_ERR    *p_err);


Arguments

as_if_settings_ix

AudioStreaming interface settings index.

timeout_ms

Lock wait timeout in milliseconds.

p_err

Pointer to variable that will receive the return error code from this function.

USBD_ERR_NONE
USBD_ERR_OS_TIMEOUT
USBD_ERR_OS_ABORT
USBD_ERR_OS_FAIL                  

Returned Value

None.

Callers

Audio Class.

Implementation guidelines

  1. Typical implementation will consist in pending on a mutex or binary semaphore.

    p_err argument should be assigned as described in following table.

Table - Error Code Assignment for Pending on a Lock

Operation result

Error code to assign

No error

USBD_ERR_NONE

Pend timeout

USBD_ERR_OS_TIMEOUT

Pend aborted

USBD_ERR_OS_ABORT

Pend failed for any other reason

USBD_ERR_OS_FAIL