cancel
Showing results for 
Search instead for 
Did you mean: 

Working with STM32 CDC_RNDIS USB library. Trying to understand the (*Process) function in USBD_CDC_RNDIS_ItfTypeDef

HCour.1
Associate II

Hi,

I'm trying to understand the purpose of CDC_RNDIS_Itf_Process in usbd_cdc_rndis_if_template.c. The @brief for this function is the same as CDC_RNDIS_Itf_Receive function, which I think is incorrect. I can't find any calls to this function ( USB_CDC_RNDIS_ItfTypdef -> Process(...) ) in any of the library code, so I'm not sure about it's purpose.

What is the purpose of this function?

from:

STM32_USB_Device_Libarary / Class / CDC_RNDIS / Src / usbd_cdc_rndis_if_template.c

/**

 * @brief CDC_RNDIS_Itf_Receive

 *     Data received over USB OUT endpoint are sent over CDC_RNDIS interface

 *     through this function.

/**

 * @brief CDC_RNDIS_Itf_Process

 *     Data received over USB OUT endpoint are sent over CDC_RNDIS interface

 *     through this function.

3 REPLIES 3
Sarra.S
ST Employee

Hello @HCour.1​ and welcome to ST Community :smiling_face_with_smiling_eyes:,

The purpose of this function in usbd_cdc_rndis_if_template.c is to receive data sent over USB OUT endpoint and process it over CDC_RNDIS interface.

it is also responsible for processing the data received from the host computer and sending it back to the host computer.

it also ensures that the data received from the host is valid, that the request is processed properly. and that the data is sent back to the host computer in the correct format.

You can refer to STM32 USB training - 09.1 USB CDC device basic labs to learn more about it

Hope that helps!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

HCour.1
Associate II

Hi @Sarra.S

Thanks for your answer. I'm still not clear about the difference between (*Process) and (*Receive) in CDC_RNDIS. I have watched the video you referenced. This is for the CDC_VCP Virtual Comm Port. CDC VCP does not have the (*Process) function in it's Interface USB_CDC_ItfTypeDef.

Please note the difference between USB_CDC_ItfTypeDef and USB_CDC_RNDIS_ItfTypeDef which has the (*Process) function pointer. This is the function I am trying to understand.

typedef struct _USBD_CDC_Itf

{

 int8_t (* Init)(void);

 int8_t (* DeInit)(void);

 int8_t (* Control)(uint8_t cmd, uint8_t *pbuf, uint16_t length);

 int8_t (* Receive)(uint8_t *Buf, uint32_t *Len);

 int8_t (* TransmitCplt)(uint8_t *Buf, uint32_t *Len, uint8_t epnum);

} USBD_CDC_ItfTypeDef;

typedef struct _USBD_CDC_RNDIS_Itf

{

 int8_t (* Init)(void);

 int8_t (* DeInit)(void);

 int8_t (* Control)(uint8_t cmd, uint8_t *pbuf, uint16_t length);

 int8_t (* Receive)(uint8_t *Buf, uint32_t *Len);

 int8_t (* TransmitCplt)(uint8_t *Buf, uint32_t *Len, uint8_t epnum);

 int8_t (* Process)(USBD_HandleTypeDef *pdev);

 uint8_t *pStrDesc;

} USBD_CDC_RNDIS_ItfTypeDef;

Jacob WOODRUFF
ST Employee

Hi All,

This question has been routed to the Online Support System for priority support from ST and all of the teams here.

Any other customer who has other questions can always submit a ticket directly to us at the following link for priority support.

http://my.st.com/ols

Regards,

Jake

ST Support