source: rtems/cpukit/sapi/include/rtems/fatal.h @ 68f36d14

4.115
Last change on this file since 68f36d14 was 68f36d14, checked in by Sebastian Huber <sebastian.huber@…>, on 01/27/13 at 13:02:50

score: Add and use rtems_assert_context

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief Fatal API.
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2011.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 */
15
16#ifndef _RTEMS_FATAL_H
17#define _RTEMS_FATAL_H
18
19#include <rtems/score/basedefs.h> /* RTEMS_COMPILER_NO_RETURN_ATTRIBUTE */
20#include <rtems/extension.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/**
27 * @defgroup ClassicFatal Fatal
28 *
29 * @ingroup ClassicRTEMS
30 *
31 * @brief The Fatal Manager provides functions for fatal system states and or
32 * irrecoverable errors.
33 */
34/**@{**/
35
36/**
37 * @brief Assert context.
38 */
39typedef struct {
40  const char *file;
41  int         line;
42  const char *function;
43  const char *failed_expression;
44} rtems_assert_context;
45
46/**
47 * @brief Exception frame.
48 */
49typedef CPU_Exception_frame rtems_exception_frame;
50
51/**
52 * @brief Prints the exception frame via printk().
53 *
54 * @see rtems_fatal() and RTEMS_FATAL_SOURCE_EXCEPTION.
55 */
56static inline void rtems_exception_frame_print(
57  const rtems_exception_frame *frame
58)
59{
60  _CPU_Exception_frame_print( frame );
61}
62
63/**
64 * @brief Invokes the internal error handler with a source of
65 * INTERNAL_ERROR_RTEMS_API and is internal set to false.
66 *
67 * @param[in] the_error is a 32-bit fatal error code.
68 *
69 * @see _Internal_error_Occurred().
70 */
71void rtems_fatal_error_occurred(
72  uint32_t   the_error
73) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
74
75/**
76 * @brief Invokes the internal error handler with is internal set to false.
77 *
78 * @param[in] source is the fatal source.
79 * @param[in] error is the fatal code.
80 *
81 * @see _Internal_error_Occurred().
82 */
83void rtems_fatal(
84  rtems_fatal_source source,
85  rtems_fatal_code error
86) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
87
88/**
89 * @brief Returns a description for a fatal source.
90 *
91 * @param[in] source is the fatal source.
92 *
93 * @retval description The fatal source description.
94 * @retval ? The passed fatal source is invalid.
95 */
96const char *rtems_fatal_source_description( rtems_fatal_source source );
97
98/**
99 * @brief Returns a description for an internal error code.
100 *
101 * @param[in] error is the error code.
102 *
103 * @retval description The error code description.
104 * @retval ? The passed error code is invalid.
105 */
106const char *rtems_internal_error_description( rtems_fatal_code error );
107
108/** @} */
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif
115/* end of include file */
Note: See TracBrowser for help on using the repository browser.