USBD_PHDC_Rd

Description

Read PHDC data. This function is blocking.

Files

usbd_phdc.h / usbd_phdc.c

Prototype

CPU_INT08U  USBD_PHDC_Rd (CPU_INT08U   class_nbr,
                          void        *p_buf,
                          CPU_INT16U   buf_len,
                          CPU_INT16U   timeout,
                          USBD_ERR    *p_err);


Arguments

class_nbr

PHDC instance number.

p_buf

Pointer to buffer that will contain opaque data from metadata message preamble.

buf_len

Opaque data buffer length in octets.

timeout

Timeout in milliseconds.

p_err

Pointer to variable that will receive the return error code from this function.

USBD_ERR_NONE
USBD_ERR_INVALID_CLASS_STATE
USBD_ERR_INVALID_ARG
USBD_ERR_NULL_PTR
USBD_ERR_RX
USBD_ERR_DEV_INVALID_NBR
USBD_ERR_EP_INVALID_NBR
USBD_ERR_DEV_INVALID_STATE
USBD_ERR_EP_INVALID_TYPE
USBD_OS_ERR_TIMEOUT
USBD_OS_ERR_ABORT
USBD_OS_ERR_FAIL

Returned Value

Number of octets received, if no error(s).

0, otherwise.

Callers

Application.

Notes / Warnings

  1. USBD_PHDC_Rd() should always be called after USBD_PHDC_PreambleRd() if metadata message preambles are enabled by the host.
  2. Application should ensure that the length of the buffer provided is large enough to accommodate the incoming transfer. Otherwise, synchronization with metadata preambles might be lost.
  3. If host enable preamble while application is pending on this function, the call will immediately return with error ‘USBD_OS_ERR_ABORT’.