Merge branch 'next' into raa

This commit is contained in:
Ismael Gomez 2018-02-12 17:28:51 +01:00
commit 018b82e802
8 changed files with 23 additions and 8 deletions

View File

@ -54,7 +54,7 @@ void logger_file::init(std::string file, int max_length_) {
pthread_mutex_init(&mutex, NULL); pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&not_empty, NULL); pthread_cond_init(&not_empty, NULL);
pthread_cond_init(&not_full, NULL); pthread_cond_init(&not_full, NULL);
max_length = max_length_*1024; max_length = (int64_t)max_length_*1024;
name_idx = 0; name_idx = 0;
filename = file; filename = file;
logfile = fopen(filename.c_str(), "w"); logfile = fopen(filename.c_str(), "w");

View File

@ -54,6 +54,7 @@ int srslte_ringbuffer_write(srslte_ringbuffer_t *q, void *p, int nof_bytes)
int w_bytes = nof_bytes; int w_bytes = nof_bytes;
pthread_mutex_lock(&q->mutex); pthread_mutex_lock(&q->mutex);
if (!q->active) { if (!q->active) {
pthread_mutex_unlock(&q->mutex);
return 0; return 0;
} }
if (q->count + w_bytes > q->capacity) { if (q->count + w_bytes > q->capacity) {
@ -85,6 +86,7 @@ int srslte_ringbuffer_read(srslte_ringbuffer_t *q, void *p, int nof_bytes)
pthread_cond_wait(&q->cvar, &q->mutex); pthread_cond_wait(&q->cvar, &q->mutex);
} }
if (!q->active) { if (!q->active) {
pthread_mutex_unlock(&q->mutex);
return 0; return 0;
} }
if (nof_bytes + q->rpm > q->capacity) { if (nof_bytes + q->rpm > q->capacity) {

View File

@ -1085,11 +1085,11 @@ void rlc_am::handle_control_pdu(uint8_t *payload, uint32_t nof_bytes)
it = tx_window.find(i); it = tx_window.find(i);
if (it != tx_window.end()) { if (it != tx_window.end()) {
if(update_vt_a) { if(update_vt_a) {
tx_window.erase(it);
if(it->second.buf) { if(it->second.buf) {
pool->deallocate(it->second.buf); pool->deallocate(it->second.buf);
it->second.buf = 0; it->second.buf = 0;
} }
tx_window.erase(it);
vt_a = (vt_a + 1)%MOD; vt_a = (vt_a + 1)%MOD;
vt_ms = (vt_ms + 1)%MOD; vt_ms = (vt_ms + 1)%MOD;
} }

View File

@ -47,6 +47,7 @@ public:
rlc2 = rlc2_; rlc2 = rlc2_;
fail_rate = fail_rate_; fail_rate = fail_rate_;
run_enable = true; run_enable = true;
running = false;
} }
void stop() void stop()

View File

@ -24,6 +24,7 @@
* *
*/ */
#include <iostream>
#include "mme/s1ap.h" #include "mme/s1ap.h"
#include "mme/s1ap_nas_transport.h" #include "mme/s1ap_nas_transport.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"

View File

@ -76,17 +76,22 @@ class cell_t
return false; return false;
} }
cell_t() { cell_t() {
this->has_valid_sib1 = false; srslte_cell_t tmp = {};
this->has_valid_sib2 = false; cell_t(tmp, 0, 0);
this->has_valid_sib3 = false;
} }
cell_t(srslte_cell_t phy_cell, uint32_t earfcn, float rsrp) { cell_t(srslte_cell_t phy_cell, uint32_t earfcn, float rsrp) {
this->has_valid_sib1 = false; this->has_valid_sib1 = false;
this->has_valid_sib2 = false; this->has_valid_sib2 = false;
this->has_valid_sib3 = false; this->has_valid_sib3 = false;
this->has_valid_sib13 = false;
this->phy_cell = phy_cell; this->phy_cell = phy_cell;
this->rsrp = rsrp; this->rsrp = rsrp;
this->earfcn = earfcn; this->earfcn = earfcn;
in_sync = false;
bzero(&sib1, sizeof(sib1));
bzero(&sib2, sizeof(sib2));
bzero(&sib3, sizeof(sib3));
bzero(&sib13, sizeof(sib13));
} }
uint32_t earfcn; uint32_t earfcn;
@ -114,6 +119,7 @@ class rrc
{ {
public: public:
rrc(); rrc();
~rrc();
void init(phy_interface_rrc *phy_, void init(phy_interface_rrc *phy_,
mac_interface_rrc *mac_, mac_interface_rrc *mac_,

View File

@ -1216,9 +1216,6 @@ phch_recv::measure::ret_code phch_recv::measure::run_subframe(uint32_t sf_idx)
} }
mean_rsrp -= temporal_offset; mean_rsrp -= temporal_offset;
} }
}
if (cnt > 2) {
return MEASURE_OK; return MEASURE_OK;
} else { } else {
return IDLE; return IDLE;

View File

@ -49,12 +49,20 @@ rrc::rrc()
:state(RRC_STATE_IDLE) :state(RRC_STATE_IDLE)
,drb_up(false) ,drb_up(false)
,sysinfo_index(0) ,sysinfo_index(0)
,serving_cell(NULL)
{ {
n310_cnt = 0; n310_cnt = 0;
n311_cnt = 0; n311_cnt = 0;
serving_cell = new cell_t(); serving_cell = new cell_t();
} }
rrc::~rrc()
{
if (serving_cell) {
delete(serving_cell);
}
}
static void liblte_rrc_handler(void *ctx, char *str) { static void liblte_rrc_handler(void *ctx, char *str) {
rrc *r = (rrc *) ctx; rrc *r = (rrc *) ctx;
r->liblte_rrc_log(str); r->liblte_rrc_log(str);