mirror of https://github.com/PentHertz/srsLTE.git
Merge branch 'next' into nas_cleanup
This commit is contained in:
commit
48c897137f
|
@ -448,8 +448,11 @@ TEST(srslte_vec_convert_fi,
|
||||||
TEST_CALL(srslte_vec_convert_fi(x, scale, z, block_size))
|
TEST_CALL(srslte_vec_convert_fi(x, scale, z, block_size))
|
||||||
|
|
||||||
for (int i = 0; i < block_size; i++) {
|
for (int i = 0; i < block_size; i++) {
|
||||||
gold = (short) ((x[i] * scale));
|
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);
|
free(x);
|
||||||
|
@ -470,8 +473,11 @@ TEST(srslte_vec_convert_if,
|
||||||
TEST_CALL(srslte_vec_convert_if(x, scale, z, block_size))
|
TEST_CALL(srslte_vec_convert_if(x, scale, z, block_size))
|
||||||
|
|
||||||
for (int i = 0; i < block_size; i++) {
|
for (int i = 0; i < block_size; i++) {
|
||||||
gold = ((float)x[i]) * k;
|
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);
|
free(x);
|
||||||
|
|
|
@ -309,6 +309,10 @@ private:
|
||||||
state_t run_state() {
|
state_t run_state() {
|
||||||
pthread_mutex_lock(&inside);
|
pthread_mutex_lock(&inside);
|
||||||
cur_state = next_state;
|
cur_state = next_state;
|
||||||
|
if (state_setting) {
|
||||||
|
state_setting = false;
|
||||||
|
state_changing = true;
|
||||||
|
}
|
||||||
pthread_cond_broadcast(&cvar);
|
pthread_cond_broadcast(&cvar);
|
||||||
pthread_mutex_unlock(&inside);
|
pthread_mutex_unlock(&inside);
|
||||||
return cur_state;
|
return cur_state;
|
||||||
|
@ -322,6 +326,8 @@ private:
|
||||||
} else {
|
} else {
|
||||||
next_state = IDLE;
|
next_state = IDLE;
|
||||||
}
|
}
|
||||||
|
state_changing = false;
|
||||||
|
pthread_cond_broadcast(&cvar);
|
||||||
pthread_mutex_unlock(&inside);
|
pthread_mutex_unlock(&inside);
|
||||||
}
|
}
|
||||||
void force_sfn_sync() {
|
void force_sfn_sync() {
|
||||||
|
@ -383,13 +389,16 @@ private:
|
||||||
pthread_cond_init(&cvar, NULL);
|
pthread_cond_init(&cvar, NULL);
|
||||||
cur_state = IDLE;
|
cur_state = IDLE;
|
||||||
next_state = IDLE;
|
next_state = IDLE;
|
||||||
|
state_setting = false;
|
||||||
|
state_changing = false;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void go_state(state_t s) {
|
void go_state(state_t s) {
|
||||||
pthread_mutex_lock(&inside);
|
pthread_mutex_lock(&inside);
|
||||||
next_state = s;
|
next_state = s;
|
||||||
while(cur_state != s) {
|
state_setting = true;
|
||||||
|
while(state_setting) {
|
||||||
pthread_cond_wait(&cvar, &inside);
|
pthread_cond_wait(&cvar, &inside);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&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 */
|
/* 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) {
|
void wait_state_change(state_t prev_state) {
|
||||||
pthread_mutex_lock(&inside);
|
pthread_mutex_lock(&inside);
|
||||||
while(cur_state == prev_state) {
|
while(state_changing) {
|
||||||
pthread_cond_wait(&cvar, &inside);
|
pthread_cond_wait(&cvar, &inside);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&inside);
|
pthread_mutex_unlock(&inside);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool state_changing, state_setting;
|
||||||
state_t cur_state, next_state;
|
state_t cur_state, next_state;
|
||||||
pthread_mutex_t inside, outside;
|
pthread_mutex_t inside, outside;
|
||||||
pthread_cond_t cvar;
|
pthread_cond_t cvar;
|
||||||
|
|
|
@ -132,6 +132,7 @@ private:
|
||||||
uint8_t k_enb_star[32];
|
uint8_t k_enb_star[32];
|
||||||
|
|
||||||
uint32_t current_ncc;
|
uint32_t current_ncc;
|
||||||
|
bool is_first_ncc;
|
||||||
|
|
||||||
bool initiated;
|
bool initiated;
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,6 @@ void phch_recv::reset()
|
||||||
current_earfcn = -1;
|
current_earfcn = -1;
|
||||||
sfn_p.reset();
|
sfn_p.reset();
|
||||||
search_p.reset();
|
search_p.reset();
|
||||||
phy_state.go_idle();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,8 @@ void usim::generate_as_keys(uint8_t *k_asme,
|
||||||
k_up_enc,
|
k_up_enc,
|
||||||
k_up_int);
|
k_up_int);
|
||||||
|
|
||||||
current_ncc = 0;
|
current_ncc = 0;
|
||||||
|
is_first_ncc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usim::generate_as_keys_ho(uint32_t pci,
|
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
|
// Generate successive NH
|
||||||
while(current_ncc != (uint32_t) ncc) {
|
while(current_ncc != (uint32_t) ncc) {
|
||||||
uint8_t *sync = NULL;
|
uint8_t *sync = NULL;
|
||||||
if (current_ncc) {
|
if (is_first_ncc) {
|
||||||
sync = nh;
|
|
||||||
} else {
|
|
||||||
sync = k_enb_initial;
|
sync = k_enb_initial;
|
||||||
|
is_first_ncc = false;
|
||||||
|
} else {
|
||||||
|
sync = nh;
|
||||||
}
|
}
|
||||||
// Generate NH
|
// Generate NH
|
||||||
security_generate_nh(k_asme,
|
security_generate_nh(k_asme,
|
||||||
|
|
Loading…
Reference in New Issue