Porting PHDC to an RTOS

Porting PHDC to an RTOS

Since PHDC communication functions can be called from different tasks at application level, there is a need to protect the resources they use (in this case, the endpoint). Furthermore, since it is possible to send data with different QoS using a single bulk endpoint, an application might want to prioritize the transfers by their QoS (i.e. medium latency transfers processed before high latency transfers). This kind of prioritization can be implemented/customized inside the RTOS layer (see the PHDC RTOS QoS-based scheduler page, for more information). 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 Table - OS Layer API Summary. For a complete API description, see the PHDC API Reference.

Table - OS Layer API Summary

Function name

Operation

USBD_PHDC_OS_Init

Initializes all internal members / tasks.

USBD_PHDC_OS_RdLock

Locks read pipe.

USBD_PHDC_OS_RdUnlock()

Unlocks read pipe.

USBD_PHDC_OS_WrBulkLock

Locks write bulk pipe.

USBD_PHDC_OS_WrBulkUnlock

Unlocks write bulk pipe.

USBD_PHDC_OS_WrIntrLock

Locks write interrupt pipe.

USBD_PHDC_OS_WrIntrUnlock()

Unlocks write interrupt pipe.

USBD_PHDC_OS_Reset()

Resets OS layer members.