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  CPU_BOOLEAN  USBD_Audio_DrvStreamStop (USBD_AUDIO_DRV  *p_audio_drv,
                                               CPU_INT08U       terminal_id_link);


Arguments

p_audio_drv

Pointer to audio driver structure.

...

This listing shows an example usage of this function handling record and playback streams.

Anchor
Listing - USBD_Audio_DrvStreamStop() Example Usage
Listing - USBD_Audio_DrvStreamStop() Example Usage

Code Block
languagecpp
titleListing - USBD_Audio_DrvStreamStop() Example Usage
linenumberstrue
static  CPU_BOOLEAN  USBD_Audio_DrvStreamStop (USBD_AUDIO_DRV  *p_audio_drv,
                                               CPU_INT08U       terminal_id_link)
{
    if (terminal_id_link == Mic_OT_USB_IN_ID) {                                   (1)
	    /* $$$$ Abort ongoing DMA transfer(s). */						          (2)

    	/* $$$$ Disable record operations on audio chip. */			              (3)

    } else if (terminal_id_link == Speaker_IT_USB_OUT_ID) {
	    /* $$$$ Abort ongoing DMA transfer(s). */						          (2)

    	/* $$$$ Disable playback operations on audio chip. */			          (3)
    }

    return (DEF_OK);
}


Panel

(1) If the function handles different streams, the terminal ID allows to differentiate them.

(2) Abort ongoing DMA transfer(s). The buffer associated to the DMA transfer may be freed with USBD_Audio_RecordBufFree() or USBD_Audio_PlaybackBufFree into the ISR responsible for DMA data transfer completion.

(3) You may have to disable the record or playback operations on the audio chip. It could be disabling some clocks, disabling some modules, etc. It may require sending a series of I2C commands for registers access,