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

Function cvi_eth_mac_control

bsp/cvitek/drivers/libraries/eth/dw_eth_mac.c:564–621  ·  view source on GitHub ↗

\brief Control Ethernet Interface. \param[in] handle ethernet handle \param[in] control Operation \param[in] arg Argument of operation (optional) \return error code */

Source from the content-addressed store, hash-verified

562 \return error code
563*/
564int32_t cvi_eth_mac_control(eth_mac_handle_t handle, uint32_t control, uint32_t arg)
565{
566 RT_ASSERT(handle);
567
568 gmac_dev_t *mac_dev = (gmac_dev_t *)handle;
569 int32_t ret = 0;
570
571 RT_ASSERT(mac_dev->phy_dev);
572
573 switch (control) {
574 case CSI_ETH_MAC_CONFIGURE:
575 if (arg) {
576 /* startup mac */
577 ret = designware_eth_start(handle);
578 } else {
579 /* stop mac */
580 designware_eth_stop(handle);
581 }
582 break;
583
584 case DRV_ETH_MAC_ADJUST_LINK:
585 ret = designware_adjust_link(handle);
586 break;
587
588 case CSI_ETH_MAC_CONTROL_TX:
589 if (arg) {
590 /* enable TX */
591 ret = designware_eth_enable(handle, CSI_ETH_MAC_CONTROL_TX);
592 } else {
593 /* disable TX */
594 ret = designware_eth_disable(handle, CSI_ETH_MAC_CONTROL_TX);
595 }
596 break;
597
598 case CSI_ETH_MAC_CONTROL_RX:
599 if (arg) {
600 /* enable RX */
601 ret = designware_eth_enable(handle, CSI_ETH_MAC_CONTROL_RX);
602 } else {
603 /* disable RX */
604 ret = designware_eth_disable(handle, CSI_ETH_MAC_CONTROL_RX);
605 }
606 break;
607
608 case DRV_ETH_MAC_CONTROL_IRQ:
609 if (arg) {
610 /* enable interrupt */
611 } else {
612 /* disable interrupt */
613 }
614 break;
615
616 default:
617 break;
618 };
619
620 return ret;
621}

Callers 1

cvi_eth_mac_phy_enableFunction · 0.85

Calls 5

designware_eth_startFunction · 0.85
designware_eth_stopFunction · 0.85
designware_adjust_linkFunction · 0.85
designware_eth_enableFunction · 0.85
designware_eth_disableFunction · 0.85

Tested by

no test coverage detected