Minor fixes

master
Xavier Arteaga 5 years ago committed by Andre Puschmann
parent 423475173d
commit 73517f981e

@ -731,8 +731,19 @@ uint32_t srslte_print_check(char* s, size_t max_len, uint32_t cur_len, const cha
if (cur_len < max_len - 1) { if (cur_len < max_len - 1) {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
cur_len += vsnprintf(&s[cur_len], max_len - cur_len, format, args); size_t n = max_len - cur_len;
int ret = vsnprintf(&s[cur_len], n, format, args);
va_end(args); va_end(args);
if (ret >= 0 && ret < n) {
// Notice that only when this returned value is non-negative and less than n, the string has been completely
// written.
cur_len += ret;
} else {
// Formatting error detected
ERROR("Formatting error when printing string\n");
exit(-1);
}
} else { } else {
ERROR("Buffer full when printing string\n"); ERROR("Buffer full when printing string\n");
exit(-1); exit(-1);

@ -100,14 +100,14 @@ private:
class ue class ue
{ {
public: public:
ue(uint16_t rnti, phy_common* phy) ue(uint16_t id, phy_common* phy)
{ {
// Copy common configuartion // Copy common configuartion
ul_cfg = phy->ul_cfg_com; ul_cfg = phy->ul_cfg_com;
dl_cfg = phy->dl_cfg_com; dl_cfg = phy->dl_cfg_com;
// Fill RNTI // Fill RNTI
this->rnti = rnti; rnti = id;
dl_cfg.pdsch.rnti = rnti; dl_cfg.pdsch.rnti = rnti;
ul_cfg.pusch.rnti = rnti; ul_cfg.pusch.rnti = rnti;
ul_cfg.pucch.rnti = rnti; ul_cfg.pucch.rnti = rnti;

@ -323,9 +323,8 @@ void cc_worker::work_ul(srslte_ul_sf_cfg_t* ul_sf_cfg, stack_interface_phy_lte::
ul_sf = *ul_sf_cfg; ul_sf = *ul_sf_cfg;
log_h->step(ul_sf.tti); log_h->step(ul_sf.tti);
for (auto& iter : ue_db) { for (auto& ue : ue_db) {
auto rnti = (uint16_t)iter.first; ue.second->is_grant_available = false;
ue_db[rnti]->is_grant_available = false;
} }
// Process UL signal // Process UL signal
@ -723,11 +722,9 @@ uint32_t cc_worker::get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS])
{ {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
uint32_t cnt = 0; uint32_t cnt = 0;
for (auto& iter : ue_db) { for (auto& ue : ue_db) {
ue* u = iter.second; if (SRSLTE_RNTI_ISUSER(ue.first) && cnt < ENB_METRICS_MAX_USERS) {
uint16_t rnti = iter.first; ue.second->metrics_read(&metrics[cnt]);
if (SRSLTE_RNTI_ISUSER(rnti) && cnt < ENB_METRICS_MAX_USERS) {
u->metrics_read(&metrics[cnt]);
cnt++; cnt++;
} }
} }
@ -777,14 +774,14 @@ int cc_worker::read_ce_arg(float* ce_arg)
int cc_worker::read_pusch_d(cf_t* pdsch_d) int cc_worker::read_pusch_d(cf_t* pdsch_d)
{ {
int nof_re = 400; // enb_ul.ul_cfg.pusch.nbits.nof_re int nof_re = enb_ul.pusch.max_re;
memcpy(pdsch_d, enb_ul.pusch.d, nof_re * sizeof(cf_t)); memcpy(pdsch_d, enb_ul.pusch.d, nof_re * sizeof(cf_t));
return nof_re; return nof_re;
} }
int cc_worker::read_pucch_d(cf_t* pdsch_d) int cc_worker::read_pucch_d(cf_t* pdsch_d)
{ {
int nof_re = SRSLTE_PUCCH_MAX_BITS / 2; // enb_ul.ul_cfg.pusch.nbits.nof_re int nof_re = SRSLTE_PUCCH_MAX_BITS / 2;
memcpy(pdsch_d, enb_ul.pucch.z_tmp, nof_re * sizeof(cf_t)); memcpy(pdsch_d, enb_ul.pucch.z_tmp, nof_re * sizeof(cf_t));
return nof_re; return nof_re;
} }

Loading…
Cancel
Save