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

📄 ixnpedl.c

📁 有关ARM开发板上的IXP400网络驱动程序的源码以。
💻 C
📖 第 1 页 / 共 2 页
字号:
/** * @file IxNpeDl.c * * @author Intel Corporation * @date 08 January 2002 * * @brief This file contains the implementation of the public API for the *        IXP400 NPE Downloader component * *  * @par * IXP400 SW Release version 2.1 *  * -- Copyright Notice -- *  * @par * Copyright (c) 2001-2005, Intel Corporation. * All rights reserved. *  * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. *  *  * @par * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *  *  * @par * -- End of Copyright Notice --*//* * Put the system defined include files required *//* * Put the user defined include files required */#include "IxNpeDl.h"#include "IxNpeDlImageMgr_p.h"#include "IxNpeDlNpeMgr_p.h"#include "IxNpeDlMacros_p.h"#include "IxFeatureCtrl.h"#include "IxOsal.h"/* * #defines used in this file */ #define IMAGEID_MAJOR_NUMBER_DEFAULT 0 #define IMAGEID_MINOR_NUMBER_DEFAULT 0/* * Typedefs whose scope is limited to this file. */typedef struct{    BOOL validImage;    UINT8 functionalityId;} IxNpeDlNpeState;/* module statistics counters */typedef struct{    UINT32 attemptedDownloads;    UINT32 successfulDownloads;    UINT32 criticalFailDownloads;} IxNpeDlStats;/* * Variable declarations global to this file only.  Externs are followed * by static variables. */static IxNpeDlNpeState ixNpeDlNpeState[IX_NPEDL_NPEID_MAX] ={    {FALSE, 0},    {FALSE, 0},    {FALSE, 0}};static IxNpeDlStats ixNpeDlStats;/* * Software guard to prevent NPE from being started multiple times. */static BOOL ixNpeDlNpeStarted[IX_NPEDL_NPEID_MAX] ={FALSE, FALSE, FALSE} ;/* * static function prototypes. */PRIVATE IX_STATUSixNpeDlNpeInitAndStartInternal (UINT32 *imageLibrary, UINT32 imageId);/* * Function definition: ixNpeDlNpeStopAndReset */PUBLIC IX_STATUSixNpeDlNpeStopAndReset (IxNpeDlNpeId npeId){    IX_STATUS status = IX_SUCCESS;    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,                     "Entering ixNpeDlNpeStopAndReset\n");    /* Ensure initialisation has been completed */    ixNpeDlNpeMgrInit();    /* If not IXP42X A0 stepping, proceed to check for existence of npe's */     if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != 	 (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))	|| (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))    {        /*         * Check whether NPE is present         */        if (IX_NPEDL_NPEID_NPEA == npeId)        {            /* Check whether NPE A is present */            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)==                IX_FEATURE_CTRL_COMPONENT_DISABLED)            {                /* NPE A does not present */                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEA does not present.\n");                return IX_SUCCESS;            }        } /* end of if(IX_NPEDL_NPEID_NPEA) */        else if (IX_NPEDL_NPEID_NPEB == npeId)        {            /* Check whether NPE B is present */            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==                IX_FEATURE_CTRL_COMPONENT_DISABLED)            {                /* NPE B does not present */                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEB does not present.\n");                return IX_SUCCESS;            }        } /* end of elseif(IX_NPEDL_NPEID_NPEB) */        else if (IX_NPEDL_NPEID_NPEC == npeId)        {            /* Check whether NPE C is present */            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==                IX_FEATURE_CTRL_COMPONENT_DISABLED)            {                /* NPE C does not present */                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEC does not present.\n");                return IX_SUCCESS;            }        } /* end of elseif(IX_NPEDL_NPEID_NPEC) */        else        {            /* Invalid NPE ID */            IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeStopAndReset - invalid Npe ID\n");            status = IX_NPEDL_PARAM_ERR;        } /* end of if-else(IX_NPEDL_NPEID_NPEC) */    } /* end of if not IXP42x-A0 Silicon */    if (status == IX_SUCCESS)    {        /* call NpeMgr function to stop the NPE */        status = ixNpeDlNpeMgrNpeStop (npeId);        if (status == IX_SUCCESS)        {            /* call NpeMgr function to reset the NPE */            status = ixNpeDlNpeMgrNpeReset (npeId);        }    } /* end of if(status) */    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,                     "Exiting ixNpeDlNpeStopAndReset : status = %d\n", status);    if (IX_SUCCESS == status)    {        /* Indicate NPE has been stopped */        ixNpeDlNpeStarted[npeId] = FALSE ;    }    return status;}/* * Function definition: ixNpeDlNpeExecutionStart */PUBLIC IX_STATUSixNpeDlNpeExecutionStart (IxNpeDlNpeId npeId){    IX_STATUS status = IX_SUCCESS;    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,                     "Entering ixNpeDlNpeExecutionStart\n");    /* If not IXP42X A0 stepping, proceed to check for existence of npe's */     if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != 	 (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))	|| (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))    {        /*         * Check whether NPE is present         */        if (IX_NPEDL_NPEID_NPEA == npeId)        {            /* Check whether NPE A is present */            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)==                IX_FEATURE_CTRL_COMPONENT_DISABLED)            {                /* NPE A does not present */                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEA does not present.\n");                return IX_SUCCESS;            }        } /* end of if(IX_NPEDL_NPEID_NPEA) */        else if (IX_NPEDL_NPEID_NPEB == npeId)        {            /* Check whether NPE B is present */            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==                IX_FEATURE_CTRL_COMPONENT_DISABLED)            {                /* NPE B does not present */                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEB does not present.\n");                return IX_SUCCESS;            }        } /* end of elseif(IX_NPEDL_NPEID_NPEB) */        else if (IX_NPEDL_NPEID_NPEC ==  npeId)        {            /* Check whether NPE C is present */            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==                IX_FEATURE_CTRL_COMPONENT_DISABLED)            {                /* NPE C does not present */                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEC does not present.\n");                return IX_SUCCESS;            }        } /* end of elseif(IX_NPEDL_NPEID_NPEC) */        else        {            /* Invalid NPE ID */            IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeExecutionStart - invalid Npe ID\n");            return IX_NPEDL_PARAM_ERR;        } /* end of if-else(IX_NPEDL_NPEID_NPEC) */    } /* end of if not IXP42x-A0 Silicon */    if (TRUE == ixNpeDlNpeStarted[npeId])    {        /* NPE has been started. */        return IX_SUCCESS ;    }    /* Ensure initialisation has been completed */    ixNpeDlNpeMgrInit();    /* call NpeMgr function to start the NPE */    status = ixNpeDlNpeMgrNpeStart (npeId);    if (IX_SUCCESS == status)    {        /* Indicate NPE has started */        ixNpeDlNpeStarted[npeId] = TRUE ;    }    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,                     "Exiting ixNpeDlNpeExecutionStart : status = %d\n",                     status);    return status;}/* * Function definition: ixNpeDlNpeExecutionStop */PUBLIC IX_STATUSixNpeDlNpeExecutionStop (IxNpeDlNpeId npeId){    IX_STATUS status = IX_SUCCESS;    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,                     "Entering ixNpeDlNpeExecutionStop\n");    /* Ensure initialisation has been completed */    ixNpeDlNpeMgrInit();    /* If not IXP42X A0 stepping, proceed to check for existence of npe's */     if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != 	 (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))	|| (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))    {        /*         * Check whether NPE is present         */        if (IX_NPEDL_NPEID_NPEA == npeId)        {            /* Check whether NPE A is present */

⌨️ 快捷键说明

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