Mistake on this page?
Report an issue in GitHub or email us
lpc_phy.h
Go to the documentation of this file.
1 /**********************************************************************
2 * $Id$ lpc_phy.h 2011-11-20
3 *//**
4 * @file lpc_phy.h
5 * @brief Common PHY definitions used with all PHYs
6 * @version 1.0
7 * @date 20 Nov. 2011
8 * @author NXP MCU SW Application Team
9 *
10 * Copyright(C) 2011, NXP Semiconductor
11 * All rights reserved.
12 *
13 ***********************************************************************
14 * Software that is described herein is for illustrative purposes only
15 * which provides customers with programming information regarding the
16 * products. This software is supplied "AS IS" without any warranties.
17 * NXP Semiconductors assumes no responsibility or liability for the
18 * use of the software, conveys no license or title under any patent,
19 * copyright, or mask work right to the product. NXP Semiconductors
20 * reserves the right to make changes in the software without
21 * notification. NXP Semiconductors also make no representation or
22 * warranty that such application will be suitable for the specified
23 * use without further testing or modification.
24 **********************************************************************/
25 
26 #ifndef __LPC_PHY_H_
27 #define __LPC_PHY_H_
28 
29 /* These PHY functions are usually part of the EMAC driver */
30 
31 /** \brief Phy status update state machine
32  *
33  * This function provides a state machine for maintaining the PHY
34  * status without blocking. It must be occasionally called for the
35  * PHY status to be maintained.
36  *
37  * \param[in] lpc17_emac LPC17 EMAC
38  */
39 
40 int32_t lpc_phy_sts_sm(LPC17_EMAC *lpc17_emac);
41 
42 /** \brief Initialize the PHY
43  *
44  * This function initializes the PHY. It will block until complete.
45  * This function is called as part of the EMAC driver
46  * initialization. Configuration of the PHY at startup is
47  * controlled by setting up configuration defines in lpc_phy.h.
48  *
49  * \param[in] lpc17_emac LPC17 EMAC
50  * \param[in] rmii If set, configures the PHY for RMII mode
51  * \return ERR_OK if the setup was successful, otherwise ERR_TIMEOUT
52  */
53 bool lpc_phy_init(LPC17_EMAC *lpc17_emac, int rmii);
54 
55 /** \brief Write a value via the MII link (non-blocking)
56  *
57  * This function will write a value on the MII link interface to a PHY
58  * or a connected device. The function will return immediately without
59  * a status. Status needs to be polled later to determine if the write
60  * was successful.
61  *
62  * \param[in] PhyReg PHY register to write to
63  * \param[in] Value Value to write
64  */
65 void lpc_mii_write_noblock(uint32_t PhyReg, uint32_t Value);
66 
67 /** \brief Write a value via the MII link (blocking)
68  *
69  * This function will write a value on the MII link interface to a PHY
70  * or a connected device. The function will block until complete.
71  *
72  * \param[in] PhyReg PHY register to write to
73  * \param[in] Value Value to write
74  * \returns 0 if the write was successful, otherwise !0
75  */
76 bool lpc_mii_write(uint32_t PhyReg, uint32_t Value);
77 
78 /** \brief Reads current MII link busy status
79  *
80  * This function will return the current MII link busy status and is meant to
81  * be used with non-blocking functions for monitor PHY status such as
82  * connection state.
83  *
84  * \returns !0 if the MII link is busy, otherwise 0
85  */
86 uint32_t lpc_mii_is_busy(void);
87 
88 /** \brief Starts a read operation via the MII link (non-blocking)
89  *
90  * This function returns the current value in the MII data register. It is
91  * meant to be used with the non-blocking oeprations. This value should
92  * only be read after a non-block read command has been issued and the
93  * MII status has been determined to be good.
94  *
95  * \returns The current value in the MII value register
96  */
97 uint32_t lpc_mii_read_data(void);
98 
99 /** \brief Starts a read operation via the MII link (non-blocking)
100  *
101  * This function will start a read operation on the MII link interface
102  * from a PHY or a connected device. The function will not block and
103  * the status mist be polled until complete. Once complete, the data
104  * can be read.
105  *
106  * \param[in] PhyReg PHY register to read from
107  * \param[in] data Pointer to where to save data read via MII
108  * \returns 0 if the read was successful, otherwise !0
109  *
110  */
111 bool lpc_mii_read(uint32_t PhyReg, uint32_t *data);
112 
113 /** \brief Read a value via the MII link (blocking)
114  *
115  * This function will read a value on the MII link interface from a PHY
116  * or a connected device. The function will block until complete.
117  *
118  * \param[in] PhyReg PHY register to read from
119  */
120 void lpc_mii_read_noblock(uint32_t PhyReg);
121 
122 /**
123  * This function provides a method for the PHY to setup the EMAC
124  * for the PHY negotiated duplex mode.
125  *
126  * @param[in] full_duplex 0 = half duplex, 1 = full duplex
127  */
128 void lpc_emac_set_duplex(int full_duplex);
129 
130 /**
131  * This function provides a method for the PHY to setup the EMAC
132  * for the PHY negotiated bit rate.
133  *
134  * @param[in] mbs_100 0 = 10mbs mode, 1 = 100mbs mode
135  */
136 void lpc_emac_set_speed(int mbs_100);
137 
138 #endif /* __LPC_PHY_H_ */
139 
140 /* --------------------------------- End Of File ------------------------------ */
int32_t lpc_phy_sts_sm(LPC17_EMAC *lpc17_emac)
Phy status update state machine.
uint32_t lpc_mii_is_busy(void)
Reads current MII link busy status.
void lpc_mii_write_noblock(uint32_t PhyReg, uint32_t Value)
Write a value via the MII link (non-blocking)
void lpc_emac_set_duplex(int full_duplex)
This function provides a method for the PHY to setup the EMAC for the PHY negotiated duplex mode...
void lpc_emac_set_speed(int mbs_100)
This function provides a method for the PHY to setup the EMAC for the PHY negotiated bit rate...
uint32_t lpc_mii_read_data(void)
Starts a read operation via the MII link (non-blocking)
bool lpc_mii_read(uint32_t PhyReg, uint32_t *data)
Starts a read operation via the MII link (non-blocking)
bool lpc_phy_init(LPC17_EMAC *lpc17_emac, int rmii)
Initialize the PHY.
void lpc_mii_read_noblock(uint32_t PhyReg)
Read a value via the MII link (blocking)
bool lpc_mii_write(uint32_t PhyReg, uint32_t Value)
Write a value via the MII link (blocking)
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.