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

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

?? smpktlib.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* smPktLib.c - VxWorks shared packet protocol library *//* Copyright 1984-2002 Wind River Systems, Inc. *//*modification history--------------------02m,03may02,mas  cache flush and volatile fix (SPR 68334); bridge flush fix		 (SPR 68844)02l,24oct01,mas  doc update (SPR 71149)02k,09oct01,mas  smPktSend: added error checking (SPR 6004), limited interrupt		 retries (SPR 25341), removed all FAST modifiers, code cleanup02j,17oct00,sn   replaced NULL with 0 so htonl works02i,21feb99,jdi  doc: listed errnos.02h,26aug93,kdl  smPktBroadcast() now checks smPktSllPut() status before 		 interrupting destination CPU  (SPR #2441).02g,13nov92,jcf  removed potential bus error during attach.02f,02aug92,kdl  Uncommented include of "copyright_wrs.h".02e,24jul92,elh  Moved heartbeat from anchor to header.02d,23jun92,elh  general cleanup and documentation.02c,02jun92,elh  the tree shuffle02b,27may92,elh	 Made completely independant, changed to use		 offsets, general cleanup.02a,14may92,pme  Split to keep only packet passing routines.01e,20feb92,elh  Added in ntohl, and htonl for 960, Added USE_OFFSET.		 Extracted and renamed OS specific calls & moved to		 smUtilLib.  Also removed function pointers		 shMemIntGenFunc and shMemHwTasFunc.		 made TAS_CHECKS 10 TAS_TRIES 5000.		 modified parameters passed to intGen function.01d,10feb92,kdl+ Changed shMemDetach to flush input queue.	    elh  Removed references to OK_WAS{EMPTY, NT_EMPTY}.		 Made shMemSend return an ERROR if packet too large.		 Changed shMemSend to return silently (no		 interrupts generated) if sending to self.		 Misc code review changes.01c,05feb92,elh  ansified.01b,27jan92,elh	 added masterCpu to shared memory anchor.		 changed shMemBeat to take pAnchor as argument.		 changed arguments to shMemIsAlive.		 changed shMemSetup to probe memory.		 changed copyright.01a,15aug90,kdl	 written.*//*DESCRIPTIONThis library contains routines which allow multiple processorsto communicate over a backplane using shared memory.  Allservices for initializing and managing the shared memory areprovided.Data is sent between CPU's via shared memory "packets".  A packetis simply a data buffer (of configurable size) with a headerthat allows it to be properly identified and manipulated as a nodein a linked list of packets.SHARED MEMORY MASTER CPUOne CPU node acts as the shared memory master.  This CPU initializesthe shared memory area and sets up the shared memory anchor.  Thesesteps are performed by the master calling the smPktSetup() routine.This routine should be called only by the shared memory master CPU,and it should only be called once for a given shared memory region.(It is, however, possible to maintain and use multiple separateshared memory regions.)Once smPktSetup() has completed successfully, there is little functionaldifference between the master CPU and other CPU's using shared memory,except that the master is responsible for maintaining the heartbeat inthe shared memory packet region header.SHARED MEMORY ANCHORThe shared memory anchor is a small data structure which is ata predetermined location, to allow all CPU's using shared memory tofind it.  The shared memory anchor contains the base offset to theactual shared memory region which will be used for inter-processormessage passing.  (This allows the master CPU to dynamically allocatethe shared memory region.)The shared memory anchor does not have to be defined as part of theshared memory region which will be used for message passing.  However,it must be located in a similar address space; the address translationconstants which CPU boards use to convert local addresses to bus addressesmust apply equally to the anchor and the regular shared memory region.ATTACHING TO SHARED MEMORYEach CPU, master or non-master, which will use the shared memory regionmust attach itself to the shared memory.  The shared memory region musthave already been initialized by the master CPU calling smPktSetup().The first step in attaching to shared memory is for each CPU to allocate andinitialize a shared memory packet descriptor (SM_PKT_DESC).  This structure describes the individual CPU's attachment to the shared memory region and is used in all subsequent shared memory calls to identify which shared memory region is being used.  Since the shared memory descriptor is used only by the local CPU, it is not necessary for the descriptor itself to be located in shared memory.  In fact, it is preferable for the descriptor to be allocated from the CPU's local memory, since local memory is usually more efficient to access.The shared memory packet descriptor is initialized by calling the smPktInit() routine.  This routine takes a number of parameters which specify the characteristics of this CPU and its access to shared memory.After the shared memory packet descriptor has been initialized, the CPU mayattach itself to the shared memory region.  This is done by calling thesmPktAttach() routine.When smPktAttach() is called, it checks that the shared memory anchor contains the special ready value and that the heartbeat is incrementing.If either of these conditions is not met, the routine will check periodically until either the ready value and incrementing heartbeat are recognized or a time limit is reached.  For non-master CPU's, this limit may be set by changing the global variable, smAliveTimeout.  The limit is expressed in seconds, with 600 seconds (10 minutes) the default.  The master CPU will only wait 5 beat periods for a recognized heartbeat, since it is the CPU responsible for initializing shared memory and incrementing the heartbeat and therefore should not have to wait.  If the time limit is reached before a valid ready value and heartbeat is seen, ERROR is returned and errno is set to S_smPktLib_DOWN .Once the CPU has attached itself to the shared memory region, it maysend packets to other CPU's or receive packets which have been sent to it.(Attempts to perform any shared memory operations without first attachingsuccessfully will return ERROR, with errno set to S_smPktLib_NOT_ATTACHED .)SENDING PACKETSTo send a packet to another CPU, an application task must first obtaina shared memory packet from the pool of free packets.  This isdone by calling smPktFreeGet(), as follows:\cs	status = smPktFreeGet (pSmPktDesc, &pPkt);\ceIn this example, <pSmPktDesc> is the address of this CPU's shared memory packetdescriptor.  If status value returned by smPktFreeGet is OK, the addressof the obtained packet will be placed in <pPkt>.  If the packet address isNULL, no free packets were available.Once a packet has been obtained, the application task must copy the datato be sent into the "data" field of the packet structure.  The maximumnumber of bytes which may be copied to the packet's data buffer is<maxPktBytes>, as specified by the master CPU during smPktSetup.  Thislimit may be determined by reading a field in the shared memory packet descriptor.The application task may set the "type" field in the packet header (SM_PKT_HDR)to indicate the specific type of packet being sent.  This field is not usedby smPktLib and may therefore be given any value.To send the completed packet, the application task calls smPktSend(),as follows:\cs	status = smPktSend (pSmPktDesc, destCpu, pPkt);\ceHere, <destCpu> is the number of the destination CPU, and <pPkt> is theaddress of the packet to be sent.  If smPktSend() returns a status of OK,the packet was successfully queued for the destination CPU.If the destination CPU did not previously have any input packets queued toit smPktSend() will call the user-provided routine, smUtilIntGen(), to interrupt the destination CPU to notify it that a packet is available.  See "Interrupts," below, for more information.If the destination CPU is not attached, ERROR is returned and errno is setto S_smPktLib_DEST_NOT_ATTACHED .  If the specified destination cpunumber is out of range (i.e. less than zero or greater than the maximumspecified during smPktSetup), ERROR is returned and errno is set toS_smPktLib_INVALID_CPU_NUMBER .If the first interrupt fails, a delay of one tick is made and anotherinterrupt is attempted.  This is repeated up to smPktMaxIntRetries attempts oruntil the interrupt is successful.  If not successful, ERROR is returnedand errno is set to S_smPktLib_INCOMPLETE_BROADCAST so that the callerdoes not try to remove the packet and place it on the free list.  Doingso would put the packet in both an input list and the free list!BROADCAST PACKETSIn some circumstances, it may be desirable to send the same data toall CPU nodes using the shared memory region.  This may be accomplishedby using a special "broadcast" mode of smPktSend().  This option sendsa copy of the same packet data to each attached CPU (except the sender).To send a broadcast message, a CPU must first obtain a free shared memorypacket using smPktFreeGet() as usual.  The data area of the packetis then filled with the message to be sent, again the same as for sendingto a single destination.Broadcast mode is indicated during smPktSend() by a special value of the<destCpu> (destination CPU) parameter.  This parameter is set toSM_BROADCAST, rather than a particular CPU number.When a broadcast message is sent, a separate packet is obtained for eachattached CPU, the data from the original packet is copied to it, andthe packet is queued to a particular CPU.  Therefore, there must besufficient free packets to send one to each CPU.  Broadcast packets aresent to destination CPU's in cpu-number order.If there are not enough free packets to send a copy to each CPU,as many as possible will be sent, but ERROR is returned and errno isset to S_smPktLib_INCOMPLETE_BROADCAST .  (If there are insufficientfree packets, the original packet passed during smPktSend() will besent to a destination CPU, to provide as complete a broadcast aspossible.)Broadcast packets are received in the same manner as any other packets.RECEIVING PACKETSPackets are received by calling the smPktRecv() routine.  This routinewill normally be called by an interrupt handler, in response to aan interrupt generated by a remote CPU sending a packet.  The smPktRecv()routine may also be called periodically, in a polling fashion, to checkfor received packets in systems which do not use interrupts to notifythe receiving CPU.To receive a packet, smPktRecv is called as follows:\cs	status = smPktRecv (pSmPktDesc, &pPkt);\ceIf the returned status is OK, <pPkt> will contain either the address ofa received packet, or NULL if no input packets were available.  A returnedstatus of ERROR indicates that an error occurred while attempting toobtain received packets.A sending CPU will interrupt the destination CPU only if therewere no packets previously queued for the destination CPU.  It istherefore important that an interrupt handler which receives packetscall smPktRecv again after each packet is received, to check foradditional packets.After a packet has been received, it must be explicitly freed by callingsmPktFreePut().DETACHING FROM SHARED MEMORYThe attachment of a CPU to shared memory may be ended by callingsmPktDetach().  This routine will mark the calling CPU as no longerattached.  After this, other CPU's may no longer send packets to it.The CPU may re-attach itself to the shared memory region by latercalling smPktAttach().  When re-attaching, the original sharedmemory descriptor may be re-used if the CPU's configuration remainsthe same, or new values may be specified via smPktInit().INTERRUPTSWhen a packet is sent to a CPU, there must be some method for that CPUto be informed that an input packet is available.  The preferred methodis for the sending CPU to be able to interrupt the receiving CPU.  Thiswill be highly dependent on the specific hardware being used.  Two types of interrupts are supported, mailbox interrupts and vmebus interrupts.  Mailbox interrupts are the first preferredmethod (SM_INT_MAILBOX), followed by vme bus interrupts (SM_INT_BUS).If interrupts cannot be used, a polling scheme may be employed(SM_INT_NONE), but this is much less efficient.When a CPU initailizes its shared memory packet descriptor via thesmPktInit() call, it passes in an interrupt type as well as threeinterrupt arguments.  This describes how the cpu wishes to be notifiedof incomming packets.  The interrupt types recognized by this libraryare listed in smLib.h.  These values may be obtained for any attached CPU bycalling smPktCpuInfoGet().The default interrupt method for a particular target is defined by theconfiguration parameters: SM_INT_TYPE, SM_INT_ARG1, SM_INT_ARG2, SM_INT_ARG3 .When a CPU sends a packet to a destination CPU which did not previouslyhave any input packets queued to it, the sending CPU will interrupt the destination CPU. A handler routine which executes in response to such an interruptmust call smPktRecv() to obtain the input packet.  Since the interruptis generated only for the first packet queued when the input list waspreviously empty, it is important that the handler routine then callsmPktRecv additional times until no more packets are available.If it is not possible to use interrupts to notify receiving CPU's, a polling method may be used.  The simplest method is for the recieving CPU torepeatedly call smPktRecv() to check for input packets.  In this case,no notification routine is used.OBTAINING STATUS INFORMATIONTwo routines are provided to obtain current status information aboutthe shared memory region and individual CPU's:The smPktInfoGet() routine gets status information which applies to thethe shared memory region as a whole.  It takes as a parameter a pointerto a special information structure (SM_PKT_INFO), which it fills beforereturning.  The smPktCpuInfoGet() routine obtains status information for a singleCPU.  The number of the CPU must be specified during the call tosmPktCpuInfoGet().  A CPU number of NONE (-1) indicates that informationon the calling CPU should be returned.  The routine takes as a parametera pointer to a special CPU information structure (SM_PKT_CPU_INFO), which it fills before returning.  INTERNALThis file runs under only vxWorks.  SunOS is no longer supported.Pointers into shared memory are declared 'volatile' so that compileroptimization does not disrupt ordering of I/O operations.Reading of locking semaphores after updates to shared memory but beforerelease of the semaphores is to cause the flushing of any external busbridge read and write FIFOs.  Failure to do so can result in erroneousreads of shared memory and subsequent deadlock conditions.*/#ifdef UNIX#undef INET#endif/* includes */#include "vxWorks.h"#include "sysLib.h"#include "taskLib.h"#include "cacheLib.h"#include "smPktLib.h"#include "smLib.h"#include "smUtilLib.h"/* defines */#define	SM_LOCK_TAKE(lockLocalAdrs,tasRoutine,numTries,pOldLvl) \		(smLockTake (lockLocalAdrs, tasRoutine, numTries, pOldLvl))#define	SM_LOCK_GIVE(lockLocalAdrs,tasClearRoutine, oldLvl) \		(smLockGive (lockLocalAdrs, tasClearRoutine, oldLvl))#define DEFAULT_TAS_TRIES	5000	/* default tries for test-and-set */#ifndef SM_PKT_MAX_INT_RETRIES# define SM_PKT_MAX_INT_RETRIES 5   /* max #retries of interrupt per pkt */#endif/* Globals */int	smPktMemSizeDefault 	= DEFAULT_MEM_SIZE;	/* memory size */int 	smPktMaxBytesDefault 	= DEFAULT_PKT_SIZE; 	/* max pkt size */int 	smPktMaxInputDefault	= DEFAULT_PKTS_MAX;	/* max input pkts */int 	smPktMaxCpusDefault     = DEFAULT_CPUS_MAX;	/* max num CPU's */int	smPktTasTries 	  	= DEFAULT_TAS_TRIES;				/* times to try test-and-set */int     smPktMaxIntRetries      = SM_PKT_MAX_INT_RETRIES;                                /* max #int retries to attempt per packet *//* Forward References */#ifdef __STDC__LOCAL STATUS smPktSllGet    (    SM_SLL_LIST volatile * listLocalAdrs,	/* local addr of packet list */    int                    baseAddr,		/* addr conversion constant */    FUNCPTR                tasRoutine,		/* test-and-set routine addr */    FUNCPTR                tasClearRoutine,	/* test-and-set routine addr */    SM_SLL_NODE **	   pNodeLocalAdrs	/* location to put node addr */    );LOCAL STATUS smPktSllPut    (    SM_SLL_LIST volatile * listLocalAdrs,	/* local addr of packet list */    int			   base,		/* base address */    FUNCPTR		   tasRoutine,		/* test-and-set routine addr */    FUNCPTR		   tasClearRoutine,	/* test-and-set routine addr */    SM_SLL_NODE volatile * nodeLocalAdrs,	/* local addr of node */    BOOL *		   pListWasEmpty	/* set to true if adding to                                                 * empty list */    );LOCAL STATUS smPktBroadcast    (    SM_PKT_DESC *	pSmPktDesc,	/* sh mem pkt descriptor */    volatile SM_PKT *	pPktOrig	/* ptr to original packet */    );#else	/* __STDC__ */LOCAL STATUS smPktSllGet ();LOCAL STATUS smPktSllPut ();LOCAL STATUS smPktBroadcast ();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
男女激情视频一区| 色婷婷综合五月| 亚洲第一久久影院| 亚洲少妇30p| 日韩毛片一二三区| 亚洲色图欧洲色图婷婷| 亚洲素人一区二区| 亚洲综合999| 日韩在线一区二区三区| 日韩和欧美一区二区| 免费成人在线视频观看| 久久精品免费观看| 国产福利一区二区三区视频在线 | 亚洲一区在线观看免费观看电影高清| 日本一区二区三区电影| 综合色天天鬼久久鬼色| 亚洲日穴在线视频| 天天影视色香欲综合网老头| 午夜国产精品影院在线观看| 免费成人av资源网| 国产一区福利在线| 91一区二区三区在线观看| 96av麻豆蜜桃一区二区| 欧美在线观看视频一区二区三区| 日本高清不卡在线观看| 欧美日韩三级视频| 日韩一级完整毛片| 国产欧美日韩在线观看| 一区二区三区欧美视频| 老司机精品视频导航| 成人a区在线观看| 欧美精选午夜久久久乱码6080| 日韩欧美视频一区| 成人欧美一区二区三区视频网页| 偷拍日韩校园综合在线| 国产不卡在线一区| 欧美伦理视频网站| 国产色婷婷亚洲99精品小说| 一区二区三区日韩| 国产乱子伦一区二区三区国色天香| 成人精品在线视频观看| 欧美精品tushy高清| 国产精品成人午夜| 午夜精品久久久久久久久久久| 国产一区中文字幕| 欧美精品久久久久久久多人混战 | 一本久道久久综合中文字幕| 日韩视频123| 亚洲成国产人片在线观看| 成人免费高清在线观看| 欧美一区二区三区啪啪| 一区二区三区中文字幕| 国产福利视频一区二区三区| 欧美一区二区三区影视| 亚洲午夜羞羞片| jvid福利写真一区二区三区| 精品人伦一区二区色婷婷| 午夜欧美大尺度福利影院在线看 | 亚洲成人一区二区| 99精品一区二区三区| 精品国产乱码久久久久久免费| 亚洲小说春色综合另类电影| 成人一区二区三区在线观看| 日韩一区二区三| 亚洲国产另类av| 欧美网站一区二区| 亚洲精品高清视频在线观看| 成人免费视频播放| 国产欧美一区视频| 国产乱一区二区| 久久久亚洲午夜电影| 精品一区二区三区av| 日韩欧美亚洲另类制服综合在线| 亚洲国产美女搞黄色| 欧美午夜精品电影| 亚洲男人天堂av| 91免费看片在线观看| 中文字幕在线观看一区二区| 成人午夜精品在线| 亚洲三级在线免费| 91豆麻精品91久久久久久| 一区二区三区视频在线看| 欧美日韩一区二区三区视频| 首页国产欧美久久| 日韩欧美中文一区| 国产一区二区三区四区在线观看| 久久综合给合久久狠狠狠97色69| 国内成人自拍视频| 欧美国产1区2区| 色成人在线视频| 日韩成人精品在线观看| 精品国产一区二区三区忘忧草| 韩国av一区二区三区| 国产精品卡一卡二卡三| 色狠狠一区二区| 日本欧美一区二区| 国产亚洲成av人在线观看导航| www.综合网.com| 一区二区三区在线免费播放| 欧美日韩夫妻久久| 久久99久久精品欧美| 日本一二三四高清不卡| 在线观看网站黄不卡| 精品伊人久久久久7777人| 欧美韩国日本不卡| 欧美日韩在线三级| 国内成人精品2018免费看| 国产精品久久久久婷婷二区次 | 一区二区三区在线看| 日韩一级大片在线| 99精品欧美一区| 天天色 色综合| 国产精品少妇自拍| 欧美日韩美少妇 | 中文字幕精品一区二区精品绿巨人| 高清不卡一区二区| 午夜精品久久一牛影视| 欧美激情一区二区| 日韩午夜激情av| 91在线国产观看| 国产毛片一区二区| 亚洲国产另类av| 国产日韩成人精品| 欧美一级专区免费大片| 91一区一区三区| 极品少妇一区二区三区精品视频| 亚洲一二三区在线观看| 欧美国产日韩精品免费观看| 91精品午夜视频| 色欧美乱欧美15图片| 福利电影一区二区| 麻豆免费精品视频| 亚洲精品v日韩精品| 国产偷国产偷精品高清尤物| 欧美一区二区三区性视频| 日本高清不卡一区| 97久久精品人人爽人人爽蜜臀| 精品一区二区三区在线观看| 亚洲午夜精品网| 一区二区三区鲁丝不卡| 国产精品白丝在线| 国产精品网友自拍| 久久久精品人体av艺术| 欧美mv日韩mv亚洲| 91精品欧美综合在线观看最新| 一本一本久久a久久精品综合麻豆| 国产精品99久久久久久有的能看| 久久爱另类一区二区小说| 日本亚洲欧美天堂免费| 日韩在线一区二区三区| 手机精品视频在线观看| 日韩激情在线观看| 日本欧美一区二区在线观看| 日韩精品一二三四| 奇米精品一区二区三区四区| 日本不卡在线视频| 日本成人在线视频网站| 男人操女人的视频在线观看欧美| 午夜激情一区二区三区| 日韩 欧美一区二区三区| 亚洲国产成人高清精品| 日韩国产在线一| 六月丁香婷婷色狠狠久久| 免费高清不卡av| 韩国成人福利片在线播放| 国产精品伊人色| 成人h动漫精品一区二| 99久久精品国产观看| 不卡电影一区二区三区| 91小视频在线观看| 欧美日韩情趣电影| 日韩一区二区在线播放| 国产婷婷精品av在线| 亚洲另类在线制服丝袜| 亚洲综合丝袜美腿| 天堂久久一区二区三区| 极品少妇xxxx偷拍精品少妇| 成人av免费在线观看| 欧美亚洲日本一区| 91精品国产一区二区人妖| 久久久综合视频| 午夜精品久久一牛影视| 裸体一区二区三区| 成人精品视频一区二区三区| 97国产一区二区| 日韩欧美高清一区| 亚洲欧洲国产日本综合| 天天做天天摸天天爽国产一区| 久久99久久久久| 91国偷自产一区二区三区成为亚洲经典| 8v天堂国产在线一区二区| 国产女同性恋一区二区| 五月激情综合网| a4yy欧美一区二区三区| 欧美tickle裸体挠脚心vk| 一级精品视频在线观看宜春院| 久久99最新地址| 欧美日韩国产另类不卡| 中文字幕一区二区三区在线观看| 久久精品二区亚洲w码|