diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-07-22 14:08:26 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-07-22 18:47:52 +0200 |
commit | 3f4588273d94b8e752172fe8e3e2889cf200c498 (patch) | |
tree | c4e856f65742928e9b75635d68b2fdb319295804 | |
parent | 7bda77928c0e08d4b1ab1efe3e1284fa372779ea (diff) |
bts-trx: Use bool type for on/off state variables
Change-Id: Icb1b7bd8852417ab7b9a7dbc205aa6f6db97d64d
-rw-r--r-- | src/osmo-bts-trx/l1_if.h | 30 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_provision_fsm.c | 42 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_vty.c | 6 |
3 files changed, 39 insertions, 39 deletions
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h index 07751f21..f35936e1 100644 --- a/src/osmo-bts-trx/l1_if.h +++ b/src/osmo-bts-trx/l1_if.h @@ -60,44 +60,44 @@ struct bts_trx_priv { struct trx_config { uint8_t trxd_hdr_ver_req; /* requested TRXD header version */ uint8_t trxd_hdr_ver_use; /* actual TRXD header version in use */ - int setformat_sent; + bool setformat_sent; bool enabled; - int arfcn_valid; + bool arfcn_valid; uint16_t arfcn; - int arfcn_sent; + bool arfcn_sent; - int tsc_valid; + bool tsc_valid; uint8_t tsc; - int tsc_sent; + bool tsc_sent; - int bsic_valid; + bool bsic_valid; uint8_t bsic; - int bsic_sent; + bool bsic_sent; - int rxgain_valid; + bool rxgain_valid; uint8_t rxgain; - int rxgain_sent; + bool rxgain_sent; int forced_max_power_red; /* -1 if not forced by VTY config (default) */ bool nominal_power_set_by_vty; /* whether nominal trx power was enforced/retreived from VTY config "nominal-tx-power" */ - int maxdly_valid; + bool maxdly_valid; int maxdly; - int maxdly_sent; + bool maxdly_sent; - int maxdlynb_valid; + bool maxdlynb_valid; int maxdlynb; - int maxdlynb_sent; + bool maxdlynb_sent; uint8_t slotmask; - int slottype_valid[TRX_NR_TS]; + bool slottype_valid[TRX_NR_TS]; uint8_t slottype[TRX_NR_TS]; - int slottype_sent[TRX_NR_TS]; + bool slottype_sent[TRX_NR_TS]; }; struct trx_l1h { diff --git a/src/osmo-bts-trx/trx_provision_fsm.c b/src/osmo-bts-trx/trx_provision_fsm.c index c3b266d8..fbeee371 100644 --- a/src/osmo-bts-trx/trx_provision_fsm.c +++ b/src/osmo-bts-trx/trx_provision_fsm.c @@ -102,15 +102,15 @@ int l1if_provision_transceiver_trx(struct trx_l1h *l1h) * provide broken values) */ if (!l1h->config.nominal_power_set_by_vty) trx_if_cmd_getnompower(l1h, l1if_getnompower_cb); - l1h->config.arfcn_sent = 1; + l1h->config.arfcn_sent = true; } if (!l1h->config.tsc_sent) { trx_if_cmd_settsc(l1h, l1h->config.tsc); - l1h->config.tsc_sent = 1; + l1h->config.tsc_sent = true; } if (!l1h->config.bsic_sent) { trx_if_cmd_setbsic(l1h, l1h->config.bsic); - l1h->config.bsic_sent = 1; + l1h->config.bsic_sent = true; } /* Ask transceiver to use the newest TRXD header version if not using it yet */ @@ -124,7 +124,7 @@ int l1if_provision_transceiver_trx(struct trx_l1h *l1h) "already using maximum configured one: %" PRIu8 "\n", l1h->config.trxd_hdr_ver_use); } - l1h->config.setformat_sent = 1; + l1h->config.setformat_sent = true; } if (pinst->num == 0 && !plink->u.osmotrx.powered && !plink->u.osmotrx.poweronoff_sent) { @@ -175,8 +175,8 @@ static bool update_ts_data(struct trx_l1h *l1h, struct trx_prov_ev_cfg_ts_data* if (l1h->config.slottype[ts_data->tn] != ts_data->slottype || !l1h->config.slottype_valid[ts_data->tn]) { l1h->config.slottype[ts_data->tn] = ts_data->slottype; - l1h->config.slottype_valid[ts_data->tn] = 1; - l1h->config.slottype_sent[ts_data->tn] = 0; + l1h->config.slottype_valid[ts_data->tn] = true; + l1h->config.slottype_sent[ts_data->tn] = false; return true; } return false; @@ -217,24 +217,24 @@ static void st_open_poweroff(struct osmo_fsm_inst *fi, uint32_t event, void *dat bsic = (uint8_t)(intptr_t)data; if (l1h->config.bsic != bsic || !l1h->config.bsic_valid) { l1h->config.bsic = bsic; - l1h->config.bsic_valid = 1; - l1h->config.bsic_sent = 0; + l1h->config.bsic_valid = true; + l1h->config.bsic_sent = false; } break; case TRX_PROV_EV_CFG_ARFCN: arfcn = (uint16_t)(intptr_t)data; if (l1h->config.arfcn != arfcn || !l1h->config.arfcn_valid) { l1h->config.arfcn = arfcn; - l1h->config.arfcn_valid = 1; - l1h->config.arfcn_sent = 0; + l1h->config.arfcn_valid = true; + l1h->config.arfcn_sent = false; } break; case TRX_PROV_EV_CFG_TSC: tsc = (uint16_t)(intptr_t)data; if (l1h->config.tsc != tsc || !l1h->config.tsc_valid) { l1h->config.tsc = tsc; - l1h->config.tsc_valid = 1; - l1h->config.tsc_sent = 0; + l1h->config.tsc_valid = true; + l1h->config.tsc_sent = false; } break; case TRX_PROV_EV_CFG_TS: @@ -291,15 +291,15 @@ static void st_open_poweron_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_sta /* after power on */ if (l1h->config.rxgain_valid && !l1h->config.rxgain_sent) { trx_if_cmd_setrxgain(l1h, l1h->config.rxgain); - l1h->config.rxgain_sent = 1; + l1h->config.rxgain_sent = true; } if (l1h->config.maxdly_valid && !l1h->config.maxdly_sent) { trx_if_cmd_setmaxdly(l1h, l1h->config.maxdly); - l1h->config.maxdly_sent = 1; + l1h->config.maxdly_sent = true; } if (l1h->config.maxdlynb_valid && !l1h->config.maxdlynb_sent) { trx_if_cmd_setmaxdlynb(l1h, l1h->config.maxdlynb); - l1h->config.maxdlynb_sent = 1; + l1h->config.maxdlynb_sent = true; } for (tn = 0; tn < TRX_NR_TS; tn++) { @@ -307,7 +307,7 @@ static void st_open_poweron_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_sta && !l1h->config.slottype_sent[tn]) { trx_if_cmd_setslot(l1h, tn, l1h->config.slottype[tn], l1if_setslot_cb); - l1h->config.slottype_sent[tn] = 1; + l1h->config.slottype_sent[tn] = true; } } } @@ -328,11 +328,11 @@ static void st_open_poweron(struct osmo_fsm_inst *fi, uint32_t event, void *data trx_if_cmd_poweroff(l1h, l1if_poweronoff_cb); plink->u.osmotrx.poweronoff_sent = true; } - l1h->config.rxgain_sent = 0; - l1h->config.maxdly_sent = 0; - l1h->config.maxdlynb_sent = 0; + l1h->config.rxgain_sent = false; + l1h->config.maxdly_sent = false; + l1h->config.maxdlynb_sent = false; for (tn = 0; tn < TRX_NR_TS; tn++) - l1h->config.slottype_sent[tn] = 0; + l1h->config.slottype_sent[tn] = false; } else if (!pinst->phy_link->u.osmotrx.poweronoff_sent) { bts_model_trx_close_cb(pinst->trx, 0); } /* else: poweroff in progress, cb will be called upon TRXC RSP */ @@ -347,7 +347,7 @@ static void st_open_poweron(struct osmo_fsm_inst *fi, uint32_t event, void *data if (update_ts_data(l1h, ts_data)) { trx_if_cmd_setslot(l1h, ts_data->tn, l1h->config.slottype[ ts_data->tn], l1if_setslot_cb); - l1h->config.slottype_sent[ ts_data->tn] = 1; + l1h->config.slottype_sent[ts_data->tn] = true; } break; diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c index fb75a4e5..6b8ca77a 100644 --- a/src/osmo-bts-trx/trx_vty.c +++ b/src/osmo-bts-trx/trx_vty.c @@ -245,7 +245,7 @@ DEFUN(cfg_phyinst_maxdly, cfg_phyinst_maxdly_cmd, l1h->config.maxdly = atoi(argv[0]); l1h->config.maxdly_valid = 1; - l1h->config.maxdly_sent = 0; + l1h->config.maxdly_sent = false; l1if_provision_transceiver_trx(l1h); return CMD_SUCCESS; @@ -271,7 +271,7 @@ DEFUN(cfg_phyinst_maxdlynb, cfg_phyinst_maxdlynb_cmd, l1h->config.maxdlynb = atoi(argv[0]); l1h->config.maxdlynb_valid = 1; - l1h->config.maxdlynb_sent = 0; + l1h->config.maxdlynb_sent = false; l1if_provision_transceiver_trx(l1h); return CMD_SUCCESS; @@ -358,7 +358,7 @@ DEFUN(cfg_phyinst_rxgain, cfg_phyinst_rxgain_cmd, l1h->config.rxgain = atoi(argv[0]); l1h->config.rxgain_valid = 1; - l1h->config.rxgain_sent = 0; + l1h->config.rxgain_sent = false; l1if_provision_transceiver_trx(l1h); return CMD_SUCCESS; |