|
|
@ -46,23 +46,23 @@ namespace srsue {
|
|
|
|
Base functions
|
|
|
|
Base functions
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
rrc::rrc()
|
|
|
|
rrc::rrc()
|
|
|
|
: state(RRC_STATE_IDLE), drb_up(false) {}
|
|
|
|
: state(RRC_STATE_IDLE), drb_up(false) {}
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::liblte_rrc_log(char *str) {
|
|
|
|
void rrc::liblte_rrc_log(char *str) {
|
|
|
|
if (rrc_log) {
|
|
|
|
if (rrc_log) {
|
|
|
|
rrc_log->warning("[ASN]: %s\n", str);
|
|
|
|
rrc_log->warning("[ASN]: %s\n", str);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printf("[ASN]: %s\n", str);
|
|
|
|
printf("[ASN]: %s\n", str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::init(phy_interface_rrc *phy_,
|
|
|
|
void rrc::init(phy_interface_rrc *phy_,
|
|
|
|
mac_interface_rrc *mac_,
|
|
|
|
mac_interface_rrc *mac_,
|
|
|
|
rlc_interface_rrc *rlc_,
|
|
|
|
rlc_interface_rrc *rlc_,
|
|
|
|
pdcp_interface_rrc *pdcp_,
|
|
|
|
pdcp_interface_rrc *pdcp_,
|
|
|
@ -98,67 +98,67 @@ namespace srsue {
|
|
|
|
set_rrc_default();
|
|
|
|
set_rrc_default();
|
|
|
|
set_phy_default();
|
|
|
|
set_phy_default();
|
|
|
|
set_mac_default();
|
|
|
|
set_mac_default();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::stop() {
|
|
|
|
void rrc::stop() {
|
|
|
|
thread_running = false;
|
|
|
|
thread_running = false;
|
|
|
|
wait_thread_finish();
|
|
|
|
wait_thread_finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rrc_state_t rrc::get_state() {
|
|
|
|
rrc_state_t rrc::get_state() {
|
|
|
|
return state;
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::set_ue_category(int category) {
|
|
|
|
void rrc::set_ue_category(int category) {
|
|
|
|
if (category >= 1 && category <= 5) {
|
|
|
|
if (category >= 1 && category <= 5) {
|
|
|
|
ue_category = category;
|
|
|
|
ue_category = category;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
rrc_log->error("Unsupported UE category %d\n", category);
|
|
|
|
rrc_log->error("Unsupported UE category %d\n", category);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* PLMN selection, cell selection/reselection and acquisition of SI procedures
|
|
|
|
* PLMN selection, cell selection/reselection and acquisition of SI procedures
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
NAS interface
|
|
|
|
NAS interface
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t rrc::get_mcc() {
|
|
|
|
uint16_t rrc::get_mcc() {
|
|
|
|
if (current_cell) {
|
|
|
|
if (current_cell) {
|
|
|
|
if (current_cell->sib1.N_plmn_ids > 0) {
|
|
|
|
if (current_cell->sib1.N_plmn_ids > 0) {
|
|
|
|
return current_cell->sib1.plmn_id[0].id.mcc;
|
|
|
|
return current_cell->sib1.plmn_id[0].id.mcc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t rrc::get_mnc() {
|
|
|
|
uint16_t rrc::get_mnc() {
|
|
|
|
if (current_cell) {
|
|
|
|
if (current_cell) {
|
|
|
|
if (current_cell->sib1.N_plmn_ids > 0) {
|
|
|
|
if (current_cell->sib1.N_plmn_ids > 0) {
|
|
|
|
return current_cell->sib1.plmn_id[0].id.mnc;
|
|
|
|
return current_cell->sib1.plmn_id[0].id.mnc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::plmn_search() {
|
|
|
|
void rrc::plmn_search() {
|
|
|
|
rrc_log->info("Starting PLMN search procedure\n");
|
|
|
|
rrc_log->info("Starting PLMN search procedure\n");
|
|
|
|
state = RRC_STATE_PLMN_SELECTION;
|
|
|
|
state = RRC_STATE_PLMN_SELECTION;
|
|
|
|
phy->cell_search_start();
|
|
|
|
phy->cell_search_start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::plmn_select(LIBLTE_RRC_PLMN_IDENTITY_STRUCT plmn_id) {
|
|
|
|
void rrc::plmn_select(LIBLTE_RRC_PLMN_IDENTITY_STRUCT plmn_id) {
|
|
|
|
rrc_log->info("PLMN %s selected\n", plmn_id_to_c_str(plmn_id).c_str());
|
|
|
|
rrc_log->info("PLMN %s selected\n", plmn_id_to_c_str(plmn_id).c_str());
|
|
|
|
|
|
|
|
|
|
|
|
state = RRC_STATE_CELL_SELECTING;
|
|
|
|
state = RRC_STATE_CELL_SELECTING;
|
|
|
@ -169,9 +169,9 @@ namespace srsue {
|
|
|
|
last_selected_cell = -1;
|
|
|
|
last_selected_cell = -1;
|
|
|
|
|
|
|
|
|
|
|
|
select_next_cell_in_plmn();
|
|
|
|
select_next_cell_in_plmn();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::connect() {
|
|
|
|
void rrc::connect() {
|
|
|
|
pthread_mutex_lock(&mutex);
|
|
|
|
pthread_mutex_lock(&mutex);
|
|
|
|
if (RRC_STATE_CELL_SELECTED == state) {
|
|
|
|
if (RRC_STATE_CELL_SELECTED == state) {
|
|
|
|
rrc_log->info("RRC in IDLE state - sending connection request.\n");
|
|
|
|
rrc_log->info("RRC in IDLE state - sending connection request.\n");
|
|
|
@ -181,9 +181,9 @@ namespace srsue {
|
|
|
|
rrc_log->warning("Received connect() but cell is not selected\n");
|
|
|
|
rrc_log->warning("Received connect() but cell is not selected\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_mutex_unlock(&mutex);
|
|
|
|
pthread_mutex_unlock(&mutex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::select_next_cell_in_plmn() {
|
|
|
|
void rrc::select_next_cell_in_plmn() {
|
|
|
|
for (uint32_t i = last_selected_cell + 1; i < known_cells.size(); i++) {
|
|
|
|
for (uint32_t i = last_selected_cell + 1; i < known_cells.size(); i++) {
|
|
|
|
for (uint32_t j = 0; j < known_cells[i].sib1.N_plmn_ids; j++) {
|
|
|
|
for (uint32_t j = 0; j < known_cells[i].sib1.N_plmn_ids; j++) {
|
|
|
|
if (known_cells[i].sib1.plmn_id[j].id.mcc == selected_plmn_id.mcc ||
|
|
|
|
if (known_cells[i].sib1.plmn_id[j].id.mcc == selected_plmn_id.mcc ||
|
|
|
@ -223,13 +223,13 @@ namespace srsue {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
PHY interface
|
|
|
|
PHY interface
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) {
|
|
|
|
void rrc::cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) {
|
|
|
|
|
|
|
|
|
|
|
|
// find if cell_id-earfcn combination already exists
|
|
|
|
// find if cell_id-earfcn combination already exists
|
|
|
|
for (uint32_t i = 0; i < known_cells.size(); i++) {
|
|
|
|
for (uint32_t i = 0; i < known_cells.size(); i++) {
|
|
|
@ -263,10 +263,10 @@ namespace srsue {
|
|
|
|
cell.phy_cell.id, cell.phy_cell.nof_prb, cell.phy_cell.nof_ports,
|
|
|
|
cell.phy_cell.id, cell.phy_cell.nof_prb, cell.phy_cell.nof_ports,
|
|
|
|
cell.earfcn, cell.rsrp);
|
|
|
|
cell.earfcn, cell.rsrp);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Detection of physical layer problems (5.3.11.1)
|
|
|
|
// Detection of physical layer problems (5.3.11.1)
|
|
|
|
void rrc::out_of_sync() {
|
|
|
|
void rrc::out_of_sync() {
|
|
|
|
if (!mac_timers->get(t311)->is_running() && !mac_timers->get(t310)->is_running()) {
|
|
|
|
if (!mac_timers->get(t311)->is_running() && !mac_timers->get(t310)->is_running()) {
|
|
|
|
n310_cnt++;
|
|
|
|
n310_cnt++;
|
|
|
|
if (n310_cnt == N310) {
|
|
|
|
if (n310_cnt == N310) {
|
|
|
@ -276,10 +276,10 @@ namespace srsue {
|
|
|
|
rrc_log->info("Detected %d out-of-sync from PHY. Starting T310 timer\n", N310);
|
|
|
|
rrc_log->info("Detected %d out-of-sync from PHY. Starting T310 timer\n", N310);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Recovery of physical layer problems (5.3.11.2)
|
|
|
|
// Recovery of physical layer problems (5.3.11.2)
|
|
|
|
void rrc::in_sync() {
|
|
|
|
void rrc::in_sync() {
|
|
|
|
if (mac_timers->get(t310)->is_running()) {
|
|
|
|
if (mac_timers->get(t310)->is_running()) {
|
|
|
|
n311_cnt++;
|
|
|
|
n311_cnt++;
|
|
|
|
if (n311_cnt == N311) {
|
|
|
|
if (n311_cnt == N311) {
|
|
|
@ -288,12 +288,12 @@ namespace srsue {
|
|
|
|
rrc_log->info("Detected %d in-sync from PHY. Stopping T310 timer\n", N311);
|
|
|
|
rrc_log->info("Detected %d in-sync from PHY. Stopping T310 timer\n", N311);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
PDCP interface
|
|
|
|
PDCP interface
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
void rrc::write_pdu_bcch_bch(byte_buffer_t *pdu) {
|
|
|
|
void rrc::write_pdu_bcch_bch(byte_buffer_t *pdu) {
|
|
|
|
pool->deallocate(pdu);
|
|
|
|
pool->deallocate(pdu);
|
|
|
|
if (state == RRC_STATE_PLMN_SELECTION) {
|
|
|
|
if (state == RRC_STATE_PLMN_SELECTION) {
|
|
|
|
// Do we need to do something with BCH?
|
|
|
|
// Do we need to do something with BCH?
|
|
|
@ -301,9 +301,9 @@ namespace srsue {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
rrc_log->warning("Received BCCH BCH in incorrect state\n");
|
|
|
|
rrc_log->warning("Received BCCH BCH in incorrect state\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::write_pdu_bcch_dlsch(byte_buffer_t *pdu) {
|
|
|
|
void rrc::write_pdu_bcch_dlsch(byte_buffer_t *pdu) {
|
|
|
|
rrc_log->info_hex(pdu->msg, pdu->N_bytes, "BCCH DLSCH message received.");
|
|
|
|
rrc_log->info_hex(pdu->msg, pdu->N_bytes, "BCCH DLSCH message received.");
|
|
|
|
rrc_log->info("BCCH DLSCH message Stack latency: %ld us\n", pdu->get_latency_us());
|
|
|
|
rrc_log->info("BCCH DLSCH message Stack latency: %ld us\n", pdu->get_latency_us());
|
|
|
|
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT dlsch_msg;
|
|
|
|
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT dlsch_msg;
|
|
|
@ -378,11 +378,11 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Right now, this thread only controls System Information acquisition procedure
|
|
|
|
// Right now, this thread only controls System Information acquisition procedure
|
|
|
|
void rrc::run_thread() {
|
|
|
|
void rrc::run_thread() {
|
|
|
|
uint32_t tti;
|
|
|
|
uint32_t tti;
|
|
|
|
uint32_t si_win_start, si_win_len;
|
|
|
|
uint32_t si_win_start, si_win_len;
|
|
|
|
uint16_t period;
|
|
|
|
uint16_t period;
|
|
|
@ -427,7 +427,7 @@ namespace srsue {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
usleep(10000);
|
|
|
|
usleep(10000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -448,13 +448,13 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Connection control and establishment/reestablishment procedures
|
|
|
|
* Connection control and establishment/reestablishment procedures
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -463,10 +463,10 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
NAS interface
|
|
|
|
NAS interface
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::write_sdu(uint32_t lcid, byte_buffer_t *sdu) {
|
|
|
|
void rrc::write_sdu(uint32_t lcid, byte_buffer_t *sdu) {
|
|
|
|
rrc_log->info_hex(sdu->msg, sdu->N_bytes, "RX %s SDU", rb_id_text[lcid]);
|
|
|
|
rrc_log->info_hex(sdu->msg, sdu->N_bytes, "RX %s SDU", rb_id_text[lcid]);
|
|
|
|
|
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
switch (state) {
|
|
|
@ -480,44 +480,44 @@ namespace srsue {
|
|
|
|
rrc_log->error("SDU received from NAS while RRC state = %s", rrc_state_text[state]);
|
|
|
|
rrc_log->error("SDU received from NAS while RRC state = %s", rrc_state_text[state]);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
MAC interface
|
|
|
|
MAC interface
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
/* Reception of PUCCH/SRS release procedure (Section 5.3.13) */
|
|
|
|
/* Reception of PUCCH/SRS release procedure (Section 5.3.13) */
|
|
|
|
void rrc::release_pucch_srs() {
|
|
|
|
void rrc::release_pucch_srs() {
|
|
|
|
// Apply default configuration for PUCCH (CQI and SR) and SRS (release)
|
|
|
|
// Apply default configuration for PUCCH (CQI and SR) and SRS (release)
|
|
|
|
set_phy_default_pucch_srs();
|
|
|
|
set_phy_default_pucch_srs();
|
|
|
|
|
|
|
|
|
|
|
|
// Configure RX signals without pregeneration because default option is release
|
|
|
|
// Configure RX signals without pregeneration because default option is release
|
|
|
|
phy->configure_ul_params(true);
|
|
|
|
phy->configure_ul_params(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::ra_problem() {
|
|
|
|
void rrc::ra_problem() {
|
|
|
|
radio_link_failure();
|
|
|
|
radio_link_failure();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
GW interface
|
|
|
|
GW interface
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
bool rrc::is_connected() {
|
|
|
|
bool rrc::is_connected() {
|
|
|
|
return (RRC_STATE_CONNECTED == state);
|
|
|
|
return (RRC_STATE_CONNECTED == state);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool rrc::have_drb() {
|
|
|
|
bool rrc::have_drb() {
|
|
|
|
return drb_up;
|
|
|
|
return drb_up;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
PDCP interface
|
|
|
|
PDCP interface
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::write_pdu(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
void rrc::write_pdu(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
rrc_log->info_hex(pdu->msg, pdu->N_bytes, "TX %s PDU", rb_id_text[lcid]);
|
|
|
|
rrc_log->info_hex(pdu->msg, pdu->N_bytes, "TX %s PDU", rb_id_text[lcid]);
|
|
|
|
rrc_log->info("TX PDU Stack latency: %ld us\n", pdu->get_latency_us());
|
|
|
|
rrc_log->info("TX PDU Stack latency: %ld us\n", pdu->get_latency_us());
|
|
|
|
|
|
|
|
|
|
|
@ -534,10 +534,10 @@ namespace srsue {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::write_pdu_pcch(byte_buffer_t *pdu) {
|
|
|
|
void rrc::write_pdu_pcch(byte_buffer_t *pdu) {
|
|
|
|
if (pdu->N_bytes > 0 && pdu->N_bytes < SRSLTE_MAX_BUFFER_SIZE_BITS) {
|
|
|
|
if (pdu->N_bytes > 0 && pdu->N_bytes < SRSLTE_MAX_BUFFER_SIZE_BITS) {
|
|
|
|
rrc_log->info_hex(pdu->msg, pdu->N_bytes, "PCCH message received %d bytes\n", pdu->N_bytes);
|
|
|
|
rrc_log->info_hex(pdu->msg, pdu->N_bytes, "PCCH message received %d bytes\n", pdu->N_bytes);
|
|
|
|
rrc_log->info("PCCH message Stack latency: %ld us\n", pdu->get_latency_us());
|
|
|
|
rrc_log->info("PCCH message Stack latency: %ld us\n", pdu->get_latency_us());
|
|
|
@ -578,23 +578,23 @@ namespace srsue {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
RLC interface
|
|
|
|
RLC interface
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::max_retx_attempted() {
|
|
|
|
void rrc::max_retx_attempted() {
|
|
|
|
//TODO: Handle the radio link failure
|
|
|
|
//TODO: Handle the radio link failure
|
|
|
|
rrc_log->warning("Max RLC reTx attempted\n");
|
|
|
|
rrc_log->warning("Max RLC reTx attempted\n");
|
|
|
|
//radio_link_failure();
|
|
|
|
//radio_link_failure();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
Senders
|
|
|
|
Senders
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::send_con_request() {
|
|
|
|
void rrc::send_con_request() {
|
|
|
|
rrc_log->debug("Preparing RRC Connection Request\n");
|
|
|
|
rrc_log->debug("Preparing RRC Connection Request\n");
|
|
|
|
LIBLTE_RRC_UL_CCCH_MSG_STRUCT ul_ccch_msg;
|
|
|
|
LIBLTE_RRC_UL_CCCH_MSG_STRUCT ul_ccch_msg;
|
|
|
|
LIBLTE_RRC_S_TMSI_STRUCT s_tmsi;
|
|
|
|
LIBLTE_RRC_S_TMSI_STRUCT s_tmsi;
|
|
|
@ -635,11 +635,11 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
rrc_log->info("Sending RRC Connection Request on SRB0\n");
|
|
|
|
rrc_log->info("Sending RRC Connection Request on SRB0\n");
|
|
|
|
pdcp->write_sdu(RB_ID_SRB0, pdcp_buf);
|
|
|
|
pdcp->write_sdu(RB_ID_SRB0, pdcp_buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* RRC connection re-establishment procedure (5.3.7) */
|
|
|
|
/* RRC connection re-establishment procedure (5.3.7) */
|
|
|
|
void rrc::send_con_restablish_request() {
|
|
|
|
void rrc::send_con_restablish_request() {
|
|
|
|
|
|
|
|
|
|
|
|
srslte_cell_t cell;
|
|
|
|
srslte_cell_t cell;
|
|
|
|
phy->get_current_cell(&cell);
|
|
|
|
phy->get_current_cell(&cell);
|
|
|
@ -724,10 +724,10 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
rrc_log->info("Sending RRC Connection Resetablishment Request on SRB0\n");
|
|
|
|
rrc_log->info("Sending RRC Connection Resetablishment Request on SRB0\n");
|
|
|
|
pdcp->write_sdu(RB_ID_SRB0, pdcp_buf);
|
|
|
|
pdcp->write_sdu(RB_ID_SRB0, pdcp_buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::send_con_restablish_complete() {
|
|
|
|
void rrc::send_con_restablish_complete() {
|
|
|
|
rrc_log->debug("Preparing RRC Connection Reestablishment Complete\n");
|
|
|
|
rrc_log->debug("Preparing RRC Connection Reestablishment Complete\n");
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
|
|
|
|
|
|
|
@ -750,9 +750,9 @@ namespace srsue {
|
|
|
|
rrc_log->console("RRC Connected\n");
|
|
|
|
rrc_log->console("RRC Connected\n");
|
|
|
|
rrc_log->info("Sending RRC Connection Reestablishment Complete\n");
|
|
|
|
rrc_log->info("Sending RRC Connection Reestablishment Complete\n");
|
|
|
|
pdcp->write_sdu(RB_ID_SRB1, pdcp_buf);
|
|
|
|
pdcp->write_sdu(RB_ID_SRB1, pdcp_buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::send_con_setup_complete(byte_buffer_t *nas_msg) {
|
|
|
|
void rrc::send_con_setup_complete(byte_buffer_t *nas_msg) {
|
|
|
|
rrc_log->debug("Preparing RRC Connection Setup Complete\n");
|
|
|
|
rrc_log->debug("Preparing RRC Connection Setup Complete\n");
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
|
|
|
|
|
|
|
@ -780,9 +780,9 @@ namespace srsue {
|
|
|
|
rrc_log->console("RRC Connected\n");
|
|
|
|
rrc_log->console("RRC Connected\n");
|
|
|
|
rrc_log->info("Sending RRC Connection Setup Complete\n");
|
|
|
|
rrc_log->info("Sending RRC Connection Setup Complete\n");
|
|
|
|
pdcp->write_sdu(RB_ID_SRB1, pdcp_buf);
|
|
|
|
pdcp->write_sdu(RB_ID_SRB1, pdcp_buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::send_ul_info_transfer(uint32_t lcid, byte_buffer_t *sdu) {
|
|
|
|
void rrc::send_ul_info_transfer(uint32_t lcid, byte_buffer_t *sdu) {
|
|
|
|
rrc_log->debug("Preparing RX Info Transfer\n");
|
|
|
|
rrc_log->debug("Preparing RX Info Transfer\n");
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
|
|
|
|
|
|
|
@ -810,9 +810,9 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
rrc_log->info("Sending RX Info Transfer\n");
|
|
|
|
rrc_log->info("Sending RX Info Transfer\n");
|
|
|
|
pdcp->write_sdu(lcid, pdu);
|
|
|
|
pdcp->write_sdu(lcid, pdu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::send_security_mode_complete(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
void rrc::send_security_mode_complete(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
rrc_log->debug("Preparing Security Mode Complete\n");
|
|
|
|
rrc_log->debug("Preparing Security Mode Complete\n");
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
ul_dcch_msg.msg_type = LIBLTE_RRC_UL_DCCH_MSG_TYPE_SECURITY_MODE_COMPLETE;
|
|
|
|
ul_dcch_msg.msg_type = LIBLTE_RRC_UL_DCCH_MSG_TYPE_SECURITY_MODE_COMPLETE;
|
|
|
@ -831,9 +831,9 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
rrc_log->info("Sending Security Mode Complete\n");
|
|
|
|
rrc_log->info("Sending Security Mode Complete\n");
|
|
|
|
pdcp->write_sdu(lcid, pdu);
|
|
|
|
pdcp->write_sdu(lcid, pdu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::send_rrc_con_reconfig_complete(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
void rrc::send_rrc_con_reconfig_complete(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
rrc_log->debug("Preparing RRC Connection Reconfig Complete\n");
|
|
|
|
rrc_log->debug("Preparing RRC Connection Reconfig Complete\n");
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
|
|
|
|
|
|
|
@ -853,15 +853,15 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
rrc_log->info("Sending RRC Connection Reconfig Complete\n");
|
|
|
|
rrc_log->info("Sending RRC Connection Reconfig Complete\n");
|
|
|
|
pdcp->write_sdu(lcid, pdu);
|
|
|
|
pdcp->write_sdu(lcid, pdu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::enable_capabilities() {
|
|
|
|
void rrc::enable_capabilities() {
|
|
|
|
bool enable_ul_64 = ue_category >= 5 && current_cell->sib2.rr_config_common_sib.pusch_cnfg.enable_64_qam;
|
|
|
|
bool enable_ul_64 = ue_category >= 5 && current_cell->sib2.rr_config_common_sib.pusch_cnfg.enable_64_qam;
|
|
|
|
rrc_log->info("%s 64QAM PUSCH\n", enable_ul_64 ? "Enabling" : "Disabling");
|
|
|
|
rrc_log->info("%s 64QAM PUSCH\n", enable_ul_64 ? "Enabling" : "Disabling");
|
|
|
|
phy->set_config_64qam_en(enable_ul_64);
|
|
|
|
phy->set_config_64qam_en(enable_ul_64);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::send_rrc_ue_cap_info(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
void rrc::send_rrc_ue_cap_info(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
rrc_log->debug("Preparing UE Capability Info\n");
|
|
|
|
rrc_log->debug("Preparing UE Capability Info\n");
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
LIBLTE_RRC_UL_DCCH_MSG_STRUCT ul_dcch_msg;
|
|
|
|
|
|
|
|
|
|
|
@ -937,13 +937,13 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
rrc_log->info("Sending UE Capability Info\n");
|
|
|
|
rrc_log->info("Sending UE Capability Info\n");
|
|
|
|
pdcp->write_sdu(lcid, pdu);
|
|
|
|
pdcp->write_sdu(lcid, pdu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
Parsers
|
|
|
|
Parsers
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::parse_dl_ccch(byte_buffer_t *pdu) {
|
|
|
|
void rrc::parse_dl_ccch(byte_buffer_t *pdu) {
|
|
|
|
srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8);
|
|
|
|
srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8);
|
|
|
|
bit_buf.N_bits = pdu->N_bytes * 8;
|
|
|
|
bit_buf.N_bits = pdu->N_bytes * 8;
|
|
|
|
pool->deallocate(pdu);
|
|
|
|
pool->deallocate(pdu);
|
|
|
@ -981,9 +981,9 @@ namespace srsue {
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::parse_dl_dcch(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
void rrc::parse_dl_dcch(uint32_t lcid, byte_buffer_t *pdu) {
|
|
|
|
srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8);
|
|
|
|
srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8);
|
|
|
|
bit_buf.N_bits = pdu->N_bytes * 8;
|
|
|
|
bit_buf.N_bits = pdu->N_bytes * 8;
|
|
|
|
liblte_rrc_unpack_dl_dcch_msg((LIBLTE_BIT_MSG_STRUCT *) &bit_buf, &dl_dcch_msg);
|
|
|
|
liblte_rrc_unpack_dl_dcch_msg((LIBLTE_BIT_MSG_STRUCT *) &bit_buf, &dl_dcch_msg);
|
|
|
@ -1032,13 +1032,13 @@ namespace srsue {
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
Timer expiration callback
|
|
|
|
Timer expiration callback
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
void rrc::timer_expired(uint32_t timeout_id) {
|
|
|
|
void rrc::timer_expired(uint32_t timeout_id) {
|
|
|
|
if (timeout_id == t310) {
|
|
|
|
if (timeout_id == t310) {
|
|
|
|
rrc_log->info("Timer T310 expired: Radio Link Failure\n");
|
|
|
|
rrc_log->info("Timer T310 expired: Radio Link Failure\n");
|
|
|
|
radio_link_failure();
|
|
|
|
radio_link_failure();
|
|
|
@ -1053,13 +1053,13 @@ namespace srsue {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
rrc_log->error("Timeout from unknown timer id %d\n", timeout_id);
|
|
|
|
rrc_log->error("Timeout from unknown timer id %d\n", timeout_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
Helpers
|
|
|
|
Helpers
|
|
|
|
*******************************************************************************/
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::reset_ue() {
|
|
|
|
void rrc::reset_ue() {
|
|
|
|
phy->reset();
|
|
|
|
phy->reset();
|
|
|
|
mac->reset();
|
|
|
|
mac->reset();
|
|
|
|
pdcp->reset();
|
|
|
|
pdcp->reset();
|
|
|
@ -1068,9 +1068,9 @@ namespace srsue {
|
|
|
|
mac_timers->get(safe_reset_timer)->stop();
|
|
|
|
mac_timers->get(safe_reset_timer)->stop();
|
|
|
|
mac_timers->get(safe_reset_timer)->reset();
|
|
|
|
mac_timers->get(safe_reset_timer)->reset();
|
|
|
|
rrc_log->console("RRC Connection released.\n");
|
|
|
|
rrc_log->console("RRC Connection released.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::rrc_connection_release() {
|
|
|
|
void rrc::rrc_connection_release() {
|
|
|
|
pthread_mutex_lock(&mutex);
|
|
|
|
pthread_mutex_lock(&mutex);
|
|
|
|
drb_up = false;
|
|
|
|
drb_up = false;
|
|
|
|
state = RRC_STATE_IDLE;
|
|
|
|
state = RRC_STATE_IDLE;
|
|
|
@ -1083,15 +1083,15 @@ namespace srsue {
|
|
|
|
mac_timers->get(safe_reset_timer)->reset();
|
|
|
|
mac_timers->get(safe_reset_timer)->reset();
|
|
|
|
mac_timers->get(safe_reset_timer)->run();
|
|
|
|
mac_timers->get(safe_reset_timer)->run();
|
|
|
|
pthread_mutex_unlock(&mutex);
|
|
|
|
pthread_mutex_unlock(&mutex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::test_con_restablishment() {
|
|
|
|
void rrc::test_con_restablishment() {
|
|
|
|
printf("Testing connection Reestablishment\n");
|
|
|
|
printf("Testing connection Reestablishment\n");
|
|
|
|
send_con_restablish_request();
|
|
|
|
send_con_restablish_request();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Detection of radio link failure (5.3.11.3) */
|
|
|
|
/* Detection of radio link failure (5.3.11.3) */
|
|
|
|
void rrc::radio_link_failure() {
|
|
|
|
void rrc::radio_link_failure() {
|
|
|
|
// TODO: Generate and store failure report
|
|
|
|
// TODO: Generate and store failure report
|
|
|
|
|
|
|
|
|
|
|
|
rrc_log->warning("Detected Radio-Link Failure\n");
|
|
|
|
rrc_log->warning("Detected Radio-Link Failure\n");
|
|
|
@ -1101,15 +1101,15 @@ namespace srsue {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
send_con_restablish_request();
|
|
|
|
send_con_restablish_request();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Determine SI messages scheduling as in 36.331 5.2.3 Acquisition of an SI message
|
|
|
|
// Determine SI messages scheduling as in 36.331 5.2.3 Acquisition of an SI message
|
|
|
|
uint32_t rrc::sib_start_tti(uint32_t tti, uint32_t period, uint32_t x) {
|
|
|
|
uint32_t rrc::sib_start_tti(uint32_t tti, uint32_t period, uint32_t x) {
|
|
|
|
return (period * 10 * (1 + tti / (period * 10)) + x) % 10240; // the 1 means next opportunity
|
|
|
|
return (period * 10 * (1 + tti / (period * 10)) + x) % 10240; // the 1 means next opportunity
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::apply_sib2_configs(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2) {
|
|
|
|
void rrc::apply_sib2_configs(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2) {
|
|
|
|
|
|
|
|
|
|
|
|
// Apply RACH timeAlginmentTimer configuration
|
|
|
|
// Apply RACH timeAlginmentTimer configuration
|
|
|
|
mac_interface_rrc::mac_cfg_t cfg;
|
|
|
|
mac_interface_rrc::mac_cfg_t cfg;
|
|
|
@ -1177,10 +1177,10 @@ namespace srsue {
|
|
|
|
N310, N311, mac_timers->get(t301)->get_timeout(),
|
|
|
|
N310, N311, mac_timers->get(t301)->get_timeout(),
|
|
|
|
mac_timers->get(t310)->get_timeout(), mac_timers->get(t311)->get_timeout());
|
|
|
|
mac_timers->get(t310)->get_timeout(), mac_timers->get(t311)->get_timeout());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Go through all information elements and apply defaults (9.2.4) if not defined
|
|
|
|
// Go through all information elements and apply defaults (9.2.4) if not defined
|
|
|
|
void rrc::apply_phy_config_dedicated(LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *phy_cnfg, bool apply_defaults) {
|
|
|
|
void rrc::apply_phy_config_dedicated(LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *phy_cnfg, bool apply_defaults) {
|
|
|
|
// Get current configuration
|
|
|
|
// Get current configuration
|
|
|
|
LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *current_cfg;
|
|
|
|
LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *current_cfg;
|
|
|
|
phy_interface_rrc::phy_cfg_t c;
|
|
|
|
phy_interface_rrc::phy_cfg_t c;
|
|
|
@ -1312,9 +1312,9 @@ namespace srsue {
|
|
|
|
// Apply changes to PHY
|
|
|
|
// Apply changes to PHY
|
|
|
|
phy->configure_ul_params();
|
|
|
|
phy->configure_ul_params();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::apply_mac_config_dedicated(LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT *mac_cnfg, bool apply_defaults) {
|
|
|
|
void rrc::apply_mac_config_dedicated(LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT *mac_cnfg, bool apply_defaults) {
|
|
|
|
// Set Default MAC main configuration (9.2.2)
|
|
|
|
// Set Default MAC main configuration (9.2.2)
|
|
|
|
LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT default_cfg;
|
|
|
|
LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT default_cfg;
|
|
|
|
bzero(&default_cfg, sizeof(LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT));
|
|
|
|
bzero(&default_cfg, sizeof(LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT));
|
|
|
@ -1364,9 +1364,9 @@ namespace srsue {
|
|
|
|
liblte_rrc_prohibit_phr_timer_num[default_cfg.phr_cnfg.prohibit_phr_timer],
|
|
|
|
liblte_rrc_prohibit_phr_timer_num[default_cfg.phr_cnfg.prohibit_phr_timer],
|
|
|
|
liblte_rrc_dl_pathloss_change_num[default_cfg.phr_cnfg.dl_pathloss_change]);
|
|
|
|
liblte_rrc_dl_pathloss_change_num[default_cfg.phr_cnfg.dl_pathloss_change]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::apply_rr_config_dedicated(LIBLTE_RRC_RR_CONFIG_DEDICATED_STRUCT *cnfg) {
|
|
|
|
void rrc::apply_rr_config_dedicated(LIBLTE_RRC_RR_CONFIG_DEDICATED_STRUCT *cnfg) {
|
|
|
|
if (cnfg->phy_cnfg_ded_present) {
|
|
|
|
if (cnfg->phy_cnfg_ded_present) {
|
|
|
|
apply_phy_config_dedicated(&cnfg->phy_cnfg_ded, false);
|
|
|
|
apply_phy_config_dedicated(&cnfg->phy_cnfg_ded, false);
|
|
|
|
// Apply SR configuration to MAC
|
|
|
|
// Apply SR configuration to MAC
|
|
|
@ -1396,15 +1396,15 @@ namespace srsue {
|
|
|
|
// TODO: handle DRB modification
|
|
|
|
// TODO: handle DRB modification
|
|
|
|
add_drb(&cnfg->drb_to_add_mod_list[i]);
|
|
|
|
add_drb(&cnfg->drb_to_add_mod_list[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::handle_con_setup(LIBLTE_RRC_CONNECTION_SETUP_STRUCT *setup) {
|
|
|
|
void rrc::handle_con_setup(LIBLTE_RRC_CONNECTION_SETUP_STRUCT *setup) {
|
|
|
|
// Apply the Radio Resource configuration
|
|
|
|
// Apply the Radio Resource configuration
|
|
|
|
apply_rr_config_dedicated(&setup->rr_cnfg);
|
|
|
|
apply_rr_config_dedicated(&setup->rr_cnfg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Reception of RRCConnectionReestablishment by the UE 5.3.7.5 */
|
|
|
|
/* Reception of RRCConnectionReestablishment by the UE 5.3.7.5 */
|
|
|
|
void rrc::handle_con_reest(LIBLTE_RRC_CONNECTION_REESTABLISHMENT_STRUCT *setup) {
|
|
|
|
void rrc::handle_con_reest(LIBLTE_RRC_CONNECTION_REESTABLISHMENT_STRUCT *setup) {
|
|
|
|
mac_timers->get(t301)->stop();
|
|
|
|
mac_timers->get(t301)->stop();
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Restablish DRB1. Not done because never was suspended
|
|
|
|
// TODO: Restablish DRB1. Not done because never was suspended
|
|
|
@ -1415,10 +1415,10 @@ namespace srsue {
|
|
|
|
// TODO: Some security stuff here... is it necessary?
|
|
|
|
// TODO: Some security stuff here... is it necessary?
|
|
|
|
|
|
|
|
|
|
|
|
send_con_restablish_complete();
|
|
|
|
send_con_restablish_complete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::handle_rrc_con_reconfig(uint32_t lcid, LIBLTE_RRC_CONNECTION_RECONFIGURATION_STRUCT *reconfig,
|
|
|
|
void rrc::handle_rrc_con_reconfig(uint32_t lcid, LIBLTE_RRC_CONNECTION_RECONFIGURATION_STRUCT *reconfig,
|
|
|
|
byte_buffer_t *pdu) {
|
|
|
|
byte_buffer_t *pdu) {
|
|
|
|
uint32_t i;
|
|
|
|
uint32_t i;
|
|
|
|
|
|
|
|
|
|
|
@ -1443,9 +1443,9 @@ namespace srsue {
|
|
|
|
nas_sdu->N_bytes = reconfig->ded_info_nas_list[i].N_bytes;
|
|
|
|
nas_sdu->N_bytes = reconfig->ded_info_nas_list[i].N_bytes;
|
|
|
|
nas->write_pdu(lcid, nas_sdu);
|
|
|
|
nas->write_pdu(lcid, nas_sdu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::add_srb(LIBLTE_RRC_SRB_TO_ADD_MOD_STRUCT *srb_cnfg) {
|
|
|
|
void rrc::add_srb(LIBLTE_RRC_SRB_TO_ADD_MOD_STRUCT *srb_cnfg) {
|
|
|
|
// Setup PDCP
|
|
|
|
// Setup PDCP
|
|
|
|
pdcp->add_bearer(srb_cnfg->srb_id);
|
|
|
|
pdcp->add_bearer(srb_cnfg->srb_id);
|
|
|
|
if (RB_ID_SRB2 == srb_cnfg->srb_id)
|
|
|
|
if (RB_ID_SRB2 == srb_cnfg->srb_id)
|
|
|
@ -1488,9 +1488,9 @@ namespace srsue {
|
|
|
|
|
|
|
|
|
|
|
|
srbs[srb_cnfg->srb_id] = *srb_cnfg;
|
|
|
|
srbs[srb_cnfg->srb_id] = *srb_cnfg;
|
|
|
|
rrc_log->info("Added radio bearer %s\n", rb_id_text[srb_cnfg->srb_id]);
|
|
|
|
rrc_log->info("Added radio bearer %s\n", rb_id_text[srb_cnfg->srb_id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::add_drb(LIBLTE_RRC_DRB_TO_ADD_MOD_STRUCT *drb_cnfg) {
|
|
|
|
void rrc::add_drb(LIBLTE_RRC_DRB_TO_ADD_MOD_STRUCT *drb_cnfg) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!drb_cnfg->pdcp_cnfg_present ||
|
|
|
|
if (!drb_cnfg->pdcp_cnfg_present ||
|
|
|
|
!drb_cnfg->rlc_cnfg_present ||
|
|
|
|
!drb_cnfg->rlc_cnfg_present ||
|
|
|
@ -1539,18 +1539,18 @@ namespace srsue {
|
|
|
|
drbs[lcid] = *drb_cnfg;
|
|
|
|
drbs[lcid] = *drb_cnfg;
|
|
|
|
drb_up = true;
|
|
|
|
drb_up = true;
|
|
|
|
rrc_log->info("Added radio bearer %s\n", rb_id_text[lcid]);
|
|
|
|
rrc_log->info("Added radio bearer %s\n", rb_id_text[lcid]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::release_drb(uint8_t lcid) {
|
|
|
|
void rrc::release_drb(uint8_t lcid) {
|
|
|
|
// TODO
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************
|
|
|
|
/**************************
|
|
|
|
* DEFAULT VALUES Section 9
|
|
|
|
* DEFAULT VALUES Section 9
|
|
|
|
****************************/
|
|
|
|
****************************/
|
|
|
|
|
|
|
|
|
|
|
|
// PHY CONFIG DEDICATED Defaults (3GPP 36.331 v10 9.2.4)
|
|
|
|
// PHY CONFIG DEDICATED Defaults (3GPP 36.331 v10 9.2.4)
|
|
|
|
void rrc::set_phy_default_pucch_srs() {
|
|
|
|
void rrc::set_phy_default_pucch_srs() {
|
|
|
|
|
|
|
|
|
|
|
|
phy_interface_rrc::phy_cfg_t current_cfg;
|
|
|
|
phy_interface_rrc::phy_cfg_t current_cfg;
|
|
|
|
phy->get_config(¤t_cfg);
|
|
|
|
phy->get_config(¤t_cfg);
|
|
|
@ -1566,23 +1566,23 @@ namespace srsue {
|
|
|
|
LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT cfg;
|
|
|
|
LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT cfg;
|
|
|
|
bzero(&cfg, sizeof(LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT));
|
|
|
|
bzero(&cfg, sizeof(LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT));
|
|
|
|
mac->set_config_sr(&cfg);
|
|
|
|
mac->set_config_sr(&cfg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::set_phy_default() {
|
|
|
|
void rrc::set_phy_default() {
|
|
|
|
LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT defaults;
|
|
|
|
LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT defaults;
|
|
|
|
bzero(&defaults, sizeof(LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT));
|
|
|
|
bzero(&defaults, sizeof(LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT));
|
|
|
|
apply_phy_config_dedicated(&defaults, true);
|
|
|
|
apply_phy_config_dedicated(&defaults, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::set_mac_default() {
|
|
|
|
void rrc::set_mac_default() {
|
|
|
|
apply_mac_config_dedicated(NULL, true);
|
|
|
|
apply_mac_config_dedicated(NULL, true);
|
|
|
|
LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT sr_cfg;
|
|
|
|
LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT sr_cfg;
|
|
|
|
bzero(&sr_cfg, sizeof(LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT));
|
|
|
|
bzero(&sr_cfg, sizeof(LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT));
|
|
|
|
sr_cfg.setup_present = false;
|
|
|
|
sr_cfg.setup_present = false;
|
|
|
|
mac->set_config_sr(&sr_cfg);
|
|
|
|
mac->set_config_sr(&sr_cfg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rrc::set_rrc_default() {
|
|
|
|
void rrc::set_rrc_default() {
|
|
|
|
N310 = 1;
|
|
|
|
N310 = 1;
|
|
|
|
N311 = 1;
|
|
|
|
N311 = 1;
|
|
|
|
t301 = mac_timers->get_unique_id();
|
|
|
|
t301 = mac_timers->get_unique_id();
|
|
|
@ -1592,6 +1592,6 @@ namespace srsue {
|
|
|
|
mac_timers->get(t310)->set(this, 1000);
|
|
|
|
mac_timers->get(t310)->set(this, 1000);
|
|
|
|
mac_timers->get(t311)->set(this, 1000);
|
|
|
|
mac_timers->get(t311)->set(this, 1000);
|
|
|
|
mac_timers->get(safe_reset_timer)->set(this, 10);
|
|
|
|
mac_timers->get(safe_reset_timer)->set(this, 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace srsue
|
|
|
|
} // namespace srsue
|
|
|
|