Merge branch 'next' into nas_cleanup

master
Pedro Alvarez 6 years ago
commit 48c897137f

@ -449,7 +449,10 @@ TEST(srslte_vec_convert_fi,
for (int i = 0; i < block_size; i++) {
gold = (short) ((x[i] * scale));
mse += cabsf((float)gold - (float) z[i]);
double err = cabsf((float)gold - (float) z[i]);
if (err > mse) {
mse = err;
}
}
free(x);
@ -471,7 +474,10 @@ TEST(srslte_vec_convert_if,
for (int i = 0; i < block_size; i++) {
gold = ((float)x[i]) * k;
mse += fabsf(gold - z[i]);
double err = cabsf((float)gold - (float) z[i]);
if (err > mse) {
mse = err;
}
}
free(x);

@ -309,6 +309,10 @@ private:
state_t run_state() {
pthread_mutex_lock(&inside);
cur_state = next_state;
if (state_setting) {
state_setting = false;
state_changing = true;
}
pthread_cond_broadcast(&cvar);
pthread_mutex_unlock(&inside);
return cur_state;
@ -322,6 +326,8 @@ private:
} else {
next_state = IDLE;
}
state_changing = false;
pthread_cond_broadcast(&cvar);
pthread_mutex_unlock(&inside);
}
void force_sfn_sync() {
@ -383,13 +389,16 @@ private:
pthread_cond_init(&cvar, NULL);
cur_state = IDLE;
next_state = IDLE;
state_setting = false;
state_changing = false;
}
private:
void go_state(state_t s) {
pthread_mutex_lock(&inside);
next_state = s;
while(cur_state != s) {
state_setting = true;
while(state_setting) {
pthread_cond_wait(&cvar, &inside);
}
pthread_mutex_unlock(&inside);
@ -398,12 +407,13 @@ private:
/* Waits until there is a call to set_state() and then run_state(). Returns when run_state() returns */
void wait_state_change(state_t prev_state) {
pthread_mutex_lock(&inside);
while(cur_state == prev_state) {
while(state_changing) {
pthread_cond_wait(&cvar, &inside);
}
pthread_mutex_unlock(&inside);
}
bool state_changing, state_setting;
state_t cur_state, next_state;
pthread_mutex_t inside, outside;
pthread_cond_t cvar;

@ -132,6 +132,7 @@ private:
uint8_t k_enb_star[32];
uint32_t current_ncc;
bool is_first_ncc;
bool initiated;

@ -135,7 +135,6 @@ void phch_recv::reset()
current_earfcn = -1;
sfn_p.reset();
search_p.reset();
phy_state.go_idle();
}

@ -272,6 +272,7 @@ void usim::generate_as_keys(uint8_t *k_asme,
k_up_int);
current_ncc = 0;
is_first_ncc = true;
}
void usim::generate_as_keys_ho(uint32_t pci,
@ -293,10 +294,11 @@ void usim::generate_as_keys_ho(uint32_t pci,
// Generate successive NH
while(current_ncc != (uint32_t) ncc) {
uint8_t *sync = NULL;
if (current_ncc) {
sync = nh;
} else {
if (is_first_ncc) {
sync = k_enb_initial;
is_first_ncc = false;
} else {
sync = nh;
}
// Generate NH
security_generate_nh(k_asme,

Loading…
Cancel
Save