2 * @brief Common PHY functions
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __LPC_PHY_H_
\r
33 #define __LPC_PHY_H_
\r
42 /** @defgroup BOARD_PHY BOARD: Board specific PHY drivers
\r
43 * @ingroup BOARD_Common
\r
44 * The simple PHY function API provides simple non-blocking PHY status
\r
45 * monitoring and initialization support for various Ethernet PHYs.
\r
46 * To initialize the PHY, call lpc_phy_init() once. lpc_phy_init() requires
\r
47 * several standard functions from the MAC driver for interfacing to the
\r
48 * PHY via a MII link (Chip_ENET_StartMIIWrite(), Chip_ENET_IsMIIBusy(),
\r
49 * Chip_ENET_StartMIIRead(), and Chip_ENET_ReadMIIData()).
\r
51 * Once initialized, just preiodically call the lpcPHYStsPoll() function
\r
52 * from the background loop or a thread and monitor the returned status
\r
53 * to determine if the PHY state has changed and the current PHY state.
\r
56 #define PHY_LINK_ERROR (1 << 0) /*!< PHY status bit for link error */
\r
57 #define PHY_LINK_BUSY (1 << 1) /*!< PHY status bit for MII link busy */
\r
58 #define PHY_LINK_CHANGED (1 << 2) /*!< PHY status bit for changed state (not persistent) */
\r
59 #define PHY_LINK_CONNECTED (1 << 3) /*!< PHY status bit for connected state */
\r
60 #define PHY_LINK_SPEED100 (1 << 4) /*!< PHY status bit for 100Mbps mode */
\r
61 #define PHY_LINK_FULLDUPLX (1 << 5) /*!< PHY status bit for full duplex mode */
\r
64 * @brief Phy status update state machine
\r
65 * @return An Or'ed value of PHY_LINK_* statuses
\r
66 * @note This function can be called at any rate and will poll the the PHY status. Multiple
\r
67 * calls may be needed to determine PHY status.
\r
69 uint32_t lpcPHYStsPoll(void);
\r
72 * @brief Initialize the PHY
\r
73 * @param rmii : Initializes PHY for RMII mode if true, MII if false
\r
74 * @param pDelayMsFunc : Delay function (in mS) used for this driver
\r
75 * @return PHY_LINK_ERROR or 0 on success
\r
76 * @note This function initializes the PHY. It will block until complete. It will not
\r
77 * wait for the PHY to detect a connected cable and remain busy. Use lpcPHYStsPoll to
\r
78 * detect cable insertion.
\r
80 uint32_t lpc_phy_init(bool rmii, p_msDelay_func_t pDelayMsFunc);
\r
90 #endif /* __LPC_PHY_H_ */
\r