Include top-level headers from cfg/ subdir.
[bertos.git] / kern / monitor.h
1 /*!
2  * \file
3  * <!--
4  * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5  * This file is part of DevLib - See devlib/README for information.
6  * -->
7  *
8  * \brief Monitor to check for stack overflows
9  *
10  * \version $Id$
11  *
12  * \author Giovanni Bajo <rasky@develer.com>
13  */
14
15 /*#*
16  *#* $Log$
17  *#* Revision 1.2  2005/04/11 19:10:28  bernie
18  *#* Include top-level headers from cfg/ subdir.
19  *#*
20  *#* Revision 1.1  2004/10/03 20:39:03  bernie
21  *#* Import in DevLib.
22  *#*
23  *#* Revision 1.1  2004/09/30 23:19:30  rasky
24  *#* Estratto il monitor degli stack da proc.c in due file a parte: monitor.c/h
25  *#* Rinominata monitor_debug_stacks in monitor_report
26  *#*
27  *#*/
28
29 #ifndef KERN_MONITOR_H
30 #define KERN_MONITOR_H
31
32 #include <cfg/cpu.h>
33 #include <cfg/config_kern.h>
34
35 #if CONFIG_KERN_MONITOR
36
37 /*!
38  * Start the kernel monitor. It is a special process which checks every second the stacks of the
39  * running processes trying to detect stack overflows.
40  *
41  * \param stacksize Size of stack in chars
42  * \param stack Pointer to the stack that will be used by the monitor
43  *
44  * \note The stack is provided by the caller so that there is no wasted space if the monitor
45  * is not used.
46  */
47 void monitor_start(size_t stacksize, cpustack_t *stack);
48
49
50 /*!
51  * Manually check if a given stack has overflown. This is used to check for stacks
52  * of processes handled externally form the kernel, or for other stacks (for instance
53  * the interrupt supervisor stack).
54  *
55  * \note For this function to work, the stack must have been filled at startup with
56  * CONFIG_KERN_STACKFILLCODE.
57  */
58 size_t monitor_check_stack(cpustack_t* stack_base, size_t stack_size);
59
60
61 /*! Print a report of the stack status through kdebug */
62 void monitor_report(void);
63
64
65 #endif /* CONFIG_KERN_MONITOR */
66 #endif /* KERN_MONITOR_H */