📄 txc_envoy_fifo_valid.c
字号:
/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
FUNCTION: ENVOY_SetEfifoStreamingCfgValid
DESCRIPTION: This function validates the TXC_ENVOY_EfifoStreamingCfgSet
INPUTS: Same as TXC_ENVOY_EfifoStreamingCfgSet
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_SetEfifoStreamingCfgValid (TXC_U16BIT handle, TXC_U16BIT port,
ENVOY_EFIFO_STREAMING_CFG_STRUCT *eFifoStreamDataPtr)
{
TXC_U16BIT error;
/* first, check the handle and the port */
error = ENVOY_VerifySetFifoHandleAndPort (handle, port);
if (error == TXC_NO_ERR)
{
/* now range check the data (it overwrites the warning, if any) */
if (eFifoStreamDataPtr->egressFifoStreamingThreshold >= ENVOY_EFIFO_END_OF_STREAMING_VALUE_ENUM)
{
eFifoStreamDataPtr->egressFifoStreamingThreshold = ENVOY_EFIFO_STREAMING_VALUE_ENUM_ERR;
error = TXC_INVALID_PARM_ERR;
}
}
/* return the error code */
return error;
}
/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
FUNCTION: ENVOY_GetEfifoStreamingCfgValid
DESCRIPTION: This function validates the TXC_ENVOY_EfifoStreamingCfgGet
INPUTS: handle and port
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_GetEfifoStreamingCfgValid (TXC_U16BIT handle, TXC_U16BIT port)
{
TXC_U16BIT error;
/* first, check the handle and the port */
error = ENVOY_VerifyGetFifoHandleAndPort (handle, port);
/* return the error code */
return error;
}
/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
FUNCTION: ENVOY_SetFifoPortCtrlValid
DESCRIPTION: This function validates the TXC_ENVOY_FifoPortCtrlSet
INPUTS: Same as TXC_ENVOY_FifoPortCtrlSet
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_SetFifoPortCtrlValid (TXC_U16BIT handle, TXC_U16BIT port,
ENVOY_FIFO_PORT_CTRL_STRUCT *fifoPortCtrlPtr)
{
TXC_U16BIT error;
/* first, check the handle and the port */
error = ENVOY_VerifySetFifoHandleAndPort (handle, port);
if (error == TXC_NO_ERR)
{
/* now range check the data (it overwrites the warning, if any) */
if (fifoPortCtrlPtr->fifoPortEnableMode >= ENVOY_FIFO_END_OF_PORT_ENABLE_MODE_ENUM)
{
fifoPortCtrlPtr->fifoPortEnableMode = ENVOY_FIFO_PORT_ENABLE_MODE_ENUM_ERR;
error = TXC_INVALID_PARM_ERR;
}
}
/* return the error code */
return error;
}
/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
FUNCTION: ENVOY_GetFifoPortCtrlValid
DESCRIPTION: This function validates the TXC_ENVOY_FifoPortCtrlGet
INPUTS: handle and port
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_GetFifoPortCtrlValid (TXC_U16BIT handle, TXC_U16BIT port)
{
TXC_U16BIT error;
/* first, check the handle and the port */
error = ENVOY_VerifyGetFifoHandleAndPort (handle, port);
/* return the error code */
return error;
}
/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
FUNCTION: ENVOY_RtrvFifoPortStatisticsValid
DESCRIPTION: This function validates the TXC_ENVOY_FifoPortStatisticsRtrv
INPUTS: handle and port
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_RtrvFifoPortStatisticsValid (TXC_U16BIT handle, TXC_U16BIT port)
{
TXC_U16BIT error;
/* first, check the handle and the port.
Note: the "setFifoHandleAndPort is used since the all ports is allowed */
error = ENVOY_VerifySetFifoHandleAndPort (handle, port);
/* return the error code */
return error;
}
/************************************************************************************/
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/************************************************************************************
FUNCTION: ENVOY_RtrvFifoStatusValid
DESCRIPTION: This function validates the TXC_ENVOY_FifoStatusRtrv
INPUTS: handle and port
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_RtrvFifoStatusValid (TXC_U16BIT handle, TXC_U16BIT port)
{
TXC_U16BIT error;
/* first, check the handle and the port.
Note: the "setFifoHandleAndPort is used since the all ports is allowed */
error = ENVOY_VerifySetFifoHandleAndPort(handle, port);
/* return the error code */
return error;
}
/****************************************************************************
** Static Functions **
****************************************************************************/
/* 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_VerifySetFifoHandleAndPort(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_VerifyGetFifoHandleAndPort(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;
}
/* Port Block Checking */
static TXC_U16BIT ENVOY_VerifySetFifoHandleAndPortBlock(TXC_U16BIT handle,
TXC_U16BIT portBlockID)
{
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_DbGetMaxMacPortBlocks (handle);
if (portBlockID >= maxPorts)
{
if (portBlockID != 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_VerifyGetFifoHandleAndPortBlock(TXC_U16BIT handle,
TXC_U16BIT portBlockID)
{
/* 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_DbGetMaxMacPortBlocks (handle);
if (portBlockID >= maxPorts)
error = TXC_INVALID_CHANNEL_ERR;
}
/* return the error */
return error;
}
/****************************************************************************
** End of Module **
****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -