include/net/if.h: Add mechanism for MMD access with SIOCxMIIREG ioctls
Add mdio_phy_id_c45 macro. This macro allows encoding of additional information needed for MMD access into the phy_id field of the mii_ioctl_data_s structure. This macro is intended for use by user applications. Add macros for decoding the phy_id encoded with the mdio_phy_id_c45 macro. These macros are intended for use by network drivers implementing SIOCxMIIREG commands. Signed-off-by: michal matias <mich4l.matias@gmail.com>
This commit is contained in:
parent
52d1877e2e
commit
8fc63aaa10
2 changed files with 24 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
*
|
||||
|
|
@ -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
|
||||
****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue