1 | /** |
---|
2 | * @file rtems/stackchk.h |
---|
3 | * |
---|
4 | * @brief Information Necessary to Utilize and Install the |
---|
5 | * Stack Checker Mechanism |
---|
6 | * |
---|
7 | * This include file contains information necessary to utilize |
---|
8 | * and install the stack checker mechanism. |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * COPYRIGHT (c) 1989-2009. |
---|
13 | * On-Line Applications Research Corporation (OAR). |
---|
14 | * |
---|
15 | * The license and distribution terms for this file may be |
---|
16 | * found in the file LICENSE in this distribution or at |
---|
17 | * http://www.rtems.com/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _RTEMS_STACKCHK_H |
---|
21 | #define _RTEMS_STACKCHK_H |
---|
22 | |
---|
23 | #include <stdbool.h> /* bool */ |
---|
24 | |
---|
25 | #include <rtems/score/percpu.h> /* Thread_Control */ |
---|
26 | #include <rtems/bspIo.h> |
---|
27 | |
---|
28 | /** |
---|
29 | * @defgroup libmisc_stackchk Stack Checker Mechanism |
---|
30 | * |
---|
31 | * @ingroup libmisc |
---|
32 | */ |
---|
33 | /**@{*/ |
---|
34 | #ifdef __cplusplus |
---|
35 | extern "C" { |
---|
36 | #endif |
---|
37 | |
---|
38 | /** |
---|
39 | * @brief Checks if current task is blown its stack. |
---|
40 | * |
---|
41 | * This method is used to determine if the current stack pointer |
---|
42 | * of the currently executing task is within bounds. |
---|
43 | * |
---|
44 | * @return This method returns true if the currently executing task |
---|
45 | * has blown its stack. |
---|
46 | * |
---|
47 | */ |
---|
48 | bool rtems_stack_checker_is_blown( void ); |
---|
49 | |
---|
50 | /** |
---|
51 | * @brief Print the stack usage report using printk. |
---|
52 | * |
---|
53 | * This method prints a stack usage report for the curently executing |
---|
54 | * task. |
---|
55 | * |
---|
56 | * @note It uses printk to print the report. |
---|
57 | */ |
---|
58 | void rtems_stack_checker_report_usage( void ); |
---|
59 | |
---|
60 | /** |
---|
61 | * @brief Print the stack usage report using caller's routine. |
---|
62 | * |
---|
63 | * This method prints a stack usage report for the curently executing |
---|
64 | * task. |
---|
65 | * |
---|
66 | * @param[in] context is the context to pass to the print handler |
---|
67 | * @param[in] print is the print handler |
---|
68 | * |
---|
69 | * @note It uses the caller's routine to print the report. |
---|
70 | */ |
---|
71 | void rtems_stack_checker_report_usage_with_plugin( |
---|
72 | void *context, |
---|
73 | rtems_printk_plugin_t print |
---|
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 | /** |
---|
99 | * @brief Stack Checker Task Begin Extension |
---|
100 | * |
---|
101 | * This method is the task begin extension for the stack checker. |
---|
102 | * |
---|
103 | * @param[in] the_thread points to task starting to execute |
---|
104 | * |
---|
105 | * @note This is called from the internal method _Thread_Handler. |
---|
106 | */ |
---|
107 | void rtems_stack_checker_begin_extension( |
---|
108 | Thread_Control *the_thread |
---|
109 | ); |
---|
110 | |
---|
111 | /** |
---|
112 | * @brief Stack Checker Task Context Switch Extension |
---|
113 | * |
---|
114 | * This method is the task context switch extension for the stack checker. |
---|
115 | * |
---|
116 | * @param[in] running points to the currently executing task which |
---|
117 | * is being context switched out |
---|
118 | * @param[in] running points to the heir task which we are switching to |
---|
119 | * |
---|
120 | * @note This is called from the internal method _Thread_Dispatch. |
---|
121 | */ |
---|
122 | void rtems_stack_checker_switch_extension( |
---|
123 | Thread_Control *running, |
---|
124 | Thread_Control *heir |
---|
125 | ); |
---|
126 | |
---|
127 | /** |
---|
128 | * @brief Stack Checker Extension Set Definition |
---|
129 | * |
---|
130 | * This macro defines the user extension handler set for the stack |
---|
131 | * checker. This macro is normally only used by confdefs.h. |
---|
132 | */ |
---|
133 | #define RTEMS_STACK_CHECKER_EXTENSION \ |
---|
134 | { \ |
---|
135 | rtems_stack_checker_create_extension, /* rtems_task_create */ \ |
---|
136 | 0, /* rtems_task_start */ \ |
---|
137 | 0, /* rtems_task_restart */ \ |
---|
138 | 0, /* rtems_task_delete */ \ |
---|
139 | rtems_stack_checker_switch_extension, /* task_switch */ \ |
---|
140 | rtems_stack_checker_begin_extension, /* task_begin */ \ |
---|
141 | 0, /* task_exitted */ \ |
---|
142 | 0 /* rtems_stack_checker_fatal_extension */, /* fatal */ \ |
---|
143 | } |
---|
144 | |
---|
145 | #ifdef __cplusplus |
---|
146 | } |
---|
147 | #endif |
---|
148 | /**@}*/ |
---|
149 | #endif |
---|
150 | /* end of include file */ |
---|