Changeset 5a78e4e in mainline for uspace/drv/nic/rtl8169/driver.c


Ignore:
Timestamp:
2014-06-16T21:59:28Z (10 years ago)
Author:
Agnieszka Tabaka <nufcia@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
91e057c
Parents:
72d120e
Message:

Added get_cable_state function implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/rtl8169/driver.c

    r72d120e r5a78e4e  
    456456static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
    457457{
     458
     459        str_cpy(info->vendor_name, NIC_VENDOR_MAX_LENGTH, "Realtek");
     460
    458461        return EOK;
    459462}
     
    461464static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    462465{
     466        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     467        uint8_t phystatus = pio_read_8(rtl8169->regs + PHYSTATUS);
     468
     469        if (phystatus & PHYSTATUS_LINK)
     470                *state = NIC_CS_PLUGGED;
     471        else
     472                *state = NIC_CS_UNPLUGGED;
     473
    463474        return EOK;
    464475}
Note: See TracChangeset for help on using the changeset viewer.