Skip to content
Snippets Groups Projects
Commit 796354ca authored by Daniel Friesel's avatar Daniel Friesel
Browse files

ptalog: Optionally store return values of function calls

parent e41dd62f
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,9 @@ class PTALog {
#ifdef PTALOG_TIMING
counter_value_t timer;
counter_overflow_t overflow;
#endif
#ifdef PTALOG_WITH_RETURNVALUES
uint16_t return_value;
#endif
} log_entry;
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment