1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup libmisc_stackchk |
---|
5 | * |
---|
6 | * @brief Stack Checker Information |
---|
7 | * |
---|
8 | * This include file contains information necessary to utilize |
---|
9 | * and install the stack checker mechanism. |
---|
10 | */ |
---|
11 | |
---|
12 | /* |
---|
13 | * COPYRIGHT (c) 1989-2009. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in the file LICENSE in this distribution or at |
---|
18 | * http://www.rtems.org/license/LICENSE. |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef _RTEMS_STACKCHK_H |
---|
22 | #define _RTEMS_STACKCHK_H |
---|
23 | |
---|
24 | #include <stdbool.h> /* bool */ |
---|
25 | |
---|
26 | #include <rtems/score/thread.h> /* Thread_Control */ |
---|
27 | #include <rtems/print.h> |
---|
28 | |
---|
29 | /** |
---|
30 | * @defgroup libmisc_stackchk Stack Checker Mechanism |
---|
31 | * |
---|
32 | * @ingroup RTEMSAPIClassic |
---|
33 | */ |
---|
34 | /**@{*/ |
---|
35 | #ifdef __cplusplus |
---|
36 | extern "C" { |
---|
37 | #endif |
---|
38 | |
---|
39 | /** |
---|
40 | * @brief Checks if current task is blown its stack. |
---|
41 | * |
---|
42 | * This method is used to determine if the current stack pointer |
---|
43 | * of the currently executing task is within bounds. |
---|
44 | * |
---|
45 | * @retval This method returns true if the currently executing task |
---|
46 | * has blown its stack. |
---|
47 | * |
---|
48 | */ |
---|
49 | bool rtems_stack_checker_is_blown( void ); |
---|
50 | |
---|
51 | /** |
---|
52 | * @brief Print the stack usage report using printk. |
---|
53 | * |
---|
54 | * This method prints a stack usage report for the curently executing |
---|
55 | * task. |
---|
56 | * |
---|
57 | * @note It uses printk to print the report. |
---|
58 | */ |
---|
59 | void rtems_stack_checker_report_usage( void ); |
---|
60 | |
---|
61 | /** |
---|
62 | * @brief Print the stack usage report using caller's routine. |
---|
63 | * |
---|
64 | * This method prints a stack usage report for the curently executing |
---|
65 | * task. |
---|
66 | * |
---|
67 | * @param[in] context is the context to pass to the print handler |
---|
68 | * @param[in] print is the print handler |
---|
69 | * |
---|
70 | * @note It uses the caller's routine to print the report. |
---|
71 | */ |
---|
72 | void rtems_stack_checker_report_usage_with_plugin( |
---|
73 | const rtems_printer *printer |
---|
74 | ); |
---|
75 | |
---|
76 | /************************************************************* |
---|
77 | ************************************************************* |
---|
78 | ** Prototyped only so the user extension can be installed ** |
---|
79 | ************************************************************* |
---|
80 | *************************************************************/ |
---|
81 | |
---|
82 | /** |
---|
83 | * @brief Stack Checker Task Create Extension |
---|
84 | * |
---|
85 | * This method is the task create extension for the stack checker. |
---|
86 | * |
---|
87 | * @param[in] running points to the currently executing task |
---|
88 | * @param[in] the_thread points to the newly created task |
---|
89 | * |
---|
90 | * @note If this this the first task created, the stack checker |
---|
91 | * will automatically intialize itself. |
---|
92 | */ |
---|
93 | bool rtems_stack_checker_create_extension( |
---|
94 | Thread_Control *running, |
---|
95 | Thread_Control *the_thread |
---|
96 | ); |
---|
97 | |
---|
98 | void rtems_stack_checker_begin_extension( Thread_Control *executing ); |
---|
99 | |
---|
100 | /** |
---|
101 | * @brief Stack Checker Task Context Switch Extension |
---|
102 | * |
---|
103 | * This method is the task context switch extension for the stack checker. |
---|
104 | * |
---|
105 | * @param[in] running points to the currently executing task which |
---|
106 | * is being context switched out |
---|
107 | * @param[in] running points to the heir task which we are switching to |
---|
108 | * |
---|
109 | * @note This is called from the internal method _Thread_Dispatch. |
---|
110 | */ |
---|
111 | void rtems_stack_checker_switch_extension( |
---|
112 | Thread_Control *running, |
---|
113 | Thread_Control *heir |
---|
114 | ); |
---|
115 | |
---|
116 | /** |
---|
117 | * @brief Stack Checker Extension Set Definition |
---|
118 | * |
---|
119 | * This macro defines the user extension handler set for the stack |
---|
120 | * checker. This macro is normally only used by confdefs.h. |
---|
121 | */ |
---|
122 | #define RTEMS_STACK_CHECKER_EXTENSION \ |
---|
123 | { \ |
---|
124 | rtems_stack_checker_create_extension, /* rtems_task_create */ \ |
---|
125 | 0, /* rtems_task_start */ \ |
---|
126 | 0, /* rtems_task_restart */ \ |
---|
127 | 0, /* rtems_task_delete */ \ |
---|
128 | rtems_stack_checker_switch_extension, /* task_switch */ \ |
---|
129 | rtems_stack_checker_begin_extension, /* task_begin */ \ |
---|
130 | 0, /* task_exitted */ \ |
---|
131 | 0, /* fatal */ \ |
---|
132 | 0 /* terminate */ \ |
---|
133 | } |
---|
134 | |
---|
135 | #ifdef __cplusplus |
---|
136 | } |
---|
137 | #endif |
---|
138 | /**@}*/ |
---|
139 | #endif |
---|
140 | /* end of include file */ |
---|