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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mem.c

?? 基于56F8346的異步電機(jī)VVVF控制程序。
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
*              cannot allocate an aligned buffer from
*              either partition, it calls memMallocEM
*              to try to allocate a buffer of the correct
*              size without the proper alignment.
*
* Arguments:
*       size - the new size of the memory buffer to be
*              allocated in internal memory
*
* Return:      If memory is insufficient to satisfy the request
*              from either partition, memMallocAlignedIM returns NULL
*
*******************************************************/
void *  memMallocAlignedEM (size_t size)
{
  void * pMem;

  pMem = memMallocAligned (&ExternalMemoryPool, size);
  if (pMem == NULL) {
    pMem = memMallocAligned (&InternalMemoryPool, size);
    if (pMem == NULL) {
      pMem = memMallocEM (size);
    }
  }
  return pMem;
}


/*******************************************************
*
* Method: memFreeEM
*
* Description: This function deallocates a memory block
*              in external memory that previously had
*              been dynamically allocated with
*              the routine memMallocEM.
*
* Arguments:
*   memblock - pointer to previously allocated memory
*
* Return:      None
*
*******************************************************/
void    memFreeEM   (void * memblock)
{
  if (memIsEM(memblock)) {
    memFree (&ExternalMemoryPool, memblock);
  }
  else {
    memFree (&InternalMemoryPool, memblock);
  }
}


/*******************************************************
*
* Method: memIsAligned
*
* Description: This function checks the address of
*              a memory block to determine whether
*              it is properly aligned to use modulo
*              addressing.
*
* Arguments:
*   memblock - the address of the memory block
*              to check alignment for modulo addressing
*       size - the size to which the block should
*              be aligned for modulo addressing
*
* Return:      The function memIsAligned returns true
*              if the address is aligned so that modulo
*              addressing can be used; otherwise, it
*              returns false.
*
*******************************************************/
bool    memIsAligned (void * memblock, size_t size)
{
  UInt16 Modulo;                       /* Modulo of the defined memory size */
  UInt16 ModuloMask;                   /* Bits mask of the modulo size */

  Modulo = 1;                          /* Set minimal modulo */
  while(size > Modulo){
    Modulo=Modulo << 1;                /* Set modulo to a double modulo (2,4,8,16, ...) */
  }
  ModuloMask = Modulo - 1;             /* Set bits mask of the modulo */
  return (((UInt16)memblock & ModuloMask) == 0); /* TRUE  - memblock mod Modulo = 0 */
                                       /* FALSE - memblock mod Modulo > 0 */
}


/*******************************************************
* Mem
*
* Description:
*   General-purpose ANSI C-compliant memory pool manager.
*
* Author:
*   Mark Glenn
*
* Design:
*   These routines manage a memory buffer that you specify, internally
*   called the pool.  Blocks of memory are allocated from and returned
*   to this pool.
*
*   The first UInt32 of every block is the size of the block
*   in bytes, inclusive.  This value is positive if the block is free,
*   negative if the block is in use, and zero if this is the last block
*   of the pool.
*******************************************************/

/* The header for each memory block in a pool. */
#pragma warn_padding off
typedef struct {
  /* The size of the block. This includes the size of this sBlockHead. */
  Int32 Size;
} sBlockHead;

/* sPool -- Holds the state of a memory pool. */
typedef struct {
  /* Points to the first block of the pool. */
  sBlockHead * pFirst;
  /* Points to the last block of the pool. */
  sBlockHead * pLast;
  /* Points to a block within the pool.  It is used
  // to remain "close" to memory most likely to be free.  We could just
  // start from the beginning of the pool each time, but then we would
  // very likely have to skip over many in-use blocks, especially as
  // memory is allocated from a fresh pool.  We wrap to pFirst if
  // there isn't enough memory between pCurrent and the end of the pool,
  // to satisfy the request. */
  sBlockHead * pCurrent;
  /* If set, aborts the program when the memory pool is
  // exhausted.  Otherwise, behave as ANSI requires. */
  bool Assert;
  /* True if we are to mutex-protect the pool. */
  bool Protect;
} sPool;
#pragma warn_padding reset


/*******************************************************
*
* Method: memProtect
*
* Description: This function set memory protection.
*
* Arguments:
*   pMemPool - pointer to the memory pool
*
* Return:      None
*
*******************************************************/
extern void memProtect(mem_sPool * pMemPool)
{
  sPool * pPool=(sPool *)pMemPool;

  pPool -> Protect=true;
}


/*******************************************************
*
* Method: memCleanUp
*
* Description: This function cleans memory.
*              Starting from the beginning of the pool,
*              merge blocks that are not in use.
*              Stop at the first in-use block.
*
* Arguments:
*   pMemPool - pointer to the memory pool
*
* Return:      Size of the free memory
*
*******************************************************/
extern size_t memCleanUp(mem_sPool * pMemPool)
{
  bool            bSatMode;
  sPool         * pPool       = (sPool *) pMemPool;
  sBlockHead    * pBlock      = pPool -> pFirst;
  sBlockHead    * pFirstBlock = pBlock;
  Int32           TotalSize   = 0;
  Int32           Size;

  bSatMode = archGetSetSaturationMode(false);
  pPool -> pCurrent = pBlock;
  while (Size = pBlock -> Size, Size != 0) {
    if (Size < 0) break;
    TotalSize += Size;
    pBlock = (sBlockHead *) (((char *) pBlock) + Size);
  }
  pFirstBlock -> Size = TotalSize;
  archGetSetSaturationMode(bSatMode);
  return (size_t)TotalSize;
}


/*******************************************************
*
* Method: MergeFree
*
* Description: This function assumes that pBlock points to a block not in-use.
*              Checks the block following to determine its state.  If it is not in-use,
*              merge it to the current block.  pBlock will not change, but the
*              size of the block to which it points may increase.
*
* Arguments:
*      pPool - pointer to the memory pool
*     pBlock - pointer to the memory pool
* SizeNeeded - size of the memory block
*
* Return:      None
*
*******************************************************/
static Int32 MergeFree(sPool* pPool, sBlockHead * pBlock, Int32 SizeNeeded)
{
  bool  bSatMode;
  Int32 CurrentSize = pBlock -> Size;

  bSatMode = archGetSetSaturationMode(false);
  assert ((((UWord16)pBlock) & 0x0001) == 0); /* Ensure that pBlock is double-word aligned */
  while (true) {
    sBlockHead * pNext;
    Int32        NextSize;

    /* Get a pointer to the next block and retrieve it's size. */
    pNext = ((sBlockHead *)(((char *) pBlock) + CurrentSize));
    assert ((((UWord16)pNext) & 0x0001) == 0); /* Ensure that pNext is double-word aligned */
    NextSize  = pNext -> Size;
    assert ((NextSize & 0x0003) == 0); /* Ensure that NextSize is double-word aligned */
    /* If the next block is in use or is the last block (Size == 0), return. */
    if (NextSize <= 0) {
      assert ((CurrentSize & 0x0003) == 0); /* Ensure that NextSize is double-word aligned */
      pBlock -> Size = CurrentSize;
      archGetSetSaturationMode (bSatMode);
      return CurrentSize;
    }
    /* Increment the known size of the current block.  We won't store it
    // until we are about to leave the routine. */
    CurrentSize += NextSize;
    /* If pCurrent happens to point to the block that we are about
    // to combine, reset it to point to the beginning of the merged block. */
    if (pNext == pPool -> pCurrent)
      pPool -> pCurrent = pBlock;

    /* Optimized to get out as soon as we know we can satisfy the request. */
    if (CurrentSize >= SizeNeeded) {
      assert ((CurrentSize & 0x0003) == 0); /* Ensure that NextSize is double-word aligned */
      pBlock -> Size = CurrentSize;
      archGetSetSaturationMode (bSatMode);
      return CurrentSize;
    }
  }
}

/*******************************************************
*
* Method: SplitBlock
*
* Description: Assumes that pBlock points to a block larger than SizeNeeded.
*              If the block is large enough to contain SizeNeeded plus another block,
*              the block is split.  The area returned to the user is the user
*              portion of the first block.  The remainder in its entirety will
*              be set to describe a not-in-use block.
*
* Arguments:
*      pPool - pointer to the memory pool
*     pBlock - pointer to the memory pool
* SizeNeeded - size of the memory block
*
* Return:      None
*
*******************************************************/
#pragma warn_unusedarg off
static void * SplitBlock(sPool * pPool, sBlockHead * pBlock, Int32 SizeNeeded)
{
  bool           bSatMode;
  Int32          Remainder;
  sBlockHead   * pUser     = pBlock + 1;
  Int32          BlockSize = pBlock -> Size;

  bSatMode = archGetSetSaturationMode(false);
  assert ((((UWord16)pBlock) & 0x0001) == 0); /* Ensure that pBlock is double-word aligned */
  #ifdef ADDRESSING_8
  /* Allocate in 4 8-bit units only. */
  SizeNeeded = (SizeNeeded + 3) & ~3;
  #endif
  if ((Remainder = BlockSize - SizeNeeded) > sizeof(sBlockHead)) {
    assert ((Remainder & 0x0003) == 0); /* Ensure that Remainder is double-word aligned */
    assert ((SizeNeeded & 0x0003) == 0); /* Ensure that Remainder is double-word aligned */
    /* Set the size of the first part of the split. */
    pBlock -> Size = -SizeNeeded;
    /* Point to the next block of the split. */
    pBlock = (sBlockHead *) ((char *) pBlock + SizeNeeded);
    assert ((((UWord16)pBlock) & 0x0001) == 0); /* Ensure that pBlock is double-word aligned */
    pBlock -> Size  = Remainder;
  }
  else {
    /* Don't split block. */
    pBlock -> Size = -BlockSize;
    pBlock         = (sBlockHead *) ((char *) pBlock + BlockSize);
    assert ((((UWord16)pBlock) & 0x0001) == 0); /* Ensure that pBlock is double-word aligned */
  }

  /* Store a pointer to a likely candidate block. */
  pPool -> pCurrent = pBlock;
  archGetSetSaturationMode(bSatMode);
  return pUser;
}
#pragma warn_unusedarg reset

/*******************************************************
*
* Method: SplitBlockRev
*
* Description: Assumes that pBlock points to a block larger than SizeNeeded.
*              If the block is large enough to contain SizeNeeded plus another block,
*              the block is split.  The area returned is the
*              portion of the end of the block.  The remainder in its entirety will
*              be set to describe a not-in-use block.
*
* Arguments:
*      pPool - pointer to the memory pool
*     pBlock - pointer to the memory pool
* SizeNeeded - size of the memory block
*
* Return:      None
*
*******************************************************/
#pragma warn_unusedarg off
static void * SplitBlockRev(sPool * pPool, sBlockHead * pBlock, UInt32 SizeNeeded)
{
  bool           bSatMode;
  sBlockHead   * pUser;
  Int32          BlockSize = pBlock -> Size;

  bSatMode  = archGetSetSaturationMode(false);
  assert ((((UWord16)pBlock) & 0x0001) == 0); /* Ensure that pBlock is double-word aligned */
  #ifdef ADDRESSING_8
  /* Allocate in 4 8-bit units only. */

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本视频免费一区| 欧美三级视频在线| 大白屁股一区二区视频| 韩国三级中文字幕hd久久精品| 美女被吸乳得到大胸91| 麻豆国产欧美一区二区三区| 日韩成人午夜精品| 日韩激情中文字幕| 免费成人美女在线观看| 久久不见久久见免费视频7 | 午夜精品久久久| 亚洲第一主播视频| 日本成人在线看| 美腿丝袜亚洲综合| 国产美女在线观看一区| 成人精品免费看| 色婷婷精品久久二区二区蜜臀av| 色悠悠亚洲一区二区| 色婷婷亚洲精品| 欧美人牲a欧美精品| 91精品国产综合久久精品| 日韩欧美综合在线| 久久日一线二线三线suv| 国产精品久久久久久久久久免费看| 亚洲天堂免费在线观看视频| 一区二区视频在线| 奇米色777欧美一区二区| 国产成人在线色| 97aⅴ精品视频一二三区| 欧美日韩在线播放三区| 欧美成人a在线| 久久综合狠狠综合久久激情| 中文字幕中文字幕中文字幕亚洲无线| 亚洲综合色区另类av| 日韩经典中文字幕一区| 国产河南妇女毛片精品久久久| av网站免费线看精品| 欧美欧美欧美欧美首页| 精品国产一区二区三区四区四| 久久久亚洲高清| 夜色激情一区二区| 激情欧美一区二区三区在线观看| 国产精品18久久久久久久网站| 色综合激情五月| 欧美成人免费网站| 亚洲天堂2014| 精品一区二区三区在线播放视频 | 91色porny蝌蚪| 欧美一区二区三区人| 欧美国产精品专区| 日韩精品亚洲一区| 不卡的av网站| 日韩欧美激情在线| 亚洲欧美另类久久久精品| 免费在线观看成人| 99国产精品99久久久久久| 欧美一区二区黄| 亚洲免费观看高清完整版在线观看| 日韩电影在线免费看| 国产成人免费视| 欧美电影在线免费观看| 最新久久zyz资源站| 免费观看日韩av| 在线看不卡av| 国产精品你懂的在线| 免费成人美女在线观看.| 色综合欧美在线| 国产精品无圣光一区二区| 日韩和的一区二区| 91久久精品国产91性色tv| 久久九九99视频| 蜜臀av亚洲一区中文字幕| 在线欧美一区二区| 国产精品久久久久久久午夜片| 美女视频黄久久| 欧美日韩国产综合一区二区三区| 亚洲欧洲精品天堂一级| 国产精品中文有码| 欧美大片在线观看一区二区| 午夜久久久久久| 色婷婷国产精品久久包臀| 国产精品视频线看| 国产精品一区二区视频| 日韩欧美二区三区| 午夜私人影院久久久久| 欧美综合久久久| 亚洲色图在线播放| 99re这里只有精品6| 欧美国产成人精品| 国产成a人无v码亚洲福利| 欧美精品一区二区三区四区| 蜜臀久久99精品久久久久宅男 | 久久伊99综合婷婷久久伊| 美女国产一区二区| 日韩欧美国产一区在线观看| 三级亚洲高清视频| 91精品国产综合久久精品app| 亚洲国产精品久久久久婷婷884| 色狠狠一区二区三区香蕉| 亚洲视频在线一区| 99久久精品情趣| 亚洲人快播电影网| 欧洲一区二区av| 亚洲高清一区二区三区| 欧美日韩不卡一区二区| 亚洲午夜免费福利视频| 欧美日韩视频在线观看一区二区三区| 一区二区欧美国产| 欧美日韩不卡一区| 日本中文字幕一区二区有限公司| 91精品久久久久久蜜臀| 青青草国产精品97视觉盛宴| 欧美一级免费大片| 久久精品72免费观看| 亚洲精品一区二区三区在线观看 | 欧美午夜精品一区二区三区| 亚洲大型综合色站| 欧美一区二区三区色| 精品中文字幕一区二区小辣椒| 26uuu精品一区二区| 国产福利精品一区二区| 日韩美女视频一区| 欧美亚洲禁片免费| 美女网站视频久久| 国产视频在线观看一区二区三区| 99精品视频中文字幕| 亚洲激情在线播放| 欧美精品免费视频| 国产在线精品一区二区| 国产精品国产自产拍在线| 在线一区二区视频| 美腿丝袜亚洲综合| 国产精品日韩成人| 欧美日高清视频| 国产一区视频导航| 亚洲免费在线观看| 337p亚洲精品色噜噜噜| 国产乱码精品一区二区三| 亚洲免费观看高清完整版在线| 欧美精品成人一区二区三区四区| 精品午夜久久福利影院| 一区在线播放视频| 欧美一区欧美二区| 成人黄色综合网站| 青青草97国产精品免费观看| 欧美国产欧美综合| 91麻豆精品国产91久久久| 粉嫩嫩av羞羞动漫久久久| 洋洋成人永久网站入口| 精品国产一区二区三区忘忧草| 91猫先生在线| 久久成人免费网| 夜夜嗨av一区二区三区| 久久久夜色精品亚洲| 欧美日韩国产一二三| 高清在线成人网| 日本免费新一区视频| 国产日韩欧美激情| 91精品久久久久久久99蜜桃| av电影天堂一区二区在线观看| 日韩不卡一二三区| 中文字幕在线不卡国产视频| 91精品国产综合久久精品麻豆| 97se狠狠狠综合亚洲狠狠| 国产一区二区三区免费看| 亚洲一卡二卡三卡四卡 | 美国三级日本三级久久99| 国产精品久久精品日日| 日韩久久精品一区| 日本久久精品电影| 国产成人免费视频网站高清观看视频 | 中文字幕制服丝袜一区二区三区| 欧美一区二视频| 在线观看精品一区| 成人av一区二区三区| 国内成人免费视频| 无码av中文一区二区三区桃花岛| 国产精品国产三级国产普通话三级 | 亚洲精品久久久久久国产精华液| 日韩欧美亚洲国产另类 | 樱桃国产成人精品视频| 久久久久97国产精华液好用吗| 宅男噜噜噜66一区二区66| 91极品美女在线| 91视频免费观看| 成人精品鲁一区一区二区| 国产九色sp调教91| 国产一区二区美女诱惑| 久久电影网站中文字幕| 日韩精彩视频在线观看| 一区二区三区在线观看动漫| 国产精品护士白丝一区av| 国产网站一区二区三区| 精品国产凹凸成av人导航| 欧美一区二区成人6969| 在线综合亚洲欧美在线视频| 欧美日韩电影在线播放| 欧美日韩一二区| 欧美三区免费完整视频在线观看| 色婷婷综合视频在线观看|