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

📄 txc_envoy_mgmt_port_api.c

📁 TranSwitch Envoy CE2 & Envoy CE4 设备驱动及编程指南
💻 C
字号:
/*--------------------------------------------------------------------------

  *******                           ****
     *     *****     **    *    *  *       *    *   *  *****   ****   *    *
     *     *    *   *  *   **   *  *       *    *   *    *    *    *  *    *
     *     *    *  *    *  * *  *   ****   *    *   *    *    *       ******
     *     *****   ******  *  * *       *  * ** *   *    *    *       *    *
     *     *   *   *    *  *   **  *    *  **  **   *    *    *    *  *    *
     *     *    *  *    *  *    *   ****   *    *   *    *     ****   *    *

                        Proprietary and Confidential 

    This program is made available only to customers and prospective customers 
of TranSwitch Corporation under license and may be used only with TranSwitch 
semi-conductor products.

                      Copyright(c) 2004 TranSwitch Inc.

 --------------------------------------------------------------------------

             *******  **      **  **        **   ********   **      **
             *******  ***     **  **        **  **********  **      **
             **       ** *    **  **        **  **      **   **    **
             *****    **  *   **   **      **   **      **     *  *
             *****    **   *  **    **    **    **      **      **
             **       **    * **     **  **     **      **      **
             *******  **     ***      ****      **********      **
             *******  **      **       **        ********       **

 --------------------------------------------------------------------------
                           TranSwitch Envoy-CE2/CE4
                                Device Driver
 --------------------------------------------------------------------------
                                                                             
   Workfile:  txc_envoy_mac_api.c                                             
                                                                             
   Description:  The management port API functions.                       
                                                                             
  -------------------------------------------------------------------------- 
                               Revision History                              
  -------------------------------------------------------------------------- 
   Rev #       Date            Author              Description               
   -----       ------          -------             -----------               
   0.5.0    6/03/04      F. Giannella         Initial release (beta)
 *--------------------------------------------------------------------------*/


/****************************************************************************
 **                             Include Files                              **
 ****************************************************************************/

#include "txc_envoy_api.h"
#include "txc_envoy_mgmt_port_support.h"
#include "txc_envoy_database.h"

#ifndef TXC_ENVOY_VIRTUAL_DEVICE_MODE
#include "txc_hw_platform.h"
#endif

/****************************************************************************
 **                            Static Functions                            **
 ****************************************************************************/



/****************************************************************************
 **                        Static/Global Variables                         **
 ****************************************************************************/
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
static TXC_U32BIT virRegData= 0;
#endif

/****************************************************************************
 **                                  Code                                  **
 ****************************************************************************/


/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
   FUNCTION:  TXC_ENVOY_MgmtPortReset

   DESCRIPTION:  This function is used to reset the Management Port.

   INPUTS: handle: Instance of the Envoy device.
    
   RETURNS:  TXC_NO_ERR or an appropriate specific error code.

   REVISION HISTORY:

    Rev       Date          Author               Description
   -----    -------      ------------         -----------------
   0.5.0    6/03/04      F. Giannella         Initial release (beta)
 *--------------------------------------------------------------------------*/

TXC_U16BIT TXC_ENVOY_MgmtPortReset (TXC_U16BIT handle)
{
    TXC_U16BIT error;

    /* check for input parameters */
    error = ENVOY_MgmtPortResetValid (handle);

    /* process the data if no error */
    if (error == TXC_NO_ERR)
    {

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_MgmtPortResetVirtual (handle); */
#else
    
        error = ENVOY_MgmtPortResetReal (handle);
#endif

    }

    /* return the error code */
    return error;

}

/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
   FUNCTION:  TXC_ENVOY_MgmtPortConfigSet

   DESCRIPTION:  This function pokes a register of the MII interface management device

   INPUTS: handle: Instance of the Envoy device to poke.
           mgmtPortDataPtr: a pointer to type ENVOY_MGMT_PORT_CFG_STRUCT
    
   RETURNS:  TXC_NO_ERR or an appropriate specific error code.

   REVISION HISTORY:

    Rev       Date          Author               Description
   -----    -------      ------------         -----------------
   0.5.0    6/03/04      F. Giannella         Initial release (beta)
 *--------------------------------------------------------------------------*/

TXC_U16BIT TXC_ENVOY_MgmtPortConfigSet(TXC_U16BIT handle, 
                                       ENVOY_MGMT_PORT_CFG_STRUCT  *mgmtPortDataPtr)
{
    TXC_U16BIT error;

    /* check for input parameters */
    error = ENVOY_SetMgmtPortConfigValid (handle, mgmtPortDataPtr);

    /* process the data if no error */
    if (error == TXC_NO_ERR)
    {

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetMgmtPortConfigVirtual (handle, mgmtPortDataPtr);*/
#else
    
        error = ENVOY_SetMgmtPortConfigReal (handle, mgmtPortDataPtr);
#endif

    }

    /* return the error code */
    return error;

}

/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
   FUNCTION:  TXC_ENVOY_MgmtPortConfigGet

   DESCRIPTION:  This function pokes a register of the MII interface management device

   INPUTS: handle: Instance of the Envoy device to poke.
           mgmtPortDataPtr: a pointer to type ENVOY_MGMT_PORT_CFG_STRUCT
    
   RETURNS:  TXC_NO_ERR or an appropriate specific error code.

   REVISION HISTORY:

    Rev       Date          Author               Description
   -----    -------      ------------         -----------------
   0.5.0    6/03/04      F. Giannella         Initial release (beta)
 *--------------------------------------------------------------------------*/

TXC_U16BIT TXC_ENVOY_MgmtPortConfigGet(TXC_U16BIT handle, 
                                       ENVOY_MGMT_PORT_CFG_STRUCT  *mgmtPortDataPtr)
{
    TXC_U16BIT error;

    /* check for input parameters */
    error = ENVOY_GetMgmtPortConfigValid (handle);

    /* process the data if no error */
    if (error == TXC_NO_ERR)
    {

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetMgmtPortConfigVirtual (handle, mgmtPortDataPtr);*/
#else
    
        error = ENVOY_GetMgmtPortConfigReal (handle, mgmtPortDataPtr);
#endif

    }

    /* return the error code */
    return error;

}


/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
   FUNCTION:  TXC_ENVOY_MgmtPortPhyRegPoke

   DESCRIPTION:  This function pokes a register of the MII interface management device

   INPUTS: handle: Instance of the Envoy device to poke.
           functInst: Unused, set to 0.
           term: Terminal, this argument is for future devices. Value passed in by
                 the user must be zero.
           phyAddr: phy device to poke (0-31)
           phyReg: phy register in the phy device to poke (0-31) 
           phyData: phy data to poke
    
   RETURNS:  TXC_NO_ERR or an appropriate specific error code.

   REVISION HISTORY:

    Rev       Date          Author               Description
   -----    -------      ------------         -----------------
   0.5.0    6/03/04      F. Giannella         Initial release (beta)
 *--------------------------------------------------------------------------*/

TXC_U16BIT TXC_ENVOY_MgmtPortPhyRegPoke (TXC_U16BIT handle, TXC_U16BIT phyAddr,
                                        TXC_U16BIT phyReg, TXC_U16BIT phyData)
{
    TXC_U16BIT error;

    /* check for input parameters */
    error = ENVOY_PokeMacPhyRegValid (handle, phyAddr, phyReg, phyData);

    /* process the data if no error */
    if (error == TXC_NO_ERR)
    {

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_PokeMacPhyRegVirtual (handle, phyAddr, phyReg, phyData); */
#else
    
        error = ENVOY_PokeMacPhyRegReal (handle, phyAddr, phyReg, phyData);
#endif

    }

    /* return the error code */
    return error;

}


/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
  FUNCTION:  TXC_ENVOY_MgmtPortPhyRegPeek

   DESCRIPTION:  This function peeks a register of the MII interface management device

   INPUTS: handle: Instance of the Envoy device to poke.
           functInst: Unused, set to 0.
           term: Terminal, this argument is for future devices. Value passed in by
                 the user must be zero.
           phyAddr: phy device to poke (0-31)
           phyReg: phy register in the phy device to poke (0-31) 
           phyData: phy data to poke
    
   RETURNS:  TXC_NO_ERR or an appropriate specific error code.

   REVISION HISTORY:

    Rev       Date          Author               Description
   -----    -------      ------------         -----------------
   0.5.0    6/03/04      F. Giannella         Initial release (beta)
*--------------------------------------------------------------------------*/
TXC_U16BIT TXC_ENVOY_MgmtPortPhyRegPeek (TXC_U16BIT handle, TXC_U16BIT phyAddr,
                                         TXC_U16BIT phyReg, TXC_U16BIT *phyDataPtr)
{
    TXC_U16BIT error;

    /* check for input parameters */
    error = ENVOY_PeekMacPhyRegValid (handle, phyAddr, phyReg);

    /* process the data if no error */
    if (error == TXC_NO_ERR)
    {

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_PeekMacPhyRegVirtual (handle, phyAddr, phyReg, phyDataPtr);*/
#else
    
        error = ENVOY_PeekMacPhyRegReal (handle, phyAddr, phyReg, phyDataPtr);
#endif

    }

    /* return the error code */
    return error;

}





/****************************************************************************
 **                              End of Module                             **
 ****************************************************************************/

⌨️ 快捷键说明

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