...
usbd_audio_drv_<codec-name>.h / usbd_audio_drv_<codec-name>.c
Prototype
Code Block |
---|
|
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 |
---|
language | cpp |
---|
title | Listing - USBD_Audio_DrvStreamRecordRx() Example Usage |
---|
linenumbers | true |
---|
|
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 |
---|
|
(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 . |