亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? zl5011xpkcpreprocess.c

?? Zalink50114----TDMoIP芯片驅動源碼
?? C
字號:
/*******************************************************************************
*
*  File name:              zl5011xPkcPreProcess.c
*
*  Version:                11
*
*  Author:                 LCW
*
*  Date created:           16/05/2002
*
*  Copyright 2002, 2003, 2004, 2005, Zarlink Semiconductor Limited.
*  All rights reserved.
*
*  Module Description:
*  This file contains all the functions that will initialise and control
*  the PKC Pre-Process block.
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     16/05/2002  LCW      Creation.
*  2     16/05/2002  LCW      Minor mods.
*  3     17/05/2002  LCW      Minor mods.
*  4     17/05/2002  LCW      Minor mods.
*  5     17/05/2002  LCW      Minor mods.
*  6     24/05/2002  LCW      Minor mods.
*  7     27/06/2002  LCW      Review actions.
*  8     06/08/2002  MRC      Rewrote filtering fns
*  9     27/09/2002  DJA      File header updated
*  10    31/10/2002  MRC      Added variants + minor fixes
*  11    23/07/2004  MRC      Fixed some compiler warnings
*
*******************************************************************************/

/*****************   INCLUDE FILES   ******************************************/

#include "zl5011x.h"
#include "zl5011xPkc.h"
#include "zl5011xPkcMap.h"
#include "zl5011xUtilLib.h"
#include "zl5011xRdWr.h"

/*******************************************************************************

 Function:
    zl5011xPkcFilterGetFreeEntry

 Description:
   This function can reserve an entry in the filter if a valid match
   number is provided, or will allocate one if possible.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of a free entry or ZL5011X_INVALID to allocate a
                  match number

 Outputs:
   matchNum       the number of a free entry if at input it was ZL5011X_INVALID

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcFilterGetFreeEntry(zl5011xParamsS *zl5011xParams,
      Uint32T *matchNum)
{
   Uint32T loop;
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcFilterGetFreeEntry: match in %d",
         *matchNum, 0, 0, 0, 0, 0);

   /* if the match number was set to a special value of invalid,
      then one will be automatically found */
   if (*matchNum == (Uint32T)ZL5011X_INVALID)
   {
      for (loop = 0; loop < ZL5011X_PKC_NUM_FILTER_ENTRIES; loop++)
      {
         if (zl5011xParams->packetIf.packetRx.pkcFilter[loop].filterReserved == ZL5011X_FALSE)
            break;
      }

      if (loop >= ZL5011X_PKC_NUM_FILTER_ENTRIES)
      {
         /* no free matches in the classifier, so return error */
         status = ZL5011X_NO_AVAIL_FILTER_MATCH;
      }
      else
      {
         *matchNum = loop;
      }
   }
   else
   {
      /* if the number was specified, but was not valid, then throw an error */
      if (*matchNum >= ZL5011X_PKC_NUM_FILTER_ENTRIES)
      {
         status = ZL5011X_PARAMETER_INVALID;
      }
      else
      {
         /* check that the match is not already in use */
         if (zl5011xParams->packetIf.packetRx.pkcFilter[*matchNum].filterReserved == ZL5011X_TRUE)
         {
            status = ZL5011X_FILTER_MATCH_IN_USE;
         }
      }
   }

   /* reserve the match if there has not been an error */
   if (status == ZL5011X_OK)
   {
      zl5011xParams->packetIf.packetRx.pkcFilter[*matchNum].filterReserved = ZL5011X_TRUE;

      ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
            "zl5011xPkcFilterGetFreeEntry: match out %d",
            *matchNum, 0, 0, 0, 0, 0);
   }

   return(status);
}

/*******************************************************************************

 Function:
    zl5011xPkcFilterEnableEntry

 Description:
   Enables a filter entry. The entry should be configured before it is
   enabled.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of the entry to enable

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcFilterEnableEntry(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum)
{
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcFilterEnableEntry: match %3d",
         matchNum, 0, 0, 0, 0, 0);

   /* check pre classifier entry number is in range */
   if (matchNum >= ZL5011X_PKC_NUM_FILTER_ENTRIES)
   {
      status = ZL5011X_PARAMETER_INVALID;
   }

   if (status == ZL5011X_OK)
   {
      zl5011xParams->packetIf.packetRx.pkcFilter[matchNum].filterInUse = ZL5011X_TRUE;

      /* set the bit to enable the filter entry */
      status = zl5011xReadModWrite(zl5011xParams, ZL5011X_PKC_FILTER_ENABLE,
            ZL5011X_1BIT_MASK << matchNum,
            ZL5011X_1BIT_MASK << matchNum);
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xPkcFilterDisableEntry

 Description:
   Disables a filter entry. The entry is still reserved, but is disabled
   in the device.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of the entry to disable

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcFilterDisableEntry(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum)
{
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcFilterDisableEntry: match %3d",
         matchNum, 0, 0, 0, 0, 0);

   /* check the filter entry number is in range */
   if (matchNum >= ZL5011X_PKC_NUM_FILTER_ENTRIES)
   {
      status = ZL5011X_PARAMETER_INVALID;
   }

   if (status == ZL5011X_OK)
   {
      zl5011xParams->packetIf.packetRx.pkcFilter[matchNum].filterInUse = ZL5011X_FALSE;

      /* set the bit to disable the pre classifier entry */
      status = zl5011xReadModWrite(zl5011xParams, ZL5011X_PKC_FILTER_ENABLE,
            0,
            ZL5011X_1BIT_MASK << matchNum);
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xPkcFilterDeleteEntry

 Description:
   Deletes a filter entry. The entry is marked as free, to allow it to
   be allocated again.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of the entry to delete

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcFilterDeleteEntry(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum)
{
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcFilterDeleteEntry: match %3d",
         matchNum, 0, 0, 0, 0, 0);

   status = zl5011xPkcFilterDisableEntry(zl5011xParams, matchNum);

   /* if the disable was okay, then free the filter by clearing
      the reserved flag */
   if (status == ZL5011X_OK)
   {
      zl5011xParams->packetIf.packetRx.pkcFilter[matchNum].filterReserved = ZL5011X_FALSE;
   }

   return status;
}

/*******************************************************************************

 Function:
   zl5011xPkcFilterSetMatch

 Description:
   A filter can be setup to match on a destination MAC address or ethertype
   and then forward the packet to the CPU.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance.
   matchNum       the number of the entry to configure
   match          structure containing the pre processor match settings

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcFilterSetMatch(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum, zl5011xPacketFilterMatchS *match)
{
   Uint32T tempWord[(ZL5011X_PKC_FILTER_MATCH_SIZE / sizeof(Uint32T)) + 1];
   Uint8T tempPos = 0;
   Uint8T index = 0;
   Uint32T address = 0;
   Uint32T loop, bits;
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcFilterSetMatch: match %3d",
         matchNum, 0, 0, 0, 0, 0);

   /* check that the parameters are okay */
   if ((matchNum >= ZL5011X_PKC_NUM_FILTER_ENTRIES) ||
      (match == NULL))
   {
      status = ZL5011X_PARAMETER_INVALID;
   }

   if (status == ZL5011X_OK)
   {
      address = ZL5011X_PKC_FILTER_MATCH + (matchNum * ZL5011X_PKC_FILTER_MATCH_SIZE);

      /* if the filter is not enabled, then the CPU queue is not required
         so force to a valid value */
      if (match->ethertypeFilterEnable != ZL5011X_TRUE)
      {
         match->ethertypeCpuQueue = ZL5011X_QUEUE_0;
      }

      if (match->macAddressFilterEnable != ZL5011X_TRUE)
      {
         match->macAddressCpuQueue = ZL5011X_QUEUE_0;
      }
   }

   /* check that the output parameters are okay */
   if (status == ZL5011X_OK)
   {
      status = ZL5011X_CHECK_QUEUE_NUMBER(match->macAddressCpuQueue);
   }

   if (status == ZL5011X_OK)
   {
      status = ZL5011X_CHECK_QUEUE_NUMBER(match->ethertypeCpuQueue);
   }

   if (status == ZL5011X_OK)
   {
      if (match->macAddressNumMaskBits >= (ZL5011X_1BIT_MASK << ZL5011X_PKC_FILTER_MAC_RANGE_FIELD))
      {
         status = ZL5011X_PARAMETER_INVALID;
      }
   }

   /* destination MAC address */
   for (loop = 0; loop < ZL5011X_MAC_SIZE; loop++)
   {
      if (status != ZL5011X_OK)
         break;

      status = zl5011xAssembleBitFields(tempWord, &index, &tempPos,
            match->macAddress[loop],
            ZL5011X_PKC_FILTER_MAC_ADDRESS_FIELD);
   }

   /* destination MAC address range */
   if(status == ZL5011X_OK)
   {
      status = zl5011xAssembleBitFields(tempWord, &index, &tempPos,
            match->macAddressNumMaskBits,
            ZL5011X_PKC_FILTER_MAC_RANGE_FIELD);
   }

   /* CPU queue to forward Mac address matches to */
   if(status == ZL5011X_OK)
   {
      status = zl5011xAssembleBitFields(tempWord, &index, &tempPos,
            match->macAddressCpuQueue,
            ZL5011X_PKC_FILTER_MAC_CPU_QUEUE_FIELD);
   }

   /* forward the Mac address matched packets to the CPU */
   if(status == ZL5011X_OK)
   {
      if (match->macAddressFilterEnable == ZL5011X_TRUE)
      {
         bits = 0x0;
      }
      else
      {
         bits = 0x1;
      }

      status = zl5011xAssembleBitFields(tempWord, &index, &tempPos,
            bits,
            ZL5011X_PKC_FILTER_MAC_ENABLE_FIELD);
   }

   /* ethertype to match */
   if(status == ZL5011X_OK)
   {
      status = zl5011xAssembleBitFields(tempWord, &index, &tempPos,
            match->ethertype,
            ZL5011X_PKC_FILTER_TYPE_ETHERTYPE_FIELD);
   }

   /* CPU queue to forward ethertype matches to */
   if(status == ZL5011X_OK)
   {
      status = zl5011xAssembleBitFields(tempWord, &index, &tempPos,
            match->ethertypeCpuQueue,
            ZL5011X_PKC_FILTER_TYPE_CPU_QUEUE_FIELD);
   }

   /* forward the ethertype matched packets to the CPU */
   if(status == ZL5011X_OK)
   {
      if (match->ethertypeFilterEnable == ZL5011X_TRUE)
      {
         bits = 0x0;
      }
      else
      {
         bits = 0x1;
      }

      status = zl5011xAssembleBitFields(tempWord, &index, &tempPos,
            bits,
            ZL5011X_PKC_FILTER_TYPE_ENABLE_FIELD);
   }

   /* Write assembled bits to device */
   if (status == ZL5011X_OK)
   {
      status = zl5011xWriteAssembledBitFields(zl5011xParams, tempWord,
            index, tempPos, address);
   }

   /* need to store all of these settings into the device structure */
   if (status == ZL5011X_OK)
   {
      (void)memcpy(&zl5011xParams->packetIf.packetRx.pkcFilter[matchNum].filterMatch,
            match, sizeof(zl5011xPacketFilterMatchS));
   }

   return status;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美另类z0zxhd电影| 91精品国产日韩91久久久久久| 成人精品国产福利| 在线成人午夜影院| 国产精品乱码一区二区三区软件| 五月天精品一区二区三区| 高清在线观看日韩| 久久精品一区蜜桃臀影院| 亚洲精品少妇30p| 国产精品1区2区| 日韩三级在线免费观看| 欧美日韩精品一区二区三区四区| 国产一区二区0| 成人免费看视频| 99re这里都是精品| 在线视频国产一区| 制服丝袜成人动漫| 国产精品1区二区.| 欧美性极品少妇| 一区二区三区中文字幕电影| 国产不卡高清在线观看视频| 欧美一区二区三区免费观看视频| 亚洲国产毛片aaaaa无费看| 91麻豆成人久久精品二区三区| 国产视频在线观看一区二区三区| www.爱久久.com| 国产婷婷色一区二区三区 | 欧美电影一区二区| 艳妇臀荡乳欲伦亚洲一区| 91免费小视频| 亚洲图片你懂的| 99re成人在线| 亚洲精品久久久蜜桃| av动漫一区二区| 亚洲免费观看视频| 在线观看日韩高清av| 亚洲午夜在线电影| 91.com视频| 伦理电影国产精品| 精品福利av导航| 成人激情动漫在线观看| 国产精品久久久久一区| 99久久er热在这里只有精品15| 国产精品高清亚洲| 91免费看视频| 午夜精品久久久久久久久| 日韩一区二区电影网| 乱中年女人伦av一区二区| 国产无人区一区二区三区| 成人福利视频网站| 亚洲免费观看视频| 欧美精品色一区二区三区| 奇米色777欧美一区二区| 日韩一区和二区| 成人免费毛片a| 性做久久久久久| 日韩美女在线视频| 99国产麻豆精品| 香港成人在线视频| 精品国产一区二区三区久久久蜜月 | 激情久久久久久久久久久久久久久久| 日韩欧美国产综合一区 | 日韩国产一区二| 欧美不卡在线视频| 91尤物视频在线观看| 日韩av中文字幕一区二区| 国产三级一区二区| 91国偷自产一区二区三区成为亚洲经典| 亚洲成人福利片| 国产欧美日韩亚州综合| 在线成人小视频| 精品一区二区在线免费观看| 4438亚洲最大| 亚洲免费av观看| 日韩一二三区视频| 日本精品视频一区二区三区| 欧美伊人久久久久久久久影院 | 国产精品996| 亚洲综合色在线| 久久日韩粉嫩一区二区三区| 一本到一区二区三区| 久久爱www久久做| 亚洲综合无码一区二区| 久久久久免费观看| 欧美日韩你懂得| 99re66热这里只有精品3直播| 日韩精品久久久久久| 中文字幕一区二区三区在线不卡 | 国产不卡视频一区| 视频一区欧美精品| 1区2区3区欧美| 欧美国产成人在线| 日韩欧美资源站| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 高清不卡一区二区在线| 激情综合网激情| 强制捆绑调教一区二区| 香蕉乱码成人久久天堂爱免费| 国产精品视频九色porn| 久久婷婷一区二区三区| 亚洲一区视频在线观看视频| 国产精品天干天干在观线| 337p粉嫩大胆噜噜噜噜噜91av| 欧美日韩亚洲高清一区二区| 色老头久久综合| 色综合一区二区| 99久久99久久免费精品蜜臀| 成人美女在线视频| 国产馆精品极品| 国产精品一区久久久久| 久久www免费人成看片高清| 奇米色777欧美一区二区| 亚洲成av人片在线观看| 亚洲国产欧美日韩另类综合| 一区二区三区精品在线| 亚洲一区在线观看视频| 亚洲午夜精品17c| 亚洲国产成人va在线观看天堂| 亚洲精品欧美激情| 亚洲一二三区不卡| 婷婷综合在线观看| 美女一区二区在线观看| 欧美一区二区三区在线看| 久久精品国产一区二区三区免费看| 亚洲国产高清不卡| 欧美成人乱码一区二区三区| 91黄色免费看| 国产精品久久久久久亚洲毛片| 久久欧美中文字幕| 亚洲视频在线一区观看| 夜夜嗨av一区二区三区 | 中文字幕佐山爱一区二区免费| 亚洲国产高清在线观看视频| 欧美国产一区二区| 国产精品免费av| 夜夜嗨av一区二区三区| 免费在线成人网| 欧美日韩免费高清一区色橹橹 | 中文字幕亚洲一区二区va在线| 日韩美女久久久| 天天综合色天天| 国产91色综合久久免费分享| 91污在线观看| 日韩三级精品电影久久久 | 日韩亚洲欧美综合| 欧美国产一区二区在线观看| 亚洲与欧洲av电影| 加勒比av一区二区| 99久久国产综合精品女不卡| 欧美男男青年gay1069videost| 日韩精品在线一区二区| 亚洲国产精品高清| 亚洲成国产人片在线观看| 国产乱码一区二区三区| 在线一区二区三区四区| 久久天天做天天爱综合色| 中文字幕亚洲一区二区av在线 | 国产成人综合自拍| 国产一区二区三区av电影| 国产在线精品一区二区夜色| 国模无码大尺度一区二区三区| 韩国视频一区二区| 国产成人av一区二区三区在线观看| 国产米奇在线777精品观看| 久久久五月婷婷| 亚洲欧洲精品一区二区三区不卡| 美日韩一级片在线观看| 欧美色欧美亚洲另类二区| 国产日产欧美一区二区视频| 亚洲一区在线观看视频| 成人免费黄色大片| 亚洲精品免费在线| 日本va欧美va欧美va精品| 国产jizzjizz一区二区| 色欧美片视频在线观看在线视频| 处破女av一区二区| 成人国产在线观看| 大白屁股一区二区视频| 成人午夜av电影| 欧美日韩在线观看一区二区 | 久久久久国产精品厨房| 亚洲成人综合网站| 欧美吻胸吃奶大尺度电影| 久久亚洲精精品中文字幕早川悠里 | 成人精品一区二区三区四区 | 免费高清不卡av| 成人成人成人在线视频| 日韩精品一区二区三区蜜臀| 亚洲午夜精品网| 国产精品自拍网站| 亚洲国产精品自拍| 不卡在线观看av| 亚洲午夜激情网站| 777奇米四色成人影色区| 狠狠色丁香久久婷婷综| 久久婷婷一区二区三区| 一区二区三区四区中文字幕| 日韩精品成人一区二区三区| 狠狠色丁香婷综合久久| 欧美精品一二三|