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