LwIP with PPP & Ethernet integration

Dependents:   NetworkingCoreLib

This is the mbed port of the LwIP stack: http://savannah.nongnu.org/projects/lwip/

It includes contributed content from NXP's port for LPCxxxx devices: http://www.lpcware.com/content/project/lightweight-ip-lwip-networking-stack

Licence

LwIP is licenced under the BSD licence:

Copyright (c) 2001-2004 Swedish Institute of Computer Science. 
All rights reserved. 
Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met: 
1. Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer. 
2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution. 
3. The name of the author may not be used to endorse or promote products 
derived from this software without specific prior written permission. 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.
Committer:
donatien
Date:
Fri May 25 08:56:35 2012 +0000
Revision:
2:1a87f74b8e3b
Parent:
0:8e01dca41002
Removed compilation of EMAC driver when using PPP

Who changed what in which revision?

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