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

Function rt_vbus_data_pop

components/vbus/vbus.c:518–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518struct rt_vbus_data* rt_vbus_data_pop(unsigned int id)
519{
520 struct rt_vbus_data *act;
521 rt_base_t level;
522
523 RT_ASSERT(0 < id && id < RT_VBUS_CHANNEL_NR);
524
525 level = rt_hw_interrupt_disable();
526
527 act = _bus_in_action[id][_IN_ACT_HEAD];
528 if (act)
529 {
530 _bus_in_action[id][_IN_ACT_HEAD] = act->next;
531 }
532
533 rt_hw_interrupt_enable(level);
534
535#ifdef RT_VBUS_USING_FLOW_CONTROL
536 if (_chn_recv_wm[id].level != 0)
537 {
538 _chn_recv_wm[id].level--;
539 if (_chn_recv_wm[id].level <= _chn_recv_wm[id].low_mark &&
540 _chn_recv_wm[id].last_warn > _chn_recv_wm[id].low_mark)
541 {
542 unsigned char buf[2];
543
544 buf[0] = RT_VBUS_CHN0_CMD_RESUME;
545 buf[1] = id;
546 vbus_debug("%s --> remote\n", dump_cmd_pkt(buf, sizeof(buf)));
547 _chn0_post(buf, sizeof(buf), RT_WAITING_FOREVER);
548 _chn_recv_wm[id].last_warn = 0;
549 }
550 }
551#endif
552 return act;
553}
554
555/* dump cmd that is not start with ACK/NAK */
556static size_t __dump_naked_cmd(char *dst, size_t lsize,

Callers 2

rt_vbus_close_chnFunction · 0.85
_readFunction · 0.85

Calls 4

dump_cmd_pktFunction · 0.85
_chn0_postFunction · 0.85
rt_hw_interrupt_disableFunction · 0.50
rt_hw_interrupt_enableFunction · 0.50

Tested by

no test coverage detected