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

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

?? zl5011xtfq.c

?? Zalink50114----TDMoIP芯片驅動源碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*******************************************************************************
*
*  File name:              zl5011xTfq.c
*
*  Version:                28
*
*  Author:                 MRC
*
*  Date created:           23/04/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 Tfq block.
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     23/04/2002  MRC      Creation
*  2     18/06/2002  PJE      reorganised interruptMask
*  3     18/06/2002  PJE      reorganised interruptMask
*  4     28/06/2002  MRC      Changed the flush fn to allow bit to be set even
*                             resume is set.
*  5     03/07/2002  PJE      modified(debugged) Enable & DisableInterrupts
*  6     19/09/2002  MRC      Added max granule fn
*  7     01/10/2002  DJA      Function TfqEnableInterrupts renamed to
*                             zl5011xTfqEnableInterrupts
*                             Function TfqDisableInterrupts renamed to
*                             zl5011xTfqDisableInterrupts
*  8     08/07/2002  PJE      new zl5011xTfqClearGranuleThresholdIntr
*  9     21/10/2002  PJE      new TfqEnable/DisableGranuleThresholdIntr
*  10    24/10/2002  PJE      API tidy up
*  11    31/10/2002  MRC      Added variants + minor fixes
*  12    22/11/2002  PJE      debug // comments
*  13    22/11/2002  PJE      debug ctxt %3d bad format
*  14    29/11/2002  MRC      Added check to ensure that the TFQ has resumed
*                             allowing any queue depth modification.
*  15    06/02/2003  MRC      Added TFQ reset function
*  16    24/03/2003  MRC      Prevented use of 16 bit queue for rev A devices
*  17    22/05/2003  MRC      Added fns to determine packet reception
*  18    05/06/2003  MRC      Added fn to return queue status
*  19    21/06/2003  MRC      Added fn to return current queue length and mask
*                             off invalid bits from the average length
*  20    07/01/2004  MRC      Corrected comment for fn TfqGetReadPointer
*  21    25/03/2004  APL      Corrected comment in fn TfqGetCurrentLength
*  22    23/07/2004  MRC      Fixed some compiler warnings
*  23    26/08/2004  MRC      Updated queue reset function
*  24    20/10/2004  MRC      Fixed queue depth stats functions
*  25    02/12/2004  APL      Added helper function zl5011xTfqFormatAvgLength
*  26    14/02/2005  MRC      Modified comment
*  27    19/04/2005  MRC      Clears extend / reduce when starting a queue
*  28    17/05/2005  MRC      Added function to reset queue statistics
*
*******************************************************************************/

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

#include "zl5011x.h"
#include "zl5011xTfq.h"
#include "zl5011xTfqMap.h"
#include "zl5011xUtilLib.h"

/*****************   EXPORTED GLOBAL VARIABLES    *****************************/

/*****************   STATIC GLOBAL VARIABLES      *****************************/

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

 Function:
   zl5011xTfqInit

 Description:
   This function initialises the TFQ block and data structure.

 Inputs:
   zl5011xParams      Pointer to the structure for this device instance

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

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

zlStatusE zl5011xTfqInit(zl5011xParamsS *zl5011xParams)
{
   zlStatusE status = ZL5011X_OK;
   Uint32T loop;

   ZL5011X_TRACE(ZL5011X_TFQ_FN_ID, "zl5011xTfqInit:", 0, 0, 0, 0, 0, 0);

   /* initialise the device structure */
   for (loop = 0; loop < ZL5011X_MAX_NUMBER_CONTEXTS; loop++)
   {
      zl5011xParams->wanIf.txQueue[loop].queueMode = ZL5011X_WAN_TX_QUEUE_FIFO;
      zl5011xParams->wanIf.txQueue[loop].queueBaseAddress = (Uint32T)ZL5011X_NOT_INITIALISED;
   }

   return(status);
}

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

 Function:
   zl5011xTfqConfigure

 Description:
   This function configures the queue for a context. Sets the address, size and
   mode of operation for the queue.
   A queue may only be modified when the context is in the INIT state. That is,
   the queue has not been previously updated.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   context        Context to use
   baseAddress    the byte address of the queue in packet memory
   size           enum to control the size of the queue (2^size)
   mode           whether the queue should resequence, and if so, the size of
                  the sequence number

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

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

zlStatusE zl5011xTfqConfigure(zl5011xParamsS *zl5011xParams, Uint32T context,
      Uint32T baseAddress, zl5011xWanTxQueueSizeE size,
      zl5011xWanTxQueueOperationE mode)

{
   zlStatusE status = ZL5011X_OK;
   Uint32T bits = 0, address;

   ZL5011X_TRACE_CONTEXT(ZL5011X_TFQ_FN_ID, context, "zl5011xTfqConfigure: ctxt %3ld, base 0x%08lx, size %d, mode %d",
                 context, baseAddress, size, mode, 0, 0);


   if (zl5011xParams->wanIf.tfmCurrent.context[context].state != ZL5011X_STATE_INIT)
   {
      status = ZL5011X_CONTEXT_NOT_IN_INIT;
   }

   if (status == ZL5011X_OK)
   {
      if ((baseAddress & ~ZL5011X_TFQ_BASE_ADDRESS_MASK) != 0)
      {
         status = ZL5011X_PARAMETER_INVALID;
      }
   }

   if (status == ZL5011X_OK)
   {
      status = ZL5011X_CHECK_WAN_TX_QUEUE_SIZE(size);
   }

   /* rev A does not support 16 bit sequence numbers for queue resequencing */
   if (mode == ZL5011X_WAN_TX_QUEUE_RESEQUENCE_16)
   {
      mode = ZL5011X_WAN_TX_QUEUE_RESEQUENCE_8;
   }

   if (status == ZL5011X_OK)
   {
      /* work out which bits to set for the queue sequencing mode */
      switch (mode)
      {
         case ZL5011X_WAN_TX_QUEUE_FIFO:
            bits = 0;
            break;

         case ZL5011X_WAN_TX_QUEUE_RESEQUENCE_8:
            /* in 8 bit sequence number mode, the maximum queue size
               is 128 packets */
            if (size > ZL5011X_WAN_TX_QUEUE_SIZE_128)
            {
               status = ZL5011X_PARAMETER_INVALID;
            }

            bits = (ZL5011X_1BIT_MASK << ZL5011X_TFQ_RESEQUENCE_MODE_BIT) |
                  (ZL5011X_1BIT_MASK << ZL5011X_TFQ_SEQUENCE_NUM_SIZE_BIT);
            break;

         case ZL5011X_WAN_TX_QUEUE_RESEQUENCE_16:
            bits = (ZL5011X_1BIT_MASK << ZL5011X_TFQ_RESEQUENCE_MODE_BIT);
            break;

         default :
            status = ZL5011X_PARAMETER_INVALID;
      }
   }

   if (status == ZL5011X_OK)
   {
      address = ZL5011X_TFQ_CTXT_STATIC_SETUP +
            (context * ZL5011X_TFQ_CTXT_CONTROL_SIZE);

      /* shift the size and base address fields into their correct place */
      bits |= (size << ZL5011X_TFQ_SIZE_BITS) |
            (baseAddress << ZL5011X_TFQ_BASE_ADDRESS_BITS);

      status = zl5011xWrite(zl5011xParams, address, bits);
   }

   /* stash the queue settings in the device structure */
   if (status == ZL5011X_OK)
   {
      zl5011xParams->wanIf.txQueue[context].queueMode = mode;
      zl5011xParams->wanIf.txQueue[context].queueBaseAddress = baseAddress;
      zl5011xParams->wanIf.txQueue[context].queueSize = size;
   }

   return(status);
}

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

 Function:
   zl5011xTfqSetACP

 Description:
   The depth of the queue is continually averaged by the device, and the average
   value used in the adaptive clocking algorithm (for asynchronous WAN
   operation). The Averaging Control Parameter controls the number of packets
   that are included in the averaging function (i.e. the time response) as
   follows:

      AVG[n] = AVG[n-1] + ((QUEUE_DEPTH[n] - AVG[n-1]) / 2^ACP)

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   context        context to use
   avgMode        enum to control the averaging of the queue (2^avgMode)


 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

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

zlStatusE zl5011xTfqSetACP(zl5011xParamsS *zl5011xParams, Uint32T context,
   zl5011xWanTxQueueAvgModeE avgMode)
{
   zlStatusE status = ZL5011X_OK;
   Uint32T bits, address;

   ZL5011X_TRACE_CONTEXT(ZL5011X_TFQ_FN_ID,  context, "zl5011xTfqSetACP: ctxt %3ld, mode %d",
                 context, avgMode, 0, 0, 0, 0);

   if (status == ZL5011X_OK)
   {
      status = ZL5011X_CHECK_WAN_TX_QUEUE_AVG(avgMode);
   }

   if (status == ZL5011X_OK)
   {
      address = ZL5011X_TFQ_CTXT_MIN_MAX_LENGTH +
            (context * ZL5011X_TFQ_CTXT_CONTROL_SIZE);

      /* set the average mode, and also initialise the min queue length */
      bits = (avgMode << ZL5011X_TFQ_ACP_BITS) |
            (ZL5011X_TFQ_QUEUE_LENGTH_MASK << ZL5011X_TFQ_MIN_QUEUE_LENGTH_BITS);

      status = zl5011xWrite(zl5011xParams, address, bits);
   }

   if (status == ZL5011X_OK)
   {
      zl5011xParams->wanIf.txQueue[context].queueAvgMode = avgMode;
   }

   return(status);
}

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

 Function:
   zl5011xTfqFlush

 Description:
   In order to do a teardown (delete the context), the queue is flushed. The
   queue cannot be flushed if it is still in resume.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   context        context to use

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   The base address for the queue is not initialised by this function. This
   means that the queue can be resumed without needing to be configured again.

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

zlStatusE zl5011xTfqFlush(zl5011xParamsS *zl5011xParams, Uint32T context)
{
   zlStatusE status = ZL5011X_OK;
   Uint32T bits, address;

   ZL5011X_TRACE_CONTEXT(ZL5011X_TFQ_FN_ID, context, "zl5011xTfqFlush: ctxt %3ld",
                 context, 0, 0, 0, 0, 0);

   address = ZL5011X_TFQ_CTXT_STATIC_SETUP + (context * ZL5011X_TFQ_CTXT_CONTROL_SIZE);

   /* read the current state of the register, to check that neither
      flush or resume are already set */
   status = zl5011xRead(zl5011xParams, address, &bits);

   if (status == ZL5011X_OK)
   {
      if ((bits & (ZL5011X_1BIT_MASK << ZL5011X_TFQ_RESUME_BIT)) != 0)
      {
         status = ZL5011X_WAN_QUEUE_IN_RESUME;
      }
      else
      {
         if ((bits & (ZL5011X_1BIT_MASK << ZL5011X_TFQ_FLUSH_BIT)) != 0)
         {
            status = ZL5011X_WAN_QUEUE_IN_FLUSH;
         }
      }

      /* the return codes set above are really just for information to the
         calling function. So set the flush bit and clear the resume bit anyway. */
      bits &= ~(ZL5011X_1BIT_MASK << ZL5011X_TFQ_RESUME_BIT);
      bits |= ZL5011X_1BIT_MASK << ZL5011X_TFQ_FLUSH_BIT;

      /* ignore the return code from the write operation */
      (void)zl5011xWrite(zl5011xParams, address, bits);
   }

   return(status);
}

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

 Function:
   zl5011xTfqResume

 Description:
   In order to start a context, the queue needs to be resumed. The
   queue cannot be resumed if it is still in flush.
   A check is made, to ensure that the memory for the queue has been set up, and
   the queue is them initialised to 0.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   context        context to use

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

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

zlStatusE zl5011xTfqResume(zl5011xParamsS *zl5011xParams, Uint32T context)
{
   zlStatusE status = ZL5011X_OK;
   Uint32T bits, regAddress;
   Uint32T queueAddress, loop, queueSize32Bits;

   ZL5011X_TRACE_CONTEXT(ZL5011X_TFQ_FN_ID, context, "zl5011xTfqResume: ctxt %3ld",
                 context, 0, 0, 0, 0, 0);

   regAddress = ZL5011X_TFQ_CTXT_STATIC_SETUP + (context * ZL5011X_TFQ_CTXT_CONTROL_SIZE);

   /* read the current state of the register, to check that neither
      flush or resume are already set */
   status = zl5011xRead(zl5011xParams, regAddress, &bits);

   if (status == ZL5011X_OK)
   {
      if ((bits & (ZL5011X_1BIT_MASK << ZL5011X_TFQ_RESUME_BIT)) != 0)
      {
         status = ZL5011X_WAN_QUEUE_IN_RESUME;
      }
      else
      {
         if ((bits & (ZL5011X_1BIT_MASK << ZL5011X_TFQ_FLUSH_BIT)) != 0)
         {
            status = ZL5011X_WAN_QUEUE_IN_FLUSH;
         }
      }
   }

   /* check that the queue size is set to a valid number */
   if (status == ZL5011X_OK)
   {
      status = ZL5011X_CHECK_WAN_TX_QUEUE_SIZE(zl5011xParams->wanIf.txQueue[context].queueSize);
   }

   if (status == ZL5011X_OK)
   {
      /* check that the base address has been set, and if so zero out the queue */
      if (zl5011xParams->wanIf.txQueue[context].queueBaseAddress == (Uint32T)ZL5011X_NOT_INITIALISED)
      {
         status = ZL5011X_ERROR;
      }
   }

   /* this gives the length of the queue in Task Manager messages */
   queueSize32Bits = ZL5011X_1BIT_MASK << zl5011xParams->wanIf.txQueue[context].queueSize;

   /* converting this into 32 bits words gives */
   queueSize32Bits *= ZL5011X_TFQ_MESSAGE_SIZE_WORDS;

   /* get the start address of the queue */
   queueAddress = zl5011xParams->wanIf.txQueue[context].queueBaseAddress;

   /* zero the contents of the queue */
   for (loop = 0; loop < queueSize32Bits; loop ++)
   {
      if (status != ZL5011X_OK)
         break;

      status = zl5011xWrite(zl5011xParams, queueAddress, 0);
      queueAddress += sizeof(Uint32T);
   }

   if (status == ZL5011X_OK)
   {
      /* clear the dynamic control register bits with the exception of the interrupt enable */
      status = zl5011xReadModWrite(zl5011xParams,
            ZL5011X_TFQ_CTXT_DYNAMIC_SETUP + (context * ZL5011X_TFQ_CTXT_CONTROL_SIZE),
            0,
            ~(ZL5011X_1BIT_MASK << ZL5011X_TFQ_OVERFLOW_INT_ENABLE));
   }

   if (status == ZL5011X_OK)
   {
      /* set the resume bit */
      bits |= ZL5011X_1BIT_MASK << ZL5011X_TFQ_RESUME_BIT;
      status = zl5011xWrite(zl5011xParams, regAddress, bits);
   }

   return(status);
}

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

 Function:
   zl5011xTfqGetQueueStatus

 Description:
   Returns whether the queue is active or not.
 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   context        context to use

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费精品国自产拍在线不卡| 色素色在线综合| av一二三不卡影片| 欧美一区二区久久久| 国产精品网站导航| 久久国产夜色精品鲁鲁99| 91在线精品秘密一区二区| 精品国产91久久久久久久妲己| 一区二区三区中文字幕电影| 国产精品综合视频| 欧美一区国产二区| 亚洲国产欧美日韩另类综合| 国产91富婆露脸刺激对白| 日韩欧美一二三| 亚洲电影中文字幕在线观看| 91最新地址在线播放| 国产日韩欧美电影| 国产一区在线视频| 精品对白一区国产伦| 日本成人在线看| 欧美乱妇20p| 亚洲高清视频的网址| 91女厕偷拍女厕偷拍高清| 中文字幕欧美三区| 国产精品一区在线观看乱码| 日韩欧美激情四射| 全部av―极品视觉盛宴亚洲| 欧美视频第二页| 亚洲综合激情小说| 色婷婷综合久久久中文一区二区| 国产精品国产三级国产aⅴ中文| 国产乱人伦偷精品视频免下载 | 亚洲女同ⅹxx女同tv| 国产精品99久久久久久久女警| 欧美成人一级视频| 久久99久久精品| 精品久久久久久最新网址| 蜜桃91丨九色丨蝌蚪91桃色| 欧美一区二区在线播放| 日本伊人精品一区二区三区观看方式| 欧美三级电影网站| 婷婷国产v国产偷v亚洲高清| 欧美亚洲动漫制服丝袜| 亚洲一区在线播放| 欧美日韩亚洲丝袜制服| 一区二区三区加勒比av| 欧美专区在线观看一区| 亚洲一区二区不卡免费| 欧美日韩久久不卡| 日本va欧美va瓶| 日韩三区在线观看| 精品一区二区三区免费毛片爱| 欧美一级黄色大片| 卡一卡二国产精品| 精品国产一区二区三区忘忧草 | 久久99国产精品免费网站| 欧美日韩精品高清| 日韩va亚洲va欧美va久久| 日韩视频免费观看高清完整版在线观看 | 成人少妇影院yyyy| 国产午夜精品一区二区三区视频| 国产成人av电影在线播放| 中文字幕不卡三区| 91成人免费电影| 无码av免费一区二区三区试看| 91麻豆精品国产无毒不卡在线观看 | 91精品麻豆日日躁夜夜躁| 久久激五月天综合精品| 国产欧美一二三区| 91麻豆蜜桃一区二区三区| 亚洲国产成人高清精品| 日韩三级在线观看| a在线欧美一区| 亚洲成人av在线电影| 精品三级在线看| 成人h动漫精品| 亚洲国产欧美日韩另类综合 | 日韩写真欧美这视频| 国产精品资源在线| 亚洲蜜桃精久久久久久久| 69堂精品视频| 国产激情视频一区二区在线观看 | 中文字幕在线一区| 欧美性色欧美a在线播放| 另类调教123区| 亚洲欧洲av色图| 欧美精选午夜久久久乱码6080| 久久99精品久久久久婷婷| 国产精品福利一区| 91精品国产高清一区二区三区蜜臀| 国产一区二区视频在线| 一区二区三区四区在线免费观看 | 成人黄色av电影| 午夜a成v人精品| 中文字幕第一页久久| 欧美久久一二区| 成人福利电影精品一区二区在线观看| 亚洲午夜激情av| 久久久www成人免费毛片麻豆| 在线一区二区三区| 国产美女娇喘av呻吟久久| 一二三区精品福利视频| 欧美xfplay| 欧美午夜不卡在线观看免费| 国产麻豆91精品| 亚洲成a人在线观看| 欧美激情一区三区| 欧美蜜桃一区二区三区| 99麻豆久久久国产精品免费优播| 日韩电影一二三区| 亚洲日本电影在线| 久久这里只精品最新地址| 欧美亚一区二区| 99视频精品在线| 国产一区二区三区观看| 午夜伊人狠狠久久| 国产精品久久久久影院| 日韩一区二区电影网| 91久久一区二区| 国产真实乱偷精品视频免| 五月天丁香久久| 亚洲免费观看高清完整版在线 | 国产精品黄色在线观看| 91精品国产一区二区人妖| 91免费观看国产| 粉嫩aⅴ一区二区三区四区| 日本vs亚洲vs韩国一区三区二区| 亚洲美女屁股眼交| 国产精品人成在线观看免费| 精品美女被调教视频大全网站| 欧美日韩一区不卡| 色欧美片视频在线观看在线视频| 国产大陆亚洲精品国产| 蜜臀久久久99精品久久久久久| 亚洲国产成人tv| 一区二区三区精品视频在线| 亚洲欧美综合在线精品| 国产精品国产三级国产普通话三级 | 色综合色狠狠天天综合色| 国产91露脸合集magnet| 精品一区二区影视| 男人操女人的视频在线观看欧美| 一区二区三区日韩精品| 中文字幕人成不卡一区| 亚洲国产高清不卡| 国产精品无码永久免费888| 国产亚洲婷婷免费| 日韩小视频在线观看专区| 欧美日韩精品一区视频| 91久久精品国产91性色tv| 丁香网亚洲国际| 国产aⅴ综合色| 成人午夜在线视频| 国产精品1区2区| 国产91精品在线观看| 丁香啪啪综合成人亚洲小说| 国产激情偷乱视频一区二区三区 | 亚洲欧美另类图片小说| 亚洲日本丝袜连裤袜办公室| 亚洲丝袜自拍清纯另类| 亚洲免费观看在线视频| 亚洲男人电影天堂| 亚洲一区中文在线| 香蕉久久一区二区不卡无毒影院| 亚洲成av人片www| 日韩电影免费在线看| 精品一区二区三区久久| 国产一区二区三区在线看麻豆| 国产一区二区三区美女| 成人福利在线看| 欧美在线视频你懂得| 欧美四级电影在线观看| 88在线观看91蜜桃国自产| 日韩手机在线导航| 久久综合久久久久88| 日本一区二区三区四区| 一区在线播放视频| 亚洲一区二区欧美| 日韩专区在线视频| 精彩视频一区二区三区| 大白屁股一区二区视频| 色哟哟在线观看一区二区三区| 在线观看国产一区二区| 337p亚洲精品色噜噜噜| 精品国产三级电影在线观看| 国产欧美一区二区三区网站| 亚洲色图制服诱惑 | 日韩理论片在线| 午夜亚洲国产au精品一区二区| 精品一区二区综合| 不卡视频在线观看| 欧美日韩另类一区| 精品嫩草影院久久| 成人欧美一区二区三区黑人麻豆 | 婷婷国产v国产偷v亚洲高清| 久久不见久久见免费视频1| 成人动漫一区二区在线| 欧美日韩午夜精品| 久久久久九九视频| 亚洲精品乱码久久久久久日本蜜臀|