Versions Compared

Key

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

Since it is possible to send data with different QoS using a single bulk endpoint, you might want to prioritize the transfers by their QoS latency (medium latency transfers processed before high latency transfers, for instance). This kind of prioritization is implemented inside PHDC µC/OS-II and µC/OS-III RTOS layer. Table - QoS Based Scheduler Priority Values shows the priority value associated with each QoS latency (the lowest priority value will be treated first).

...

Panel
borderWidth0
titleTable - QoS Based Scheduler Priority Values


QoS latencyQoS based scheduler associated priority
Very high latency3
High latency2
Medium latency1



For instance, let’s say that your application has 3 tasks. Task A has an OS priority of 1, task B has an OS priority of 2 and task C has an OS priority of 3. Note that a low priority number indicates a high priority task. Now say that all 3 tasks want to write PHDC data of different QoS latency. Task A wants to write data that can have very high latency, task B wants to write data that can have medium latency, and finally, task C wants to write data that can have high latency. Table - QoS-Based Scheduling Example shows a summary of the tasks involved in this example.

...

Panel
borderWidth0
titleTable - QoS-Based Scheduling Example


TaskQoS latency of data to writeOS priorityQoS priority of data to write
AVery high13
BMedium21
CHigh32



If no QoS based priority management is implemented, the OS will then resume the tasks in the order of their OS priority. In this example, the task that has the higher OS priority, A, will be resumed first. However, that task wants to write data that can have very high latency (QoS priority of 3). A better choice would be to resume task B first, which wants to send data that can have medium latency (QoS priority of 1). Figure - Task Execution Order, Without QoS Based Scheduling and Figure - Task Execution Order, with QoS Based Scheduling represent this example without and with a QoS-based scheduler, respectively.

...

Panel
borderWidth0
titleTable - QoS-Based Scheduler API Summary


Function nameCalled byOperation
USBD_PHDC_OS_WrBulkLock()USBD_PHDC_Wr() or USBD_PHDC_PreambleWr(), depending if preambles are enabled or not.Locks write bulk pipe.
USBD_PHDC_OS_WrBulkUnlock()USBD_PHDC_Wr().Unlocks write bulk pipe.
USBD_PHDC_OS_WrBulkSchedTask()N/A.Determines next task to resume.



The pseudocode for these three functions is shown in the three following listings.

...

Code Block
languagecpp
titleListing - Pseudocode for QoS-Based Scheduler’s Task
linenumberstrue

static  void  USBD_PHDC_OS_WrBulkSchedTask (void *p_arg)
{
    Pend on scheduler lock semaphore;
 
    Get next highest QoS ready;
    PostSem(SemList[QoS]);
 
    Pend on scheduler release semaphore;
}

...