Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/10214


Change subject: cardem: show detailed reset cause
......................................................................

cardem: show detailed reset cause

this helps detecting when a reset was due to the watchdog

Change-Id: I2d59c2f2c8fe9e559eddfafacf25879263ef81ff
---
M firmware/apps/cardem/main.c
1 file changed, 15 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/14/10214/1

diff --git a/firmware/apps/cardem/main.c b/firmware/apps/cardem/main.c
index ae46794..7d65c7e 100644
--- a/firmware/apps/cardem/main.c
+++ b/firmware/apps/cardem/main.c
@@ -157,11 +157,25 @@
                "SIMtrace2 firmware " GIT_VERSION " (C) 2010-2016 by Harald 
Welte\n\r"
                
"=============================================================================\n\r");

+#if (TRACE_LEVEL >= TRACE_LEVEL_INFO)
        TRACE_INFO("Chip ID: 0x%08x (Ext 0x%08x)\n\r", CHIPID->CHIPID_CIDR, 
CHIPID->CHIPID_EXID);
        TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\n\r",
                   g_unique_id[0], g_unique_id[1],
                   g_unique_id[2], g_unique_id[3]);
-       TRACE_INFO("Reset Cause: 0x%x\n\r", (RSTC->RSTC_SR & 
RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos);
+       uint8_t reset_cause = (RSTC->RSTC_SR & RSTC_SR_RSTTYP_Msk) >> 
RSTC_SR_RSTTYP_Pos;
+       static const char* reset_causes[] = {
+               "general reset (first power-up reset)",
+               "backup reset (return from backup mode)",
+               "watchdog reset (watchdog fault occurred)",
+               "software reset (processor reset required by the software)",
+               "user reset (NRST pin detected low)",
+       };
+       if (reset_cause < ARRAY_SIZE(reset_causes)) {
+               TRACE_INFO("Reset Cause: %s\n\r", reset_causes[reset_cause]);
+       } else {
+               TRACE_INFO("Reset Cause: 0x%x\n\r", (RSTC->RSTC_SR & 
RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos);
+       }
+#endif

        board_main_top();


--
To view, visit https://gerrit.osmocom.org/10214
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d59c2f2c8fe9e559eddfafacf25879263ef81ff
Gerrit-Change-Number: 10214
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <[email protected]>

Reply via email to