EETimes

Embedded Systems November 2000 Vol13_12

Issue link: http://dc.ee.ubm-us.com/i/71849

Contents of this Issue

Navigation

Page 121 of 189

0 a l n flag is set to ALIVE, and the process continues as descdbed above. The monitor changes its scheme as follows: if t.he monitor checks the flags and sees the value ASLEEP, it considers that state to be valid. So, if all flags are either ASLEEP or ALIVE then the watchdog is kicked. The disadvantage is tJ1at if a task sets a flag to ASLEEP and never changes it back, it always passes the test and any deadlock or infini te loops in that task go undetected. Therefore, one of our rules is that the line of code following the line where tJ1e flag is set to ASLEEP must perform the wait, normally using one of the blocking function cal ls from tJ1e operating system. The instruction which follows the wait must set the £lag to ALIVE. For example: myFLag = ASLEEP; KS_wait(KEY_PRESS_HAPPENED); myFLag = ALIVE; Because tJ1ere are no conditions or branches in this sequence, no set of circumstances allow the task to contin- ue with the flag in the ASLEEP state. Once the flag has been set to ALIVE, the t.ask must run to some point where the flag is again set to ALIVE or ASLEEP, before the monitor task ha time to clear the flag to U KNOWN and wait one timeout period. Many tasks have only one place where they wait on an external event and set the flag to ASLEEP. Those tasks must complete one full loop and be back at the tJ1ree lines shown above in less time than the monitor's timeout. Note tJ1at this mechanism is not Our inspiration. Powerful tools. Great productivity. Integrated price. Paradigm introduces all the tools you'll need for x86 integration in one package. Paradigm C++ is alone in offering a complete integrated development environment that includes all the tools you need to get your x86 embedded application jump started. Editing, project management, debugging, compiler, assembler, version control and more, all fully integrated into the powerful Paradigm C++ development environment. If you are tired of wasting time on non-integrated tools, then Paradigm C++ is where you want to be. Download a copy of Paradigm C++ from http:/ jwww.devtools.com/pcpp and see the future of x86 development tools today. Pdraillgm Paradigm Systems 3301 Country Club Road Suite 2214 Endwell, NY 13760 1-800-537-5043 Phone 607-748-5966 Fax 607-748-5968 info@devtools.com http:/ fwww.devtools.com 120 NOVEMBER 2000 Embedded Systems Programming used on all blocking calls to the oper- ating syst.em; it is only used for the waits that are dependent on events for which a finite return time cannot be guaranteed. There are sti ll some concerns witJ1 tJ1is scheme. If a deadlock occurs that involves waits in a number of waiting tasks while each of tJ1e waiting tasks has its flag set to ASLEEP, tJ1e monitor can- not detect the fault. In order to avoid this pitfall , a graph can be manually created to show each task wi tJ1 an arrow to the tasks it waits on (drawing arrows only for waits tJ1at set the task Ilag to ASLEEP). If there is a complete loop (for example, Taskl waits on Task2; Task2 waits on Task3; and Task3 waits on Taskl) , tJ1en these waits are not gen- uinely waiting for external events and you should consider whetJ1er tJ1e task flag should be set. to ASLEEP at all of these points. If such a loop cannot be avoided, an extra timeout. could be set on one of the waits (assuming that your RTOS supports timed waits) , and tJ1is timeout would provide protection

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems November 2000 Vol13_12