MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _function_disable

Function _function_disable

components/legacy/usb/usbdevice/class/rndis.c:1001–1038  ·  view source on GitHub ↗

* This function will stop cdc class, it will be called on handle set configuration request. * * @param device the usb device object. * * @return RT_EOK on successful. */

Source from the content-addressed store, hash-verified

999 * @return RT_EOK on successful.
1000 */
1001static rt_err_t _function_disable(ufunction_t func)
1002{
1003 LOG_I("plugged out");
1004
1005#ifdef RNDIS_DELAY_LINK_UP
1006 /* stop link up timer. */
1007 rt_timer_stop(&((rt_rndis_eth_t)func->user_data)->timer);
1008#endif /* RNDIS_DELAY_LINK_UP */
1009
1010 /* clean resp chain list. */
1011 {
1012 struct rt_rndis_response * response;
1013 rt_base_t level = rt_hw_interrupt_disable();
1014
1015 while(!rt_list_isempty(&((rt_rndis_eth_t)func->user_data)->response_list))
1016 {
1017 response = (struct rt_rndis_response *)((rt_rndis_eth_t)func->user_data)->response_list.next;
1018 LOG_D("remove resp chain list!");
1019
1020 rt_list_remove(&response->list);
1021 rt_free((void *)response->buffer);
1022 rt_free(response);
1023 }
1024
1025 ((rt_rndis_eth_t)func->user_data)->need_notify = RT_TRUE;
1026 rt_hw_interrupt_enable(level);
1027 }
1028
1029
1030 /* link down. */
1031 eth_device_linkchange(&((rt_rndis_eth_t)func->user_data)->parent, RT_FALSE);
1032
1033 /* reset eth rx tx */
1034 ((rt_rndis_eth_t)func->user_data)->rx_frist = RT_TRUE;
1035 ((rt_rndis_eth_t)func->user_data)->rx_flag = RT_FALSE;
1036
1037 return RT_EOK;
1038}
1039
1040
1041static struct ufunction_ops ops =

Callers

nothing calls this directly

Calls 7

rt_timer_stopFunction · 0.85
rt_list_isemptyFunction · 0.85
rt_list_removeFunction · 0.85
rt_freeFunction · 0.85
eth_device_linkchangeFunction · 0.85
rt_hw_interrupt_disableFunction · 0.50
rt_hw_interrupt_enableFunction · 0.50

Tested by

no test coverage detected