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

📄 ixf_api.c

📁 开发Inetl IXP2400平台所必须的硬件诊断和测试程序。该软件包支持的功能包括CPU基本功能检测
💻 C
📖 第 1 页 / 共 3 页
字号:
    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->ChipOnlineFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->ChipOnlineFuncPtr)(pChipData, section);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

/******************************************************************
* Function : IxfApiSetChipOffline
*-----------------------------------------------------------------
* Description  : Takes some or all of the chip offline.
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
*           section  :  Specifies which portion of the chip to 
*                       take offline.
* Outputs : None.
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiSetChipOffline(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 */
    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->ChipOfflineFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->ChipOfflineFuncPtr)(pChipData, section);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}
#endif

/******************************************************************
* Function : IxfApiReset
*-----------------------------------------------------------------
* Description  : Reset (chip or a section of the chip) and then 
*                reconfigure it. To restart traffic, the chip or 
*                section of chip must be set back online
*-----------------------------------------------------------------
* Inputs  : pChipData : Initialized Chip Data
*           section   : Determines the section(block) to reset
*           resetType : Specifies type of Reset
* Outputs : None.
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiReset(bb_ChipData_t *pChipData, bb_ChipSegment_t *section,
    bb_SelResetType_e resetType)
{
    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->ResetFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->ResetFuncPtr)(pChipData, section, resetType);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

#if 0
/******************************************************************
* Function : IxfApiCfgTest
*-----------------------------------------------------------------
* Description  : Run Tests
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
*           section   : Determines the section(block) to run the
*                       test for.
*           testType : The type of test to run.
*           pTestCfg : Contains the test configuration data.
* Outputs : None.
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e
IxfApiCfgTest(bb_ChipData_t *pChipData, bb_ChipSegment_t *section,
    bb_TestType_e testType, void *pTestCfg)
{
    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->CfgTestFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->CfgTestFuncPtr)(pChipData, section,
                testType, pTestCfg);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

/******************************************************************
* Function : IxfApiSetAlarmCfg
*-----------------------------------------------------------------
* Description  : Edits Interrupt Enabled Masks for a Specific Set
*                of Interrupts.
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
*           section   : Determines the section(block) of the alarm(s)
*                       to edit.
*           AlarmType : Specifies the type of Alarm
*           pAlarmCfg : A pointer to the alarm structure.
* Outputs : 
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiSetAlarmCfg(bb_ChipData_t *pChipData, bb_ChipSegment_t *section,
    bb_AlarmType_e AlarmType, void *pAlarmCfg)
{
    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->SetAlarmCfgFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->SetAlarmCfgFuncPtr)(pChipData, section,
                AlarmType, pAlarmCfg);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}
#endif

/******************************************************************
* Function : IxfApiGenericRead
*-----------------------------------------------------------------
* Description  : This routine will read starting at a particular 
*                location and read for N number of words.
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
*           wordSize  : Identifies the size of a word.
*           address   : Location where to start reading from.
*           length    : Number of words to read.
* Outputs : buffer    : The buffer to contain the read data.
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiGenericRead(bb_ChipData_t *pChipData, bb_Word_Size_t wordSize,
    ulong address, ushort length, void *buffer)
{
    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->ReadFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->ReadFuncPtr)(pChipData, wordSize,
                address, length, buffer);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}


/******************************************************************
* Function : IxfApiGenericWrite
*-----------------------------------------------------------------
* Description  : This routine will write starting at a particular 
*                location and write for N number of words.
*-----------------------------------------------------------------
* Inputs  : pChipData : Validated Chip Data
*           wordSize  : Identifies the size of a word.
*           address   : Location where to start writing to.
*           length    : Number of words to write.
*           buffer    : The buffer to contain the read data.
* Outputs : None.
*-----------------------------------------------------------------
* Returns : 
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : 
******************************************************************/
bb_Error_e 
IxfApiGenericWrite(bb_ChipData_t *pChipData, bb_Word_Size_t wordSize,
    ulong address, ushort length, void *buffer)
{
    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->WriteFuncPtr)
        {
            /* Call Function Pointer */
            rc = (pChipFuncPtrs->WriteFuncPtr)(pChipData, wordSize,
                address, length, buffer);
        }
        else
        {
            rc = bb_FN_NOT_SUPPORTED;
        }
    }

    return rc;
}

⌨️ 快捷键说明

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