NXP LPC1768 Ethernet driver for lwip and CMSIS-RTOS

Dependents:   EthernetInterface EthernetInterface EthernetInterface_RSF EthernetInterface ... more

Legacy Networking Libraries

This is an mbed 2 networking library. For mbed 5, the networking libraries have been revised to better support additional network stacks and thread safety here.

This library is based on the code of the NXP LPC port of the Lightweight TCP/IP Stack

Copyright(C) 2011, NXP Semiconductor
All rights reserved.

Software that is described herein is for illustrative purposes only
which provides customers with programming information regarding the
products. This software is supplied "AS IS" without any warranties.
NXP Semiconductors assumes no responsibility or liability for the
use of the software, conveys no license or title under any patent,
copyright, or mask work right to the product. NXP Semiconductors
reserves the right to make changes in the software without
notification. NXP Semiconductors also make no representation or
warranty that such application will be suitable for the specified
use without further testing or modification.
Committer:
mbed_official
Date:
Thu May 26 09:00:26 2016 +0100
Revision:
33:9de8bd8ca1c8
Synchronized with git revision 745ebbf4557f0f3964f73063c1d88ddbcda0ed22

Full URL: https://github.com/mbedmicro/mbed/commit/745ebbf4557f0f3964f73063c1d88ddbcda0ed22/

Synch - fix lwip-eth path

Who changed what in which revision?

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