- use DEVELHELP for native as well
- fix function name in documentation
- improve documentation language/spelling
This commit is contained in:
Ludwig Ortmann 2014-02-26 16:48:44 +01:00
parent 0c14597ec2
commit 470bd7f17f
3 changed files with 17 additions and 6 deletions

View File

@ -13,7 +13,7 @@
* @file crash.h * @file crash.h
* @brief Crash handling header * @brief Crash handling header
* *
* Define a panic() function that allows to stop/reboot the system * Define a core_panic() function that allows to stop/reboot the system
* when an unrecoverable problem has occured. * when an unrecoverable problem has occured.
* *
* @author Kévin Roussel <Kevin.Roussel@inria.fr> * @author Kévin Roussel <Kevin.Roussel@inria.fr>
@ -28,11 +28,11 @@
A numeric code indicating the failure reason can be given A numeric code indicating the failure reason can be given
as the ::crash_code parameter. as the ::crash_code parameter.
Detailing the failure is possible using the ::message parameter. Detailing the failure is possible using the ::message parameter.
This function should serve a similar purpose than the panic() This function should serve a similar purpose as the panic()
function of Unix/Linux kernels. function of Unix/Linux kernels.
if DEVELHELP macro is defined, system will be halted; If the DEVELHELP macro is defined, the system will be halted;
system will be rebooted otherwise. the system will be rebooted otherwise.
WARNING: this function NEVER returns! */ WARNING: this function NEVER returns! */
NORETURN void core_panic(int crash_code, const char *message); NORETURN void core_panic(int crash_code, const char *message);

View File

@ -13,7 +13,7 @@
* @file kernel.h * @file kernel.h
* @brief Kernel compile time configuration * @brief Kernel compile time configuration
* *
* A reboot() function is also provided (and used by panic() when needed). * A reboot() function is also provided (and used by core_panic() when needed).
* *
* @author Freie Universität Berlin, Computer Systems & Telematics * @author Freie Universität Berlin, Computer Systems & Telematics
* @author Kaspar Schleiser <kaspar@schleiser.de> * @author Kaspar Schleiser <kaspar@schleiser.de>
@ -87,7 +87,7 @@ extern config_t sysconfig;
/** /**
* @brief Immediately reboots the system. * @brief Immediately reboots the system.
* *
* This function is used by panic() when the DEVELHELP macro is not defined. * This function is used by core_panic() when the DEVELHELP macro is not defined.
* *
* @return WARNING: this function NEVER returns! * @return WARNING: this function NEVER returns!
*/ */

View File

@ -41,12 +41,23 @@ NORETURN void core_panic(int crash_code, const char *message)
/* try to print panic message to console (if possible) */ /* try to print panic message to console (if possible) */
puts("******** SYSTEM FAILURE ********\n"); puts("******** SYSTEM FAILURE ********\n");
puts(message); puts(message);
#if DEVELHELP
puts("******** RIOT HALTS HERE ********\n"); puts("******** RIOT HALTS HERE ********\n");
#else
puts("******** RIOT WILL REBOOT ********\n");
#endif
puts("\n\n"); puts("\n\n");
} }
dINT();
#if DEVELHELP
/* since we're atop an Unix-like platform, /* since we're atop an Unix-like platform,
just use the (developer-)friendly core-dump feature */ just use the (developer-)friendly core-dump feature */
kill(getpid(), SIGTRAP); kill(getpid(), SIGTRAP);
#else
reboot();
#endif
/* proove the compiler that we won't return from this function /* proove the compiler that we won't return from this function
(even if we actually won't even get here...) */ (even if we actually won't even get here...) */
while (1) { while (1) {