|
10 | 10 | // |
11 | 11 | // ====================================================================== |
12 | 12 |
|
13 | | -#include <Fw/Logger/Logger.hpp> |
| 13 | +#include <zephyr/sys/reboot.h> |
14 | 14 | #include <FprimeZephyrReference/Components/FatalHandler/FatalHandler.hpp> |
15 | 15 | #include <Fw/FPrimeBasicTypes.hpp> |
16 | | -#include <zephyr/sys/reboot.h> |
| 16 | +#include <Fw/Logger/Logger.hpp> |
17 | 17 |
|
18 | 18 | namespace Components { |
19 | 19 |
|
20 | | - // ---------------------------------------------------------------------- |
21 | | - // Construction, initialization, and destruction |
22 | | - // ---------------------------------------------------------------------- |
| 20 | +// ---------------------------------------------------------------------- |
| 21 | +// Construction, initialization, and destruction |
| 22 | +// ---------------------------------------------------------------------- |
23 | 23 |
|
24 | | - FatalHandler :: |
25 | | - FatalHandler( |
26 | | - const char *const compName |
27 | | - ) : FatalHandlerComponentBase(compName) |
28 | | - { |
| 24 | +FatalHandler ::FatalHandler(const char* const compName) : FatalHandlerComponentBase(compName) {} |
29 | 25 |
|
30 | | - } |
| 26 | +FatalHandler ::~FatalHandler() {} |
31 | 27 |
|
32 | | - FatalHandler :: |
33 | | - ~FatalHandler() |
34 | | - { |
35 | | - |
36 | | - } |
37 | | - |
38 | | - void FatalHandler::reboot() { |
39 | | - // When running in CI failsafe mode and the board is a teensy, |
40 | | - // then we should invoke bkpt #251 to trigger the soft reboot enabling a |
41 | | - // flash of new software |
42 | | - #if defined(FPRIME_CI_FAILSAFE_CYCLE_COUNT) |
43 | | - // Magic bootloader breakpoint, provided by PRJC |
44 | | - if (strncmp(CONFIG_BOARD, "teensy", 6) == 0) { |
| 28 | +void FatalHandler::reboot() { |
| 29 | +// When running in CI failsafe mode and the board is a teensy, |
| 30 | +// then we should invoke bkpt #251 to trigger the soft reboot enabling a |
| 31 | +// flash of new software |
| 32 | +#if defined(FPRIME_CI_FAILSAFE_CYCLE_COUNT) |
| 33 | + // Magic bootloader breakpoint, provided by PRJC |
| 34 | + if (strncmp(CONFIG_BOARD, "teensy", 6) == 0) { |
45 | 35 | asm("bkpt #251"); |
46 | | - } |
47 | | - #endif |
| 36 | + } |
| 37 | +#endif |
48 | 38 | // Otherwise, use Zephyr to reboot the system |
49 | 39 | sys_reboot(SYS_REBOOT_COLD); |
50 | | - } |
51 | | - |
52 | | - void FatalHandler::FatalReceive_handler( |
53 | | - const FwIndexType portNum, |
54 | | - FwEventIdType Id) { |
55 | | - Fw::Logger::log("FATAL %" PRI_FwEventIdType "handled.\n",Id); |
56 | | - Os::Task::delay(Fw::TimeInterval(0, 1000)); // Delay to allow log to be processed |
57 | | - this->reboot(); // Reboot the system |
58 | | - } |
| 40 | +} |
59 | 41 |
|
| 42 | +void FatalHandler::FatalReceive_handler(const FwIndexType portNum, FwEventIdType Id) { |
| 43 | + Fw::Logger::log("FATAL %" PRI_FwEventIdType "handled.\n", Id); |
| 44 | + Os::Task::delay(Fw::TimeInterval(0, 1000)); // Delay to allow log to be processed |
| 45 | + this->reboot(); // Reboot the system |
| 46 | +} |
60 | 47 |
|
61 | | -} // end namespace Svc |
| 48 | +} // namespace Components |
0 commit comments