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

📄 txc_envoy_mgmt_port_valid.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_valid.c                                             
                                                                             
   Description:  Validation of Management Port API calls.                   
                                                                             
  -------------------------------------------------------------------------- 
                               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"



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


/****************************************************************************
 **                        Static/Global Variables                         **
 ****************************************************************************/



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


/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************

   FUNCTION:  ENVOY_MgmtPortResetValid

   DESCRIPTION: This function validates the TXC_ENVOY_MgmtPortReset

   INPUTS:  Same as TXC_ENVOY_MgmtPortReset

   RETURNS:  TXC_NO_ERR or an appropriate specific error code listed in appendix.

   CAVEATS:  None.

   REVISION HISTORY:

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

TXC_U16BIT ENVOY_MgmtPortResetValid(TXC_U16BIT handle)
{
    TXC_U16BIT error;

    /* check the handle. This may return invalid handle or driver not created */
    error = ENVOY_DbVerifyHandle (handle);

    /* return the error code */
    return error;
}


/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************

   FUNCTION:  ENVOY_SetMgmtPortConfigValid

   DESCRIPTION: This function validates the TXC_ENVOY_MgmtPortConfigSet

   INPUTS:  Same as TXC_ENVOY_MgmtPortConfigSet

   RETURNS:  TXC_NO_ERR or an appropriate specific error code listed in appendix.

   CAVEATS:  None.

   REVISION HISTORY:

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

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

    /* first, check the handle. This may return invalid handle or driver not created */
    error = ENVOY_DbVerifyHandle (handle);

    /* now range check the data */
    if (error == TXC_NO_ERR)
    {
        /* check the phy addr number */
        if (mgmtPortDataPtr->mgmtClockDivideMode >= ENVOY_MGMT_PORT_END_OF_CLK_DIV_ENUM)
        {
            mgmtPortDataPtr->mgmtClockDivideMode = ENVOY_MGMT_PORT_CLK_DIV_ENUM_ERR;
            error = TXC_INVALID_PARM_ERR;
        }
    }

    /* return the error code */
    return error;
}

/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************

   FUNCTION:  ENVOY_GetMgmtPortConfigValid

   DESCRIPTION: This function validates the TXC_ENVOY_MgmtPortConfigGet

   INPUTS:  Same as TXC_ENVOY_MgmtPortConfigGet

   RETURNS:  TXC_NO_ERR or an appropriate specific error code listed in appendix.

   CAVEATS:  None.

   REVISION HISTORY:

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

TXC_U16BIT ENVOY_GetMgmtPortConfigValid(TXC_U16BIT handle)
{
    TXC_U16BIT error;

    /* first, check the handle. This may return invalid handle or driver not created */
    error = ENVOY_DbVerifyHandle (handle);

    /* return the error code */
    return error;
}


/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************

   FUNCTION:  ENVOY_PokeMacPhyRegValid

   DESCRIPTION: This function validates the ENVOYPokeMacPhyReg

   INPUTS:  Same as ENVOY_PokeMacPhyReg

   RETURNS:  TXC_NO_ERR or an appropriate specific error code listed in appendix.

   CAVEATS:  None.

   REVISION HISTORY:

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

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

    /* first, check the handle. This may return invalid handle or driver not created */
    error = ENVOY_DbVerifyHandle (handle);

    /* now range check the data */
    if (error == TXC_NO_ERR)
    {
        /* check the phy addr number */
        if ((phyAddr > ENVOY_MAC_MAX_PHY_ADDR) && (phyAddr != ENVOY_MAC_ALL_PHYS))
            error = TXC_INVALID_CHANNEL_ERR;

        /* check the phy register */
        if (phyReg > ENVOY_MAC_MAX_PHY_REG) 
            error = TXC_INVALID_CHANNEL_ERR;

        /* any value is accepted for phy data */
    }

    /* return the error code */
    return error;
}


/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************

   FUNCTION:  ENVOY_PeekMacPhyRegValid

   DESCRIPTION: This function validates the ENVOYPeekMacPhyReg

   INPUTS:  Same as ENVOY_PeekMacPhyReg
  
   RETURNS:  TXC_NO_ERR or an appropriate specific error code listed in appendix.

   CAVEATS:  None.

   REVISION HISTORY:

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

TXC_U16BIT ENVOY_PeekMacPhyRegValid(TXC_U16BIT handle, TXC_U16BIT phyAddr, 
                                    TXC_U16BIT phyReg)
{
    TXC_U16BIT error;

    /* first, check the handle. This may return invalid handle or driver not created */
    error = ENVOY_DbVerifyHandle (handle);

    /* now range check the data */
    if (error == TXC_NO_ERR)
    {
        /* check the phy addr number */
        if (phyAddr> ENVOY_MAC_MAX_PHY_ADDR)
            error = TXC_INVALID_CHANNEL_ERR;

        /* check the phy register */
        if (phyReg> ENVOY_MAC_MAX_PHY_REG)
            error = TXC_INVALID_CHANNEL_ERR;
    }

    /* return the error code */
    return error;
}

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

⌨️ 快捷键说明

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