fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30221 )
Change subject: trxcon: use 'trxcon_phyif_' prefix for the PHYIF API ......................................................................
trxcon: use 'trxcon_phyif_' prefix for the PHYIF API
Change-Id: Icd2fc41cb3f42a791bf619c5f7b8fa4154371ba4 Related: OS#5599 --- M src/host/trxcon/include/osmocom/bb/trxcon/phyif.h M src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h M src/host/trxcon/src/trx_if.c M src/host/trxcon/src/trxcon_fsm.c M src/host/trxcon/src/trxcon_main.c M src/host/trxcon/src/trxcon_shim.c 6 files changed, 97 insertions(+), 97 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h index 7a5740d..43363cb 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h @@ -5,72 +5,72 @@ #include <osmocom/core/bits.h>
/* PHYIF command type */ -enum phyif_cmd_type { - PHYIF_CMDT_RESET, - PHYIF_CMDT_POWERON, - PHYIF_CMDT_POWEROFF, - PHYIF_CMDT_MEASURE, - PHYIF_CMDT_SETFREQ_H0, - PHYIF_CMDT_SETFREQ_H1, - PHYIF_CMDT_SETSLOT, - PHYIF_CMDT_SETTA, +enum trxcon_phyif_cmd_type { + TRXCON_PHYIF_CMDT_RESET, + TRXCON_PHYIF_CMDT_POWERON, + TRXCON_PHYIF_CMDT_POWEROFF, + TRXCON_PHYIF_CMDT_MEASURE, + TRXCON_PHYIF_CMDT_SETFREQ_H0, + TRXCON_PHYIF_CMDT_SETFREQ_H1, + TRXCON_PHYIF_CMDT_SETSLOT, + TRXCON_PHYIF_CMDT_SETTA, };
-/* param of PHYIF_CMDT_SETFREQ_H0 */ -struct phyif_cmdp_setfreq_h0 { +/* param of TRXCON_PHYIF_CMDT_SETFREQ_H0 */ +struct trxcon_phyif_cmdp_setfreq_h0 { uint16_t band_arfcn; };
-/* param of PHYIF_CMDT_SETFREQ_H1 */ -struct phyif_cmdp_setfreq_h1 { +/* param of TRXCON_PHYIF_CMDT_SETFREQ_H1 */ +struct trxcon_phyif_cmdp_setfreq_h1 { uint8_t hsn; uint8_t maio; const uint16_t *ma; unsigned int ma_len; };
-/* param of PHYIF_CMDT_SETSLOT */ -struct phyif_cmdp_setslot { +/* param of TRXCON_PHYIF_CMDT_SETSLOT */ +struct trxcon_phyif_cmdp_setslot { uint8_t tn; uint8_t pchan; /* enum gsm_phys_chan_config */ };
-/* param of PHYIF_CMDT_SETTA */ -struct phyif_cmdp_setta { +/* param of TRXCON_PHYIF_CMDT_SETTA */ +struct trxcon_phyif_cmdp_setta { int8_t ta; /* intentionally signed */ };
-/* param of PHYIF_CMDT_MEASURE (command) */ -struct phyif_cmdp_measure { +/* param of TRXCON_PHYIF_CMDT_MEASURE (command) */ +struct trxcon_phyif_cmdp_measure { uint16_t band_arfcn; };
-/* param of PHYIF_CMDT_MEASURE (response) */ -struct phyif_rspp_measure { +/* param of TRXCON_PHYIF_CMDT_MEASURE (response) */ +struct trxcon_phyif_rspp_measure { uint16_t band_arfcn; int dbm; };
-struct phyif_cmd { - enum phyif_cmd_type type; +struct trxcon_phyif_cmd { + enum trxcon_phyif_cmd_type type; union { - struct phyif_cmdp_setfreq_h0 setfreq_h0; - struct phyif_cmdp_setfreq_h1 setfreq_h1; - struct phyif_cmdp_setslot setslot; - struct phyif_cmdp_setta setta; - struct phyif_cmdp_measure measure; + struct trxcon_phyif_cmdp_setfreq_h0 setfreq_h0; + struct trxcon_phyif_cmdp_setfreq_h1 setfreq_h1; + struct trxcon_phyif_cmdp_setslot setslot; + struct trxcon_phyif_cmdp_setta setta; + struct trxcon_phyif_cmdp_measure measure; } param; };
-struct phyif_rsp { - enum phyif_cmd_type type; +struct trxcon_phyif_rsp { + enum trxcon_phyif_cmd_type type; union { - struct phyif_rspp_measure measure; + struct trxcon_phyif_rspp_measure measure; } param; };
/* BURST.req - a burst to be transmitted */ -struct phyif_burst_req { +struct trxcon_phyif_burst_req { uint32_t fn; uint8_t tn; uint8_t pwr; @@ -79,7 +79,7 @@ };
/* BURST.ind - a received burst */ -struct phyif_burst_ind { +struct trxcon_phyif_burst_ind { uint32_t fn; uint8_t tn; int16_t toa256; @@ -89,8 +89,8 @@ };
-int phyif_handle_burst_ind(void *priv, const struct phyif_burst_ind *bi); -int phyif_handle_burst_req(void *phyif, const struct phyif_burst_req *br); -int phyif_handle_cmd(void *phyif, const struct phyif_cmd *cmd); -int phyif_handle_rsp(void *priv, const struct phyif_rsp *rsp); -void phyif_close(void *phyif); +int trxcon_phyif_handle_burst_ind(void *priv, const struct trxcon_phyif_burst_ind *bi); +int trxcon_phyif_handle_burst_req(void *phyif, const struct trxcon_phyif_burst_req *br); +int trxcon_phyif_handle_cmd(void *phyif, const struct trxcon_phyif_cmd *cmd); +int trxcon_phyif_handle_rsp(void *priv, const struct trxcon_phyif_rsp *rsp); +void trxcon_phyif_close(void *phyif); diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h b/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h index 92de3b0..0243dd5 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h @@ -55,5 +55,5 @@ struct trx_instance *trx_if_open(const struct trx_if_params *params); void trx_if_close(struct trx_instance *trx);
-int trx_if_handle_phyif_burst_req(struct trx_instance *trx, const struct phyif_burst_req *br); -int trx_if_handle_phyif_cmd(struct trx_instance *trx, const struct phyif_cmd *cmd); +int trx_if_handle_phyif_burst_req(struct trx_instance *trx, const struct trxcon_phyif_burst_req *br); +int trx_if_handle_phyif_cmd(struct trx_instance *trx, const struct trxcon_phyif_cmd *cmd); diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c index fd6a3b0..5a662f0 100644 --- a/src/host/trxcon/src/trx_if.c +++ b/src/host/trxcon/src/trx_if.c @@ -275,7 +275,7 @@ */
static int trx_if_cmd_setslot(struct trx_instance *trx, - const struct phyif_cmdp_setslot *cmdp) + const struct trxcon_phyif_cmdp_setslot *cmdp) { /* Values correspond to 'enum ChannelCombination' in osmo-trx.git */ static const uint8_t chan_types[_GSM_PCHAN_MAX] = { @@ -308,7 +308,7 @@ */
static int trx_if_cmd_rxtune(struct trx_instance *trx, - const struct phyif_cmdp_setfreq_h0 *cmdp) + const struct trxcon_phyif_cmdp_setfreq_h0 *cmdp) { uint16_t freq10;
@@ -323,7 +323,7 @@ }
static int trx_if_cmd_txtune(struct trx_instance *trx, - const struct phyif_cmdp_setfreq_h0 *cmdp) + const struct trxcon_phyif_cmdp_setfreq_h0 *cmdp) { uint16_t freq10;
@@ -350,7 +350,7 @@ */
static int trx_if_cmd_measure(struct trx_instance *trx, - const struct phyif_cmdp_measure *cmdp) + const struct trxcon_phyif_cmdp_measure *cmdp) { uint16_t freq10;
@@ -382,15 +382,15 @@ return; }
- const struct phyif_rsp rsp = { - .type = PHYIF_CMDT_MEASURE, + const struct trxcon_phyif_rsp rsp = { + .type = TRXCON_PHYIF_CMDT_MEASURE, .param.measure = { .band_arfcn = band_arfcn, .dbm = dbm, }, };
- phyif_handle_rsp(trx->priv, &rsp); + trxcon_phyif_handle_rsp(trx->priv, &rsp); }
/* @@ -407,7 +407,7 @@ */
static int trx_if_cmd_setta(struct trx_instance *trx, - const struct phyif_cmdp_setta *cmdp) + const struct trxcon_phyif_cmdp_setta *cmdp) { return trx_ctrl_cmd(trx, 0, "SETTA", "%d", cmdp->ta); } @@ -426,7 +426,7 @@ */
static int trx_if_cmd_setfh(struct trx_instance *trx, - const struct phyif_cmdp_setfreq_h1 *cmdp) + const struct trxcon_phyif_cmdp_setfreq_h1 *cmdp) { /* Reserve some room for CMD SETFH <HSN> <MAIO> */ char ma_buf[TRXC_BUF_SIZE - 24]; @@ -560,38 +560,38 @@ return -EIO; }
-int trx_if_handle_phyif_cmd(struct trx_instance *trx, const struct phyif_cmd *cmd) +int trx_if_handle_phyif_cmd(struct trx_instance *trx, const struct trxcon_phyif_cmd *cmd) { int rc;
switch (cmd->type) { - case PHYIF_CMDT_RESET: + case TRXCON_PHYIF_CMDT_RESET: if ((rc = trx_if_cmd_poweroff(trx)) != 0) return rc; rc = trx_if_cmd_echo(trx); break; - case PHYIF_CMDT_POWERON: + case TRXCON_PHYIF_CMDT_POWERON: rc = trx_if_cmd_poweron(trx); break; - case PHYIF_CMDT_POWEROFF: + case TRXCON_PHYIF_CMDT_POWEROFF: rc = trx_if_cmd_poweroff(trx); break; - case PHYIF_CMDT_MEASURE: + case TRXCON_PHYIF_CMDT_MEASURE: rc = trx_if_cmd_measure(trx, &cmd->param.measure); break; - case PHYIF_CMDT_SETFREQ_H0: + case TRXCON_PHYIF_CMDT_SETFREQ_H0: if ((rc = trx_if_cmd_rxtune(trx, &cmd->param.setfreq_h0)) != 0) return rc; if ((rc = trx_if_cmd_txtune(trx, &cmd->param.setfreq_h0)) != 0) return rc; break; - case PHYIF_CMDT_SETFREQ_H1: + case TRXCON_PHYIF_CMDT_SETFREQ_H1: rc = trx_if_cmd_setfh(trx, &cmd->param.setfreq_h1); break; - case PHYIF_CMDT_SETSLOT: + case TRXCON_PHYIF_CMDT_SETSLOT: rc = trx_if_cmd_setslot(trx, &cmd->param.setslot); break; - case PHYIF_CMDT_SETTA: + case TRXCON_PHYIF_CMDT_SETTA: rc = trx_if_cmd_setta(trx, &cmd->param.setta); break; default: @@ -628,7 +628,7 @@ static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what) { struct trx_instance *trx = ofd->data; - struct phyif_burst_ind bi; + struct trxcon_phyif_burst_ind bi; uint8_t buf[TRXD_BUF_SIZE]; ssize_t read_len;
@@ -644,7 +644,7 @@ return -EINVAL; }
- bi = (struct phyif_burst_ind) { + bi = (struct trxcon_phyif_burst_ind) { .tn = buf[0], .fn = osmo_load32be(buf + 1), .rssi = -(int8_t) buf[5], @@ -675,11 +675,11 @@ "RX burst tn=%u fn=%u rssi=%d toa=%d\n", bi.tn, bi.fn, bi.rssi, bi.toa256);
- return phyif_handle_burst_ind(trx->priv, &bi); + return trxcon_phyif_handle_burst_ind(trx->priv, &bi); }
int trx_if_handle_phyif_burst_req(struct trx_instance *trx, - const struct phyif_burst_req *br) + const struct trxcon_phyif_burst_req *br) { uint8_t buf[TRXD_BUF_SIZE]; size_t length; diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c index 9980344..d3420f2 100644 --- a/src/host/trxcon/src/trxcon_fsm.c +++ b/src/host/trxcon/src/trxcon_fsm.c @@ -41,7 +41,7 @@ uint32_t event, void *data) { struct trxcon_inst *trxcon = fi->priv; - struct phyif_cmd phycmd = { }; + struct trxcon_phyif_cmd phycmd = { };
switch (event) { case TRXCON_EV_PHYIF_FAILURE: @@ -58,8 +58,8 @@ osmo_fsm_inst_state_chg(fi, TRXCON_ST_RESET, 0, 0); l1sched_reset(trxcon->sched, true);
- phycmd.type = PHYIF_CMDT_RESET; - phyif_handle_cmd(trxcon->phyif, &phycmd); + phycmd.type = TRXCON_PHYIF_CMDT_RESET; + trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd); break; case TRXCON_EV_RESET_SCHED_REQ: l1sched_reset(trxcon->sched, false); @@ -70,16 +70,16 @@
switch (req->type) { case TRXCON_PHY_CFGT_PCHAN_COMB: - phycmd.type = PHYIF_CMDT_SETSLOT; + phycmd.type = TRXCON_PHYIF_CMDT_SETSLOT; phycmd.param.setslot.tn = req->pchan_comb.tn; phycmd.param.setslot.pchan = req->pchan_comb.pchan; - phyif_handle_cmd(trxcon->phyif, &phycmd); + trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd); break; case TRXCON_PHY_CFGT_TX_PARAMS: if (trxcon->l1p.ta != req->tx_params.timing_advance) { - phycmd.type = PHYIF_CMDT_SETTA; + phycmd.type = TRXCON_PHYIF_CMDT_SETTA; phycmd.param.setta.ta = req->tx_params.timing_advance; - phyif_handle_cmd(trxcon->phyif, &phycmd); + trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd); } trxcon->l1p.tx_power = req->tx_params.tx_power; trxcon->l1p.ta = req->tx_params.timing_advance; @@ -144,7 +144,7 @@ trxcon->fi_data = talloc_memdup(fi, req, sizeof(*req)); OSMO_ASSERT(trxcon->fi_data != NULL);
- /* trxcon_st_full_power_scan_onenter() sends the initial PHYIF_CMDT_MEASURE */ + /* trxcon_st_full_power_scan_onenter() sends the initial TRXCON_PHYIF_CMDT_MEASURE */ osmo_fsm_inst_state_chg(fi, TRXCON_ST_FULL_POWER_SCAN, 0, 0); /* TODO: timeout */ }
@@ -164,8 +164,8 @@
/* Only if current ARFCN differs */ if (trxcon->l1p.band_arfcn != req->band_arfcn) { - const struct phyif_cmd phycmd = { - .type = PHYIF_CMDT_SETFREQ_H0, + const struct trxcon_phyif_cmd phycmd = { + .type = TRXCON_PHYIF_CMDT_SETFREQ_H0, .param.setfreq_h0 = { .band_arfcn = req->band_arfcn, }, @@ -175,11 +175,11 @@ trxcon->l1p.band_arfcn = req->band_arfcn;
/* Tune transceiver to required ARFCN */ - phyif_handle_cmd(trxcon->phyif, &phycmd); + trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd); }
- const struct phyif_cmd phycmd = { .type = PHYIF_CMDT_POWERON }; - phyif_handle_cmd(trxcon->phyif, &phycmd); + const struct trxcon_phyif_cmd phycmd = { .type = TRXCON_PHYIF_CMDT_POWERON }; + trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd); break; } case TRXCON_EV_FULL_POWER_SCAN_REQ: @@ -197,14 +197,14 @@ const struct trxcon_param_full_power_scan_req *req = trxcon->fi_data;
/* req->band_arfcn_start holds the current ARFCN */ - const struct phyif_cmd phycmd = { - .type = PHYIF_CMDT_MEASURE, + const struct trxcon_phyif_cmd phycmd = { + .type = TRXCON_PHYIF_CMDT_MEASURE, .param.measure = { .band_arfcn = req->band_arfcn_start, }, };
- phyif_handle_cmd(trxcon->phyif, &phycmd); + trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd); }
static void trxcon_st_full_power_scan_action(struct osmo_fsm_inst *fi, @@ -234,7 +234,7 @@
if (res->band_arfcn < req->band_arfcn_stop) { l1ctl_tx_pm_conf(trxcon, res->band_arfcn, res->dbm, false); - /* trxcon_st_full_power_scan_onenter() sends the next PHYIF_CMDT_MEASURE */ + /* trxcon_st_full_power_scan_onenter() sends the next TRXCON_PHYIF_CMDT_MEASURE */ req->band_arfcn_start = res->band_arfcn + 1; osmo_fsm_inst_state_chg(fi, TRXCON_ST_FULL_POWER_SCAN, 0, 0); /* TODO: timeout */ } else { @@ -332,8 +332,8 @@ }
if (req->hopping) { - const struct phyif_cmd phycmd = { - .type = PHYIF_CMDT_SETFREQ_H1, + const struct trxcon_phyif_cmd phycmd = { + .type = TRXCON_PHYIF_CMDT_SETFREQ_H1, .param.setfreq_h1 = { .hsn = req->h1.hsn, .maio = req->h1.maio, @@ -343,21 +343,21 @@ };
/* Apply the freq. hopping parameters */ - if (phyif_handle_cmd(trxcon->phyif, &phycmd) != 0) + if (trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd) != 0) return;
/* Set current ARFCN to an invalid value */ trxcon->l1p.band_arfcn = 0xffff; } else { - const struct phyif_cmd phycmd = { - .type = PHYIF_CMDT_SETFREQ_H0, + const struct trxcon_phyif_cmd phycmd = { + .type = TRXCON_PHYIF_CMDT_SETFREQ_H0, .param.setfreq_h0 = { .band_arfcn = req->h0.band_arfcn, }, };
/* Tune transceiver to required ARFCN */ - if (phyif_handle_cmd(trxcon->phyif, &phycmd) != 0) + if (trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd) != 0) return;
/* Update current ARFCN */ @@ -549,7 +549,7 @@ if (trxcon->l2if != NULL) trxcon_l1ctl_close(trxcon); if (trxcon->phyif != NULL) - phyif_close(trxcon->phyif); + trxcon_phyif_close(trxcon->phyif);
talloc_free(trxcon); fi->priv = NULL; diff --git a/src/host/trxcon/src/trxcon_main.c b/src/host/trxcon/src/trxcon_main.c index 54a8067..cf04679 100644 --- a/src/host/trxcon/src/trxcon_main.c +++ b/src/host/trxcon/src/trxcon_main.c @@ -86,17 +86,17 @@
static void *tall_trxcon_ctx = NULL;
-int phyif_handle_burst_req(void *phyif, const struct phyif_burst_req *br) +int trxcon_phyif_handle_burst_req(void *phyif, const struct trxcon_phyif_burst_req *br) { return trx_if_handle_phyif_burst_req(phyif, br); }
-int phyif_handle_cmd(void *phyif, const struct phyif_cmd *cmd) +int trxcon_phyif_handle_cmd(void *phyif, const struct trxcon_phyif_cmd *cmd) { return trx_if_handle_phyif_cmd(phyif, cmd); }
-void phyif_close(void *phyif) +void trxcon_phyif_close(void *phyif) { trx_if_close(phyif); } @@ -138,7 +138,7 @@ l1c->priv = trxcon; trxcon->l2if = l1c;
- const struct trx_if_params phyif_params = { + const struct trx_if_params trxcon_phyif_params = { .local_host = app_data.trx_bind_ip, .remote_host = app_data.trx_remote_ip, .base_port = app_data.trx_base_port, @@ -150,7 +150,7 @@ };
/* Init transceiver interface */ - trxcon->phyif = trx_if_open(&phyif_params); + trxcon->phyif = trx_if_open(&trxcon_phyif_params); if (trxcon->phyif == NULL) { /* TRXCON_EV_PHYIF_FAILURE triggers l1ctl_client_conn_close() */ osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_PHYIF_FAILURE, NULL); diff --git a/src/host/trxcon/src/trxcon_shim.c b/src/host/trxcon/src/trxcon_shim.c index 29c3a14..6434461 100644 --- a/src/host/trxcon/src/trxcon_shim.c +++ b/src/host/trxcon/src/trxcon_shim.c @@ -74,7 +74,7 @@ const struct l1sched_burst_req *br) { struct trxcon_inst *trxcon = sched->priv; - const struct phyif_burst_req phybr = { + const struct trxcon_phyif_burst_req phybr = { .fn = br->fn, .tn = br->tn, .pwr = br->pwr, @@ -82,7 +82,7 @@ .burst_len = br->burst_len, };
- return phyif_handle_burst_req(trxcon->phyif, &phybr); + return trxcon_phyif_handle_burst_req(trxcon->phyif, &phybr); }
/* External L2 API for the scheduler */ @@ -220,7 +220,7 @@ }
/* External L1 API for the PHYIF */ -int phyif_handle_burst_ind(void *priv, const struct phyif_burst_ind *bi) +int trxcon_phyif_handle_burst_ind(void *priv, const struct trxcon_phyif_burst_ind *bi) { struct trxcon_inst *trxcon = priv; const struct l1sched_meas_set meas = { @@ -240,14 +240,14 @@ return 0; }
-int phyif_handle_rsp(void *priv, const struct phyif_rsp *rsp) +int trxcon_phyif_handle_rsp(void *priv, const struct trxcon_phyif_rsp *rsp) { struct trxcon_inst *trxcon = priv;
switch (rsp->type) { - case PHYIF_CMDT_MEASURE: + case TRXCON_PHYIF_CMDT_MEASURE: { - const struct phyif_rspp_measure *meas = &rsp->param.measure; + const struct trxcon_phyif_rspp_measure *meas = &rsp->param.measure; struct trxcon_param_full_power_scan_res res = { .band_arfcn = meas->band_arfcn, .dbm = meas->dbm,