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

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

?? netbuflib.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
    reTry:    level = intLock();			/* lock interrupts very briefly */    if ((pClBlk = pNetPool->pClBlkHead) != NULL)        {        pNetPool->pClBlkHead = pClBlk->clNode.pClBlkNext;        intUnlock (level); 			/* unlock interrupts */        pClBlk->clNode.pClBuf = NULL;        pClBlk->pClFreeRtn    = NULL;        pClBlk->clRefCnt      = 0;        pClBlk->pNetPool      = pNetPool; 	/* netPool originator */        }    else /* if (canWait != M_ISR) */        {        if (canWait == M_WAIT)            {            if (_pNetBufCollect)                {                intUnlock (level);			/* unlock interrupts */                (*_pNetBufCollect) (pNetPool->pPoolStat);		canWait = M_DONTWAIT;                goto reTry;                }            }        intUnlock (level);       	errnoSet (S_netBufLib_NO_POOL_MEMORY);	}    return (pClBlk);    }/********************************************************************************* _clusterGet - get a new cluster of a given cluster pool.** This function returns a cluster given a pool pointer.  The reference count* for the cluster is incremented.** RETURNS: pointer to a cluster or NULL** NOMANUAL*/LOCAL char * _clusterGet    (    NET_POOL_ID		pNetPool,	/* pointer to the net pool */    CL_POOL_ID 		pClPool 	/* ptr to the cluster pool */    )    {    int		level;				/* level of interrupt */    CL_BUF_ID	pClBuf;				/* ptr to the cluster buffer */    level = intLock (); 			/* lock interrupts briefly */    if (pClPool->pClHead == NULL)		/* return if no buffers */        {        intUnlock (level);        return (NULL);        }    pClBuf = pClPool->pClHead;			/* update the head */    if ((pClPool->pClHead = pClBuf->pClNext) == NULL)        {	/* update the pool Mask */        pNetPool->clMask &= ~(CL_LOG2_TO_CL_SIZE(pClPool->clLg2));        }    pClPool->clNumFree--; 			/* decrement the free count */    pClPool->clUsage++;				/* increment the usage count */    intUnlock (level);    return ((char *)pClBuf);    }/********************************************************************************* mClGet - get a new mBlk/cluster pair.** This function gets a free cluster from the NET_POOL and joins it with* the mBlk passed to it.  An mBlk must be pre allocated and passed to this* function.** RETURNS: OK or ERROR.** NOMANUAL*/LOCAL STATUS _mClGet    (    NET_POOL_ID		pNetPool,	/* pointer to the net pool */    M_BLK_ID	 	pMblk, 		/* mBlk to embed the cluster in */    int			bufSize,	/* size of the buffer to get */    int			canWait,	/* wait or dontwait */    BOOL		bestFit		/* TRUE/FALSE */    )    {    int			log2Size;	/* size of cluster to the base 2 */    CL_POOL_ID 		pClPool; 	/* pointer to the cluster pool */    CL_BUF_ID		pClBuf = NULL; 	/* pointer to the cluster buffer */    CL_BLK_ID		pClBlk = NULL; 	/* pointer to the cluster blk */    FAST int 		ms; 		/* integer for level */    /* check pMblk */    if ((pMblk == NULL) || ((pClBlk = _clBlkGet (pNetPool, canWait)) == NULL))	goto mClGetError;    /* check the boundary conditions */    if (bufSize > pNetPool->clSizeMax)	{	if (bestFit)            {            errno = S_netBufLib_CLSIZE_INVALID;	    goto mClGetError;            }	else	    log2Size = pNetPool->clLg2Max;	}    else if (bufSize < pNetPool->clSizeMin)	log2Size = pNetPool->clLg2Min;    else	{	log2Size = SIZE_TO_LOG2(bufSize);	if (bufSize > CL_LOG2_TO_CL_SIZE(log2Size))	    log2Size++;	}    /* get the appropriate pool pointer */    if ((pClPool = pNetPool->clTbl [CL_LOG2_TO_CL_INDEX (log2Size)]) == NULL)	{#ifdef NETBUF_DEBUG	logMsg ("mClGet: Invalid cluster type\n", 0, 0, 0, 0, 0, 0);#endif /* NETBUF_DEBUG */        errno = S_netBufLib_CLSIZE_INVALID;	goto mClGetError;	}    reTry:    ms = intLock(); 			/* lock interrupts briefly */    if (pClPool->pClHead == NULL)        {        /* pool has max clusters, find best fit or close fit */        if (pNetPool->clMask >= CL_LOG2_TO_CL_SIZE(pClPool->clLg2))            {	/* first fetch a cluster with a closest bigger size */            bufSize  = CL_LOG2_TO_CL_SIZE(pClPool->clLg2);            log2Size = pClPool->clLg2;            while (bufSize <= CL_SIZE_MAX)                {                if (pNetPool->clMask & bufSize)                    {                    pClPool = pNetPool->clTbl [CL_LOG2_TO_CL_INDEX (log2Size)];                    break;                    }                bufSize <<= 1;                log2Size ++;                }            }        /* if close fit then find closest lower size */        else if (!bestFit && pNetPool->clMask)            {            pClPool = pNetPool->clTbl [CL_SIZE_TO_CL_INDEX(pNetPool->clMask)];            }        else if (canWait == M_WAIT)	/* want for buffers */            {            if (_pNetBufCollect)                {                intUnlock (ms);                (*_pNetBufCollect) (pNetPool->pPoolStat);		canWait = M_DONTWAIT;                goto reTry;                }            }        }    if ((pClBuf = pClPool->pClHead))	{	/* if this is the last cluster available set the mask */	if ((pClPool->pClHead = pClBuf->pClNext) == NULL)            {	    pNetPool->clMask &= ~(CL_LOG2_TO_CL_SIZE(pClPool->clLg2));            }	pClPool->clNumFree--;	pClPool->clUsage++;        intUnlock (ms);	}    else	{	pNetPool->pPoolStat->mDrops++;	/* no. times failed to find space */        intUnlock (ms);	errnoSet (S_netBufLib_NO_POOL_MEMORY);	goto mClGetError;	}    pMblk->mBlkHdr.mData  = (caddr_t) pClBuf;    pMblk->mBlkHdr.mFlags |= M_EXT;    pClBlk->clNode.pClBuf = (caddr_t) pClBuf;    pClBlk->clSize	  = pClPool->clSize;    pClBlk->pClFreeRtn	  = NULL;    pClBlk->clRefCnt	  = 1;    pMblk->pClBlk 	  = pClBlk;    return (OK); 		/* return OK */    mClGetError:    if (pClBlk != NULL)        _clBlkFree (pClBlk);    return (ERROR); 		/* return ERROR */    }/********************************************************************************* clPoolIdGet - return a pool Id for a given cluster Size** This function returns a poolID for a given cluster Size.* If this returns NULL then the corresponding pool has not been initialized.** RETURNS: CL_POOL_ID or NULL.** NOMANUAL*/LOCAL CL_POOL_ID _clPoolIdGet    (    NET_POOL_ID		pNetPool,	/* pointer to the net pool */    int 		bufSize,	/* size of the buffer */    BOOL		bestFit		/* TRUE/FALSE */    )    {    int			log2Size;    if (bufSize > pNetPool->clSizeMax)	{	log2Size = pNetPool->clLg2Max;	if (bestFit)	    return (NULL);	}    else if (bufSize < pNetPool->clSizeMin)        {	log2Size = pNetPool->clLg2Min;        }    else	{	log2Size = SIZE_TO_LOG2(bufSize);	if (bufSize > CL_LOG2_TO_CL_SIZE(log2Size))	    log2Size++;	}    return (pNetPool->clTbl [CL_LOG2_TO_CL_INDEX(log2Size)]);    }/********************************************************************************* netBufLibInit - initialize netBufLib** This routine executes during system startup if INCLUDE_NETWORK is defined* when the image is built. It links the network buffer library into the image.** RETURNS: OK or ERROR.**/STATUS netBufLibInit (void)    {    return (OK);    }/********************************************************************************* netPoolInit - initialize a netBufLib-managed memory pool** Call this routine to set up a netBufLib-managed memory* pool.  Within this pool, netPoolInit() organizes several sub-pools: one* for `mBlk' structures, one for `clBlk' structures, and as many cluster* sub-pools are there are cluster sizes.  As input, this routine expects* the following parameters:* .IP <pNetPool> 15* Expects a NET_POOL_ID that points to a previously allocated NET_POOL* structure.  You need not initialize any values in this structure.  That* is handled by netPoolInit().* .IP <pMclBlkConfig>* Expects a pointer to a previously allocated and initialized M_CL_CONFIG* structure.  Within this structure, you must provide four* values: 'mBlkNum', a count of `mBlk' structures; 'clBlkNum', a count* of `clBlk' structures; 'memArea', a pointer to an area of memory* that can contain all the `mBlk' and `clBlk' structures; and 'memSize', * the size of that memory area.  For example, you can set up an M_CL_CONFIG * structure as follows:* .CS*     M_CL_CONFIG mClBlkConfig = /@ mBlk, clBlk configuration table @/*         {*         mBlkNum     clBlkNum        memArea         memSize*         ----------  ----            -------         -------*         400,        245,            0xfe000000,     21260*         };* .CE* You can * calculate the 'memArea' and 'memSize' values.  Such code could first * define a table as shown above, but set both 'memArea' and 'memSize' * as follows:* .CS* mClBlkConfig.memSize = (mClBlkConfig.mBlkNum * (M_BLK_SZ + sizeof(long))) +*                        (mClBlkConfig.clBlkNum * CL_BLK_SZ);* .CE* You can set the memArea value to a pointer to private memory, or you can* reserve the memory with a call to malloc().  For example:* .CS*     mClBlkConfig.memArea = malloc(mClBlkConfig.memSize);* .CE** The netBufLib.h file defines M_BLK_SZ as:* .CS*     sizeof(struct mBlk)* .CE* Currently, this evaluates to 32 bytes.  Likewise, this file * defines CL_BLK_SZ as:* .CS *     sizeof(struct clBlk)* .CE* Currently, this evaluates to 32 bytes. ** When choosing values for 'mBlkNum' and 'clBlkNum', remember that you need * as many `clBlk' structures as you have clusters (data buffers).  You also * need at least as many `mBlk' structures as you have `clBlk' structures, but * you will most likely need more. * That is because netBufLib shares buffers by letting multiple `mBlk' * structures join to the same `clBlk' and thus to its underlying cluster.  * The `clBlk' keeps a count of the number of `mBlk' structures that * reference it.  ** .IP <pClDescTbl>* Expects a pointer to a table of previously allocated and initialized CL_DESC* structures.  Each structure in this table describes a single cluster pool.* You need a dedicated cluster pool for each cluster size you want to support.* Within each CL_DESC structure, you must provide four values: 'clusterSize',* the size of a cluster in this cluster pool; 'num', the number of clusters * in this cluster pool; 'memArea', a pointer to an area of memory that can * contain all the clusters; and 'memSize', the size of that memory area.* * Thus, if you need to support six different cluster sizes, this parameter* must point to a table containing six CL_DESC structures.  For example,* consider the following:* .CS*     CL_DESC clDescTbl [] =   /@ cluster descriptor table @/*         {*         /@*         clusterSize        num     memArea         memSize*         ----------         ----    -------         -------*         @/*         {64,               100,    0x10000,        6800},*         {128,              50,     0x20000,        6600},*         {256,              50,     0x30000,        13000},*         {512,              25,     0x40000,        12900},*         {1024,             10,     0x50000,        10280},*         {2048,             10,     0x60000,        20520}*         };* .CE* As with the 'memArea' and 'memSize' members in the M_CL_CONFIG structure,* you can set these members of the CL_DESC structures by calculation after* you create the table.  The formula would be as follows:* .CS*     clDescTbl[n].memSize = *         (clDescTbl[n].num * (clDescTbl[n].clusterSize + sizeof(long)));* .CE* The 'memArea' member can point to a private memory area that you know to be * available for storing clusters, or you can use malloc().* .CS*     clDescTbl[n].memArea =  malloc( clDescTbl[n].memSize ); * .CE** Valid cluster sizes range from 64 bytes to 65536 bytes.  If there are * multiple cluster pools, valid sizes are further restricted to powers of* two (for example, 64, 128, 256, and so on).  If there is only one cluster * pool (as is often the case for the memory pool specific to a single * device driver), there is no power of two restriction.  Thus, the cluster * can be of any size between 64 bytes and 65536 bytes on 4-byte alignment.  A * typical buffer size for Ethernet devices is 1514 bytes.  However, because* a cluster size requires a 4-byte alignment, the cluster size for this * Ethernet buffer would have to be increased to at least 1516 bytes.* * .IP <clDescTblNumEnt>* Expects a count of the elements in the CL_DESC table referenced by * the <pClDescTbl> parameter.  This is a count of the number of cluster* pools.  You can get this value using the NELEMENTS macro defined  * in vxWorks.h.  For example:* .CS*     int clDescTblNumEnt = (NELEMENTS(clDescTbl));* .CE* .IP <pFuncTbl>* Expects a NULL or a pointer to a function table.  This table contains * pointers to the functions used to manage the buffers in this memory pool.  * Using a NULL for this parameter tells netBufLib to use its default function * table.  If you opt for the default function table, every `mBlk' and * every cluster is prepended by a 4-byte header (which is why the size * calculations above for clusters and `mBlk' structures contained an * extra 'sizeof(long)').  However, users need not concern themselves * with this header when accessing these buffers.  The returned pointers * from functions such as netClusterGet() return pointers to the start of* data, which is just after the header.  * .LP

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美另类久久久精品| 一级精品视频在线观看宜春院| 色哟哟欧美精品| 久久国产麻豆精品| 亚洲精品一二三| 久久久欧美精品sm网站| 91超碰这里只有精品国产| 成人精品小蝌蚪| 久久福利视频一区二区| 亚洲制服丝袜在线| 中文字幕综合网| 久久色中文字幕| 欧美一区二区精美| 在线免费观看成人短视频| 国产大陆精品国产| 精品中文字幕一区二区小辣椒 | 成人欧美一区二区三区白人| 欧美精品色一区二区三区| 99r精品视频| 国产成人丝袜美腿| 麻豆国产一区二区| 亚洲超丰满肉感bbw| 亚洲黄一区二区三区| 国产精品天天摸av网| 精品国产免费一区二区三区四区| 欧美区视频在线观看| 在线精品视频一区二区| 成人免费看黄yyy456| 国内精品视频666| 日本美女视频一区二区| 午夜欧美在线一二页| 一区二区不卡在线视频 午夜欧美不卡在| 久久精品在这里| 国产性做久久久久久| 久久综合九色综合欧美98 | 欧美精品一区二区在线播放 | 欧美不卡在线视频| 日韩欧美一级片| 欧美一二三在线| 日韩一区二区三区免费观看| 欧美在线|欧美| 91麻豆产精品久久久久久 | 日韩欧美国产电影| 日韩欧美亚洲国产另类| 欧美精品色一区二区三区| 正在播放亚洲一区| 欧美一二三四在线| 日韩欧美成人午夜| 久久综合久久综合九色| 国产亚洲精品aa| 中文字幕欧美激情一区| 国产精品美女久久久久av爽李琼| 国产日韩在线不卡| 国产视频911| 亚洲三级免费电影| 亚洲福利视频导航| 毛片av一区二区三区| 国内精品国产成人| 成人av网址在线观看| 99re热这里只有精品视频| 色www精品视频在线观看| 欧美最新大片在线看| 欧美精品久久天天躁| 精品美女在线观看| 国产精品伦一区二区三级视频| 日韩毛片高清在线播放| 亚洲午夜视频在线观看| 奇米影视7777精品一区二区| 极品瑜伽女神91| 成人av在线播放网站| 欧美在线小视频| 欧美α欧美αv大片| 国产欧美久久久精品影院| 亚洲免费看黄网站| 麻豆精品蜜桃视频网站| 成人精品在线视频观看| 欧美探花视频资源| 精品国产伦一区二区三区观看方式| 久久久国产精品午夜一区ai换脸| 亚洲品质自拍视频| 免费成人结看片| 国产高清久久久| 欧美性大战久久久久久久 | 亚洲精品一区二区三区精华液 | 亚洲国产日韩精品| 国内精品久久久久影院色| 91蜜桃网址入口| 欧美福利电影网| 国产精品久久网站| 美女久久久精品| 色综合久久久久网| 精品久久国产字幕高潮| 亚洲精品v日韩精品| 美女视频黄 久久| 91久久精品一区二区三区| 精品国产乱码久久久久久老虎| 亚洲六月丁香色婷婷综合久久 | 97se亚洲国产综合在线| 制服丝袜亚洲精品中文字幕| 国产日产精品一区| 日韩福利电影在线观看| 92国产精品观看| 亚洲精品一区二区三区在线观看 | 亚洲国产一区二区在线播放| 国产精品一区二区视频| 欧美日本免费一区二区三区| 国产精品毛片大码女人| 久久国产精品色| 欧美视频在线不卡| 国产精品美女www爽爽爽| 激情六月婷婷久久| 欧美精品亚洲一区二区在线播放| 日韩美女视频19| 国产suv精品一区二区883| 日韩限制级电影在线观看| 一区二区三区精品在线| 不卡的电影网站| 精品国产1区2区3区| 日韩成人一级片| 欧美日韩日日骚| 亚洲九九爱视频| 99在线精品视频| 国产清纯白嫩初高生在线观看91| 麻豆freexxxx性91精品| 欧美日韩二区三区| 亚洲一区视频在线| 在线观看一区日韩| 亚洲视频免费看| 成人精品国产免费网站| 久久色.com| 国产乱码精品一区二区三区忘忧草| 日韩欧美国产三级电影视频| 天堂资源在线中文精品| 欧美三级一区二区| 夜夜爽夜夜爽精品视频| 日本精品裸体写真集在线观看 | 日本va欧美va欧美va精品| 在线免费观看成人短视频| 亚洲免费伊人电影| 色婷婷综合久久久久中文一区二区| 国产日韩欧美一区二区三区乱码 | 国产主播一区二区三区| 久久这里只有精品视频网| 老司机午夜精品99久久| 日韩免费一区二区三区在线播放| 日产国产欧美视频一区精品| 7777女厕盗摄久久久| 日韩高清不卡在线| 日韩欧美国产综合一区 | 国产无一区二区| 成人动漫视频在线| 国产精品国产三级国产普通话99 | 欧美精品一卡两卡| 日韩电影在线看| 精品剧情在线观看| 国产成人aaa| 亚洲免费看黄网站| 欧美夫妻性生活| 国产一区二区主播在线| 国产精品久久国产精麻豆99网站| www.亚洲人| 亚洲一区av在线| 制服丝袜日韩国产| 国产精品综合二区| 国产精品福利在线播放| 91久久精品一区二区三| 欧美a一区二区| 国产午夜精品久久| 在线精品视频免费播放| 秋霞电影一区二区| 国产亚洲精久久久久久| 日本精品视频一区二区| 奇米色一区二区| 国产精品久久久久国产精品日日| 在线一区二区观看| 免费的国产精品| 亚洲欧洲日韩女同| 欧美日韩成人激情| 国产美女久久久久| 亚洲综合在线免费观看| 日韩欧美你懂的| 91在线观看美女| 久久精品国产网站| 亚洲另类在线视频| 日韩女优毛片在线| 91女神在线视频| 蜜臀av一区二区三区| 亚洲欧洲制服丝袜| 欧美一区二区三区电影| 99热这里都是精品| 美女网站在线免费欧美精品| 国产精品免费av| 欧美成人一区二区三区在线观看| 91一区一区三区| 国内精品伊人久久久久av一坑| 亚洲午夜一区二区| 中文字幕在线一区| 精品免费99久久| 精品视频免费在线| 91在线观看污|