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

📄 xpmaininit.c

📁 摩托罗拉Motolola公司网络处理器C3的示范代码.实现了ATM的AAL2层交换功能.想了解网络处理器的可以
💻 C
字号:
/* *  Copyright (c) 2001, 2002 C-Port Corporation *  All Rights Reserved * *  The information contained in this file is confidential and proprietary. *  Any reproduction, use or disclosure, in whole or in part, of this *  program, including any attempt to obtain a human-readable version of this *  program, without the express, prior written consent of C-Port *  Corporation is strictly prohibited. */#include <dcpKernelSvcs.h>#include <dcpTableSvcs.h>#include <dcpQueueSvcs.h>#include <dcpBufferSvcs.h>#include <dcpRegisterDefs.h>#include <dcpBootFlags.h>#include <dcpPsGen.h>#include <dcpPsAtm.h>#include <dcpPsSonet.h>#include <atm.h>#include <atmXpIf.h>#include <aal2XpIf.h>#include <aal2.h>#include <xpMainInit.h>BsPoolId          poolIds[NUMBER_OF_CPS];QosQueueParams qosQueueParams[7] = {    {   32,   32},    {   32,   32},    {   64,   64},    {  128,  128},    {  512,  512},    {   64,   64},    {   32,   32},};void aal2Check(QsStatus ret){    if (ret != qsStatusSuccess)    {        ksPrintf("code %d\n", ret);        ksPanic("aal2XpInit");    }}void configureQmu(void){    QsQueueId    ids[100];    QsStatus     ret;    KsProcId     pid;    int32u       pool = 0;    int32u       allowLimit;    int32u       index = 0;    int32u       procNum;    int32u       queueNum;    /* Setup dynamic pool 0 */    ret = qsQueuePool(pool, 16384);    aal2Check(ret);    /* Configure QoS CP queues */    for (procNum = 0; procNum < NUMBER_OF_PROCS; procNum++)    {        pid = qmuParams[procNum].pid;        if (QOS_CP(procNum))        {            index = 0;            ret = qsQueueCreate(pid, 100, ids);            aal2Check(ret);            /* Shaper queues : CBR and rt-VBR */            for (queueNum = 0 ; queueNum < 100 ; queueNum++)            {                switch(queueNum)                {                    case 64:                    case 96:                    case 97:                    case 98:                    case 99:                        index++;                        break;                    default:                        break;                }                ret = qsQueueConfig(ids[queueNum], pool,                                         qosQueueParams[index].allow,                                             qosQueueParams[index].limit);                aal2Check(ret);            }        }        else        {            /* Configure CP, FP and XP queues */            qsQueueCreate(pid, MAX_QUEUES_PER_PROC, ids);            for (queueNum = 0 ; queueNum < MAX_QUEUES_PER_PROC ;queueNum++)            {                allowLimit = qmuParams[procNum].allow_limit[queueNum];                 ret = qsQueueConfig(ids[queueNum], pool,                               1 << (allowLimit >> 4),                              1 << (allowLimit & 0x0F));                aal2Check(ret);            }        }    }    qsEnable();}/**************************************************************************** * *  Function:       DCPmain() * *  Description:    Main routine. * *  Arguments:      package - The Package * *  Returns:        FALSE - if terminated abnormally * ***************************************************************************/int DCPmain(KsPackage package){    int32u atmPortNum = 0;    int i;    PsSonetType       sonetRate    = psSonetTypeOC3c;    KsProcId          procId;    /* Initialize all of the system services */    ksInitialize(AAL2_MAIN_THREAD_STACK_SIZE);  /* DCP kernel services */    qsInitialize(16);                           /* DCP queue services  */    bsInitialize();                             /* DCP buffer services */    /*     * Configure QMU      * --------------------------------------------------------     */    configureQmu();    /*     * Configure BMU      * --------------------------------------------------------     */    for (i=0; i< NUMBER_OF_CPS; i++)     {        if (bmuParams[i])        {            poolIds[i] = bsPoolAllocate((1 << bmuParams[i]), 64);        }    }    if ((_XpBootFlags & BMU_PRECONFIGURED) == 0) BS_DUMP_PRECONFIG_INFO();    /*     * Configure the SDP's     * --------------------------------------------------------     */    for (i=0; i<NUMBER_OF_CPS; i++)    {        procId = CPprocID(i);        if (ATM_CP(i))        {            atmPortNum = procId;            psSonetPortConfigure(procId, sonetRate, ksSdpSideBoth);            psSonetScrambleSet(procId, TRUE);#ifdef SIM            psSonetPayloadScrambleSet(procId, FALSE);#else            psSonetPayloadScrambleSet(procId, TRUE);#endif            psTxWaterMarkSet(i, 16);            psTxAutoInsertCells(i, TRUE);            psTxAutoInsertionEnable(i, TRUE);            psAtmPortConfigure(procId, sonetRate, ksSdpSideBoth);            atmUcodeConfigure(procId, sonetRate,0);        }        else if (AAL2_RX_CP(i) || AAL2_TX_CP(i))        {            ksSdpByteLoopbackConfigure(procId);        }    }    /* load rc's */    ksProcLoad(package) ;    /* Chain to main program */    ksProcLoadXp(package, NULL);    while(1);}

⌨️ 快捷键说明

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