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

📄 txc_envoy_fifo_api.c

📁 TranSwitch Envoy CE2 & Envoy CE4 设备驱动及编程指南
💻 C
📖 第 1 页 / 共 2 页
字号:
/*--------------------------------------------------------------------------

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

                        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_fifo_api.c                                             
                                                                             
   Description:  FIFO control functions including Ingress Flow Control
                 Threshold settings.
                                                                             
  -------------------------------------------------------------------------- 
                               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_fifo_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

/* ======================================================================== */

/*                   FIFO CONFIGURATION AND CONTROL  FUNCTIONS              */


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

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

   FUNCTION:  TXC_ENVOY_IngressFlowCtrlWmarkSet

   DESCRIPTION: This function sets the configuration thresholds associated with 
                the ingress flow control of an Ethernet port.

   INPUTS: handle: Instance of the Envoy device to configure.
           port: The ethernet MAC port to configure. For Envoy-CE2, the range is from 
                 0 to 15, corresponding to ethernet physical port 1 to 8. For Envoy-CE4,
                 the range is 0 to 31, corresponding to ethernet physical ports 1 to 32.
                 The value 0xFFFF is used to configure all ethernet ports of specified
                 terminal the same way.
           ingressFlowCtrlWatermarkDataPtr: a pointer to type ENVOY_IFIFO_FLOW_CTRL_WTRMRK_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_IngressFlowCtrlWmarkSet (TXC_U16BIT handle, TXC_U16BIT portBlockID,
                ENVOY_IFIFO_FLOW_CTRL_WMARK_STRUCT *ingressFlowCtrlWmarkDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;

    /* check for input parameters */
    error = ENVOY_SetIngressFlowCtrlWmarkValid (handle, portBlockID, ingressFlowCtrlWmarkDataPtr);

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetIngressFlowCtrlWmarkVirtual (handle, portBlockID, ingressFlowCtrlWmarkDataPtr); */
#else
    
        error = ENVOY_SetIngressFlowCtrlWmarkReal (handle, portBlockID, ingressFlowCtrlWmarkDataPtr);
#endif

    }

    /* return the error code */
    return error;

}

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

   FUNCTION:  TXC_ENVOY_IngressFlowCtrlWmarkGet

   DESCRIPTION: This function gets the configuration thresholds associated with 
                the ingress flow control of an Ethernet port.

   INPUTS: handle: Instance of the Envoy device to configure.
           port: The ethernet MAC port to configure. For Envoy-CE2, the range is from 
                 0 to 15, corresponding to ethernet physical port 1 to 8. For Envoy-CE4,
                 the range is 0 to 31, corresponding to ethernet physical ports 1 to 32.
                 The value 0xFFFF is used to configure all ethernet ports of specified
                 terminal the same way.
           ingressFlowCtrlWatermarkDataPtr: a pointer to type ENVOY_IFIFO_FLOW_CTRL_WTRMRK_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_IngressFlowCtrlWmarkGet (TXC_U16BIT handle, TXC_U16BIT portBlockID,
                ENVOY_IFIFO_FLOW_CTRL_WMARK_STRUCT *ingressFlowCtrlWmarkDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;

    /* check for input parameters */
    error = ENVOY_GetIngressFlowCtrlWmarkValid (handle, portBlockID);

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_GetIngressFlowCtrlWmarkVirtual (handle, portBlockID, ingressFlowCtrlWmarkDataPtr); */
#else
    
        error = ENVOY_GetIngressFlowCtrlWmarkReal (handle, portBlockID, ingressFlowCtrlWmarkDataPtr);
#endif

    }

    /* return the error code */
    return error;

}


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

   FUNCTION:  TXC_ENVOY_IfifoTransferModeSet

   DESCRIPTION: This function sets the transfer mode for all Ingress FIFOs.

   INPUTS: handle: Instance of the Envoy device to configure.
           port: The ethernet MAC port to configure. For Envoy-CE2, the range is from 
                 0 to 15, corresponding to ethernet physical port 1 to 8. For Envoy-CE4,
                 the range is 0 to 31, corresponding to ethernet physical ports 1 to 32.
                 The value 0xFFFF is used to configure all ethernet ports of specified
                 terminal the same way.
           ingressFifoTransferModeDataPtr: a pointer to type ENVOY_IFIFO_TRANSFER_MODE_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_IfifoTransferModeSet (TXC_U16BIT handle, 
           ENVOY_IFIFO_TRANSFER_MODE_STRUCT *iFifoTransferModeDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;
    TXC_U16BIT error1 = TXC_NO_ERR;
    TXC_U16BIT error2 = TXC_NO_ERR;

    /* check for input parameters */
    error1 = ENVOY_SetIngressFifoTransferModeValid (handle, iFifoTransferModeDataPtr);

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetIngressFifoTransferModeVirtual (handle, iFifoTransferModeDataPtr); */
#else
        error2 = ENVOY_SetIngressFifoTransferModeReal (handle, iFifoTransferModeDataPtr);
#endif

    }

    if (error2 == TXC_NO_ERR)
    {
        error = error1;  /* to allow return of a warning */
    }
    else
    {
        error = error2;
    }

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

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

   FUNCTION:  TXC_ENVOY_IfifoTransferModeGet

   DESCRIPTION: This function gets the transfer mode for all Ingress FIFOs.

   INPUTS: handle: Instance of the Envoy device to configure.
           port: The ethernet MAC port to configure. For Envoy-CE2, the range is from 
                 0 to 15, corresponding to ethernet physical port 1 to 8. For Envoy-CE4,
                 the range is 0 to 31, corresponding to ethernet physical ports 1 to 32.
                 The value 0xFFFF is used to configure all ethernet ports of specified
                 terminal the same way.
           ingressFifoTransferModeDataPtr: a pointer to type ENVOY_IFIFO_TRANSFER_MODE_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_IfifoTransferModeGet (TXC_U16BIT handle, 
           ENVOY_IFIFO_TRANSFER_MODE_STRUCT *iFifoTransferModeDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;

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

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetIngressFifoTransferModeVirtual (handle, iFifoTransferModeDataPtr); */
#else
        error = ENVOY_GetIngressFifoTransferModeReal (handle, iFifoTransferModeDataPtr);
#endif

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



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

   FUNCTION:  TXC_ENVOY_EfifoTransferModeSet

   DESCRIPTION: This function sets the transfer mode for all Egress FIFOs.

   INPUTS: handle: Instance of the Envoy device to configure.
           port: The ethernet MAC port to configure. For Envoy-CE2, the range is from 
                 0 to 15, corresponding to ethernet physical port 1 to 8. For Envoy-CE4,
                 the range is 0 to 31, corresponding to ethernet physical ports 1 to 32.
                 The value 0xFFFF is used to configure all ethernet ports of specified
                 terminal the same way.
           egressFifoTransferModeDataPtr: a pointer to type ENVOY_EFIFO_TRANSFER_MODE_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_EfifoTransferModeSet (TXC_U16BIT handle,
       ENVOY_EFIFO_TRANSFER_MODE_STRUCT *eFifoTransferModeDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;

    /* check for input parameters */
    error = ENVOY_SetEgressFifoTransferModeValid (handle, eFifoTransferModeDataPtr);

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetEgressFifoTransferModeVirtual (handle, eFifoTransferModeDataPtr); */
#else
        error = ENVOY_SetEgressFifoTransferModeReal (handle, eFifoTransferModeDataPtr);
#endif

    }

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


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

   FUNCTION:  TXC_ENVOY_EfifoTransferModeGet

   DESCRIPTION: This function gets the transfer mode associated with the Egress FIFOs.

⌨️ 快捷键说明

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