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

📄 ixf_api.c

📁 开发Inetl IXP2400平台所必须的硬件诊断和测试程序。该软件包支持的功能包括CPU基本功能检测
💻 C
📖 第 1 页 / 共 3 页
字号:
        rc =  bb_FN_NOT_SUPPORTED;
    }


    /* Assign the chip's COMMON function pointers */
    if (rc != bb_FN_NOT_SUPPORTED)
    {
        pChipFuncPtrs =
            ((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr;

        /* If function pointer is valid */
        if (pChipFuncPtrs->GetStatusFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->GetStatusFuncPtr)(pChipData, section,
                selStatus,  pStatus);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

/******************************************************************
* Function : IxfApiGetOpMode
*-----------------------------------------------------------------
* Description  : Gets the operation mode of the chip.
*-----------------------------------------------------------------
* Inputs  : pChipData : Initialized Chip Data
*           section   : Determines the section(block) to get the
*                       status from.
*           opMode    : The mode of operation.
* Outputs : pModeCfg  : Place to put mode.
*-----------------------------------------------------------------
* Returns : bb_Error_e  Returns Error Condition if Not successful
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : None.
******************************************************************/
bb_Error_e 
IxfApiGetOpMode(bb_ChipData_t *pChipData, bb_ChipSegment_t *section,
    bb_OperMode_e *opMode, void *pModeCfg)
{
    CommonFunctionPointers_t *pChipFuncPtrs;
    bb_Error_e rc = bb_NO_ERROR;

    /* Check to see if the specific chip's function pointer table
    has be initialized */
    if(((ChipFunctionPointers_t *) pChipData->funcPtr) != NULL)
    {
        if(((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr ==
            NULL)
        {
            /* Set Return Code */
            rc =  bb_FN_NOT_SUPPORTED;
        }
    }
    else
    {
        /* Set Return Code */
        rc =  bb_FN_NOT_SUPPORTED;
    }

    /* Assign the chip's COMMON function pointers */
    if (rc != bb_FN_NOT_SUPPORTED)
    {
        pChipFuncPtrs =
            ((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr;

        /* If function pointer is valid */
        if (pChipFuncPtrs->GetOpModeFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->GetOpModeFuncPtr)(pChipData, section,
                opMode, pModeCfg);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}
#endif

/******************************************************************
* Function : IxfApiSetOpMode
*-----------------------------------------------------------------
* Description  : Sets the operation mode of the chip.
*-----------------------------------------------------------------
* Inputs  : pChipData : Initialized Chip Data
*           section   : Determines the section(block) to get the
*                       status from.
*           opMode    : The mode of operation.
*           pModeCfg  : place to put mode.
* Outputs : None.
*-----------------------------------------------------------------
* Returns : bb_Error_e  Returns Error Condition if Not successful
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : None.
******************************************************************/
bb_Error_e 
IxfApiSetOpMode(bb_ChipData_t *pChipData, bb_ChipSegment_t *section,
    bb_OperMode_e opMode, void *pModeCfg)
{
    CommonFunctionPointers_t *pChipFuncPtrs;
    bb_Error_e rc = bb_NO_ERROR;

    /* Check to see if the specific chip's function pointer table
    has be initialized */
    if(((ChipFunctionPointers_t *) pChipData->funcPtr) != NULL)
    {
        if(((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr ==
            NULL)
        {
            /* Set Return Code */
            rc =  bb_FN_NOT_SUPPORTED;
        }
    }
    else
    {
        /* Set Return Code */
        rc =  bb_FN_NOT_SUPPORTED;
    }


    /* Assign the chip's COMMON function pointers */
    if (rc != bb_FN_NOT_SUPPORTED)
    {
        pChipFuncPtrs =
            ((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr;

        /* If function pointer is valid */
        if (pChipFuncPtrs->SetOpModeFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->SetOpModeFuncPtr)(pChipData, section,
                opMode, pModeCfg);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

#if 0
/******************************************************************
* Function : IxfApiGetCounters
*-----------------------------------------------------------------
* Description  : Retrieve a set of Counters
*-----------------------------------------------------------------
* Inputs  : pChipData   : Validated Chip Data
*           section     : Determines the section(block) to get the
*                         counters from.
*           SelCounters : Selects the set of counters
* Outputs : pCounters   : Place to put Counters
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiGetCounters(bb_ChipData_t *pChipData, bb_ChipSegment_t *section,
    bb_SelCounters_e SelCounters, void *pCounters)
{
    CommonFunctionPointers_t *pChipFuncPtrs;
    bb_Error_e rc = bb_NO_ERROR;

    /* Check to see if the specific chip's function pointer table
    has be initialized */
    if(((ChipFunctionPointers_t *) pChipData->funcPtr) != NULL)
    {
        if(((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr ==
            NULL)
        {
            /* Set Return Code */
            rc =  bb_FN_NOT_SUPPORTED;
        }
    }
    else
    {
        /* Set Return Code */
        rc =  bb_FN_NOT_SUPPORTED;
    }

    /* Assign the chip's COMMON function pointers */
    if (rc != bb_FN_NOT_SUPPORTED)
    {
        pChipFuncPtrs =
            ((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr;

        /* If function pointer is valid */
        if (pChipFuncPtrs->GetCountersFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->GetCountersFuncPtr)(pChipData,
                section, SelCounters, pCounters);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

/******************************************************************
* Function : IxfApiInitAlarmCallback
*-----------------------------------------------------------------
* Description  : Initialize the Driver
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
*           pAlarmCallback : Alarm Callback
* Outputs : None.
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiInitAlarmCallback(bb_ChipData_t *pChipData, AlarmCallBack pAlarmCallbackArg)
{
    CommonFunctionPointers_t *pChipFuncPtrs;
    bb_Error_e rc = bb_NO_ERROR;

    /* Check to see if the specific chip's function pointer table
    has be initialized */
    if(((ChipFunctionPointers_t *) pChipData->funcPtr) != NULL)
    {
        if(((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr ==
            NULL)
        {
            /* Set Return Code */
            rc =  bb_FN_NOT_SUPPORTED;
        }
    }
    else
    {
        /* Set Return Code */
        rc =  bb_FN_NOT_SUPPORTED;
    }

    /* Assign the chip's COMMON function pointers */
    if (rc != bb_FN_NOT_SUPPORTED)
    {
        pChipFuncPtrs =
            ((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr;

        /* If function pointer is valid */
        if (pChipFuncPtrs->InitAlarmCallbackFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->InitAlarmCallbackFuncPtr)(pChipData,
                pAlarmCallbackArg);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

/******************************************************************
* Function : IxfApiChipIsr
*-----------------------------------------------------------------
* Description  : Handle Interupts for Chip
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
* Outputs : None.
*-----------------------------------------------------------------
* Returns : None.
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments:   Interrupts are reported through a Callback function.
*
*   Transmit and receive Interrupts act independantly of each another.
*
*   Interrupts have been prioritized to be handled according to the severity 
*   of the effecting interupt. See the MasterInterruptHandler function for 
*   specifics
******************************************************************/
void
IxfApiChipIsr(bb_ChipData_t *pChipData)
{
    CommonFunctionPointers_t *pChipFuncPtrs;
    bb_Error_e rc = bb_NO_ERROR;

    /* Check to see if the specific chip's function pointer table
    has be initialized */
    if(((ChipFunctionPointers_t *) pChipData->funcPtr) != NULL)
    {
        if(((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr ==
            NULL)
        {
            /* Set Return Code */
            rc =  bb_FN_NOT_SUPPORTED;
        }
    }
    else
    {
        /* Set Return Code */
        rc =  bb_FN_NOT_SUPPORTED;
    }

    /* Assign the chip's COMMON function pointers */
    if (rc != bb_FN_NOT_SUPPORTED)
    {
        pChipFuncPtrs =
            ((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr;

        /* If function pointer is valid */
        if (pChipFuncPtrs->ChipIsrFuncPtr)
        {
            /* Call Function Pointer */
            (pChipFuncPtrs->ChipIsrFuncPtr)(pChipData);
        }
    }

    return;
}

/******************************************************************
* Function : IxfApiGetChipInfo
*-----------------------------------------------------------------
* Description  : Get the chip information.
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
* Outputs : pChipInfo : Place to return chip info
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiGetChipInfo(bb_ChipData_t *pChipData, bb_ChipInfo_t *pChipInfo)
{
    CommonFunctionPointers_t *pChipFuncPtrs;
    bb_Error_e rc = bb_NO_ERROR;

    /* Check to see if the specific chip's function pointer table
    has be initialized */
    if(((ChipFunctionPointers_t *) pChipData->funcPtr) != NULL)
    {
        if(((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr ==
            NULL)
        {
            /* Set Return Code */
            rc =  bb_FN_NOT_SUPPORTED;
        }
    }
    else
    {
        /* Set Return Code */
        rc =  bb_FN_NOT_SUPPORTED;
    }

    /* Assign the chip's COMMON function pointers */
    if (rc != bb_FN_NOT_SUPPORTED)
    {
        pChipFuncPtrs =
            ((ChipFunctionPointers_t *) pChipData->funcPtr)->tCommonFuncPtr;

        /* If function pointer is valid */
        if (pChipFuncPtrs->ChipInfoFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->ChipInfoFuncPtr)(pChipData, pChipInfo);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

/******************************************************************
* Function : IxfApiSetChipOnline
*-----------------------------------------------------------------
* Description  : Puts some or all of the chip online.
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
*           section   : Specifies which portion of the chip to 
*                       put online.
* Outputs : None.
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None. 
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiSetChipOnline(bb_ChipData_t *pChipData,
    bb_ChipSegment_t *section)
{
    CommonFunctionPointers_t *pChipFuncPtrs;
    bb_Error_e rc = bb_NO_ERROR;

    /* Check to see if the specific chip's function pointer table
    has be initialized */

⌨️ 快捷键说明

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