Print contexts in another line with active info

Make it clear to determine if a source is configured to emit
interruptions to a given context by printing the active=1 attribute when
the priority is larger than the threshold of the context.
This commit is contained in:
Rodrigo Arias 2024-09-04 12:44:53 +02:00
parent b075d6fa2a
commit 7e48cfe72e

View File

@ -6,6 +6,7 @@
/* Changelog: /* Changelog:
* v0.0.1 (2024-09-03): Initial version. * v0.0.1 (2024-09-03): Initial version.
* v0.0.2 (2024-09-04): Print contexts in another line and on/off information.
*/ */
#include <stdio.h> #include <stdio.h>
@ -25,7 +26,7 @@ long nsources = 1024L;
static void static void
usage(void) usage(void)
{ {
printf("plictool v0.0.1 - Rodrigo Arias Mallo <rodrigo.arias@bsc.es>\n"); printf("plictool v0.0.2 - Rodrigo Arias Mallo <rodrigo.arias@bsc.es>\n");
printf( printf(
"Usage: plictool [-a addr] [-s nsources] [-c ncontexts]\n"); "Usage: plictool [-a addr] [-s nsources] [-c ncontexts]\n");
@ -44,7 +45,7 @@ void dump_sources(void *base)
uint32_t priority = *priority_reg; uint32_t priority = *priority_reg;
const char *fmt = const char *fmt =
"src=%ld pend=%u prio=%u"; "src=%ld pend=%u prio=%u\n";
if (pending || priority) { if (pending || priority) {
printf(fmt, s, pending, priority); printf(fmt, s, pending, priority);
@ -66,11 +67,10 @@ void dump_sources(void *base)
printed_source = 1; printed_source = 1;
} }
printf(" ctx=%ld thre=%u", c, threshold); int active = priority > threshold ? 1 : 0;
}
if (printed_source) printf(" ctx=%ld thre=%u active=%d\n", c, threshold, active);
printf("\n"); }
} }
} }