source: rtems/cpukit/sapi/include/rtems/fatal.h @ 599d71f

5
Last change on this file since 599d71f was 143696a, checked in by Sebastian Huber <sebastian.huber@…>, on 10/16/15 at 06:15:03

basedefs.h: Add and use RTEMS_NO_RETURN

  • 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.org/license/LICENSE.
14 */
15
16#ifndef _RTEMS_FATAL_H
17#define _RTEMS_FATAL_H
18
19#include <rtems/score/basedefs.h> /* RTEMS_NO_RETURN */
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 _Terminate().
70 */
71void rtems_fatal_error_occurred(
72  uint32_t   the_error
73) RTEMS_NO_RETURN;
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 _Terminate().
82 */
83void rtems_fatal(
84  rtems_fatal_source source,
85  rtems_fatal_code error
86) RTEMS_NO_RETURN;
87
88/**
89 * @brief Returns a text for a fatal source.
90 *
91 * The text for each fatal source is the enumerator constant.
92 *
93 * @param[in] source is the fatal source.
94 *
95 * @retval text The fatal source text.
96 * @retval "?" The passed fatal source is invalid.
97 */
98const char *rtems_fatal_source_text( rtems_fatal_source source );
99
100/**
101 * @brief Returns a text for an internal error code.
102 *
103 * The text for each internal error code is the enumerator constant.
104 *
105 * @param[in] error is the error code.
106 *
107 * @retval text The error code text.
108 * @retval "?" The passed error code is invalid.
109 */
110const char *rtems_internal_error_text( rtems_fatal_code error );
111
112/** @} */
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif
119/* end of include file */
Note: See TracBrowser for help on using the repository browser.