Commit 5baefbaa authored by Alessandro Rubini's avatar Alessandro Rubini

general: rename flags to d_flags (they are for diagnostics only)

I'm going to introduce a "flags" field in pp_instance, so diagnostic
flags are better called d_flags. The same applies, for consistency,
to the global variable.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent d0de8bbc
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
@setchapternewpage off @setchapternewpage off
@set update-month July 2014 @set update-month November 2014
@set release __RELEASE_GIT_ID__ @set release __RELEASE_GIT_ID__
@finalout @finalout
...@@ -356,7 +356,8 @@ unfair to hide them. ...@@ -356,7 +356,8 @@ unfair to hide them.
We want to allow run-time modification of diagnostics flags We want to allow run-time modification of diagnostics flags
with a per-link granularity. Currently we have configuration-based with a per-link granularity. Currently we have configuration-based
per-link diagnostic flags and global flags that can be changed per-link diagnostic flags and global diagnostic
flags that can be changed
at run time (for example, arch-wrpc offers that through a shell at run time (for example, arch-wrpc offers that through a shell
command). We think this feature is useful command). We think this feature is useful
when you run more than a pair of interfaces and have problems when you run more than a pair of interfaces and have problems
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
#include <ppsi/ppsi.h> #include <ppsi/ppsi.h>
unsigned long pp_global_flags; /* This is the only "global" file in ppsi */ unsigned long pp_global_d_flags; /* This is the only "global" file in ppsi */
/* /*
* This is somehow a duplicate of __pp_diag, but I still want * This is somehow a duplicate of __pp_diag, but I still want
...@@ -17,15 +17,15 @@ static void pp_fsm_printf(struct pp_instance *ppi, char *fmt, ...) ...@@ -17,15 +17,15 @@ static void pp_fsm_printf(struct pp_instance *ppi, char *fmt, ...)
{ {
va_list args; va_list args;
TimeInternal t; TimeInternal t;
unsigned long oflags = pp_global_flags; unsigned long oflags = pp_global_d_flags;
if (!pp_diag_allow(ppi, fsm, 1)) if (!pp_diag_allow(ppi, fsm, 1))
return; return;
/* temporarily set NOTIMELOG, as we'll print the time ourselves */ /* temporarily set NOTIMELOG, as we'll print the time ourselves */
pp_global_flags |= PP_FLAG_NOTIMELOG; pp_global_d_flags |= PP_FLAG_NOTIMELOG;
ppi->t_ops->get(ppi, &t); ppi->t_ops->get(ppi, &t);
pp_global_flags = oflags; pp_global_d_flags = oflags;
pp_printf("diag-fsm-1-%s: %09d.%03d: ", ppi->port_name, pp_printf("diag-fsm-1-%s: %09d.%03d: ", ppi->port_name,
(int)t.seconds, (int)t.nanoseconds / 1000000); (int)t.seconds, (int)t.nanoseconds / 1000000);
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#define pp_error(...) pp_printf("ERROR: " __VA_ARGS__) #define pp_error(...) pp_printf("ERROR: " __VA_ARGS__)
/* /*
* The "new" diagnostics is based on flags: there are per-instance flags * The "new" diagnostics is based on flags: there are per-instance d_flags
* and global flags. * and global d_flags.
* *
* Basically, we may have just bits about what to print, but we might * Basically, we may have just bits about what to print, but we might
* want to add extra-verbose stuff for specific cases, like looking at * want to add extra-verbose stuff for specific cases, like looking at
...@@ -37,17 +37,17 @@ enum pp_diag_things { ...@@ -37,17 +37,17 @@ enum pp_diag_things {
/* /*
* Note: we may use less bits and have more things, without changing * Note: we may use less bits and have more things, without changing
* anything. Set's say levels are ony 0..3 -- still,I prefer to be * anything. Set's say levels are ony 0..3 -- still,I prefer to be
* able to print the active flags as %x while debugging this very * able to print the active d_flags as %x while debugging this very
* mechanism). * mechanism).
*/ */
extern unsigned long pp_global_flags; /* Supplement ppi-specific ones */ extern unsigned long pp_global_d_flags; /* Supplement ppi-specific ones */
#define PP_FLAG_NOTIMELOG 1 /* This is for a special case, I'm sorry */ #define PP_FLAG_NOTIMELOG 1 /* This is for a special case, I'm sorry */
/* So, extract the level */ /* So, extract the level */
#define __PP_FLAGS(ppi) ((ppi ? ppi->flags : 0) | pp_global_flags) #define __PP_FLAGS(ppi) ((ppi ? ppi->d_flags : 0) | pp_global_d_flags)
#define __PP_DIAG_ALLOW(ppi, th, level) \ #define __PP_DIAG_ALLOW(ppi, th, level) \
((__PP_FLAGS(ppi) >> (4 * (th)) & 0xf) >= level) ((__PP_FLAGS(ppi) >> (4 * (th)) & 0xf) >= level)
......
...@@ -140,7 +140,7 @@ struct pp_instance { ...@@ -140,7 +140,7 @@ struct pp_instance {
int next_state, next_delay, is_new_state; /* set by state processing */ int next_state, next_delay, is_new_state; /* set by state processing */
void *arch_data; /* if arch needs it */ void *arch_data; /* if arch needs it */
void *ext_data; /* if protocol ext needs it */ void *ext_data; /* if protocol ext needs it */
unsigned long flags; /* ppi-specific flags (diag mainly) */ unsigned long d_flags; /* diagnostics, ppi-specific flags */
/* Pointer to global instance owning this pp_instance*/ /* Pointer to global instance owning this pp_instance*/
struct pp_globals *glbs; struct pp_globals *glbs;
......
...@@ -110,7 +110,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv) ...@@ -110,7 +110,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv)
case 'd': case 'd':
/* Use the general flags, per-instance TBD */ /* Use the general flags, per-instance TBD */
a = argv[++i]; a = argv[++i];
pp_global_flags = pp_diag_parse(a); pp_global_d_flags = pp_diag_parse(a);
break; break;
case 'C': case 'C':
if (pp_config_string(ppg, argv[++i]) != 0) if (pp_config_string(ppg, argv[++i]) != 0)
......
...@@ -112,9 +112,9 @@ static int f_diag(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg) ...@@ -112,9 +112,9 @@ static int f_diag(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg)
unsigned long level = pp_diag_parse(arg->s); unsigned long level = pp_diag_parse(arg->s);
if (ppg->cfg.cur_ppi_n >= 0) if (ppg->cfg.cur_ppi_n >= 0)
CUR_PPI(ppg)->flags = level; CUR_PPI(ppg)->d_flags = level;
else else
pp_global_flags = level; pp_global_d_flags = level;
return 0; return 0;
} }
......
...@@ -260,7 +260,7 @@ int wr_servo_update(struct pp_instance *ppi) ...@@ -260,7 +260,7 @@ int wr_servo_update(struct pp_instance *ppi)
got_sync = 0; got_sync = 0;
if (__PP_DIAG_ALLOW_FLAGS(pp_global_flags, pp_dt_servo, 1)) { if (__PP_DIAG_ALLOW_FLAGS(pp_global_d_flags, pp_dt_servo, 1)) {
dump_timestamp(ppi, "servo:t1", s->t1); dump_timestamp(ppi, "servo:t1", s->t1);
dump_timestamp(ppi, "servo:t2", s->t2); dump_timestamp(ppi, "servo:t2", s->t2);
dump_timestamp(ppi, "servo:t3", s->t3); dump_timestamp(ppi, "servo:t3", s->t3);
......
...@@ -19,7 +19,7 @@ static int bare_time_get(struct pp_instance *ppi, TimeInternal *t) ...@@ -19,7 +19,7 @@ static int bare_time_get(struct pp_instance *ppi, TimeInternal *t)
/* TAI = UTC + 35 */ /* TAI = UTC + 35 */
t->seconds = tv.tv_sec + DSPRO(ppi)->currentUtcOffset; t->seconds = tv.tv_sec + DSPRO(ppi)->currentUtcOffset;
t->nanoseconds = tv.tv_usec * 1000; t->nanoseconds = tv.tv_usec * 1000;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG)) if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9li.%06li\n", __func__, pp_diag(ppi, time, 2, "%s: %9li.%06li\n", __func__,
tv.tv_sec, tv.tv_usec); tv.tv_sec, tv.tv_usec);
return 0; return 0;
......
...@@ -54,7 +54,7 @@ static int sim_time_get(struct pp_instance *ppi, TimeInternal *t) ...@@ -54,7 +54,7 @@ static int sim_time_get(struct pp_instance *ppi, TimeInternal *t)
(long long)PP_NSEC_PER_SEC; (long long)PP_NSEC_PER_SEC;
t->correct = 1; t->correct = 1;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG)) if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9li.%09li\n", __func__, pp_diag(ppi, time, 2, "%s: %9li.%09li\n", __func__,
(long)t->seconds, (long)t->nanoseconds); (long)t->seconds, (long)t->nanoseconds);
return 0; return 0;
......
...@@ -32,7 +32,7 @@ static int unix_time_get(struct pp_instance *ppi, TimeInternal *t) ...@@ -32,7 +32,7 @@ static int unix_time_get(struct pp_instance *ppi, TimeInternal *t)
t->seconds = tp.tv_sec + DSPRO(ppi)->currentUtcOffset; t->seconds = tp.tv_sec + DSPRO(ppi)->currentUtcOffset;
t->nanoseconds = tp.tv_nsec; t->nanoseconds = tp.tv_nsec;
t->correct = 1; t->correct = 1;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG)) if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9li.%09li\n", __func__, pp_diag(ppi, time, 2, "%s: %9li.%09li\n", __func__,
tp.tv_sec, tp.tv_nsec); tp.tv_sec, tp.tv_nsec);
return 0; return 0;
......
...@@ -18,7 +18,7 @@ static int wrpc_time_get(struct pp_instance *ppi, TimeInternal *t) ...@@ -18,7 +18,7 @@ static int wrpc_time_get(struct pp_instance *ppi, TimeInternal *t)
t->seconds = sec; t->seconds = sec;
t->nanoseconds = nsec; t->nanoseconds = nsec;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG)) if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9lu.%09li\n", __func__, pp_diag(ppi, time, 2, "%s: %9lu.%09li\n", __func__,
(long)sec, (long)nsec); (long)sec, (long)nsec);
return 0; return 0;
......
...@@ -176,7 +176,7 @@ static int wrs_time_get(struct pp_instance *ppi, TimeInternal *t) ...@@ -176,7 +176,7 @@ static int wrs_time_get(struct pp_instance *ppi, TimeInternal *t)
t->nanoseconds = p.current_nsec; t->nanoseconds = p.current_nsec;
t->correct = p.pps_valid; t->correct = p.pps_valid;
if (!(pp_global_flags & PP_FLAG_NOTIMELOG)) if (!(pp_global_d_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: (valid %x) %9li.%09li\n", __func__, pp_diag(ppi, time, 2, "%s: (valid %x) %9li.%09li\n", __func__,
p.pps_valid, p.pps_valid,
(long)p.current_sec, (long)p.current_nsec); (long)p.current_sec, (long)p.current_nsec);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment