fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43609?usp=email )
(
3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: proxy: implement TRXC SETSLOT ......................................................................
proxy: implement TRXC SETSLOT
Store the timeslot config into per-chan timeslot state struct. Currently unused, but may be useful later for VTY introspection.
Change-Id: I0f038fc453336e60d41641ec490907cddf259c3f Related: OS#6672 --- M proxy/include/osmocom/proxy/trx.h M proxy/src/ctrl_cmd.c 2 files changed, 31 insertions(+), 0 deletions(-)
Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve
diff --git a/proxy/include/osmocom/proxy/trx.h b/proxy/include/osmocom/proxy/trx.h index 4f56a24..7301f62 100644 --- a/proxy/include/osmocom/proxy/trx.h +++ b/proxy/include/osmocom/proxy/trx.h @@ -6,6 +6,8 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/logging.h>
+#include <osmocom/trx/trxc.h> + #include <osmocom/proxy/path_sim.h>
struct osmo_trx_ep; @@ -14,6 +16,15 @@ /*! dBm, nominal Tx power (per endpoint) */ #define PROXY_TRX_DEFAULT_TX_POWER 50
+/*! TDMA timeslots per GSM frame */ +#define PROXY_TRX_NUM_TS 8 + +/*! Per-timeslot config received via SETSLOT. */ +struct proxy_trx_ts { + struct osmo_trxc_setslot cfg; + bool valid; /*!< has SETSLOT been received for this TS? */ +}; + /*! Per-channel state: each channel is conceptually its own (child) * transceiver with an independent Rx/Tx frequency, sharing the endpoint's * power state and clock. */ @@ -22,6 +33,7 @@ uint32_t tx_freq; /*!< Tx frequency in Hz, 0 if not (yet) tuned */ bool rf_muted; /*!< RFMUTE: force NOPE.ind on bursts this channel transmits */ struct path_sim_state path_sim; /*!< RF path simulation state (path_sim.c) */ + struct proxy_trx_ts ts[PROXY_TRX_NUM_TS]; /*!< per-timeslot config (SETSLOT) */ };
/*! One virtual transceiver endpoint */ diff --git a/proxy/src/ctrl_cmd.c b/proxy/src/ctrl_cmd.c index ceaed21..ca6ac7b 100644 --- a/proxy/src/ctrl_cmd.c +++ b/proxy/src/ctrl_cmd.c @@ -167,6 +167,23 @@ "RF mute %s\n", trx->chans[chan].rf_muted ? "on" : "off"); }
+static void ctrl_cmd_setslot(struct proxy_trx *trx, unsigned int chan, + const struct osmo_trxc_msg *cmd, struct osmo_trxc_msg *rsp) +{ + struct osmo_trxc_setslot ss; + + if (osmo_trxc_setslot_parse(&ss, cmd) < 0) { + LOGP_TRXCH(trx, chan, DTRXC, LOGL_ERROR, + "%s(): Failed to parse command arguments: '%s'\n", + __func__, osmo_trxc_msg_name(cmd)); + rsp->status = 1; + return; + } + + trx->chans[chan].ts[ss.tn].cfg = ss; + trx->chans[chan].ts[ss.tn].valid = true; +} + /* FAKE_TOA/FAKE_RSSI/FAKE_CI: "<delta>" adjusts the current value by delta; * "<value> <threshold>" sets an absolute value with a +/-threshold random * jitter applied on every forwarded burst (see path_sim_apply()). */ @@ -321,6 +338,8 @@ ctrl_cmd_nomtxpower(trx, chan, &rsp); } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_RFMUTE)) { ctrl_cmd_rfmute(trx, chan, cmd, &rsp); + } else if (!strcmp(cmd->cmd, OSMO_TRXC_CMD_SETSLOT)) { + ctrl_cmd_setslot(trx, chan, cmd, &rsp); } else if (!strcmp(cmd->cmd, CTRL_CMD_SETTA)) { ctrl_cmd_setta(trx, chan, cmd, &rsp); } else if (!strcmp(cmd->cmd, CTRL_CMD_MEASURE)) {