Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

usbd_audio_drv_<codec-name>.h / usbd_audio_drv_<codec-name>.c

Prototype

Code Block
languagecpp
static  void  USBD_Audio_DrvStreamRecordRx (USBD_AUDIO_DRV  *p_audio_drv,
                                            CPU_INT08U       terminal_id_link,
                                            void            *p_buf,
                                            CPU_INT16U      *p_buf_len,
                                            USBD_ERR        *p_err)


Arguments

p_audio_drv

Pointer to audio driver structure.

...

This listing shows an example usage of this function.

Anchor
Listing - USBD_Audio_DrvStreamRecordRx() Example Usage
Listing - USBD_Audio_DrvStreamRecordRx() Example Usage

Code Block
languagecpp
titleListing - USBD_Audio_DrvStreamRecordRx() Example Usage
linenumberstrue
static  void  *USBD_Audio_DrvStreamRecordRx (USBD_AUDIO_DRV  *p_audio_drv,
                                             CPU_INT08U       terminal_id_link,
											 void            *p_buf,
                                             CPU_INT16U      *p_buf_len,
                                             USBD_ERR        *p_err)
{
	/* $$$$ Retrieve a ready record buffer. */						          (1)
}


Panel
bgColor#f0f0f0

(1) When an audio transfer is completed, the codec driver should signal the record task that a buffer is ready by sending calling the function USBD_Audio_RecordRxCmpl. This function will post a request to the record task. Upon reception of this request, the record task will call the function USBD_Audio_DrvStreamRecordRx() through a function pointer to get a ready buffer. If the audio peripheral uses DMA, the buffer is already ready and there is nothing special to do in this function. If the audio peripheral uses a FIFO mode, you may have to copy the received audio samples to the buffer referenced by the pointer p_buf.


Tip

The Audio Peripheral Driver should support at least double-buffering to optimize the record streaming.

(2) In case of error, you may return the error code USBD_ERR_RX.