Added ZMQ Tx sample offset

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 7b25eac47c
commit 19e9c25d1d

@ -307,6 +307,9 @@ int rf_zmq_open_multi(char* args, void** h, uint32_t nof_channels)
parse_double(args, "tx_freq", i, &tx_freq);
tx_opts.frequency_mhz = (uint32_t)(tx_freq / 1e6);
// tx_offset
parse_int32(args, "tx_offset", i, &tx_opts.sample_offset);
// fail_on_disconnect
char tmp[RF_PARAM_LEN] = {};
parse_string(args, "fail_on_disconnect", i, tmp);

@ -42,6 +42,7 @@ typedef struct {
cf_t* zeros;
void* temp_buffer_convert;
uint32_t frequency_mhz;
int32_t sample_offset;
} rf_zmq_tx_t;
typedef struct {

@ -39,6 +39,7 @@ int rf_zmq_tx_open(rf_zmq_tx_t* q, rf_zmq_opts_t opts, void* zmq_ctx, char* sock
q->socket_type = opts.socket_type;
q->sample_format = opts.sample_format;
q->frequency_mhz = opts.frequency_mhz;
q->sample_offset = opts.sample_offset;
rf_zmq_info(q->id, "Binding transmitter: %s\n", sock_args);
@ -179,6 +180,19 @@ int rf_zmq_tx_baseband(rf_zmq_tx_t* q, cf_t* buffer, uint32_t nsamples)
pthread_mutex_lock(&q->mutex);
if (q->sample_offset > 0) {
_rf_zmq_tx_baseband(q, q->zeros, (uint32_t)q->sample_offset);
q->sample_offset = 0;
} else if (q->sample_offset < 0) {
n = SRSLTE_MIN(-q->sample_offset, nsamples);
buffer += n;
nsamples -= n;
q->sample_offset += n;
if (nsamples == 0) {
return n;
}
}
n = _rf_zmq_tx_baseband(q, buffer, nsamples);
pthread_mutex_unlock(&q->mutex);

Loading…
Cancel
Save