Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DebugLib Socket lwip lwip-sys
Fork of NetworkingCoreLib by
main/lwip/arch/lpc_phy.h@0:013f5d54248c, 2012-05-24 (annotated)
- Committer:
- donatien
- Date:
- Thu May 24 14:49:40 2012 +0000
- Revision:
- 0:013f5d54248c
Initial Commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| donatien | 0:013f5d54248c | 1 | /********************************************************************** |
| donatien | 0:013f5d54248c | 2 | * $Id$ lpc_phy.h 2011-11-20 |
| donatien | 0:013f5d54248c | 3 | *//** |
| donatien | 0:013f5d54248c | 4 | * @file lpc_phy.h |
| donatien | 0:013f5d54248c | 5 | * @brief Common PHY definitions used with all PHYs |
| donatien | 0:013f5d54248c | 6 | * @version 1.0 |
| donatien | 0:013f5d54248c | 7 | * @date 20 Nov. 2011 |
| donatien | 0:013f5d54248c | 8 | * @author NXP MCU SW Application Team |
| donatien | 0:013f5d54248c | 9 | * |
| donatien | 0:013f5d54248c | 10 | * Copyright(C) 2011, NXP Semiconductor |
| donatien | 0:013f5d54248c | 11 | * All rights reserved. |
| donatien | 0:013f5d54248c | 12 | * |
| donatien | 0:013f5d54248c | 13 | *********************************************************************** |
| donatien | 0:013f5d54248c | 14 | * Software that is described herein is for illustrative purposes only |
| donatien | 0:013f5d54248c | 15 | * which provides customers with programming information regarding the |
| donatien | 0:013f5d54248c | 16 | * products. This software is supplied "AS IS" without any warranties. |
| donatien | 0:013f5d54248c | 17 | * NXP Semiconductors assumes no responsibility or liability for the |
| donatien | 0:013f5d54248c | 18 | * use of the software, conveys no license or title under any patent, |
| donatien | 0:013f5d54248c | 19 | * copyright, or mask work right to the product. NXP Semiconductors |
| donatien | 0:013f5d54248c | 20 | * reserves the right to make changes in the software without |
| donatien | 0:013f5d54248c | 21 | * notification. NXP Semiconductors also make no representation or |
| donatien | 0:013f5d54248c | 22 | * warranty that such application will be suitable for the specified |
| donatien | 0:013f5d54248c | 23 | * use without further testing or modification. |
| donatien | 0:013f5d54248c | 24 | **********************************************************************/ |
| donatien | 0:013f5d54248c | 25 | |
| donatien | 0:013f5d54248c | 26 | #ifndef __LPC_PHY_H_ |
| donatien | 0:013f5d54248c | 27 | #define __LPC_PHY_H_ |
| donatien | 0:013f5d54248c | 28 | |
| donatien | 0:013f5d54248c | 29 | #include "lwip/opt.h" |
| donatien | 0:013f5d54248c | 30 | #include "lwip/err.h" |
| donatien | 0:013f5d54248c | 31 | #include "lwip/netif.h" |
| donatien | 0:013f5d54248c | 32 | |
| donatien | 0:013f5d54248c | 33 | #ifdef __cplusplus |
| donatien | 0:013f5d54248c | 34 | extern "C" |
| donatien | 0:013f5d54248c | 35 | { |
| donatien | 0:013f5d54248c | 36 | #endif |
| donatien | 0:013f5d54248c | 37 | |
| donatien | 0:013f5d54248c | 38 | /* These PHY functions are usually part of the EMAC driver */ |
| donatien | 0:013f5d54248c | 39 | |
| donatien | 0:013f5d54248c | 40 | /** \brief Phy status update state machine |
| donatien | 0:013f5d54248c | 41 | * |
| donatien | 0:013f5d54248c | 42 | * This function provides a state machine for maintaining the PHY |
| donatien | 0:013f5d54248c | 43 | * status without blocking. It must be occasionally called for the |
| donatien | 0:013f5d54248c | 44 | * PHY status to be maintained. |
| donatien | 0:013f5d54248c | 45 | * |
| donatien | 0:013f5d54248c | 46 | * \param[in] netif NETIF structure |
| donatien | 0:013f5d54248c | 47 | */ |
| donatien | 0:013f5d54248c | 48 | s32_t lpc_phy_sts_sm(struct netif *netif); |
| donatien | 0:013f5d54248c | 49 | |
| donatien | 0:013f5d54248c | 50 | /** \brief Initialize the PHY |
| donatien | 0:013f5d54248c | 51 | * |
| donatien | 0:013f5d54248c | 52 | * This function initializes the PHY. It will block until complete. |
| donatien | 0:013f5d54248c | 53 | * This function is called as part of the EMAC driver |
| donatien | 0:013f5d54248c | 54 | * initialization. Configuration of the PHY at startup is |
| donatien | 0:013f5d54248c | 55 | * controlled by setting up configuration defines in lpc_phy.h. |
| donatien | 0:013f5d54248c | 56 | * |
| donatien | 0:013f5d54248c | 57 | * \param[in] netif NETIF structure |
| donatien | 0:013f5d54248c | 58 | * \return ERR_OK if the setup was successful, otherwise ERR_TIMEOUT |
| donatien | 0:013f5d54248c | 59 | */ |
| donatien | 0:013f5d54248c | 60 | err_t lpc_phy_init(struct netif *netif); |
| donatien | 0:013f5d54248c | 61 | |
| donatien | 0:013f5d54248c | 62 | /** \brief Write a value via the MII link (non-blocking) |
| donatien | 0:013f5d54248c | 63 | * |
| donatien | 0:013f5d54248c | 64 | * This function will write a value on the MII link interface to a PHY |
| donatien | 0:013f5d54248c | 65 | * or a connected device. The function will return immediately without |
| donatien | 0:013f5d54248c | 66 | * a status. Status needs to be polled later to determine if the write |
| donatien | 0:013f5d54248c | 67 | * was successful. |
| donatien | 0:013f5d54248c | 68 | * |
| donatien | 0:013f5d54248c | 69 | * \param[in] PhyReg PHY register to write to |
| donatien | 0:013f5d54248c | 70 | * \param[in] Value Value to write |
| donatien | 0:013f5d54248c | 71 | */ |
| donatien | 0:013f5d54248c | 72 | void lpc_mii_write_noblock(u32_t PhyReg, u32_t Value); |
| donatien | 0:013f5d54248c | 73 | |
| donatien | 0:013f5d54248c | 74 | /** \brief Write a value via the MII link (blocking) |
| donatien | 0:013f5d54248c | 75 | * |
| donatien | 0:013f5d54248c | 76 | * This function will write a value on the MII link interface to a PHY |
| donatien | 0:013f5d54248c | 77 | * or a connected device. The function will block until complete. |
| donatien | 0:013f5d54248c | 78 | * |
| donatien | 0:013f5d54248c | 79 | * \param[in] PhyReg PHY register to write to |
| donatien | 0:013f5d54248c | 80 | * \param[in] Value Value to write |
| donatien | 0:013f5d54248c | 81 | * \returns 0 if the write was successful, otherwise !0 |
| donatien | 0:013f5d54248c | 82 | */ |
| donatien | 0:013f5d54248c | 83 | err_t lpc_mii_write(u32_t PhyReg, u32_t Value); |
| donatien | 0:013f5d54248c | 84 | |
| donatien | 0:013f5d54248c | 85 | /** \brief Reads current MII link busy status |
| donatien | 0:013f5d54248c | 86 | * |
| donatien | 0:013f5d54248c | 87 | * This function will return the current MII link busy status and is meant to |
| donatien | 0:013f5d54248c | 88 | * be used with non-blocking functions for monitor PHY status such as |
| donatien | 0:013f5d54248c | 89 | * connection state. |
| donatien | 0:013f5d54248c | 90 | * |
| donatien | 0:013f5d54248c | 91 | * \returns !0 if the MII link is busy, otherwise 0 |
| donatien | 0:013f5d54248c | 92 | */ |
| donatien | 0:013f5d54248c | 93 | u32_t lpc_mii_is_busy(void); |
| donatien | 0:013f5d54248c | 94 | |
| donatien | 0:013f5d54248c | 95 | /** \brief Starts a read operation via the MII link (non-blocking) |
| donatien | 0:013f5d54248c | 96 | * |
| donatien | 0:013f5d54248c | 97 | * This function returns the current value in the MII data register. It is |
| donatien | 0:013f5d54248c | 98 | * meant to be used with the non-blocking oeprations. This value should |
| donatien | 0:013f5d54248c | 99 | * only be read after a non-block read command has been issued and the |
| donatien | 0:013f5d54248c | 100 | * MII status has been determined to be good. |
| donatien | 0:013f5d54248c | 101 | * |
| donatien | 0:013f5d54248c | 102 | * \returns The current value in the MII value register |
| donatien | 0:013f5d54248c | 103 | */ |
| donatien | 0:013f5d54248c | 104 | u32_t lpc_mii_read_data(void); |
| donatien | 0:013f5d54248c | 105 | |
| donatien | 0:013f5d54248c | 106 | /** \brief Starts a read operation via the MII link (non-blocking) |
| donatien | 0:013f5d54248c | 107 | * |
| donatien | 0:013f5d54248c | 108 | * This function will start a read operation on the MII link interface |
| donatien | 0:013f5d54248c | 109 | * from a PHY or a connected device. The function will not block and |
| donatien | 0:013f5d54248c | 110 | * the status mist be polled until complete. Once complete, the data |
| donatien | 0:013f5d54248c | 111 | * can be read. |
| donatien | 0:013f5d54248c | 112 | * |
| donatien | 0:013f5d54248c | 113 | * \param[in] PhyReg PHY register to read from |
| donatien | 0:013f5d54248c | 114 | */ |
| donatien | 0:013f5d54248c | 115 | err_t lpc_mii_read(u32_t PhyReg, u32_t *data); |
| donatien | 0:013f5d54248c | 116 | |
| donatien | 0:013f5d54248c | 117 | /** \brief Read a value via the MII link (blocking) |
| donatien | 0:013f5d54248c | 118 | * |
| donatien | 0:013f5d54248c | 119 | * This function will read a value on the MII link interface from a PHY |
| donatien | 0:013f5d54248c | 120 | * or a connected device. The function will block until complete. |
| donatien | 0:013f5d54248c | 121 | * |
| donatien | 0:013f5d54248c | 122 | * \param[in] PhyReg PHY register to read from |
| donatien | 0:013f5d54248c | 123 | * \param[in] data Pointer to where to save data read via MII |
| donatien | 0:013f5d54248c | 124 | * \returns 0 if the read was successful, otherwise !0 |
| donatien | 0:013f5d54248c | 125 | */ |
| donatien | 0:013f5d54248c | 126 | void lpc_mii_read_noblock(u32_t PhyReg); |
| donatien | 0:013f5d54248c | 127 | |
| donatien | 0:013f5d54248c | 128 | /** |
| donatien | 0:013f5d54248c | 129 | * This function provides a method for the PHY to setup the EMAC |
| donatien | 0:013f5d54248c | 130 | * for the PHY negotiated duplex mode. |
| donatien | 0:013f5d54248c | 131 | * |
| donatien | 0:013f5d54248c | 132 | * @param[in] full_duplex 0 = half duplex, 1 = full duplex |
| donatien | 0:013f5d54248c | 133 | */ |
| donatien | 0:013f5d54248c | 134 | void lpc_emac_set_duplex(int full_duplex); |
| donatien | 0:013f5d54248c | 135 | |
| donatien | 0:013f5d54248c | 136 | /** |
| donatien | 0:013f5d54248c | 137 | * This function provides a method for the PHY to setup the EMAC |
| donatien | 0:013f5d54248c | 138 | * for the PHY negotiated bit rate. |
| donatien | 0:013f5d54248c | 139 | * |
| donatien | 0:013f5d54248c | 140 | * @param[in] mbs_100 0 = 10mbs mode, 1 = 100mbs mode |
| donatien | 0:013f5d54248c | 141 | */ |
| donatien | 0:013f5d54248c | 142 | void lpc_emac_set_speed(int mbs_100); |
| donatien | 0:013f5d54248c | 143 | |
| donatien | 0:013f5d54248c | 144 | #ifdef __cplusplus |
| donatien | 0:013f5d54248c | 145 | } |
| donatien | 0:013f5d54248c | 146 | #endif |
| donatien | 0:013f5d54248c | 147 | |
| donatien | 0:013f5d54248c | 148 | #endif /* __LPC_PHY_H_ */ |
| donatien | 0:013f5d54248c | 149 | |
| donatien | 0:013f5d54248c | 150 | /* --------------------------------- End Of File ------------------------------ */ |
