third_party/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
/**
 * Read handler for Device Status register.
 *
 * Get the link status from PHY.
 *
 * @returns VBox status code.
 *
 * @param   pThis       The device state structure.
 * @param   offset      Register offset in memory-mapped frame.
 * @param   index       Register index in register array.
 * @param   mask        Used to implement partial reads (8 and 16-bit).
 */
Read handler for Device Status register.
Get the link status from PHY.

@returns VBox status code.

@param   pThis       The device state structure.
@param   offset      Register offset in memory-mapped frame.
@param   index       Register index in register array.
@param   mask        Used to implement partial reads (8 and 16-bit).
Read handler for Device Status register . Get the link status from PHY . @returns VBox status code . @param pThis The device state structure . @param offset Register offset in memory - mapped frame . @param index Register index in register array . @param mask Used to implement partial reads ( 8 and 16 - bit ) .
static int e1kRegReadCTRL(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint32_t *pu32Value)
{
    E1kLog(("%s e1kRegReadCTRL: mdio dir=%s mdc dir=%s mdc=%d\n",
            pThis->szPrf, (CTRL & CTRL_MDIO_DIR)?"OUT":"IN ",
            (CTRL & CTRL_MDC_DIR)?"OUT":"IN ", !!(CTRL & CTRL_MDC)));
    if ((CTRL & CTRL_MDIO_DIR) == 0 && (CTRL & CTRL_MDC))
    {
        if (Phy::readMDIO(&pThis->phy))
            *pu32Value = CTRL | CTRL_MDIO;
        else
            *pu32Value = CTRL & ~CTRL_MDIO;
        E1kLog(("%s e1kRegReadCTRL: Phy::readMDIO(%d)\n",
                pThis->szPrf, !!(*pu32Value & CTRL_MDIO)));
    }
    else
    {
        *pu32Value = CTRL;
    }
    return VINF_SUCCESS;
}
static int e1kRegReadCTRL ( PE1KSTATE pThis , uint32_t offset , uint32_t index , uint32_t * pu32Value ) { E1kLog ( ( " \n " , pThis -> szPrf , ( CTRL & CTRL_MDIO_DIR ) ? " " : " " , ( CTRL & CTRL_MDC_DIR ) ? " " : " " , ! ! ( CTRL & CTRL_MDC ) ) ) ; if ( ( CTRL & CTRL_MDIO_DIR ) == 0 && ( CTRL & CTRL_MDC ) ) { if ( Phy :: readMDIO ( & pThis -> phy ) ) * pu32Value = CTRL | CTRL_MDIO ; else * pu32Value = CTRL & ~ CTRL_MDIO ; E1kLog ( ( " \n " , pThis -> szPrf , ! ! ( * pu32Value & CTRL_MDIO ) ) ) ; } else { * pu32Value = CTRL ; } return VINF_SUCCESS ; }
Read handler for Device Status register.
Read handler for Device Status register .
/* MDC is high and MDIO pin is used for input, read MDIO pin from PHY */ /* MDIO pin is used for output, ignore it */