Deprecated fork of old network stack source from github. Please use official library instead: https://mbed.org/users/mbed_official/code/EthernetInterface/
lpc_phy.h
00001 /********************************************************************** 00002 * $Id$ lpc_phy.h 2011-11-20 00003 *//** 00004 * @file lpc_phy.h 00005 * @brief Common PHY definitions used with all PHYs 00006 * @version 1.0 00007 * @date 20 Nov. 2011 00008 * @author NXP MCU SW Application Team 00009 * 00010 * Copyright(C) 2011, NXP Semiconductor 00011 * All rights reserved. 00012 * 00013 *********************************************************************** 00014 * Software that is described herein is for illustrative purposes only 00015 * which provides customers with programming information regarding the 00016 * products. This software is supplied "AS IS" without any warranties. 00017 * NXP Semiconductors assumes no responsibility or liability for the 00018 * use of the software, conveys no license or title under any patent, 00019 * copyright, or mask work right to the product. NXP Semiconductors 00020 * reserves the right to make changes in the software without 00021 * notification. NXP Semiconductors also make no representation or 00022 * warranty that such application will be suitable for the specified 00023 * use without further testing or modification. 00024 **********************************************************************/ 00025 00026 #ifndef __LPC_PHY_H_ 00027 #define __LPC_PHY_H_ 00028 00029 #include "lwip/opt.h" 00030 #include "lwip/err.h" 00031 #include "lwip/netif.h" 00032 00033 #ifdef __cplusplus 00034 extern "C" 00035 { 00036 #endif 00037 00038 /* These PHY functions are usually part of the EMAC driver */ 00039 00040 /** \brief Phy status update state machine 00041 * 00042 * This function provides a state machine for maintaining the PHY 00043 * status without blocking. It must be occasionally called for the 00044 * PHY status to be maintained. 00045 * 00046 * \param[in] netif NETIF structure 00047 */ 00048 s32_t lpc_phy_sts_sm(struct netif *netif); 00049 00050 /** \brief Initialize the PHY 00051 * 00052 * This function initializes the PHY. It will block until complete. 00053 * This function is called as part of the EMAC driver 00054 * initialization. Configuration of the PHY at startup is 00055 * controlled by setting up configuration defines in lpc_phy.h. 00056 * 00057 * \param[in] netif NETIF structure 00058 * \param[in] rmii If set, configures the PHY for RMII mode 00059 * \return ERR_OK if the setup was successful, otherwise ERR_TIMEOUT 00060 */ 00061 err_t lpc_phy_init(struct netif *netif, int rmii); 00062 00063 /** \brief Write a value via the MII link (non-blocking) 00064 * 00065 * This function will write a value on the MII link interface to a PHY 00066 * or a connected device. The function will return immediately without 00067 * a status. Status needs to be polled later to determine if the write 00068 * was successful. 00069 * 00070 * \param[in] PhyReg PHY register to write to 00071 * \param[in] Value Value to write 00072 */ 00073 void lpc_mii_write_noblock(u32_t PhyReg, u32_t Value); 00074 00075 /** \brief Write a value via the MII link (blocking) 00076 * 00077 * This function will write a value on the MII link interface to a PHY 00078 * or a connected device. The function will block until complete. 00079 * 00080 * \param[in] PhyReg PHY register to write to 00081 * \param[in] Value Value to write 00082 * \returns 0 if the write was successful, otherwise !0 00083 */ 00084 err_t lpc_mii_write(u32_t PhyReg, u32_t Value); 00085 00086 /** \brief Reads current MII link busy status 00087 * 00088 * This function will return the current MII link busy status and is meant to 00089 * be used with non-blocking functions for monitor PHY status such as 00090 * connection state. 00091 * 00092 * \returns !0 if the MII link is busy, otherwise 0 00093 */ 00094 u32_t lpc_mii_is_busy(void); 00095 00096 /** \brief Starts a read operation via the MII link (non-blocking) 00097 * 00098 * This function returns the current value in the MII data register. It is 00099 * meant to be used with the non-blocking oeprations. This value should 00100 * only be read after a non-block read command has been issued and the 00101 * MII status has been determined to be good. 00102 * 00103 * \returns The current value in the MII value register 00104 */ 00105 u32_t lpc_mii_read_data(void); 00106 00107 /** \brief Starts a read operation via the MII link (non-blocking) 00108 * 00109 * This function will start a read operation on the MII link interface 00110 * from a PHY or a connected device. The function will not block and 00111 * the status mist be polled until complete. Once complete, the data 00112 * can be read. 00113 * 00114 * \param[in] PhyReg PHY register to read from 00115 */ 00116 err_t lpc_mii_read(u32_t PhyReg, u32_t *data); 00117 00118 /** \brief Read a value via the MII link (blocking) 00119 * 00120 * This function will read a value on the MII link interface from a PHY 00121 * or a connected device. The function will block until complete. 00122 * 00123 * \param[in] PhyReg PHY register to read from 00124 * \param[in] data Pointer to where to save data read via MII 00125 * \returns 0 if the read was successful, otherwise !0 00126 */ 00127 void lpc_mii_read_noblock(u32_t PhyReg); 00128 00129 /** 00130 * This function provides a method for the PHY to setup the EMAC 00131 * for the PHY negotiated duplex mode. 00132 * 00133 * @param[in] full_duplex 0 = half duplex, 1 = full duplex 00134 */ 00135 void lpc_emac_set_duplex(int full_duplex); 00136 00137 /** 00138 * This function provides a method for the PHY to setup the EMAC 00139 * for the PHY negotiated bit rate. 00140 * 00141 * @param[in] mbs_100 0 = 10mbs mode, 1 = 100mbs mode 00142 */ 00143 void lpc_emac_set_speed(int mbs_100); 00144 00145 #ifdef __cplusplus 00146 } 00147 #endif 00148 00149 #endif /* __LPC_PHY_H_ */ 00150 00151 /* --------------------------------- End Of File ------------------------------ */
Generated on Tue Jul 12 2022 23:10:19 by 1.7.2