Minor changes

master
Xavier Arteaga 5 years ago
parent 38f848ecdf
commit 0ad99a35f9

@ -58,7 +58,7 @@ SRSLTE_API int srslte_timestamp_add(srslte_timestamp_t* t, time_t full_secs, dou
SRSLTE_API int srslte_timestamp_sub(srslte_timestamp_t* t, time_t full_secs, double frac_secs);
SRSLTE_API double srslte_timestamp_real(srslte_timestamp_t* t);
SRSLTE_API double srslte_timestamp_real(const srslte_timestamp_t* t);
SRSLTE_API bool srslte_timestamp_iszero(const srslte_timestamp_t* t);

@ -34,11 +34,19 @@ void srslte_channel_rlf_execute(srslte_channel_rlf_t* q,
uint32_t nsamples,
const srslte_timestamp_t* ts)
{
uint32_t period_ms = q->t_on_ms + q->t_off_ms;
double full_secs_ms = (ts->full_secs * 1000) % period_ms;
double frac_secs_ms = (ts->frac_secs * 1000);
double time_ms = full_secs_ms + frac_secs_ms;
// Caulculate full period in MS
uint64_t period_ms = q->t_on_ms + q->t_off_ms;
// Convert seconds to ms and reduce it into 32 bit
uint32_t full_secs_ms = (uint32_t)((ts->full_secs * 1000UL) % period_ms);
// Convert Fractional seconds into ms and convert it to integer
uint32_t frac_secs_ms = (uint32_t)round(ts->frac_secs * 1000);
// Add full seconds and fractional performing period module
uint32_t time_ms = (full_secs_ms + frac_secs_ms) % period_ms;
// Decide whether enables or disables channel
if (time_ms < q->t_on_ms) {
srslte_vec_sc_prod_cfc(in, 1.0f, out, nsamples);
} else {

@ -103,7 +103,7 @@ int srslte_timestamp_sub(srslte_timestamp_t* t, time_t full_secs, double frac_se
return ret;
}
double srslte_timestamp_real(srslte_timestamp_t* t)
double srslte_timestamp_real(const srslte_timestamp_t* t)
{
return t->frac_secs + t->full_secs;
}

Loading…
Cancel
Save