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

📄 ixhssacccodelet.c

📁 intel IXP400系列cpu(2.3版)的库文件
💻 C
📖 第 1 页 / 共 2 页
字号:
/** * @file IxHssAccCodelet.c * * @date 26 Mar 2002 * * @brief This file contains the main routine for the HSS Access Codelet. * *  * @par * IXP400 SW Release version 2.3 *  * -- 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 -- * @sa IxHssAccCodelet.h *//* * Put the system defined include files required. */#ifdef __vxworks#include <end.h>    /* END drivers */#include <endLib.h> /* END drivers */#include <logLib.h>#include <ioLib.h>#endif/* * Put the user defined include files required. */#include "IxHssAcc.h"#include "IxNpeDl.h"#include "IxNpeMh.h"#include "IxOsal.h"#include "IxQMgr.h"#include "IxFeatureCtrl.h"#include "IxHssAccCodelet.h"#if defined(__wince) && defined(IX_USE_SERCONSOLE)#include "IxSerConsole.h"#define printf ixSerPrintf#define gets ixSerGets#endif/* * #defines and macros used in this file. *//** * NPE-A Image  */#define IX_HSSACC_CODELET_NPEA_IMAGE_ID IX_NPEDL_NPEIMAGE_NPEA_HSS_2_PORT/* * Typedefs whose scope is limited to this file. *//* * Variable declarations global to this file only.  Externs are followed by * static variables. *//* Service Flag */extern BOOL packetisedFlag ;extern BOOL channelisedFlag ;/* * Function prototypes. */IX_STATUSixHssAccCodeletServiceMain (IxHssAccCodeletPortMode portMode);/* * Function definition: ixHssAccCodeletMain */PUBLIC IX_STATUSixHssAccCodeletMain (IxHssAccCodeletOperation operationType,                     IxHssAccCodeletPortMode portMode,                     IxHssAccCodeletVerifyMode verifyMode){    /* Setup codelet services */    switch (operationType)    {      case IX_HSSACC_CODELET_PKT_CHAN_SERV :           packetisedFlag = TRUE ;           channelisedFlag = TRUE ;           break ;      case IX_HSSACC_CODELET_PKT_SERV_ONLY :                packetisedFlag = TRUE ;           break ;      case IX_HSSACC_CODELET_CHAN_SERV_ONLY :           channelisedFlag = TRUE ;           break ;      default:	  printf ("Invalid operationType option! \n");	  printf ("Please choose one of the following options: \n");	  printf ("%u : Packetised Service Only.\n",		  IX_HSSACC_CODELET_PKT_SERV_ONLY);	  printf ("%u : Channelised Service Only. \n", 		  IX_HSSACC_CODELET_CHAN_SERV_ONLY);	  printf ("%u : Packetised & Channelised Services.\n", 		  IX_HSSACC_CODELET_PKT_CHAN_SERV);        return IX_FAIL;    }    /* Check HSS Port Mode */    if ((IX_HSSACC_CODELET_HSS_PORT_0_ONLY > portMode) &&        (IX_HSSACC_CODELET_DUAL_PORTS < portMode))    {	printf ("Invalid portMode option! \n");        printf ("Please choose one of the following options: \n");        printf ("%u : HSS Port 0 Only.\n", 		IX_HSSACC_CODELET_HSS_PORT_0_ONLY);        printf ("%u : HSS Port 1 Only.\n", 		IX_HSSACC_CODELET_HSS_PORT_1_ONLY);        printf ("%u : Both HSS Port 0 and 1. \n", 		IX_HSSACC_CODELET_DUAL_PORTS);        return IX_FAIL;    }    /* Check Verify Mode */    if ((IX_HSSACC_CODELET_VERIFY_ON != verifyMode) &&        (IX_HSSACC_CODELET_VERIFY_OFF != verifyMode))    {  	printf ("Invalid verifyMode option! \n");        printf ("Please choose one of the following options: \n");        printf ("%u : Codelet verifies received traffic.\n", 		IX_HSSACC_CODELET_VERIFY_ON);        printf ("%u : Codelet does not verify received traffic.\n", 		IX_HSSACC_CODELET_VERIFY_OFF);        return IX_FAIL;         }    else     {        /*         * Enable verification in both packatised and channelised services.          */        ixHssAccCodeletPacketisedVerifySet ((verifyMode == IX_HSSACC_CODELET_VERIFY_ON ? TRUE : FALSE));        ixHssAccCodeletChannelisedVerifySet((verifyMode == IX_HSSACC_CODELET_VERIFY_ON ? TRUE : FALSE));    }       /* The codelet only supports PHY Loopback. Disable codelet loopback  */    ixHssAccCodeletHssLoopbackSet (TRUE);    ixHssAccCodeletCodeletLoopbackSet (FALSE);     /* Initialize npeDl, npeMh, QMgr and hssAcc */    if (IX_SUCCESS != ixHssAccCodeletInit())    {        printf("ixHssAccCodeletInit() fails ! Exit \n");        return IX_FAIL;    }    /* Start HSS Services */    ixHssAccCodeletServiceStart(portMode);    return IX_SUCCESS ;}/* * Function definition: ixHssAccCodeletServiceMain */IX_STATUSixHssAccCodeletServiceMain (IxHssAccCodeletPortMode portMode){    IxHssAccHdlcPort hdlcPortId;    UINT32 i;     /**********************/    /* CONFIGURE HSS PORT */    /**********************/    if ((IX_HSSACC_CODELET_HSS_PORT_0_ONLY == portMode) ||        (IX_HSSACC_CODELET_DUAL_PORTS == portMode))    {        ixHssAccCodeletConfigure (IX_HSSACC_HSS_PORT_0);    }    if ((IX_HSSACC_CODELET_HSS_PORT_1_ONLY == portMode) ||        (IX_HSSACC_CODELET_DUAL_PORTS == portMode))    {        ixHssAccCodeletConfigure (IX_HSSACC_HSS_PORT_1);    }    /******************/    /* START SERVICES */    /******************/    if (TRUE == packetisedFlag)    {        if ((IX_HSSACC_CODELET_HSS_PORT_0_ONLY == portMode) ||            (IX_HSSACC_CODELET_DUAL_PORTS == portMode))        {            /* start the Packetised Service for all clients */            for (hdlcPortId = 0; hdlcPortId < IX_HSSACC_HDLC_PORT_MAX;                 hdlcPortId++)            {                ixHssAccCodeletPacketisedServiceStart (IX_HSSACC_HSS_PORT_0, hdlcPortId);            }	}        if ((IX_HSSACC_CODELET_HSS_PORT_1_ONLY == portMode) ||            (IX_HSSACC_CODELET_DUAL_PORTS == portMode))        {            /* start the Packetised Service for all clients */            for (hdlcPortId = 0; hdlcPortId < IX_HSSACC_HDLC_PORT_MAX;                 hdlcPortId++)            {                ixHssAccCodeletPacketisedServiceStart (IX_HSSACC_HSS_PORT_1, hdlcPortId);            }	}    }    if (TRUE == channelisedFlag)    {         if ((IX_HSSACC_CODELET_HSS_PORT_0_ONLY == portMode) ||            (IX_HSSACC_CODELET_DUAL_PORTS == portMode))        {            /* start the Channelised Service for the single client */            ixHssAccCodeletChannelisedServiceConfigure (IX_HSSACC_HSS_PORT_0);	}        if ((IX_HSSACC_CODELET_HSS_PORT_1_ONLY == portMode) ||            (IX_HSSACC_CODELET_DUAL_PORTS == portMode))        {            /* start the Channelised Service for the single client */            ixHssAccCodeletChannelisedServiceConfigure (IX_HSSACC_HSS_PORT_1);	}        if ((IX_HSSACC_CODELET_HSS_PORT_0_ONLY == portMode) ||            (IX_HSSACC_CODELET_DUAL_PORTS == portMode))        {            /* start the Channelised Service for the single client */            ixHssAccCodeletChannelisedServiceStart (IX_HSSACC_HSS_PORT_0);	}        if ((IX_HSSACC_CODELET_HSS_PORT_1_ONLY == portMode) ||            (IX_HSSACC_CODELET_DUAL_PORTS == portMode))        {            /* start the Channelised Service for the single client */            ixHssAccCodeletChannelisedServiceStart (IX_HSSACC_HSS_PORT_1);	}    }     /*********************/    /* EXERCISE SERVICES */    /*********************/    for (i = 0; i < (IX_HSSACC_CODELET_DURATION_IN_MS/200); i++)    {        if (TRUE == packetisedFlag)        {            if ((IX_HSSACC_CODELET_HSS_PORT_0_ONLY == portMode) ||                (IX_HSSACC_CODELET_DUAL_PORTS == portMode))            {                /* let each packetised client exercise the Packetised Service */                for (hdlcPortId = 0; hdlcPortId < IX_HSSACC_HDLC_PORT_MAX;                     hdlcPortId++)                {                    ixHssAccCodeletPacketisedServiceRun (IX_HSSACC_HSS_PORT_0, hdlcPortId);                }	    }            if ((IX_HSSACC_CODELET_HSS_PORT_1_ONLY == portMode) ||                (IX_HSSACC_CODELET_DUAL_PORTS == portMode))            {                /* let each packetised client exercise the Packetised Service */                for (hdlcPortId = 0; hdlcPortId < IX_HSSACC_HDLC_PORT_MAX;                     hdlcPortId++)                {                    ixHssAccCodeletPacketisedServiceRun (IX_HSSACC_HSS_PORT_1, hdlcPortId);                }	    }        }        if (TRUE == channelisedFlag)        {            if ((IX_HSSACC_CODELET_HSS_PORT_0_ONLY == portMode) ||                (IX_HSSACC_CODELET_DUAL_PORTS == portMode))            {                /* let the channelised client exercise the Channelised Service */                ixHssAccCodeletChannelisedServiceRun (IX_HSSACC_HSS_PORT_0);	    }            if ((IX_HSSACC_CODELET_HSS_PORT_1_ONLY == portMode) ||                (IX_HSSACC_CODELET_DUAL_PORTS == portMode))            {                /* let the channelised client exercise the Channelised Service */                ixHssAccCodeletChannelisedServiceRun (IX_HSSACC_HSS_PORT_1);	    }        }

⌨️ 快捷键说明

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