Fixed bug in previous commit

master
Ismael Gomez 7 years ago
parent bf691e8c65
commit e59822f9a9

@ -309,10 +309,11 @@ private:
CELL_SELECT, CELL_SELECT,
CELL_RESELECT, CELL_RESELECT,
CELL_MEASURE, CELL_MEASURE,
CELL_CAMP CELL_CAMP,
IDLE_RX
} phy_state; } phy_state;
bool is_in_idle; bool is_in_idle, is_in_idle_rx;
// Sampling rate mode (find is 1.96 MHz, camp is the full cell BW) // Sampling rate mode (find is 1.96 MHz, camp is the full cell BW)
enum { enum {

@ -380,22 +380,32 @@ bool phch_recv::cell_handover(srslte_cell_t cell)
log_h->info("Cell HO: Waiting pending PHICH\n"); log_h->info("Cell HO: Waiting pending PHICH\n");
} }
bool ret; bool ret = false;
this->cell = cell; this->cell = cell;
Info("Cell HO: Stopping sync with current cell\n"); Info("Cell HO: Stopping sync with current cell\n");
worker_com->reset_ul(); worker_com->reset_ul();
//stop_sync(); phy_state = IDLE_RX;
cnt = 0;
while(!is_in_idle_rx && cnt<20) {
usleep(1000);
cnt++;
}
if (is_in_idle_rx) {
Info("Cell HO: Reconfiguring cell\n"); Info("Cell HO: Reconfiguring cell\n");
if (set_cell()) { if (set_cell()) {
Info("Cell HO: Synchronizing with new cell\n");
//resync_sfn(true, true); //resync_sfn(true, true);
sfn_p.reset(); sfn_p.reset();
phy_state = CELL_RESELECT; phy_state = CELL_RESELECT;
Info("Cell HO: Synchronizing with new cell\n");
ret = true; ret = true;
} else { } else {
log_h->error("Cell HO: Configuring cell PCI=%d\n", cell.id); log_h->error("Cell HO: Configuring cell PCI=%d\n", cell.id);
ret = false; ret = false;
} }
} else {
log_h->error("Cell HO: Could not stop sync\n");
ret = false;
}
return ret; return ret;
} }
@ -574,6 +584,7 @@ void phch_recv::run_thread()
uint32_t sf_idx = 0; uint32_t sf_idx = 0;
phy_state = IDLE; phy_state = IDLE;
is_in_idle = true; is_in_idle = true;
is_in_idle_rx = false;
while (running) while (running)
{ {
@ -582,6 +593,10 @@ void phch_recv::run_thread()
Debug("SYNC: state=%d\n", phy_state); Debug("SYNC: state=%d\n", phy_state);
} }
if (phy_state != IDLE_RX) {
is_in_idle_rx = false;
}
log_h->step(tti); log_h->step(tti);
log_phy_lib_h->step(tti); log_phy_lib_h->step(tti);
@ -746,6 +761,23 @@ void phch_recv::run_thread()
is_in_idle = true; is_in_idle = true;
usleep(1000); usleep(1000);
break; break;
case IDLE_RX:
if (!worker) {
worker = (phch_worker *) workers_pool->wait_worker(tti);
}
is_in_idle_rx = true;
if (worker) {
for (uint32_t i = 0; i < SRSLTE_MAX_PORTS; i++) {
buffer[i] = worker->get_buffer(i);
}
if (!radio_h->rx_now(buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb), NULL)) {
Error("SYNC: Receiving from radio while in IDLE_RX\n");
}
} else {
// wait_worker() only returns NULL if it's being closed. Quit now to avoid unnecessary loops here
running = false;
}
break;
} }
// Increase TTI counter and trigger MAC clock (lower priority) // Increase TTI counter and trigger MAC clock (lower priority)

Loading…
Cancel
Save