lwip-eth

Fork of lwip-eth by mbed official

Committer:
mbed_official
Date:
Thu Apr 24 10:45:51 2014 +0100
Revision:
10:ab9330955226
Parent:
arch/lpc_phy.h@5:698d868a5285
Synchronized with git revision 94fd2228fb4a382fb98d0115f6691fc0b659eea8

Full URL: https://github.com/mbedmicro/mbed/commit/94fd2228fb4a382fb98d0115f6691fc0b659eea8/

Currently NET_7 (HttpClient test) and NET_8 (NTP test) fail for
unknown reasons.

Who changed what in which revision?

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