Merge branch 'next' into nas_cleanup

This commit is contained in:
Pedro Alvarez 2018-08-29 18:45:20 +01:00
commit 48c897137f
5 changed files with 29 additions and 11 deletions

View File

@ -448,8 +448,11 @@ TEST(srslte_vec_convert_fi,
TEST_CALL(srslte_vec_convert_fi(x, scale, z, block_size))
for (int i = 0; i < block_size; i++) {
gold = (short) ((x[i] * scale));
mse += cabsf((float)gold - (float) z[i]);
gold = (short) ((x[i] * scale));
double err = cabsf((float)gold - (float) z[i]);
if (err > mse) {
mse = err;
}
}
free(x);
@ -470,8 +473,11 @@ TEST(srslte_vec_convert_if,
TEST_CALL(srslte_vec_convert_if(x, scale, z, block_size))
for (int i = 0; i < block_size; i++) {
gold = ((float)x[i]) * k;
mse += fabsf(gold - z[i]);
gold = ((float)x[i]) * k;
double err = cabsf((float)gold - (float) z[i]);
if (err > mse) {
mse = err;
}
}
free(x);

View File

@ -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;

View File

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

View File

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

View File

@ -271,7 +271,8 @@ void usim::generate_as_keys(uint8_t *k_asme,
k_up_enc,
k_up_int);
current_ncc = 0;
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,