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

📄 txc_envoy_pkt_ctrl_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_pkt_ctrl_api.c                                             
                                                                             
   Description:  Packet Control 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_pkt_ctrl_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

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

/*                   ETHERNET PACKET CONTROL  FUNCTIONS                     */


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


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

   FUNCTION:  TXC_ENVOY_IngressPacketCtrlSet

   DESCRIPTION: This function sets the control of the ingress packet stream received 
                from 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.
           macIfaceDataPtr: a pointer to type TXC_IfMAC_CONFIG_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_IngressPacketCtrlSet (TXC_U16BIT handle, TXC_U16BIT port, 
                                            ENVOY_INGRESS_PKT_CTRL_STRUCT *ingressPktCtrlDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;

    /* check for input parameters */
    error = ENVOY_SetIngressPacketCtrlValid (handle, port, ingressPktCtrlDataPtr);

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetIngressPacketCtrlVirtual (handle, port, ingressPktCtrlDataPtr); */
#else
    
        error = ENVOY_SetIngressPacketCtrlReal    (handle, port, ingressPktCtrlDataPtr);
#endif

    }

    /* return the error code */
    return error;

}

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

   FUNCTION:  TXC_ENVOY_IngressPacketCtrlGet

   DESCRIPTION: This function gets the control of the ingress packet stream received 
                from 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.
           macIfaceDataPtr: a pointer to type TXC_IfMAC_CONFIG_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_IngressPacketCtrlGet (TXC_U16BIT handle, TXC_U16BIT port, 
                    ENVOY_INGRESS_PKT_CTRL_STRUCT *ingressPktCtrlDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;

    /* check for input parameters */
    error = ENVOY_GetIngressPacketCtrlValid (handle, port);

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_GetIngressPacketCtrlVirtual (handle, port, ingressPktCtrlDataPtr); */
#else
    
        error = ENVOY_GetIngressPacketCtrlReal    (handle, port, ingressPktCtrlDataPtr);
#endif

    }

    /* return the error code */
    return error;

}

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

   FUNCTION:  TXC_ENVOY_EgressPacketCtrlSet

   DESCRIPTION: This function sets the configuration of the egress packet traffic 
                control of an ethernet physical 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.
           egressPktCtrlDataPtr: a pointer to type ENVOY_EGRESS_PKT_CTRL_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_EgressPacketCtrlSet (TXC_U16BIT handle, TXC_U16BIT port, 
                                    ENVOY_EGRESS_PKT_CTRL_STRUCT *egressPktCtrlDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;

    /* check for input parameters */
    error = ENVOY_SetEgressPacketCtrlValid (handle, port, egressPktCtrlDataPtr);

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetEgressPacketCtrlVirtual (handle, port, egressPktCtrlDataPtr); */
#else
    
        error = ENVOY_SetEgressPacketCtrlReal (handle, port, egressPktCtrlDataPtr);
#endif

    }

    /* return the error code */
    return error;

}


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

   FUNCTION:  TXC_ENVOY_EgressPacketCtrlGet

   DESCRIPTION: This function gets the configuration of the egress packet traffic 
                control of an ethernet physical 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.
           egressPktCtrlDataPtr: a pointer to type ENVOY_EGRESS_PKT_CTRL_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_EgressPacketCtrlGet (TXC_U16BIT handle, TXC_U16BIT port, 
                                    ENVOY_EGRESS_PKT_CTRL_STRUCT *egressPktCtrlDataPtr)
{
    TXC_U16BIT error = TXC_NO_ERR;

    /* check for input parameters */
    error = ENVOY_GetEgressPacketCtrlValid (handle, port);

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_GetEgressPacketCtrlVirtual (handle, port, egressPktCtrlDataPtr); */
#else
    
        error = ENVOY_GetEgressPacketCtrlReal (handle, port, egressPktCtrlDataPtr);
#endif

    }

    /* return the error code */
    return error;

}





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

⌨️ 快捷键说明

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