📄 txc_envoy_mac_api.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: Ethernet MAC functions: Control, Configuration, Flow Control,
Status and RMON Statistics Monitoring, as defined in API sec
section 7.
--------------------------------------------------------------------------
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_mac_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 **
****************************************************************************/
/* ======================================================================== */
/* MAC FUNCTIONS */
/*--------------------------------------------------------------------------*
FUNCTION: TXC_ENVOY_MacReset
DESCRIPTION: This function is used to reset the ethernet port
INPUTS: handle: Instance of the Envoy device to reset.
port: The ethernet MAC port to reset. 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.
macResetPtr: a pointer to type TXC_IfMAC_RESET_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_MacReset (TXC_U16BIT handle, TXC_U16BIT port,
TXC_IfMAC_RESET_STRUCT *macResetPtr)
{
TXC_U16BIT error;
/* check for input parameters */
error = ENVOY_MacResetValid (handle, port, macResetPtr);
/* process the data if no error */
if (error == TXC_NO_ERR)
{
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
error = ENVOY_MacResetVirtual (handle, port, macResetPtr);
#else
error = ENVOY_MacResetReal (handle, port, macResetPtr);
#endif
}
/* return the error code */
return error;
}
/*--------------------------------------------------------------------------*
FUNCTION: TXC_ENVOY_MacIfaceSet
DESCRIPTION: This function sets the configuration of the MAC interface
control parameters 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.
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_MacIfaceSet (TXC_U16BIT handle, TXC_U16BIT port,
TXC_IfMAC_CONFIG_STRUCT *macIfaceDataPtr)
{
TXC_U16BIT error;
/* check for input parameters */
error = ENVOY_SetMacIfaceValid (handle, port, macIfaceDataPtr);
/* process the data if no error */
if (error == TXC_NO_ERR)
{
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
error = ENVOY_SetMacIfaceVirtual (handle, port, macIfaceDataPtr);
#else
error = ENVOY_SetMacIfaceReal (handle, port, macIfaceDataPtr);
#endif
}
/* return the error code */
return error;
}
/*--------------------------------------------------------------------------*
FUNCTION: TXC_ENVOY_MacIfaceGet
DESCRIPTION: This function gets the configuration of the MAC interface
control 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.
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_MacIfaceGet (TXC_U16BIT handle, TXC_U16BIT port,
TXC_IfMAC_CONFIG_STRUCT *macIfaceDataPtr)
{
TXC_U16BIT error;
/* check for input parameters */
error = ENVOY_GetMacIfaceValid (handle, port);
/* process the data if no error */
if (error == TXC_NO_ERR)
{
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
error = ENVOY_GetMacIfaceVirtual (handle, port, macIfaceDataPtr);
#else
error = ENVOY_GetMacIfaceReal (handle, port, macIfaceDataPtr);
#endif
}
/* return the error code */
return error;
}
/*--------------------------------------------------------------------------*
FUNCTION: TXC_IfMAC_OperationalStateSet
DESCRIPTION: This function controls the port enable/disable states 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.
macOperationalStateDataPtr: a pointer to type TXC_IfMAC_OPERATIONAL_STATE_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_OperationalStateSet (TXC_U16BIT handle, TXC_U16BIT port,
TXC_IfMAC_OPERATIONAL_STATE_STRUCT *macOperationalStateDataPtr)
{
TXC_U16BIT error = TXC_NO_ERR;
/* check for input parameters */
error = ENVOY_SetMacOperationalStateValid (handle, port, macOperationalStateDataPtr);
/* process the data if no error */
if (error == TXC_NO_ERR)
{
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
/* error = ENVOY_SetMacOperationalStateVirtual (handle, port, macOperationalStateDataPtr); */
#else
error = ENVOY_SetMacOperationalStateReal (handle, port, macOperationalStateDataPtr);
#endif
}
/* return the error code */
return error;
}
/*--------------------------------------------------------------------------*
FUNCTION: TXC_IfMAC_OperationalStateGet
DESCRIPTION: This function controls the port enable/disable states 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.
macOperationalStateDataPtr: a pointer to type TXC_IfMAC_OPERATIONAL_STATE_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_OperationalStateGet (TXC_U16BIT handle, TXC_U16BIT port,
TXC_IfMAC_OPERATIONAL_STATE_STRUCT *macOperationalStateDataPtr)
{
TXC_U16BIT error = TXC_NO_ERR;
/* check for input parameters */
error = ENVOY_GetMacOperationalStateValid (handle, port);
/* process the data if no error */
if (error == TXC_NO_ERR)
{
#ifdef TXC_ENVOY_VIRTUAL_DEVICE_MODE
/* error = ENVOY_SetMacOperationalStateVirtual (handle, port, macOperationalStateDataPtr); */
#else
error = ENVOY_GetMacOperationalStateReal (handle, port, macOperationalStateDataPtr);
#endif
}
/* return the error code */
return error;
}
/*--------------------------------------------------------------------------*
FUNCTION: TXC_ENVOY_MacHalfDuplexSet
DESCRIPTION: This function sets the half duplex configuration parameters 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.
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_MacHalfDuplexSet (TXC_U16BIT handle, TXC_U16BIT port,
TXC_IfMAC_HALF_DUPLEX_STRUCT * macHalfDuplexDataPtr)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -