?? vxw_pt5.html
字號(hào):
<br>(From: Fred Roeber, froeber@bbn.com)<p><hr WIDTH="60%"><p><h3><a NAME="5.7"><center>5.7 Semaphores</center></a></h3><a NAME="5.7-A"></a>Q: It looks like the priority inversion mechanism is not working correctly.<p>A: This may not be the issue here, but you should note the throw-away line inthe semMLib description...<p>"The task will return to its normal priority only after relinquishing all ofits mutual-exclusion semaphores that have the inversion-safety optionenabled".<p>So if your Task Two happens to have hold of some other (probably unrelated)inversion-safe mutex, this will prevent it from reverting to its formerpriority, even though Task One is not waiting on the semaphore you arecurrently focussing on. (This was the cause of a deadlock I recentlyencountered!)<br>(From: Will Fookes, will@noSpam.wfookes.co.uk)<p><hr WIDTH="60%"><p><h3><a NAME="5.8"><center>5.8 Simulator (VxSim)</center></a></h3><a NAME="5.8-A"></a><p>Q: How can I start multiple simulators on NT and have these communicating?<p>A: While in a VxWorks class, the instructor gave me the following info.With this I was able to finally get it to work!<br>Just two things:<ol><li>Make sure you configure WDB END driver instead of the WDB simulator pipe.<blockquote>development tool components -> WDB agent components -><br>select WDB connection -> WDB END driver connection</blockquote></li><li>I got an exception using buffers greater then 1400 with a TCPconnection. Fragmentation problem? Same code works fine on real hardware.</li></ol>The info in in <a href="multsimnt.html">this file</a>.<br>(From: Luc Pariseau, lparisea@nortelnetworks.com)<p><hr WIDTH="50%"><a NAME="5.8-B"></a><p>Q: How do I increase the memory of the simulator?<p>A: Use the /r switch to control the amount of memory of the simulator. Thesize is in bytes, and not in kBytes as the manual states. You also have tobuild a custom-configured simulator, as the default simulator does not supportthe /r-switch.<p><a NAME="5.8-B1"></a>In case the command line is not an option, here is another way:I think the magic line you want to change is in 01Simulator.win32.tcl:[::simulatorLaunch $imageName $pNo $workingDir 30000] \and the 30000 will be your memory size. If you don't want to brute force ityou can add code to the showImageDlg procedure (look at the dialog on thebottom of the file) to prompt you for it. Right now it seems as if it'shardcoded on win32 platform and they prompt you only on UNIX.. (look in theLaunch directory for the UNIX implementation)<br>(From: Steven Szabo, Steven.Szabo@motorola.com)<p><hr WIDTH="50%"><a NAME="5.8-C"></a><p>Q: How can I have 2 simulators communicate with eachother on Win2K box?<p>A: You need to setup the ULIP driver correctly, which means you need to enable IP-Routing.<br>Here is the result of my "ipconfig /all" (Sorry, output is in German! (Jameans Yes, Nein means No)):<pre>Windows 2000-IP-Konfiguration Hostname. . . . . . . . . . . . . : martin Primares DNS-Suffix . . . . . . . : Knotentyp . . . . . . . . . . . . : Hybridadapter IP-Routing aktiviert. . . . . . . : Ja<------------------- WINS-Proxy aktiviert. . . . . . . : NeinEthernetadapter "vxSIM WindRiver": Verbindungsspezifisches DNS-Suffix: Beschreibung. . . . . . . . . . . : WindRiver ULIP Physikalische Adresse . . . . . . : 00-00-00-00-00-00 DHCP-aktiviert. . . . . . . . . . : Nein IP-Adresse. . . . . . . . . . . . : 90.0.0.254<-------------------- Subnetzmaske. . . . . . . . . . . : 255.255.0.0<------------------- Standardgateway . . . . . . . . . : DNS-Server. . . . . . . . . . . . :</pre>Pinging from one to the other vxSim works fine.But you need to start the Simulator using a processor number >0, then youwill get the target server calling parameters to start with wdbrpc:<code>90.0.0.2 -B wdbrpc -Bt 3 -R f:\TEMP\tsfs -RW -n "vxsim1@martin"</code><p>Here is my output:<br>Simulator #1 to #3:<pre>-> ping "90.0.0.4"PING 90.0.0.4: 56 data bytes64 bytes from vxTarget (90.0.0.4): icmp_seq=0. time=0. ms</pre>Simulator #3 to #1:<pre>-> ping "90.0.0.2"PING 90.0.0.2: 56 data bytes64 bytes from vxTarget (90.0.0.2): icmp_seq=0. time=0. ms</pre>Simulator #3 to win2k host:<pre>-> ping "90.0.0.254"PING 90.0.0.254: 56 data bytes64 bytes from host (90.0.0.254): icmp_seq=0. time=0. ms</pre><br>(From: Martin Raabe, Martin.Raabe@WindRiver.com)<p><hr WIDTH="50%"><a NAME="5.8-D"></a><p>Q: The font in my VxSim window is very small.<p>A: You are probably using Regional settings other than English. If you changeit to English, it should work. There is also another way where you don'thave to change regional settings and it involves tempering with the codeof VxWorks.exe.<br>(From: Tomislav Razov, tomislav.razov@siemens.hr)<p><a NAME="5.8-D2"></a>It is also possible to use the following tool. The exe file should be runafter each time you run the simulator. We integrated the call into theresposible TCL file, which is <a href="01Simulator.win32.tcl.patch">attached</a> also.The tool (source and executable) can be found here:<a href="SimFont.zip">SimFont.zip</a>.<br>(From: Ofer Goren, ofer_goren@iamba.com)<p><hr WIDTH="50%"><a NAME="5.8-E"></a><p>Q: How can I make 2 simulators communicate on a Solaris box?<p>A: Enable IP forwarding on solaris.<pre>ndd -set /dev/ip ip_forwarding 1</pre>(From: Vijay Paul, paulv@lucent.com)<p><hr WIDTH="60%"><p><h3><a NAME="5.9"><center>5.9 Task related items</center></a></h3><a NAME="5.9-A"></a>Q: What is the use of taskDelay(0)?<p>A: The following msg was posted by Dave Schmidt of Wind River on thenewsgroup concerning taskDelay (0):<blockquote>That will put the current task at the end of the ready queue for thecurrent priority. It will allow any other tasks on the ready queue ofthe same priority to be run (sort of round robin, if you issuetaskDelay(0) for them also when you want to go to the next task), ofcourse all higher priority tasks will run and intterrupt serviceroutines will also run.<br>Please note that this method will NOT allow tasks of lower priority torun, it just forces a rescheduling. If the task being delayed is theonly one of that priority, then it will restart immediately.</blockquote><p><hr WIDTH="50%"><a NAME="5.9-B"></a><p>Q: How do I use taskInit?<p>A: First: why use taskInit? If you want to synchronise startup use taskInitand let the new task(s) wait on a semaphore.<br>But if you still want to use it, here are some examples:<p>From john_94501@my-deja.com:<br>This code is cut from something that uses taskInit ina portable way (i.e. it takes into account the stack direction of theCPU being used). This is another reason why I prefer to use taskSpawn!<pre> int ret; char *memArea; /* initialize TCB and stack space */ memArea = (char *) malloc (STACK_ROUND_UP(STACK_SIZE) + sizeof (WIND_TCB) + 16); /* initialize task */ ret = taskInit ((WIND_TCB *) (memArea + 16), NULL, 150, VX_NO_STACK_FILL,#if (_STACK_DIR == _STACK_GROWS_DOWN) (char *) (memArea + STACK_SIZE + sizeof (WIND_TCB)),#else memArea + STACK_ROUND_UP (sizeof (WIND_TCB) + 16),#endif STACK_SIZE, (FUNCPTR) function, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /* args */ if (ret == ERROR) { perror ("taskInit"); return(0); } else { taskActivate ((int) memArea); }</pre>And that is basically it! Your task should be running by the end of thatsequence. If you wish to delay the starting point just move the call totaskActivate().<p>Another example from steven.offenbacher@jhuapl.edu:<p> I also have a working example where I don't usemalloc. I statically create the TCB and stack.<pre> WIND_TCB tMonitorTcb; char tMonitorStack[STACK_SIZE]; /* Example #04. taskInit/taskActivate method using statically allocated TCB and stack */ status = taskInit(&tMonitorTcb, /* TCB Address */ "tMonitorMethod04", /* Task/Thread Name */ 240, /* Priority 0=Highest */ VX_NO_STACK_FILL, /* Options */ /* Determine which way stack grows and adjust address if necessary */#if (_STACK_DIR == _STACK_GROWS_DOWN) tMonitorStack+STACK_SIZE, /* Stack base address */#else tMontiorStack, /* Stack base address */#endif STACK_SIZE, /* Stack size in bytes*/ (FUNCPTR) monitor, /* Task entry point */ 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0); /* VxW Req 10 parms */ /* Task exists but is not running at this point. The debugger can now attach to the task and set breakpoints provided the user does not detach or attach to some other task */ if (status == OK) /* Only activate if init ok */ status = taskActivate((int)&tMonitorTcb);/* Actually start task */</pre><p><hr WIDTH="50%"><a NAME="5.9-C"></a><p>Q: When the priority of a task is requested using taskPriorityGet it ispossible that this is not the real value, as this might change due topriority inversion. How do I get the right value?<p>Q: The normal priority is kept in the TCB. It can be read using this command:<pre>priority = (taskTcb(taskIdSelf()))->priNormal;</pre><br>(From cwein@my-deja.com and Pete Kockritz, pkockritz@home.com)<p><hr WIDTH="50%"><a NAME="5.9-D"></a><p>Q: Using WindView, I've noticed a task that has just completed (eg. byreturning) doing the following in close sucession:<ul><li>Calling taskDelete upon itself (presumably this is what shouldhappen when the task returns)</li><li>Being almost immediately preempted by tExcTask, which then:</li><ul><li>taskDeletes the task /again/ and then...</li><li>calls taskSuspend on the task (which is now *very* much dead)</li></ul></ul>Why this order, the task would have been deleted after the first call to taskDelete anyway.<p>A: The sequence is not only familiar, but it is correct, at least asfar as the deletion of the task... let me explain in more detail...<br>Normally, when one task deletes another the one doing the work has acontext, stack etc to execute the task deletion code on. This isnecessary, obviously, since the code performing the deletion is simply Ccode, and might block or be interrupted.<br>Now, when a task deletes itself it has a small problem: it can't deleteits own stack and context information (TCB), since that would leave theexecuting code without any stack or context. OK, it could lockinterrupts until it was all cleaned up, but that would not be good in areal time OS where interrupt latency is an important factor.<br>So, the taskDelete() code performs some checks up front, and if it isdeleting itself the work is actually passed to another task to do(tExcTask in this case). The actual code is a little more involved, butthis is a rough idea of what happens (function names not accurate, butchosen to express the concept):<pre>if (taskToDelete == taskIdSelf() { queueJob (taskDelete, taskToDelete); taskSuspend (0); }</pre>Since the exception task is a high priority task it will preempt thetask deleting that was itself in most cases. At some point in theprocess, the taskDelete operation blocked for something. At that time,the original task was rescheduled, and promptly suspended itself (afterall, it is expecting to die very soon...).<br>Your description sounds pretty much like what I'd expect WindView to seefor a task deletion. The "exception" task is not really that well namedsince it is used for more than just displaying exception messages.Consider it to be a kernel thread, used for the OS to push work out totask level, much like an ISR that signals an associated task to performthe actual work.<br>(From: john_94501@my-deja.com)<p><hr WIDTH="50%"><a NAME="5.9-E"></a><p>Q: How can I build a stack-trace?<p>A: You can do this using an undocumented function called "trcStack".Here is all you need. You can even call xxxTrace(tid) from interrupt level...though logMsg() is far from ideal.<pre>/********************************************************************************* xxxTracePrint - stack trace print function** RETURNS: OK or ERROR*/static void xxxTracePrint ( INSTR *caller, int func, int nargs, int *args ) { char buf [250]; int ix; int len = 0; len += sprintf (&buf [len], "%#10x: %#10x (", (int)caller, func); for (ix = 0; ix < nargs; ix++) { if (ix != 0) len += sprintf (&buf [len], ", "); len += sprintf (&buf [len], "%#x", args [ix]); } len += sprintf (&buf [len], ")\n"); logMsg (buf); }/********************************************************************************* xxxTrace - stack trace** RETURNS: OK or ERROR*/int xxxTrace ( WIND_TCB *pTcb ) { REG_SET regs; if (pTcb == NULL) return (ERROR); taskRegsGet ((int)pTcb, &regs); trcStack (&regs, (FUNCPTR) xxxTracePrint, (int)pTcb); return (OK); }</pre>(From: Geoffrey Espin, espin@idiom.com)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -