USBD_PHDC_PreambleRd

Description

Read metadata preamble. This function is blocking.

Files

usbd_phdc.h / usbd_phdc.c

Prototype

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


Arguments

class_nbr

PHDC instance number.

p_buf

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

buf_len

Opaque data buffer length in octets.

p_nbr_xfer

Pointer to a variable that will contain the number of transfer the preamble will apply to. After this call, USBD_PHDC_Rd shall be called nbr_xfer times by the application.

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_ALLOC
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

Length of opaque data read from metadata preamble, if no error.

0, otherwise

Callers

Application.

Notes / Warnings

  1. USBD_PHDC_PreambleRd() should always be called before USBD_PHDC_Rd if metadata message preambles are enabled by the host. Application should then call USBD_PHDC_Rd p_nbr_xfer times.
  2. If host disable preamble while application is pending on this function, the call will immediately return with error ‘USBD_OS_ERR_ABORT’.