Ethernetwebsoc

Dependencies:   C12832_lcd LM75B WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
GordonSin
Date:
Fri May 31 04:09:54 2013 +0000
Revision:
0:0ed2a7c7190c
31/5/2013;

Who changed what in which revision?

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