Commit 3053b3af authored by Alessandro Rubini's avatar Alessandro Rubini

general: remove two bitfields (use flags instead)

Bitfields are a bad practice. And this removes a few bytes in the wrpc
builds (no change in other builds).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent ea6042b4
...@@ -20,8 +20,7 @@ static struct pp_runtime_opts sim_master_rt_opts = { ...@@ -20,8 +20,7 @@ static struct pp_runtime_opts sim_master_rt_opts = {
.outbound_latency = {0, PP_DEFAULT_OUTBOUND_LATENCY}, .outbound_latency = {0, PP_DEFAULT_OUTBOUND_LATENCY},
.max_rst = PP_DEFAULT_MAX_RESET, .max_rst = PP_DEFAULT_MAX_RESET,
.max_dly = PP_DEFAULT_MAX_DELAY, .max_dly = PP_DEFAULT_MAX_DELAY,
.no_adjust = PP_DEFAULT_NO_ADJUST, .flags = PP_DEFAULT_FLAGS,
.no_rst_clk = PP_DEFAULT_NO_RESET_CLOCK,
.ap = PP_DEFAULT_AP, .ap = PP_DEFAULT_AP,
.ai = PP_DEFAULT_AI, .ai = PP_DEFAULT_AI,
.s = PP_DEFAULT_DELAY_S, .s = PP_DEFAULT_DELAY_S,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#define PP_DEFAULT_INBOUND_LATENCY 0 /* in nsec */ #define PP_DEFAULT_INBOUND_LATENCY 0 /* in nsec */
#define PP_DEFAULT_OUTBOUND_LATENCY 0 /* in nsec */ #define PP_DEFAULT_OUTBOUND_LATENCY 0 /* in nsec */
#define PP_DEFAULT_NO_RESET_CLOCK 0 #define PP_DEFAULT_FLAGS 0
#define PP_DEFAULT_ETHERNET_MODE 0 #define PP_DEFAULT_ETHERNET_MODE 0
#define PP_DEFAULT_DOMAIN_NUMBER 0 #define PP_DEFAULT_DOMAIN_NUMBER 0
#define PP_DEFAULT_AP 10 #define PP_DEFAULT_AP 10
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#define PP_NR_FOREIGN_RECORDS 5 #define PP_NR_FOREIGN_RECORDS 5
#define PP_DEFAULT_MAX_RESET 0 #define PP_DEFAULT_MAX_RESET 0
#define PP_DEFAULT_MAX_DELAY 0 #define PP_DEFAULT_MAX_DELAY 0
#define PP_DEFAULT_NO_ADJUST 0
#define PP_DEFAULT_TTL 1 #define PP_DEFAULT_TTL 1
/* We use an array of timeouts, with these indexes */ /* We use an array of timeouts, with these indexes */
......
...@@ -20,13 +20,14 @@ struct pp_runtime_opts { ...@@ -20,13 +20,14 @@ struct pp_runtime_opts {
Integer32 max_rst; /* Maximum number of nanoseconds to reset */ Integer32 max_rst; /* Maximum number of nanoseconds to reset */
Integer32 max_dly; /* Maximum number of nanoseconds of delay */ Integer32 max_dly; /* Maximum number of nanoseconds of delay */
Integer32 ttl; Integer32 ttl;
UInteger32 /* slave_only:1, -- moved to ppsi, is no more global */ int flags;
/* master_only:1, -- moved to ppsi, is no more global */ #define PP_FLAG_NO_ADJUST 0x01
no_adjust:1, #define PP_FLAG_NO_RESET 0x02
/* ethernet_mode:1, -- moved to ppsi, is no more global */ /* slave_only:1, -- moved to ppi, no more global */
/* e2e_mode:1, -- no more: we only support e2e */ /* master_only:1, -- moved to ppi, no more global */
/* gptp_mode:1, -- no more: peer-to-peer unsupported */ /* ethernet_mode:1, -- moved to ppi, no more global */
no_rst_clk:1; /* e2e_mode:1, -- no more: we only support e2e */
/* gptp_mode:1, -- no more: peer-to-peer unsupported */
Integer16 ap, ai; Integer16 ap, ai;
Integer16 s; Integer16 s;
Integer8 announce_intvl; Integer8 announce_intvl;
......
...@@ -121,7 +121,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv) ...@@ -121,7 +121,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv)
return -1; return -1;
break; break;
case 'x': case 'x':
GOPTS(ppg)->no_rst_clk = 1; GOPTS(ppg)->flags |= PP_FLAG_NO_RESET;
break; break;
case 'O': case 'O':
a = argv[++i]; a = argv[++i];
...@@ -142,7 +142,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv) ...@@ -142,7 +142,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv)
} }
break; break;
case 't': case 't':
GOPTS(ppg)->no_adjust = 1; GOPTS(ppg)->flags |= PP_FLAG_NO_ADJUST;
break; break;
case 'a': case 'a':
a = argv[++i]; a = argv[++i];
......
...@@ -21,8 +21,7 @@ struct pp_runtime_opts __pp_default_rt_opts = { ...@@ -21,8 +21,7 @@ struct pp_runtime_opts __pp_default_rt_opts = {
.outbound_latency = {0, PP_DEFAULT_OUTBOUND_LATENCY}, .outbound_latency = {0, PP_DEFAULT_OUTBOUND_LATENCY},
.max_rst = PP_DEFAULT_MAX_RESET, .max_rst = PP_DEFAULT_MAX_RESET,
.max_dly = PP_DEFAULT_MAX_DELAY, .max_dly = PP_DEFAULT_MAX_DELAY,
.no_adjust = PP_DEFAULT_NO_ADJUST, .flags = PP_DEFAULT_FLAGS,
.no_rst_clk = PP_DEFAULT_NO_RESET_CLOCK,
.ap = PP_DEFAULT_AP, .ap = PP_DEFAULT_AP,
.ai = PP_DEFAULT_AI, .ai = PP_DEFAULT_AI,
.s = PP_DEFAULT_DELAY_S, .s = PP_DEFAULT_DELAY_S,
......
...@@ -26,7 +26,7 @@ void pp_servo_init(struct pp_instance *ppi) ...@@ -26,7 +26,7 @@ void pp_servo_init(struct pp_instance *ppi)
SRV(ppi)->obs_drift = -d << 10; /* note "-" */ SRV(ppi)->obs_drift = -d << 10; /* note "-" */
} else { } else {
/* level clock */ /* level clock */
if (!OPTS(ppi)->no_adjust) if (!(OPTS(ppi)->flags & PP_FLAG_NO_ADJUST))
ppi->t_ops->adjust(ppi, 0, 0); ppi->t_ops->adjust(ppi, 0, 0);
SRV(ppi)->obs_drift = 0; SRV(ppi)->obs_drift = 0;
} }
...@@ -209,8 +209,8 @@ void pp_servo_got_resp(struct pp_instance *ppi) ...@@ -209,8 +209,8 @@ void pp_servo_got_resp(struct pp_instance *ppi)
TimeInternal time_tmp; TimeInternal time_tmp;
/* if secs, reset clock or set freq adjustment to max */ /* if secs, reset clock or set freq adjustment to max */
if (!OPTS(ppi)->no_adjust) { if (!(OPTS(ppi)->flags & PP_FLAG_NO_ADJUST)) {
if (!OPTS(ppi)->no_rst_clk) { if (!(OPTS(ppi)->flags & PP_FLAG_NO_RESET)) {
/* Can't use adjust, limited to +/- 2s */ /* Can't use adjust, limited to +/- 2s */
time_tmp = ppi->t4; time_tmp = ppi->t4;
add_TimeInternal(&time_tmp, &time_tmp, add_TimeInternal(&time_tmp, &time_tmp,
...@@ -278,7 +278,7 @@ void pp_servo_got_resp(struct pp_instance *ppi) ...@@ -278,7 +278,7 @@ void pp_servo_got_resp(struct pp_instance *ppi)
/* apply controller output as a clock tick rate adjustment, if /* apply controller output as a clock tick rate adjustment, if
* provided by arch, or as a raw offset otherwise */ * provided by arch, or as a raw offset otherwise */
if (!OPTS(ppi)->no_adjust) { if (!(OPTS(ppi)->flags & PP_FLAG_NO_ADJUST)) {
if (ppi->t_ops->adjust_freq) if (ppi->t_ops->adjust_freq)
ppi->t_ops->adjust_freq(ppi, -adj); ppi->t_ops->adjust_freq(ppi, -adj);
else else
......
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