comparison packages/kernel/current/include/except.hxx @ 0:3111d98ba7b3 ecos-v1_1-release

Initial commit of eCos version 1.1
author jlarmour
date Tue, 11 May 1999 11:16:07 +0000
parents
children 443894e2e912
comparison
equal deleted inserted replaced
-1:000000000000 0:3111d98ba7b3
1 #ifndef CYGONCE_KERNEL_EXCEPT_HXX
2 #define CYGONCE_KERNEL_EXCEPT_HXX
3
4 //==========================================================================
5 //
6 // except.hxx
7 //
8 // Exception handling declarations
9 //
10 //==========================================================================
11 //####COPYRIGHTBEGIN####
12 //
13 // -------------------------------------------
14 // The contents of this file are subject to the Cygnus eCos Public License
15 // Version 1.0 (the "License"); you may not use this file except in
16 // compliance with the License. You may obtain a copy of the License at
17 // http://sourceware.cygnus.com/ecos
18 //
19 // Software distributed under the License is distributed on an "AS IS"
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
21 // License for the specific language governing rights and limitations under
22 // the License.
23 //
24 // The Original Code is eCos - Embedded Cygnus Operating System, released
25 // September 30, 1998.
26 //
27 // The Initial Developer of the Original Code is Cygnus. Portions created
28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved.
29 // -------------------------------------------
30 //
31 //####COPYRIGHTEND####
32 //==========================================================================
33 //#####DESCRIPTIONBEGIN####
34 //
35 // Author(s): nickg
36 // Contributors: nickg
37 // Date: 1997-04-09
38 // Purpose: Define exception interfaces
39 // Description: The classes defined here collectively implement the
40 // internal API used to register, manage and deliver
41 // exceptions.
42 // Usage: #include <cyg/kernel/thread.hxx>
43 //
44 //####DESCRIPTIONEND####
45 //
46 //==========================================================================
47
48 #include <cyg/kernel/ktypes.h>
49 #include <cyg/infra/cyg_ass.h> // assertion macros
50 #include <cyg/hal/hal_intr.h> // exception defines
51
52 // -------------------------------------------------------------------------
53 // Exception handler function prototype
54
55 typedef void cyg_exception_handler(
56 CYG_ADDRWORD data, // user supplied data
57 cyg_code exception_number, // exception being raised
58 CYG_ADDRWORD exception_info // any exception specific info
59 );
60
61 // -------------------------------------------------------------------------
62 // Exception delivery interface. This function is exported to the HAL which
63 // invokes it for all exceptions that it is not able to handle itself.
64
65 externC void deliver_exception( CYG_WORD code, CYG_ADDRWORD data );
66
67 // -------------------------------------------------------------------------
68 // Exception control class. Depending on the configuration there is either
69 // one of these per thread, or one for the entire system.
70
71 #ifdef CYGPKG_KERNEL_EXCEPTIONS
72
73 class Cyg_Exception_Control
74 {
75
76 #ifdef CYGSEM_KERNEL_EXCEPTIONS_DECODE
77 cyg_exception_handler *exception_handler[CYG_EXCEPTION_COUNT];
78
79 CYG_ADDRWORD exception_data[CYG_EXCEPTION_COUNT];
80 #else
81 cyg_exception_handler *exception_handler; // Handler function
82
83 CYG_ADDRWORD exception_data; // Handler data
84 #endif
85
86 public:
87
88 Cyg_Exception_Control();
89
90 // Register an exception handler for either the specific exception
91 // or for all exceptions.
92 void register_exception(
93 cyg_code exception_number, // exception number
94 cyg_exception_handler handler, // handler function
95 CYG_ADDRWORD data, // data argument
96 cyg_exception_handler **old_handler, // handler function
97 CYG_ADDRWORD *old_data // data argument
98 );
99
100 // Remove an exception handler.
101 void deregister_exception(
102 cyg_code exception_number // exception number
103 );
104
105 // Deliver the given exception now by invoking the appropriate
106 // exception handler.
107 void deliver_exception(
108 cyg_code exception_number, // exception being raised
109 CYG_ADDRWORD exception_info // exception specific info
110 );
111 };
112
113 #endif
114
115 // -------------------------------------------------------------------------
116 #endif // ifndef CYGONCE_KERNEL_EXCEPT_HXX
117 // EOF except.hxx