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

📄 aal2tablecreatexp.c

📁 摩托罗拉Motolola公司网络处理器C3的示范代码.实现了ATM的AAL2层交换功能.想了解网络处理器的可以
💻 C
字号:
/* *  aal2TableCreate.c * *  AAL2 Switch tables creation. *//* *  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 <dcpTypes.h>#include <dcpTableSvcs.h>#include <atm.h>#include <aal2TableDefs.h>#include <aal2XpIf.h>/* * table ids : * these values are sent to the RC application in a message */TS_TABLE_DATA(cidTab);TsTableId TABLE_ID_CID;/* *  Function:           aal2TableCreate() * *  Description:        Create the system wide tables using the DCP system *                      services the appropriate table id for the lookup. *  *  Arguments:          none * *  Returns:            none */void aal2TableCreate(){    /*     *  Create the indexed tables for CID lookup     *  Number of VcIndices supported in the sample app = 25      *  Number of CIDs supported = 255, but say 256     *  Number of Table Entries supported = 25 * 256     */    tsTableInit(&cidTab, tsTableData, 25 * 256, 16, 4);    tsTableCreate(&cidTab, &TABLE_ID_CID);    return;}/* *  Function:           aal2CidTableWrite() * *  Description:        Write a set of VC entries out to the CID table * *  Arguments:          tabEntry - pointer to the table entry *                      tableId  - table identifier * *  Returns:            none */void aal2CidTableWrite (CidTabEntry* tabEntry, TsTableId tableId){    aal2WriteVerify ((int32u)tabEntry->index, &tabEntry->data, tableId, 16);}/* *  Function:           aal2WriteVerify() * *  Description:        Write a single table entry, read it back and compare * *  Arguments:          tableIndex - index into the table *                      tableData  - pointer to the data to be written into *                                   the table entry *                      tableId    - table identifier *                      length     - length of the data to be written into *                                   the table entry * *  Returns:            none */void aal2WriteVerify   (int32u     tableIndex,                        void*      tableData,                        TsTableId  tableId,                        int        length){    int         offset      = 0;    TsEntry     entry;    TsKey       key;    TsStatus    stat;    CidTabEntryData      *testPtr;    key.keyData     = (int32u*)&tableIndex;    key.maskLenBits = 0;    entry.length  = length;    entry.reqTag  = tsRequestTag(0);    entry.respTag = 0;    while (offset < length)    {        entry.data    = tableData;        entry.offset  = offset;        /* ksPrintf("Egress Data: %x, Ingress key", entry.data, *key.keyData); */                stat = tsEntryInsert(tableId, &key, &entry);        if (stat) {ksPrintf("Aal2 Table Insert failed: %d", stat); }        stat = tsEntryLookup(tableId, &key, &entry);        if (stat) {ksPrintf("Aal2 Table Lookup failed: %d", stat); ksPanic("ts");}        while(!tsLookupResponseValid(entry.respTag))            ;        testPtr = (CidTabEntryData *)tsLookupGetResponse(entry.respTag);        tsLookupRelease(entry.respTag);        if (memcmp(testPtr, tableData, 12))        {            ksPrintf("Error: Table update request failed !!!  Exiting...\n");            ksPanic("aal2WriteVerify");        }        /* ksPrintf("eg VcIndex:%d, eg CID: %d, eg Queue Id: %d", 			((CidTabEntryData *)testPtr)->vcIndex, 			((CidTabEntryData *)testPtr)->cid,			((CidTabEntryData *)testPtr)->queueId);  */        tableData += 16;        offset    += 16;    }}

⌨️ 快捷键说明

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