📄 txc_envoy_mac_valid.c
字号:
REVISION HISTORY:
Rev Date Author Description
----- ------- ------------ -----------------
0.5.0 6/03/04 F. Giannella Initial release (beta)
*--------------------------------------------------------------------------*/
TXC_U16BIT ENVOY_SetMacEgressFlowCtrlValid (TXC_U16BIT handle, TXC_U16BIT port,
TXC_IfMAC_EGRESS_FLOW_CTRL_MODE_STRUCT *macEgressFlowCtrlModeDataPtr)
{ TXC_U16BIT error;
/* first, check the handle & port */
error = ENVOY_VerifySetMacHandleAndPort (handle, port);
/* now range check the data */
if (error == TXC_NO_ERR)
{
if ((macEgressFlowCtrlModeDataPtr->egressFlowCtrlEnable != TXC_FALSE) &&
(macEgressFlowCtrlModeDataPtr->egressFlowCtrlEnable != TXC_TRUE))
{
macEgressFlowCtrlModeDataPtr->egressFlowCtrlEnable = TXC_BOOL_INVALID;
error = TXC_INVALID_PARM_ERR;
}
}
return(error);
}
/*--------------------------------------------------------------------------*
FUNCTION: ENVOY_GetMacEgressFlowCtrlValid
DESCRIPTION: This function validates the TXC_ENVOY_MacEgressFlowCtrlGet input parameters
INPUTS: Same as TXC_ENVOY_MacEgressFlowCtrlGet
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_GetMacEgressFlowCtrlValid (TXC_U16BIT handle, TXC_U16BIT port,
TXC_IfMAC_EGRESS_FLOW_CTRL_MODE_STRUCT *macEgressFlowCtrlModeDataPtr)
{ TXC_U16BIT error;
error = ENVOY_VerifyGetMacHandleAndPort (handle, port);
/* return the error code */
return error;
}
/*--------------------------------------------------------------------------*
FUNCTION: ENVOY_RtrvMacStatusValid
DESCRIPTION: This function validates the TXC_IfMAC_StatusRtrv
INPUTS: Same as TXC_IfMAC_StatusRtrv
RETURNS: TXC_NO_ERR or an appropriate specific error code listed in appendix.
CAVEATS: All bit-mapped status indicators affected by this driver are latched
and cleared on read. If the condition persists, the status is re-latched on the
next device clock.
REVISION HISTORY:
Rev Date Author Description
----- ------- ------------ -----------------
0.5.0 6/03/04 F. Giannella Initial release (beta)
*--------------------------------------------------------------------------*/
TXC_U16BIT
ENVOY_RtrvMacStatusValid(
TXC_U16BIT handle,
TXC_U16BIT port)
{
TXC_U16BIT error;
error = ENVOY_VerifyGetMacHandleAndPort (handle, port);
/* return the error code */
return error;
}
/*--------------------------------------------------------------------------*
FUNCTION: ENVOY_SetMacRmonCtrlValid
DESCRIPTION: This function validates the TXC_ENVOY_MacRmonCtrlSet input parameters
INPUTS: Same as TXC_ENVOY_MacRmonCtrlSet
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_SetMacRmonCtrlValid(
TXC_U16BIT handle,
ENVOY_MAC_RMON_CTRL_STRUCT *macRmonCtrlDataPtr)
{
TXC_U16BIT error;
TXC_U16BIT port = 0; /* initialized so that only handle check is done */
/* first, check the handle */
error = ENVOY_VerifySetMacHandleAndPort (handle, port);
/* now range check the data */
if (error == TXC_NO_ERR)
{
if ((macRmonCtrlDataPtr->rmonSaturateEnable != TXC_FALSE) &&
(macRmonCtrlDataPtr->rmonSaturateEnable != TXC_TRUE))
{
macRmonCtrlDataPtr->rmonSaturateEnable = TXC_BOOL_INVALID;
error = TXC_INVALID_PARM_ERR;
}
if (macRmonCtrlDataPtr->rbytCntMode >= ENVOY_END_OF_RX_CNT_MODE)
{
macRmonCtrlDataPtr->rbytCntMode = TXC_U16_INVALID;
error = TXC_INVALID_PARM_ERR;
}
}
return(error);
}
/*--------------------------------------------------------------------------*
FUNCTION: ENVOY_GetMacRmonCtrlValid
DESCRIPTION: This function validates the TXC_ENVOY_MacRmonCtrlGet input parameters
INPUTS: Same as TXC_ENVOY_MacRmonCtrlGet
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_GetMacRmonCtrlValid(
TXC_U16BIT handle,
ENVOY_MAC_RMON_CTRL_STRUCT *macRmonCtrlDataPtr)
{
TXC_U16BIT error;
TXC_U16BIT port = 0; /* initialized so that only handle check is done */
/* first, check the handle */
error = ENVOY_VerifyGetMacHandleAndPort (handle, port);
return(error);
}
/*--------------------------------------------------------------------------*
FUNCTION: ENVOY_RtrvMacTxStatisticsValid
DESCRIPTION: This function validates the ENVOYRtrvMacTxStatistics
INPUTS: Same as TXC_ENVOY_MacTxStatisticsRtrv
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_RtrvMacTxStatisticsValid
(TXC_U16BIT handle, TXC_U16BIT port)
{
TXC_U16BIT error;
error = ENVOY_VerifyGetMacHandleAndPort (handle, port);
/* return the error code */
return error;
}
/*--------------------------------------------------------------------------*
FUNCTION: ENVOY_RtrvMacRxStatisticsValid
DESCRIPTION: This function validates the TXC_ENVOY_RtrvMacRxStatistics
INPUTS: Same as TXC_ENVOY_RtrvMacRxStatistics
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_RtrvMacRxStatisticsValid(
TXC_U16BIT handle, TXC_U16BIT port)
{
TXC_U16BIT error;
error = ENVOY_VerifyGetMacHandleAndPort (handle, port);
/* return the error code */
return error;
}
/****************************************************************************
** Static Function **
****************************************************************************/
/* check port and handle, in that order for valid range.
ON THE SET FUNCTIONS. Set function allow the port == 0xFFFF.
Overwrite the last error, so the hierarchy is correctly followed. */
static TXC_U16BIT ENVOY_VerifySetMacHandleAndPort(TXC_U16BIT handle,
TXC_U16BIT port)
{
TXC_U16BIT maxPorts, error;
/* first, check the handle. This may return invalid handle or driver not created */
error = ENVOY_DbVerifyHandle (handle);
/* if NO handle error, make sure the port value is correct,
allow for the all ports (0xFFFF) */
if (error == TXC_NO_ERR)
{
maxPorts = ENVOY_DbGetMaxMacPorts (handle);
if (port >= maxPorts)
{
if (port != ENVOY_MAC_ALL_PORTS)
error = TXC_INVALID_CHANNEL_ERR;
}
}
/* return the error */
return error;
}
/* check port, then handle, in that order for valid range. ON THE GET
Overwrite the last error, so the hierarchy is correctly followed. */
static TXC_U16BIT ENVOY_VerifyGetMacHandleAndPort(TXC_U16BIT handle,
TXC_U16BIT port)
{
/* TXC_U16BIT maxTerms, maxPorts, error; */
TXC_U16BIT maxPorts, error;
/* first, check the handle. This may return invalid handle or driver not created */
error = ENVOY_DbVerifyHandle (handle);
/* if NO handle error, make sure the port value is correct,
do not allow for the all ports (0xFFFF) */
if (error == TXC_NO_ERR)
{
maxPorts = ENVOY_DbGetMaxMacPorts (handle);
if (port >= maxPorts)
error = TXC_INVALID_CHANNEL_ERR;
}
/* return the error */
return error;
}
/****************************************************************************
** End of Module **
****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -