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

📄 txc_envoy_mac_api.c

📁 TranSwitch Envoy CE2 & Envoy CE4 设备驱动及编程指南
💻 C
📖 第 1 页 / 共 3 页
字号:
{
    TXC_U16BIT error;

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

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        error = ENVOY_SetMacHalfDuplexVirtual (handle, port, macHalfDuplexDataPtr);
#else
    
        error = ENVOY_SetMacHalfDuplexReal    (handle, port, macHalfDuplexDataPtr);
#endif

    }

    /* return the error code */
    return error;

}


/*--------------------------------------------------------------------------*

   FUNCTION:  TXC_ENVOY_MacHalfDuplexGet

   DESCRIPTION:  This function gets the half duplex configuration parameters 
                 of an ethernet physical port.

   INPUTS: handle: Instance of the Envoy device to get the configuration of.
            port: The ethernet MAC port to get the configuration of. For Envoy-CE2,
                  the range is from 0 to 15, corresponding to ethernet physical port
                  1 to 16. For Envoy-CE4, the range is 0 to 31, corresponding to 
                  ethernet physical ports 1 to 32. The value 0xFFFF cannot be used 
                  to simultaneously get the configuration of multiple ethernet ports.  
           macHalfDuplexDataPtr: a pointer to type TXC_IfMAC_HALF_DUPLEX_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_MacHalfDuplexGet (TXC_U16BIT handle, TXC_U16BIT port,
                                       TXC_IfMAC_HALF_DUPLEX_STRUCT * macHalfDuplexDataPtr)
{
    TXC_U16BIT error;

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

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        error = ENVOY_GetMacHalfDuplexVirtual (handle, port, macHalfDuplexDataPtr);
#else
    
        error = ENVOY_GetMacHalfDuplexReal    (handle, port, macHalfDuplexDataPtr);
#endif

    }

    /* return the error code */
    return error;

}




/*--------------------------------------------------------------------------*

   FUNCTION:  TXC_IfMAC_MacLoopbackSet

   DESCRIPTION:  This function sets the configuration of the MAC loopback
                 associated with 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.           
          macDiagDataPtr: a pointer to type ENVOY_MAC_DIAG_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_IfMAC_MacLoopbackSet (TXC_U16BIT handle, TXC_U16BIT port, 
                          TXC_IfMAC_LOOPBACK_STRUCT *macLoopbackDataPtr)
{
    TXC_U16BIT error;

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

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetMacLoopbackVirtual (handle, port, macLoopbackDataPtr);*/
#else
    
        error = ENVOY_SetMacLoopbackReal    (handle, port, macLoopbackDataPtr);
#endif

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

}




/*--------------------------------------------------------------------------*

   FUNCTION:  TXC_IfMAC_MacLoopbackGet

   DESCRIPTION:  This function gets the configuration of the MAC Loopback
                 associated with 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.           
          macDiagDataPtr: a pointer to type ENVOY_MAC_DIAG_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_IfMAC_MacLoopbackGet (TXC_U16BIT handle, TXC_U16BIT port,
                          TXC_IfMAC_LOOPBACK_STRUCT *macLoopbackDataPtr)
{
    TXC_U16BIT error;

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

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

#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE

        /*error = ENVOY_SetMacLoopbackVirtual (handle, port, macLoopbackDataPtr);*/
#else
    
        error = ENVOY_GetMacLoopbackReal    (handle, port, macLoopbackDataPtr);
#endif

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

}




/*--------------------------------------------------------------------------*
   FUNCTION:     TXC_ENVOY_MacIngressFlowCtrlSet
 
   DESCRIPTION:  This function configures the FIFO flow control mode for each 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.

           fifoFlowCtrlDataPtr: a pointer to type TXC_IfMAC_INGRESS_FLOW_CTRL_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_MacIngressFlowCtrlSet  (TXC_U16BIT handle, TXC_U16BIT port, 
         TXC_IfMAC_INGRESS_FLOW_CTRL_MODE_STRUCT *macIngressFlowCtrlModeDataPtr)

{
    TXC_U16BIT error;

    /* check for input parameters */
    if ((error = ENVOY_SetMacIngressFlowCtrlValid (handle, port, macIngressFlowCtrlModeDataPtr)) != TXC_NO_ERR)

         return error; /* return the error code */

    /* process the data if no error */
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
        return error;
#else
    /* error = ENVOY_SetFifoFlowCtrlReal(handle, port, fifoFlowCtrlDataPtr); */
    error = ENVOY_SetMacIngressFlowCtrlReal(handle, port, macIngressFlowCtrlModeDataPtr);
#endif
    /* return the error code */
    return error;
}




/*--------------------------------------------------------------------------*
   FUNCTION:     TXC_ENVOY_MacIngressFlowCtrlGet
 
   DESCRIPTION:  This function gets the configuration the Ingress MAC flow control mode 
                 for each ethernet port.
 
   INPUTS: handle: Instance of the Envoy device to configure.
            port: The ethernet MAC port to get the configuration of. For Envoy-CE2,
                  the range is from 0 to 15, corresponding to ethernet physical port
                  1 to 16. For Envoy-CE4, the range is 0 to 31, corresponding to
                  ethernet physical ports 1 to 32. The value 0xFFFF cannot be used
                  to simultaneously get the configuration of multiple ethernet ports.
 
           fifoFlowCtrlDataPtr: a pointer to type TXC_IfMAC_INGRESS_FLOW_CTRL_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_MacIngressFlowCtrlGet  (TXC_U16BIT handle, TXC_U16BIT port, 
         TXC_IfMAC_INGRESS_FLOW_CTRL_MODE_STRUCT *macIngressFlowCtrlModeDataPtr)

{
    TXC_U16BIT error;

    /* check for input parameters */
    if ((error = ENVOY_GetMacIngressFlowCtrlValid (handle, port, macIngressFlowCtrlModeDataPtr)) != TXC_NO_ERR)
         return error; /* return the error code */

    /* process the data if no error */
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
        return error;
#else
    error = ENVOY_GetMacIngressFlowCtrlReal(handle, port, macIngressFlowCtrlModeDataPtr);
#endif

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






/*--------------------------------------------------------------------------*
   FUNCTION:     TXC_ENVOY_MacEgressFlowCtrlSet
 
   DESCRIPTION:  This function configures the FIFO flow control mode for each 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.           

           macEgressFlowCtrlModeDataPtr: a pointer to type TXC_IfMAC_EGRESS_FLOW_CTRL_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_MacEgressFlowCtrlSet  (TXC_U16BIT handle, TXC_U16BIT port, 
           TXC_IfMAC_EGRESS_FLOW_CTRL_MODE_STRUCT *macEgressFlowCtrlModeDataPtr)
{
    TXC_U16BIT error;

    /* check for input parameters */
    if ((error = ENVOY_SetMacEgressFlowCtrlValid (handle, port, macEgressFlowCtrlModeDataPtr)) != TXC_NO_ERR)

         return error; /* return the error code */

    /* process the data if no error */
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
        return error;
#else
    /* error = ENVOY_SetFifoFlowCtrlReal(handle, port, fifoFlowCtrlDataPtr); */
    error = ENVOY_SetMacEgressFlowCtrlReal(handle, port, macEgressFlowCtrlModeDataPtr);
#endif
    /* return the error code */
    return error;
}




/*--------------------------------------------------------------------------*
   FUNCTION:     TXC_ENVOY_MacEgressFlowCtrlGet
 
   DESCRIPTION:  This function gets the configuration the Ingress MAC flow control mode 
                 for each ethernet port.
 
   INPUTS: handle: Instance of the Envoy device to configure.
            port: The ethernet MAC port to get the configuration of. For Envoy-CE2,
                  the range is from 0 to 15, corresponding to ethernet physical port
                  1 to 16. For Envoy-CE4, the range is 0 to 31, corresponding to
                  ethernet physical ports 1 to 32. The value 0xFFFF cannot be used
                  to simultaneously get the configuration of multiple ethernet ports.
 
           fifoFlowCtrlDataPtr: a pointer to type TXC_IfMAC_EGRESS_FLOW_CTRL_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_MacEgressFlowCtrlGet (TXC_U16BIT handle, TXC_U16BIT port,
                 TXC_IfMAC_EGRESS_FLOW_CTRL_MODE_STRUCT *macEgressFlowCtrlModeDataPtr)
{
    TXC_U16BIT error;

    /* check for input parameters */
    if ((error = ENVOY_GetMacEgressFlowCtrlValid (handle, port, macEgressFlowCtrlModeDataPtr)) != TXC_NO_ERR)
         return error; /* return the error code */

    /* process the data if no error */
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
        return error;
#else
    error = ENVOY_GetMacEgressFlowCtrlReal(handle, port, macEgressFlowCtrlModeDataPtr);
#endif

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

⌨️ 快捷键说明

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