ms: add agc
Change-Id: If7aa2c4e9a08878049cf6a7e95bbdf357d74e1fe
This commit is contained in:
parent
115b0099dd
commit
195813fd85
|
@ -198,6 +198,7 @@ struct blade_hw {
|
|||
using tx_buf_q_type = spsc_cond_timeout<BLADE_NUM_BUFFERS, dev_buf_t *, true, false>;
|
||||
const unsigned int rxFullScale, txFullScale;
|
||||
const int rxtxdelay;
|
||||
bool use_agc;
|
||||
|
||||
static std::atomic<bool> stop_lower_threads_flag;
|
||||
double rxfreq_cache, txfreq_cache;
|
||||
|
@ -230,7 +231,7 @@ struct blade_hw {
|
|||
close_device();
|
||||
}
|
||||
blade_hw(struct mssdr_cfg *cfgdata)
|
||||
: rxFullScale(2047), txFullScale(2047), rxtxdelay(-60), rxfreq_cache(0),
|
||||
: rxFullScale(2047), txFullScale(2047), rxtxdelay(-60), use_agc(cfgdata->use_agc), rxfreq_cache(0),
|
||||
txfreq_cache(0)
|
||||
{
|
||||
cfg.tx_freq = cfgdata->overrides.ul_freq;
|
||||
|
@ -305,7 +306,8 @@ struct blade_hw {
|
|||
blade_check(bladerf_set_bandwidth, dev, BLADERF_CHANNEL_TX(0), (bladerf_bandwidth)cfg.bandwidth,
|
||||
(bladerf_bandwidth *)NULL);
|
||||
|
||||
blade_check(bladerf_set_gain_mode, dev, BLADERF_CHANNEL_RX(0), BLADERF_GAIN_MGC);
|
||||
blade_check(bladerf_set_gain_mode, dev, BLADERF_CHANNEL_RX(0),
|
||||
use_agc ? BLADERF_GAIN_AUTOMATIC : BLADERF_GAIN_MGC);
|
||||
setRxGain(cfg.rxgain, 0);
|
||||
setTxGain(cfg.txgain, 0);
|
||||
usleep(1000);
|
||||
|
|
|
@ -239,7 +239,6 @@ struct ms_trx : public BASET, public sched_hw_info {
|
|||
unsigned int mTSC;
|
||||
unsigned int mBSIC;
|
||||
int timing_advance;
|
||||
bool do_auto_gain;
|
||||
bool use_va;
|
||||
|
||||
pthread_t lower_rx_task;
|
||||
|
@ -278,7 +277,7 @@ struct ms_trx : public BASET, public sched_hw_info {
|
|||
void maybe_update_gain(one_burst &brst);
|
||||
|
||||
ms_trx(struct mssdr_cfg *cfgdata)
|
||||
: BASET(cfgdata), mTSC(0), mBSIC(0), timing_advance(0), do_auto_gain(false), use_va(cfgdata->use_va), rxqueue(),
|
||||
: BASET(cfgdata), mTSC(0), mBSIC(0), timing_advance(0), use_va(cfgdata->use_va), rxqueue(),
|
||||
first_sch_buf(new blade_sample_type[SCH_LEN_SPS]),
|
||||
burst_copy_buffer(new blade_sample_type[ONE_TS_BURST_LEN]), first_sch_buf_rcv_ts(0),
|
||||
rcv_done{ false }, sch_thread_done{ false }, upper_is_ready(false)
|
||||
|
|
|
@ -144,7 +144,7 @@ bool ms_trx::handle_sch_or_nb()
|
|||
while (upper_is_ready && !rxqueue.spsc_push(&brst))
|
||||
;
|
||||
|
||||
if (do_auto_gain)
|
||||
if (!use_agc)
|
||||
maybe_update_gain(brst);
|
||||
|
||||
return false;
|
||||
|
|
|
@ -74,6 +74,7 @@ struct mssdr_ctx *vty_mssdr_ctx_alloc(void *talloc_ctx)
|
|||
{
|
||||
struct mssdr_ctx *trx = talloc_zero(talloc_ctx, struct mssdr_ctx);
|
||||
trx->cfg.use_va = true;
|
||||
trx->cfg.use_agc = true;
|
||||
return trx;
|
||||
}
|
||||
|
||||
|
@ -98,6 +99,8 @@ static void mssdr_dump_vty(struct vty *vty, struct mssdr_ctx *trx)
|
|||
vty_out(vty, " ul-gain-override %f%s", trx->cfg.overrides.ul_gain, VTY_NEWLINE);
|
||||
if (trx->cfg.use_va)
|
||||
vty_out(vty, " viterbi-eq %s%s", trx->cfg.use_va ? "enable" : "disable", VTY_NEWLINE);
|
||||
if (trx->cfg.use_agc)
|
||||
vty_out(vty, " rx-agc %s%s", trx->cfg.use_agc ? "enable" : "disable", VTY_NEWLINE);
|
||||
}
|
||||
|
||||
static int config_write_mssdr(struct vty *vty)
|
||||
|
@ -115,6 +118,8 @@ static int config_write_mssdr(struct vty *vty)
|
|||
vty_out(vty, " ul-gain-override %f%s", trx->cfg.overrides.ul_gain, VTY_NEWLINE);
|
||||
if (trx->cfg.use_va)
|
||||
vty_out(vty, " viterbi-eq %s%s", trx->cfg.use_va ? "enable" : "disable", VTY_NEWLINE);
|
||||
if (trx->cfg.use_agc)
|
||||
vty_out(vty, " rx-agc %s%s", trx->cfg.use_agc ? "enable" : "disable", VTY_NEWLINE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -216,6 +221,25 @@ DEFUN_ATTR(cfg_use_viterbi, cfg_use_viterbi_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN_ATTR(cfg_use_agc, cfg_use_agc_cmd,
|
||||
"rx-agc (disable|enable)",
|
||||
"Use the transceiver rx agc (default=enable)\n"
|
||||
"Disable agc\n"
|
||||
"Enable agc\n",
|
||||
CMD_ATTR_HIDDEN)
|
||||
{
|
||||
struct mssdr_ctx *trx = mssdr_from_vty(vty);
|
||||
|
||||
if (strcmp("disable", argv[0]) == 0)
|
||||
trx->cfg.use_agc = false;
|
||||
else if (strcmp("enable", argv[0]) == 0)
|
||||
trx->cfg.use_agc = true;
|
||||
else
|
||||
return CMD_WARNING;
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static struct cmd_node mssdr_node = {
|
||||
MSSDR_NODE,
|
||||
"%s(config-mssdr)# ",
|
||||
|
@ -234,6 +258,7 @@ int mssdr_vty_init(struct mssdr_ctx *trx)
|
|||
install_element(MSSDR_NODE, &cfg_ul_gain_override_cmd);
|
||||
install_element(MSSDR_NODE, &cfg_dl_gain_override_cmd);
|
||||
install_element(MSSDR_NODE, &cfg_use_viterbi_cmd);
|
||||
install_element(MSSDR_NODE, &cfg_use_agc_cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ struct mssdr_cfg {
|
|||
double dl_gain;
|
||||
} overrides;
|
||||
bool use_va;
|
||||
bool use_agc;
|
||||
};
|
||||
|
||||
struct mssdr_ctx {
|
||||
|
|
|
@ -19,4 +19,5 @@ mssdr
|
|||
ul-gain-override 30
|
||||
dl-gain-override 30
|
||||
viterbi-eq enable
|
||||
rx-agc enable
|
||||
|
||||
|
|
Loading…
Reference in New Issue