diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-07-26 15:44:39 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-07-26 15:44:39 +0200 |
commit | 796354ca13e85c37a6233d34429737c8f0cf9e80 (patch) | |
tree | 3469f898da0df04e93027b9114ebe6316ccf6e10 | |
parent | e41dd62ff0415b254d8846280fe6070f834d0907 (diff) |
ptalog: Optionally store return values of function calls
-rw-r--r-- | include/object/ptalog.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/object/ptalog.h b/include/object/ptalog.h index 70e9664..808eef8 100644 --- a/include/object/ptalog.h +++ b/include/object/ptalog.h @@ -20,6 +20,9 @@ class PTALog { counter_value_t timer; counter_overflow_t overflow; #endif +#ifdef PTALOG_WITH_RETURNVALUES + uint16_t return_value; +#endif } log_entry; int const max_entry = 15; @@ -70,12 +73,14 @@ class PTALog { { kout << "[PTA] trace=" << dec << trace_id << " count=" << log_index << endl; for (uint8_t i = 0; i < log_index; i++) { -#ifdef PTALOG_TIMING kout << "[PTA] transition=" << log[i].transition_id; - kout << " cycles=" << log[i].timer << "/" << log[i].overflow << endl; -#else - kout << "[PTA] transition=" << log[i].transition_id << endl; +#ifdef PTALOG_TIMING + kout << " cycles=" << log[i].timer << "/" << log[i].overflow; +#endif +#ifdef PTALOG_WITH_RETURNVALUES + kout << " return=" << log[i].return_value; #endif + kout << endl; } } @@ -84,6 +89,13 @@ class PTALog { gpio.write(sync_pin, 1); } +#ifdef PTALOG_WITH_RETURNVALUES + inline void logReturn(uint16_t ret) + { + log[log_index - 1].return_value = ret; + } +#endif + #ifdef PTALOG_TIMING inline void stopTransition(Counter& counter) #else |