Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Now that the class instance has been correctly initialized, it’s time to exchange data. PHDC offers 4 functions to do so.  summarizes the communication functions provided by the PHDC implementation. See the PHDC API Reference for a complete API reference.

With Metadata Preamble

Via the preamble enabled callback, the application will be notified once the host enables the metadata preamble. If metadata preambles are enabled, you should use the following procedure to perform a read:

  • Call USBD_PHDC_PreambleRd(). Device expects metadata preamble from the host. This function will return opaque data and the number of incoming transfers that the host specified. Note that if the host disables preamble while the application is pending on that function, it will immediately return with error “USBD_ERR_OS_ABORT”.
  • Call USBD_PHDC_Rd() a number of times corresponding to the number of incoming transfers returned by USBD_PHDC_PreambleRd(). The application must ensure that the buffer provided to the function is large enough to accommodate all the data. Otherwise, synchronization issues might happen. Note that if the host enables preamble while the application is pending on that function, it will immediately return with error “USBD_ERR_OS_ABORT”.

You should use the following procedure to perform a write:

  • Call USBD_PHDC_PreambleWr(). The host expects metadata preamble from the device. The application will have to specify opaque data, transfer’s QoS (see ), and a number of following transfers to which the selected QoS applies.
  • Call USBD_PHDC_Wr() a number of times corresponding to the number of transfers following the preamble.

Without Metadata Preamble

If the device does not support metadata preamble or if it supports them but it has not been enabled by the host, you should not call USBD_PHDC_PreambleRd() and USBD_PHDC_PreambleWr().

  • No labels