Embedded Systems Design - July 2008 - (Page 42) 20 years ago programmer) is checked. If the class field of the exception indicates “handle by priority,” the exception handler compares the priority passed when the exception was raised against the current exception priority. Exceptions of equal or higher priority halt the system, while exceptions of lower priority are simply noted. The fault field is the unique crash code for the exception. A SYS_EXCEPTION data structure would be built at compile time by oring flags to the crash code as follows: sys_fault((long) (SYS_RPT_ONLY | SYS_PRT_3 | SYS_CRASH_001), err ); Listing 2 Sys_fault entry point. ; ; ; ; ; ; ; + + | Copyright (c) 1989, Thomas E. Beseme | + + File: sys_flta.asm Services Provided: Contains interfaces and support routines for system crash handler. ; Date: 3-10-89 ; EXTRN _csys_fault:FAR _SYS_FLTA_TEXT SEGMENT PARA PUBLIC ‘CODE’ ASSUME CS:_SYS_FLTA_TEXT PUBLIC _sys_fault _sys_fault PROC FAR ; ;==== Set up stack frame to suit SYS_CRASH_REGS in sys_flt.c. push bp ; initial stack frame mov bp,sp pushf push ax push bx push cx push dx push si push di push ds push es ; ;==== Call _csys_fault to format crash report. mov ax,sp ; Get current stack pointer. push ss ; Store segment on stack. push ax ; Store offset on stack. call FAR PTR_csys_fault add sp,4 ; Restore stack pointer. ; ;==== Restore registers and return. pop es pop ds pop di pop si pop dx pop cx pop bx pop ax popf pop bp ret ; far return ; _sys_fault ENDP ; _SYS_FLTA_TEXT ENDS END This fault is report-only with a priority of 3 and a crash code of 1. The values of the flags are such that their bit positions are aligned with the proper fields of the SYS_EXCEPTION data structure. For both of these concepts—recovery and classes of exceptions—the procedure csys_fault() shown in Listing 1 requires enhancement to meet the individual needs and requirements of the system. The point is to have the central exception handler in place. The programmer can then start with simple fault handling and, if necessary, increase the capabilities of the exception handler to meet the needs of a growing system. THE METHOD’S RESULT The purpose of exception handling is to build a consistent environment that helps isolate and identify problems. The central exception handler can be updated and modified to support the current system condition, whether it be during implementation or after the product is shipped. During system implementation, an exception handler should allow the programmer to identify problems when they occur. Once the project is completed. The exception handler should record problems as they occur, restart the system, and recover automatically from the exception. ■ When this article was written, Thomas Besemer was a consultant in Sunnyvale, Calif., specializing in embedded system design and implementation. He has worked on factory automation installations in many roles, including hardware engineer, programmer, and project manager. To find out what he’s doing today, go to http://thomas-iv.com/founder.html. 42 JULY 2008 | embedded systems design | www.embedded.com http://thomas-iv.com/founder.html http://www.embedded.com
Table of Contents Feed for the Digital Edition of Embedded Systems Design - July 2008 Embedded Systems Design - July 2008 Contents #Include Parity Bit Programming Pointers Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design Building a Power Supply for Discontinuous Transmission Wireless Networks An Exception Primer Advertising Index Break Points Marketplace Embedded Systems Design - July 2008 Embedded Systems Design - July 2008 - Embedded Systems Design - July 2008 (Page Cover1) Embedded Systems Design - July 2008 - Embedded Systems Design - July 2008 (Page Cover2) Embedded Systems Design - July 2008 - Embedded Systems Design - July 2008 (Page 1) Embedded Systems Design - July 2008 - Embedded Systems Design - July 2008 (Page 2) Embedded Systems Design - July 2008 - Contents (Page 3) Embedded Systems Design - July 2008 - Contents (Page 4) Embedded Systems Design - July 2008 - Contents (Page 5) Embedded Systems Design - July 2008 - Contents (Page 6) Embedded Systems Design - July 2008 - #Include (Page 7) Embedded Systems Design - July 2008 - #Include (Page 8) Embedded Systems Design - July 2008 - Parity Bit (Page 9) Embedded Systems Design - July 2008 - Programming Pointers (Page 10) Embedded Systems Design - July 2008 - Programming Pointers (Page 11) Embedded Systems Design - July 2008 - Programming Pointers (Page 12) Embedded Systems Design - July 2008 - Programming Pointers (Page 13) Embedded Systems Design - July 2008 - Programming Pointers (Page 14) Embedded Systems Design - July 2008 - Programming Pointers (Page 15) Embedded Systems Design - July 2008 - Programming Pointers (Page 16) Embedded Systems Design - July 2008 - Programming Pointers (Page 17) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 18) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 19) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 20) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 21) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 22) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 23) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 24) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 25) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 26) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 27) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 28) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 29) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 30) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 31) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 32) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 33) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 34) Embedded Systems Design - July 2008 - An Exception Primer (Page 35) Embedded Systems Design - July 2008 - An Exception Primer (Page 36) Embedded Systems Design - July 2008 - An Exception Primer (Page 37) Embedded Systems Design - July 2008 - An Exception Primer (Page 38) Embedded Systems Design - July 2008 - An Exception Primer (Page 39) Embedded Systems Design - July 2008 - An Exception Primer (Page 40) Embedded Systems Design - July 2008 - An Exception Primer (Page 41) Embedded Systems Design - July 2008 - An Exception Primer (Page 42) Embedded Systems Design - July 2008 - An Exception Primer (Page 43) Embedded Systems Design - July 2008 - Advertising Index (Page 44) Embedded Systems Design - July 2008 - Break Points (Page 45) Embedded Systems Design - July 2008 - Break Points (Page 46) Embedded Systems Design - July 2008 - Marketplace (Page 47) Embedded Systems Design - July 2008 - Marketplace (Page 48) Embedded Systems Design - July 2008 - Marketplace (Page Cover3) Embedded Systems Design - July 2008 - Marketplace (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.