Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/net/if.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@
# define IFF_IS_IPv4(f) (1)
#endif

/* MDIO Manageable Device (MMD) support with SIOCxMIIREG ioctl commands */

#define MDIO_PHY_ID_C45 0x8000
#define MDIO_PHY_ID_PRTAD 0x03E0
#define MDIO_PHY_ID_DEVAD 0x001F
#define MDIO_PHY_ID_C45_MASK \
(MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)

#define mdio_phy_id_c45(prtad, devad) \
((uint16_t)(MDIO_PHY_ID_C45 | ((prtad) << 5) | (devad)))

/* RFC 2863 operational status */

enum
Expand Down
14 changes: 13 additions & 1 deletion include/nuttx/net/netdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* include/nuttx/net/netdev.h
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-FileCopyrightText: 2007, 2009, 2011-2018 Gregory Nutt. All rights reserved.
* SPDX-FileCopyrightText: 2007,2009 Gregory Nutt. All rights reserved.
* SPDX-FileCopyrightText: 2011-2018 Gregory Nutt. All rights reserved.
* SPDX-FileCopyrightText: 2001-2003, Adam Dunkels. All rights reserved.
* SPDX-FileContributor: Gregory Nutt <[email protected]>
*
Expand Down Expand Up @@ -216,6 +217,17 @@
(netdev_ipv6_lookup(dev, addr, true) != NULL)
#endif

/* MDIO Manageable Device (MMD) support with SIOCxMIIREG ioctl commands */

#define mdio_phy_id_is_c45(phy_id) \
(((phy_id) & MDIO_PHY_ID_C45) && !((phy_id) & ~MDIO_PHY_ID_C45_MASK))

#define mdio_phy_id_prtad(phy_id) \
((uint16_t)(((phy_id) & MDIO_PHY_ID_PRTAD) >> 5))

#define mdio_phy_id_devad(phy_id) \
((uint16_t)((phy_id) & MDIO_PHY_ID_DEVAD))

/****************************************************************************
* Public Types
****************************************************************************/
Expand Down