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

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

?? smpktlib.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
#endif	/* __STDC__ *//******************************************************************************** smPktSetup - set up shared memory (master CPU only)** This routine should be called only by the master CPU using shared* memory.  It initializes the specified memory area for use by the* shared memory protocol.** After the shared memory has been initialized, this and other CPU's* may initialize a shared memory packet descriptor to it, using smPktInit(),* and then attach to the shared memory area, using smPktAttach().** The <anchorLocalAdrs> parameter is the memory address by which the master* CPU accesses the shared memory anchor.** The <smLocalAdrs> parameter is the memory address by which the master* CPU accesses the actual shared memory region to be initialized.** The <smSize> parameter is the size, in bytes, of the shared memory* region.** The shared memory routines must be able to obtain exclusive access to* shared data structures.  To allow this, a test-and-set operation is* used.  It is preferable to use a genuine test-and-set instruction, if* the hardware being used permits this.  If this is not possible, smUtilLib* provides a software emulation of test-and-set.  The <tasType> parameter* specifies what method of test-and-set is to be used.** The <maxCpus> parameter specifies the maximum number of CPU's which may* use the shared memory region.** The <maxPktBytes> parameter specifies the size, in bytes, of the data* buffer in shared memory packets.  This is the largest amount of data* which may be sent in a single packet.  If this value is not an exact* multiple of 4 bytes, it will be rounded up to the next multiple of 4.** INTERNAL* The first item in the shared memory area is the shared memory packet* header (SM_PKT_MEM_HDR).  Following this is an array of CPU * descriptors (SM_PKT_CPU_DESC); this table contains one CPU descriptor * for each possible CPU, as specified by <maxCpus>.* The shared memory area following the cpu table is allocated to the global* list of free packets (SM_PKT), used for sending data between CPU's.  Note* that the shared memory anchor is NOT part of the regular shared memory area.** Since the size of each data packet is not pre-determined, the actual size* is calculated based on the size of the (fixed) packet header and the* data buffer size, specified by <maxPktBytes>.** The standard smPktSllPut routine is used to build the free packet list.* The software test-and-set routine is always used, regardless of the* definition of <tasType>, because no hardware TAS routine has been supplied* yet. (That is done during smPktAttach.)  Use of any TAS method at this* stage is mainly a formality, since no other CPU's are able to attach to* the shared memory region.** RETURNS: OK, or ERROR.** ERRNO: S_smPktLib_SHARED_MEM_TOO_SMALL, S_smPktLib_MEMORY_ERROR** INTERNAL:  This routine and smObjSetup can not be called at the same time!!!*/STATUS smPktSetup    (    SM_ANCHOR * anchorLocalAdrs, 	/* local addr of anchor */    char * 	smLocalAdrs,		/* local addr of sh mem area */    int		smSize,			/* size of shared memory area */    int		tasType, 		/* test and set type */    int		maxCpus,		/* max number of cpus */    int		maxPktBytes		/* max bytes of packet data */    )    {    SM_ANCHOR volatile * pAnchorv = (SM_ANCHOR volatile *) anchorLocalAdrs;    SM_PKT_MEM_HDR volatile *	smPktHdr;	/* local addr of sh mem hdr */    int				pktSize;	/* actual size of pkt */    STATUS			status;	 	/* return status */    SM_PKT volatile *		pPkt;		/* local addr of free packet */    int				memLeft;    char			temp = 0;    int				base = (int) anchorLocalAdrs;    int 			bytesUsed = 0;    int                         tmp;            /* temp storage */    /* set up default values for parameters */    smSize 	= (smSize == 0)  ?  smPktMemSizeDefault : smSize;    maxCpus	= (maxCpus == 0) ?  smPktMaxCpusDefault : maxCpus;    maxPktBytes = (maxPktBytes == 0) ?  smPktMaxBytesDefault : maxPktBytes;    maxPktBytes = ((maxPktBytes + sizeof (int) - 1) / sizeof (int)) *                  sizeof (int);                 /* round up buf to int mult */    pktSize = (sizeof (SM_PKT_HDR) + maxPktBytes);                                                /* pkt size incl data buffer */    if (smSetup (anchorLocalAdrs, smLocalAdrs, tasType, maxCpus,		 &bytesUsed) == ERROR)       return (ERROR);    smSize 	-= bytesUsed;    smLocalAdrs += bytesUsed;    /*     * Check that shared mem size is big enough to contain:     * the shared memory packet header, the shared memory packet     * cpu descriptors and 1 pkt per cpu.     */    if (smSize < (sizeof (SM_PKT_MEM_HDR) +	(maxCpus * sizeof (SM_PKT_CPU_DESC)) + (maxCpus * pktSize)))        {        errno = S_smPktLib_SHARED_MEM_TOO_SMALL;        return (ERROR);                         /* not enough sh mem */        }    /* Probe beginning and end of shared memory */    if ((smUtilMemProbe (smLocalAdrs , VX_WRITE, sizeof (char), &temp) != OK) ||        (smUtilMemProbe (smLocalAdrs + smSize - 1, VX_WRITE, sizeof (char),			 &temp) != OK))        {        errno = S_smPktLib_MEMORY_ERROR;        return (ERROR);        }    /* Clear shared memory */    bzero (smLocalAdrs, smSize);    /* Fill in header */    smPktHdr = (SM_PKT_MEM_HDR volatile *) smLocalAdrs;    smPktHdr->maxPktBytes = htonl (maxPktBytes);/* max size of pkt data buf */    smPktHdr->pktCpuTbl   = htonl (SM_LOCAL_TO_OFFSET ((char *) smPktHdr +				   		       sizeof (SM_PKT_MEM_HDR),						       base));    pAnchorv->smPktHeader = htonl (SM_LOCAL_TO_OFFSET (smLocalAdrs, base));    /* Set up list of free packets */    pPkt = (SM_PKT *) (smLocalAdrs + sizeof (SM_PKT_MEM_HDR) +		      (maxCpus * sizeof (SM_PKT_CPU_DESC)));						/* calculate addr of 1st pkt */    memLeft = smSize - ((int) ((char *) pPkt - smLocalAdrs));						/* calculate remaining sh mem */    while (memLeft >= pktSize)	{	/* allow one more in free list*/	smPktHdr->freeList.limit = htonl (ntohl (smPktHdr->freeList.limit) +1);	/* Add packet to list, always use software test-and-set emulation */	status = smPktSllPut (&(smPktHdr->freeList), base, smUtilSoftTas, NULL,			      &(pPkt->header.node), NULL);	if (status == ERROR)	    {	    smPktHdr->freeList.limit = htonl (ntohl (smPktHdr->freeList.limit)	                                      - 1);	    return (ERROR);			/* error adding to free list */	    }	pPkt = (SM_PKT *) ((char *) pPkt + pktSize);/* advance pkt pointer */	memLeft -= pktSize;			/* decrease mem remaining */	}    CACHE_PIPE_FLUSH ();                        /* CACHE FLUSH   [SPR 68334] */    tmp = smPktHdr->freeList.limit;             /* BRIDGE FLUSH  [SPR 68334] */    return (OK);				/* shared mem init complete */    }/******************************************************************************** smPktInit - initialize shared memory packet descriptor** This routine initializes a shared memory packet descriptor.  The descriptor* must have been previously allocated (generally in the CPU's local* memory).  Once the descriptor has been initialized by this routine,* the CPU may attach itself to the shared memory area by calling* smPktAttach().** Only the shared memory descriptor itself is modified by this routine.* No structures in shared memory are affected.** The <pSmPktDesc> paramter is the address of the shared memory packet * descriptor which is to be initialized; this structure must have * already been allocated before smPktInit is called.** The <anchorLocalAdrs> parameter is the memory address by which the local* CPU may access the shared memory anchor.  This address may vary for* different CPU's because of address offsets (particularly if the anchor is* located in one CPU's dual-ported memory).** The <maxInputPkts> parameter specifies the maximum number of incoming* shared memory packets which may be queued to this CPU at one time.  If* a remote CPU attempts to send more packets after this limit is reached,* an error will be returned to the remote CPU.** The <ticksPerBeat> parameter specifies the frequency of the shared memory* heartbeat.  The frequency is expressed in terms of how many CPU* ticks on the local CPU correspond to one heartbeat period.** The <intType>, <intArg1>, <intArg2>, and <intArg3> parameters allow a* CPU to announce the method by which it is to be notified of input packets* which have been queued to it.  Once this CPU has attached to the shared* memory region, other CPU's will be able to determine these interrupt* parameters by calling smPktCpuInfoGet().  The following interrupt * methods are currently recognized by this library: SM_INT_MAILBOX, * SM_INT_BUS, SM_INT_NONE, and SM_INT_USER .** RETURNS: N/A*/void smPktInit    (    SM_PKT_DESC *	pSmPktDesc,         /* ptr to sh mem packet descr */    SM_ANCHOR *		anchorLocalAdrs,    /* local addr of sh mem anchor*/    int                 maxInputPkts,       /* max queued packets allowed */    int                 ticksPerBeat,       /* cpu ticks per heartbeat */    int                 intType,            /* interrupt method */    int                 intArg1,            /* interrupt argument #1 */    int                 intArg2,            /* interrupt argument #2 */    int                 intArg3             /* interrupt argument #3 */    )    {    if (pSmPktDesc == NULL)        return;                                 /* don't use null ptr */    bzero ((char *) pSmPktDesc, sizeof (SM_PKT_DESC));    smInit (&pSmPktDesc->smDesc, anchorLocalAdrs, ticksPerBeat, intType,	    intArg1, intArg2, intArg3);    pSmPktDesc->maxInputPkts  = (maxInputPkts == 0) ? smPktMaxInputDefault :				   		      maxInputPkts;    pSmPktDesc->status        = SM_CPU_NOT_ATTACHED;    /* initial status */    }/******************************************************************************** smPktAttach - attach to shared memory** This routine "attaches" the local CPU to a shared memory area.  The* shared memory area is identified by the shared memory packet descriptor* whose address specified by <pSmPktDesc>.  The descriptor must have* already been initialized by calling smPktInit().** This routine will complete the attach process only if and when the* shared memory has been initialized by the master CPU.  To determine* this, the shared memory anchor is checked for the proper value* (SM_READY_VALUE) in the anchor's ready-value field and a check is made for* an active heartbeat.  This repeated checking continues until either * the ready-value and heartbeat have been verified or a timeout limit * is reached.  If the shared memory is not recognized as active within * the timeout period, this routine returns an error (S_smPktLib_DOWN).** The attachment to shared memory may be ended by calling smPktDetach().** RETURNS: OK, or ERROR.** ERRNO: S_smPktLib_DOWN** SEE ALSO: smPktInit()*/STATUS smPktAttach    (    SM_PKT_DESC	*	pSmPktDesc	/* packet descriptor */    )    {    SM_PKT_MEM_HDR volatile *	pHdr;		/* sm pkt header */    SM_PKT_CPU_DESC volatile *	pPktDesc;	/* pkt cpu descriptor */    int				cpuNum;		/* this cpu's number */    SM_ANCHOR volatile *	pAnchor;	/* anchor */    int				beatsToWait;    SM_DESC *			pSmDesc = (SM_DESC *) &pSmPktDesc->smDesc;    cpuNum  = pSmDesc->cpuNum;    pAnchor = pSmDesc->anchorLocalAdrs;    /* Check that shared memory is initialized and running */    /*     * XXX master CPU should only wait DEFAULT_BEATS_TO_WAIT but we don't     * know who the master is unless we look in the anchor.  The anchor may     * not be mapped onto the bus, and we will blow up with a BERR if we     * poke around.  So we just wait a long time, even if we are the master.     * This could be fixed by listing the SM master and local processor     * numbers in the packet descriptor so that the two could be compared.     * If equal, we would be the master and no waiting would be necessary.     */    beatsToWait = DEFAULT_ALIVE_TIMEOUT;    if (smIsAlive ((SM_ANCHOR *)pAnchor, (int *)&(pAnchor->smPktHeader),                   pSmDesc->base, beatsToWait, pSmDesc->ticksPerBeat) == FALSE)        {        errno = S_smPktLib_DOWN;        return (ERROR);                         /* sh memory not active */        }    if (smAttach (pSmDesc) == ERROR)	return (ERROR);    /* Get local address for shared mem packet header */    pHdr = SM_OFFSET_TO_LOCAL (ntohl (pAnchor->smPktHeader), pSmDesc->base, 			       SM_PKT_MEM_HDR volatile *);    pSmPktDesc->hdrLocalAdrs = (SM_PKT_MEM_HDR *) pHdr;    pSmPktDesc->maxPktBytes  = ntohl (pHdr->maxPktBytes);    pSmPktDesc->cpuLocalAdrs = SM_OFFSET_TO_LOCAL (ntohl (pHdr->pktCpuTbl),				 	    	   pSmDesc->base,					    	   SM_PKT_CPU_DESC *);    pPktDesc = &((pSmPktDesc->cpuLocalAdrs) [cpuNum]);						/* calculate addr of cpu desc						 * in global table.						 */    pPktDesc->inputList.limit = htonl (pSmPktDesc->maxInputPkts);						/* max queued count */    pPktDesc->status  = htonl (SM_CPU_ATTACHED);/* mark this cpu as attached */    pSmPktDesc->status = SM_CPU_ATTACHED;	/* also mark sh mem descr */    CACHE_PIPE_FLUSH ();                        /* CACHE FLUSH   [SPR 68334] */    cpuNum = pPktDesc->status;			/* BRIDGE FLUSH  [SPR 68334] */    return (OK);				/* attach complete */    }/******************************************************************************** smPktFreeGet - get a shared memory packet from free list** This routine obtains a shared memory packet.  The packet is taken* from the global free packet list.  No initialization of the packet* contents is performed.** The address of the obtained packet is placed in the location specified* by <ppPkt>.  If there were no free packets available, this value will* be NULL.** RETURNS: OK, or ERROR.** ERRNO: S_smPktLib_NOT_ATTACHED*/STATUS smPktFreeGet    (    SM_PKT_DESC *	pSmPktDesc,	/* ptr to shared memory descriptor */    SM_PKT **		ppPkt 		/* location to put packet address */    )    {    SM_DESC *	pSmDesc = &pSmPktDesc->smDesc;    /* Check that this cpu is connected to shared memory */    if (pSmPktDesc->status != SM_CPU_ATTACHED)	{	errno = S_smPktLib_NOT_ATTACHED;	return (ERROR);				/* local cpu is not attached */	}    /* Get packet from free list */    return (smPktSllGet (&(pSmPktDesc->hdrLocalAdrs->freeList),			 pSmDesc->base, pSmDesc->tasRoutine,			 pSmDesc->tasClearRoutine, (SM_SLL_NODE **) ppPkt));    }/******************************************************************************** smPktSend - send a packet via shared memory** This routine queues a packet (previously acquired via smPktFreeGet)* to be received by another CPU.  If the input list for the destination* CPU was previously empty and the destination has not specified polling * as its interrupt type, this routine will interrupt the destination CPU. ** If the specified <destCpu> is SM_BROADCAST, a copy of the packet will* be sent to each CPU which is attached to the shared memory area (except* the sender CPU).  If there are not enough free packets to send a copy* to each cpu, or if errors occur when sending to one or more destinations,* an error (S_smPktLib_INCOMPLETE_BROADCAST) is returned.** If ERROR is returned and errno equals S_smPktLib_INCOMPLETE_BROADCAST,* the original packet, <pPkt>, was sent to an attached CPU and does not* have to be freed.  A return code of ERROR combined with any other value* of errno indicates that <pPkt> was NOT sent and should be explicitly* freed using smPktFreePut().  (A return value of OK indicates that

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区欧美二区| 国产精品电影院| 欧美亚洲国产一区二区三区va | 亚洲视频一区二区在线| 亚洲精品一区二区三区精华液| 制服丝袜在线91| 91精品国产综合久久久久久漫画| 欧美久久久久免费| 91精品国产丝袜白色高跟鞋| 884aa四虎影成人精品一区| 日韩天堂在线观看| 精品国产一区二区在线观看| 久久久蜜桃精品| 中文字幕一区免费在线观看| 综合久久给合久久狠狠狠97色 | 毛片av中文字幕一区二区| 日本不卡免费在线视频| 蜜桃91丨九色丨蝌蚪91桃色| 极品少妇xxxx精品少妇| 丁香亚洲综合激情啪啪综合| 99精品欧美一区二区三区小说| 色老综合老女人久久久| 欧美精品 日韩| 久久精品一区二区三区四区| 国产精品久99| 视频一区欧美日韩| 国产激情视频一区二区在线观看| 91蝌蚪porny成人天涯| 欧美一区二区三区电影| 中文字幕二三区不卡| 亚洲国产三级在线| 精品中文字幕一区二区| 99久久精品情趣| 日韩一二三区视频| 国产精品入口麻豆原神| 日日摸夜夜添夜夜添国产精品 | 自拍偷拍亚洲激情| 日本sm残虐另类| 91免费精品国自产拍在线不卡| 欧美美女视频在线观看| 日本一区二区成人在线| 五月天久久比比资源色| 国产一区二区在线视频| 欧美在线观看禁18| 欧美激情资源网| 日本伊人色综合网| 播五月开心婷婷综合| 欧美一级黄色片| 亚洲图片一区二区| 不卡一区二区中文字幕| 日韩精品一区二区在线观看| 亚洲在线中文字幕| eeuss鲁片一区二区三区在线观看| 欧美高清性hdvideosex| 亚洲精品国产精品乱码不99| 国产福利91精品一区| 精品国产乱码久久久久久免费| 亚洲高清中文字幕| 91免费观看在线| 中文字幕亚洲一区二区va在线| 久久精品国产亚洲5555| 欧美日韩亚洲综合一区二区三区| 中文字幕在线一区二区三区| 国产一区二区看久久| 日韩欧美在线不卡| 日韩av二区在线播放| 欧洲一区在线电影| 亚洲激情自拍偷拍| 91麻豆视频网站| 亚洲三级久久久| 91麻豆精东视频| 亚洲欧美韩国综合色| 99精品在线观看视频| 国产精品成人在线观看| 成人小视频免费在线观看| 国产日韩欧美不卡| 国产精品99久久不卡二区| 久久久不卡网国产精品一区| 国产一区二区视频在线| 久久精品视频在线看| 懂色av一区二区三区蜜臀| 中文字幕在线免费不卡| 91国产成人在线| 婷婷综合久久一区二区三区| 欧美精品aⅴ在线视频| 奇米影视7777精品一区二区| 日韩免费高清视频| 国产在线一区二区| 亚洲欧美在线视频| 在线视频你懂得一区| 五月婷婷综合激情| 26uuu亚洲综合色| 处破女av一区二区| 一区二区在线看| 欧美丰满少妇xxxbbb| 久久91精品国产91久久小草| 国产欧美日韩激情| 91久久久免费一区二区| 久久激情综合网| 欧美高清在线精品一区| 欧洲一区二区三区在线| 久久er精品视频| 亚洲欧美中日韩| 日韩亚洲欧美在线| 成人av在线一区二区三区| 午夜影院在线观看欧美| 2014亚洲片线观看视频免费| 成av人片一区二区| 男人的j进女人的j一区| 国产精品天天看| 欧美精品久久一区| 99久久免费视频.com| 日本不卡一区二区三区| 国产精品久久久久三级| 欧美一级夜夜爽| 粗大黑人巨茎大战欧美成人| 日韩精品成人一区二区三区| 久久久久国产精品人| 欧美日韩视频第一区| 国产成人午夜视频| 美女在线视频一区| 亚洲激情图片qvod| 久久久www成人免费无遮挡大片| 色94色欧美sute亚洲13| 国产一区二区三区日韩| 天天色图综合网| √…a在线天堂一区| 精品免费视频.| 欧美日韩国产另类一区| 99久久免费视频.com| 国产一区二区三区精品视频| 五月婷婷激情综合| 亚洲男人的天堂网| 中文字幕中文在线不卡住| 精品国产91洋老外米糕| 91麻豆精品国产91久久久| 94-欧美-setu| 成人少妇影院yyyy| 国产精品综合网| 久久精品国产色蜜蜜麻豆| 亚洲成人777| 亚洲国产另类av| 夜夜揉揉日日人人青青一国产精品| 久久网站最新地址| 精品国产一区二区三区四区四| 欧美日韩国产成人在线免费| 91精品1区2区| 色妹子一区二区| 99r国产精品| 91在线高清观看| 色欧美乱欧美15图片| 91激情在线视频| 日本大香伊一区二区三区| 一本一道波多野结衣一区二区| 99国产欧美另类久久久精品| 北条麻妃一区二区三区| 波多野结衣中文一区| www.亚洲国产| bt7086福利一区国产| 99在线热播精品免费| www.av亚洲| 欧美午夜精品久久久| 欧美另类变人与禽xxxxx| 欧美一区二区黄色| 亚洲精品一区在线观看| 国产亚洲精品超碰| 国产精品电影一区二区| 国产亚洲欧美色| 欧美亚洲禁片免费| 欧美系列在线观看| 欧美日韩一区三区四区| 欧美一区二区福利在线| 精品久久久久久久久久久久久久久 | 亚洲另类中文字| 亚洲国产成人va在线观看天堂| 亚洲一区二区三区四区在线 | 色欧美乱欧美15图片| 欧美日韩小视频| 精品国产一区二区三区av性色| 久久久av毛片精品| 日韩理论片在线| 美国毛片一区二区三区| 国产风韵犹存在线视精品| 97se狠狠狠综合亚洲狠狠| 777久久久精品| 国产日产欧美一区二区三区| 亚洲欧美日韩中文播放| 国产精品区一区二区三| 日韩精品欧美成人高清一区二区| 老司机免费视频一区二区三区| 成人午夜视频在线观看| 欧美日韩精品一区二区三区蜜桃| 日韩色视频在线观看| |精品福利一区二区三区| 蜜臀av性久久久久蜜臀aⅴ流畅| 成人aaaa免费全部观看| 日韩一本二本av| 亚洲一线二线三线视频| 国产剧情在线观看一区二区| 日本乱码高清不卡字幕|