mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx.git
synced 2025-11-01 04:33:33 +00:00
Compare commits
7 Commits
mstx_oldtr
...
coverity
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1535052873 | ||
|
|
49792aa1f7 | ||
|
|
e5c36f6abb | ||
|
|
bbefe9eaff | ||
|
|
5e3e23c337 | ||
|
|
8a2a0f0e17 | ||
|
|
1cc9505011 |
@@ -185,13 +185,13 @@ int Resampler::rotate(const float *in, size_t in_len, float *out, size_t out_len
|
||||
n, 1, 1, 0);
|
||||
}
|
||||
|
||||
return out_len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Resampler::init(float bw)
|
||||
{
|
||||
/* Filterbank filter internals */
|
||||
if (initFilters(bw) < 0)
|
||||
if (!initFilters(bw))
|
||||
return false;
|
||||
|
||||
/* Precompute filterbank paths */
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
* @param in_len input buffer length
|
||||
* @param out continuous buffer of output complex float values
|
||||
* @param out_len output buffer length
|
||||
* @return number of samples outputted, negative on error
|
||||
* @return 0 on success and negative on error
|
||||
*
|
||||
* Input and output vector lengths must of be equal multiples of the
|
||||
* rational conversion rate denominator and numerator respectively.
|
||||
|
||||
@@ -43,11 +43,10 @@
|
||||
|
||||
/*
|
||||
* Samples-per-symbol for uplink (receiver) path
|
||||
* Do not modify this value. EDGE configures 4 sps automatically on
|
||||
* B200/B210 devices only. Use of 4 sps on the receive path for other
|
||||
* configurations is not supported.
|
||||
* 4 - Provides better timing precision (avoids FPGA DDC timing ambiguity)
|
||||
* 1 - Reduces processor load, but increases timing ambiguity
|
||||
*/
|
||||
#define DEFAULT_RX_SPS 1
|
||||
#define DEFAULT_RX_SPS 4
|
||||
|
||||
/* Default configuration parameters
|
||||
* Note that these values are only used if the particular key does not
|
||||
@@ -61,6 +60,9 @@
|
||||
#define DEFAULT_DIVERSITY false
|
||||
#define DEFAULT_CHANS 1
|
||||
|
||||
/* Max number of channels in multi-carrier configuration */
|
||||
#define MAX_MCHANS 3
|
||||
|
||||
struct trx_config {
|
||||
std::string log_level;
|
||||
std::string addr;
|
||||
@@ -168,7 +170,7 @@ bool trx_setup_config(struct trx_config *config)
|
||||
if (!config->chans)
|
||||
config->chans = DEFAULT_CHANS;
|
||||
|
||||
if (config->mcbts && ((config->chans < 0) || (config->chans > 5))) {
|
||||
if (config->mcbts && (config->chans > MAX_MCHANS)) {
|
||||
std::cout << "Unsupported number of channels" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1729,8 +1729,10 @@ bool energyDetect(signalVector &rxBurst,
|
||||
|
||||
signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2;
|
||||
float energy = 0.0;
|
||||
if (windowLength < 0) windowLength = 20;
|
||||
if (windowLength > rxBurst.size()) windowLength = rxBurst.size();
|
||||
|
||||
if (windowLength > rxBurst.size())
|
||||
windowLength = rxBurst.size();
|
||||
|
||||
for (unsigned i = 0; i < windowLength; i++) {
|
||||
energy += windowItr->norm2();
|
||||
windowItr+=4;
|
||||
@@ -1790,10 +1792,6 @@ static int detectBurst(signalVector &burst,
|
||||
/* Normalize our channel gain */
|
||||
*amp = *amp / sync->gain;
|
||||
|
||||
/* Compenate for residual rotation with dual Laurent pulse */
|
||||
if (sps == 4)
|
||||
*amp = *amp * complex(0.0, 1.0);
|
||||
|
||||
/* Compensate for residuate time lag */
|
||||
*toa = *toa - sync->toa;
|
||||
|
||||
@@ -1911,7 +1909,7 @@ int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh,
|
||||
int rc, target, head, tail;
|
||||
CorrelationSequence *sync;
|
||||
|
||||
if ((tsc < 0) || (tsc > 7))
|
||||
if (tsc > 7)
|
||||
return -SIGERR_UNSUPPORTED;
|
||||
|
||||
target = 3 + 58 + 16 + 5;
|
||||
@@ -1945,15 +1943,22 @@ int detectEdgeBurst(signalVector &rxBurst, unsigned tsc, float thresh,
|
||||
|
||||
signalVector *downsampleBurst(signalVector &burst)
|
||||
{
|
||||
int rc;
|
||||
signalVector *in, *out;
|
||||
|
||||
in = new signalVector(DOWNSAMPLE_IN_LEN, dnsampler->len());
|
||||
out = new signalVector(DOWNSAMPLE_OUT_LEN);
|
||||
memcpy(in->begin(), burst.begin(), DOWNSAMPLE_IN_LEN * 2 * sizeof(float));
|
||||
|
||||
dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN,
|
||||
(float *) out->begin(), DOWNSAMPLE_OUT_LEN);
|
||||
rc = dnsampler->rotate((float *) in->begin(), DOWNSAMPLE_IN_LEN,
|
||||
(float *) out->begin(), DOWNSAMPLE_OUT_LEN);
|
||||
delete in;
|
||||
|
||||
if (rc < 0) {
|
||||
delete out;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user