The audio class uses its own RTOS abstraction layer providing specific services needed by the two internal tasks, playback and record. Both tasks requires a queue to process certain types of messages. The playback task will receive events each time an audio transfer has completed. The record task will receive AudioStreaming requests to retrieve ready buffers from the Audio Peripheral driver and submit them to the USB device driver. A delay used by the playback and the record tasks in certain error conditions is also available from the audio RTOS layer. Two different lock mechanisms are also utilized to protect each AudioStreaming's structure and ring buffer queue.
By default, Micrium will provide an RTOS layer for both μC/OS-II and μC/OS-III. However, it is possible to create your own RTOS layer. Your layer will need to implement the functions listed in . For a complete API description, see the Audio API Reference.
OS Tick Rate
Whenever possible, USBD_Audio_OS_DlyMs
should provide a delay with a 1 ms granularity. That is the OS tick rate should be set to produce at least 1 tick per millisecond.. It will improve the audio class tasks scheduling as audio class works on a 1 ms frame basis. Moreover, a retry mechanism is implemented in the playback and record tasks in case a transfer cannot be queued on a given endpoint. The playback or record task waits 1 ms between each attempt before re-transmitting the transfer.