Versions Compared

Key

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

...

  • Allocating an optional internal data structure using µC/LIB memory functions (refer to Memory Allocation Functions). This structure can then be saved in the DataPtr field of USBD_AUDIO_DRV structure. 
  • Setting all clocks required by peripherals (for instance I2C, I2S controllers, etc.) communicating with the audio chip.
  • Setting any I/O required to interface peripherals to the audio chip.
  • Setting any interrupt needed by peripherals. It may also encompass installing ISR (Interrupt Service Routine) for those peripherals (for instance, an ISR for I2C communication, an ISR for I2S communication if no DMA is used).
  • Initializing the DMA controller if it is used to transfer audio data. 
  • Initializing the audio chip by configuring its registers accessed by I2C or SPI for instance.
  • Initializing any software resources needed for the driver functioning. For instance:
    • Allocating DMA descriptors if it is required by your DMA controller implementation from the heap or a dedicated memory using µC/LIB memory functions (refer to Memory Allocation Functions).
    • Allocating the silence buffer using µC/LIB memory functions if a playback stream is required and initializing it with zeros using Mem_Clr().
    • Allocating a dummy buffer using µC/LIB memory functions if a record stream is required.
  • Set p_err to USBD_ERR_AUDIO_CODEC_INIT_FAILED if any error occurs during the initialization sequence. Otherwise set it to USBD_ERR_NONE.

...