⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c6455_mdio.h

📁 TI公司的NSP
💻 H
字号:
/*
 *  Copyright 2007 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *
 *  @(#) TCP/IP_Network_Developers_Kit 1.92.00.22 01-10-2007 (ndk-b22)
 */
/*****************************************************************************\
*           Copyright (C) 1999-2003 Texas Instruments Incorporated.
*                           All Rights Reserved
*------------------------------------------------------------------------------
* FILENAME...... c6455_mdio.h
* DATE CREATED.. 10/07/2005
* LAST MODIFIED.
*------------------------------------------------------------------------------
* NOTE:
*   When used in an multitasking environment, no MDIO function may be
*   called while another MDIO function is operating on the same device
*   handle in another thread. It is the responsibility of the application
*   to assure adherence to this restriction.
*
\******************************************************************************/

#include "c6455_common.h"
#include <usertype.h>

/*-----------------------------------------------------------------------*\
* NEW TYPES
\*-----------------------------------------------------------------------*/
#ifndef _EMAC_TYPES
#define _EMAC_TYPES
typedef void * Handle;
#endif

/*-----------------------------------------------------------------------*\
* MDIO Configuration Mode Flags
*
* These flags determine how the MDIO module behaves
\*-----------------------------------------------------------------------*/
#define MDIO_MODEFLG_AUTONEG     0x0001                 /* Use Autonegotiate         */
/* The following bits are used for manual and fallback configuration */
#define MDIO_MODEFLG_HD10        0x0002                 /* Use 10Mb/s Half Duplex    */
#define MDIO_MODEFLG_FD10        0x0004                 /* Use 10Mb/s Full Duplex    */
#define MDIO_MODEFLG_HD100       0x0008                 /* Use 100Mb/s Half Duplex   */
#define MDIO_MODEFLG_FD100       0x0010                 /* Use 100Mb/s Full Duplex   */
#define MDIO_MODEFLG_FD1000      0x0020                 /* Use 1000Mb/s Full Duplex  */
#define MDIO_MODEFLG_LOOPBACK    0x0040                 /* Use PHY Loopback          */
/* The following bits are reserved for use by the MDIO module            */
#define MDIO_MODEFLG_NWAYACTIVE  0x0080                 /* NWAY is currently active  */
#define MDIO_MODEFLG_EXTLOOPBACK    0x0100              /* Use external PHY Loopback, with plug  */

/*-----------------------------------------------------------------------*\
* MDIO Link Status Values
*
* These values indicate current PHY link status
\*-----------------------------------------------------------------------*/
#define MDIO_LINKSTATUS_NOLINK   0
#define MDIO_LINKSTATUS_HD10     1
#define MDIO_LINKSTATUS_FD10     2
#define MDIO_LINKSTATUS_HD100    3
#define MDIO_LINKSTATUS_FD100    4
#define MDIO_LINKSTATUS_FD1000   5

/*-----------------------------------------------------------------------*\
* MDIO Events
*
* These events are returned by MDIO_timerTick() to allow the application
* (or EMAC) to track MDIO status.
\*-----------------------------------------------------------------------*/
#define MDIO_EVENT_NOCHANGE      0   /* No change from previous status */
#define MDIO_EVENT_LINKDOWN      1   /* Link down event                */
#define MDIO_EVENT_LINKUP        2   /* Link (or re-link) event        */
#define MDIO_EVENT_PHYERROR      3   /* No PHY connected               */


/*-----------------------------------------------------------------------*\
* MDIO_open()
*
* Opens the MDIO peripheral and start searching for a PHY device.
*
* It is assumed that the MDIO module is reset prior to calling this
* function.
\*-----------------------------------------------------------------------*/
Handle MDIO_open( uint mdioModeFlags );

/*-----------------------------------------------------------------------*\
* MDIO_close()
*
* Close the MDIO peripheral and disable further operation.
\*-----------------------------------------------------------------------*/
void MDIO_close( Handle hMDIO );

/*-----------------------------------------------------------------------*\
* MDIO_getStatus()
*
* Called to get the status of the MDIO/PHY
\*-----------------------------------------------------------------------*/
void MDIO_getStatus( Handle hMDIO, uint *pPhy, uint *pLinkStatus );

/*-----------------------------------------------------------------------*\
* MDIO_timerTick()
*
* Called to signify that approx 100mS have elapsed
*
* Returns an MDIO event code (see MDIO Events in C6455_MDIO.H).
\*-----------------------------------------------------------------------*/
uint MDIO_timerTick( Handle hMDIO );

/*-----------------------------------------------------------------------*\
* MDIO_initPHY()
*
* Force a switch to the specified PHY, and start negotiation.
*
* This call is only used to override the normal PHY detection process.
*
* Returns 1 if the PHY selection completed OK, else 0
\*-----------------------------------------------------------------------*/
uint MDIO_initPHY( Handle hMDIO, uint phyAddr );

/*-----------------------------------------------------------------------*\
* MDIO_phyRegRead()
*
* Raw data read of a PHY register.
*
* Returns 1 if the PHY ACK'd the read, else 0
\*-----------------------------------------------------------------------*/
uint MDIO_phyRegRead( uint phyIdx, uint phyReg, Uint16 *pData );

/*-----------------------------------------------------------------------*\
* MDIO_phyRegWrite()
*
* Raw data write  of a PHY register.
*
* Returns 1 if the PHY ACK'd the write, else 0
\*-----------------------------------------------------------------------*/
uint MDIO_phyRegWrite( uint phyIdx, uint phyReg, Uint16 data );

/******************************************************************************\
* End of c6455_mdio.h
\******************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -