mirror of https://github.com/PentHertz/srsLTE.git
Moved PRACH and SR procedures to srsLTE
This commit is contained in:
parent
8d45cf6938
commit
414643174b
|
@ -131,7 +131,6 @@ void phy::set_param(phy_params::phy_param_t param, int64_t value) {
|
|||
params_db.set_param((uint32_t) param, value);
|
||||
}
|
||||
|
||||
|
||||
// FIXME: Add PRACH power control
|
||||
bool phy::send_prach(uint32_t preamble_idx) {
|
||||
return send_prach(preamble_idx, -1, 0);
|
||||
|
@ -158,32 +157,8 @@ void phy::send_sr(bool enable)
|
|||
if (enable) {
|
||||
// Get sr_periodicity and sr_N_offset from table 10.1-5
|
||||
uint32_t I_sr = params_db.get_param(phy_params::SR_CONFIG_INDEX);
|
||||
if (I_sr < 5) {
|
||||
sr_periodicity = 5;
|
||||
sr_N_offset = I_sr;
|
||||
} else if (I_sr < 15) {
|
||||
sr_periodicity = 10;
|
||||
sr_N_offset = I_sr-5;
|
||||
} else if (I_sr < 35) {
|
||||
sr_periodicity = 20;
|
||||
sr_N_offset = I_sr-15;
|
||||
} else if (I_sr < 75) {
|
||||
sr_periodicity = 40;
|
||||
sr_N_offset = I_sr-35;
|
||||
} else if (I_sr < 155) {
|
||||
sr_periodicity = 80;
|
||||
sr_N_offset = I_sr-75;
|
||||
} else if (I_sr < 157) {
|
||||
sr_periodicity = 2;
|
||||
sr_N_offset = I_sr-155;
|
||||
} else if (I_sr == 157) {
|
||||
sr_periodicity = 1;
|
||||
sr_N_offset = I_sr-157;
|
||||
} else {
|
||||
Error("Invalid I_sr=%d\n", I_sr);
|
||||
return;
|
||||
}
|
||||
sr_n_pucch = params_db.get_param(phy_params::SR_PUCCH_RESINDEX);
|
||||
srslte_ue_ul_sr_config(I_sr, &sr_periodicity, &sr_N_offset);
|
||||
Info("SR I_sr=%d, periodicity=%d, N_offset=%d, n_pucch=%d\n", I_sr, sr_periodicity, sr_N_offset, sr_n_pucch);
|
||||
sr_tx_tti = get_current_tti();
|
||||
}
|
||||
|
|
|
@ -109,25 +109,11 @@ bool prach::is_ready_to_send(uint32_t current_tti_) {
|
|||
if (initiated && preamble_idx >= 0 && preamble_idx < 64 && params_db != NULL) {
|
||||
// consider the number of subframes the transmission must be anticipated
|
||||
uint32_t current_tti = (current_tti_ + tx_advance_sf)%10240;
|
||||
|
||||
// Get SFN and sf_idx from the PRACH configuration index
|
||||
uint32_t config_idx = (uint32_t) params_db->get_param(phy_params::PRACH_CONFIG_INDEX);
|
||||
srslte_prach_sfn_t prach_sfn = srslte_prach_get_sfn(config_idx);
|
||||
|
||||
if (prach_sfn == SRSLTE_PRACH_SFN_EVEN && ((current_tti/10)%2)==0 ||
|
||||
prach_sfn == SRSLTE_PRACH_SFN_ANY)
|
||||
{
|
||||
srslte_prach_sf_config_t sf_config;
|
||||
srslte_prach_sf_config(config_idx, &sf_config);
|
||||
for (int i=0;i<sf_config.nof_sf;i++) {
|
||||
if ((current_tti%10) == sf_config.sf[i] && allowed_subframe == -1 ||
|
||||
((current_tti%10) == sf_config.sf[i] && (current_tti%10) == allowed_subframe))
|
||||
{
|
||||
Info("PRACH Buffer: Ready to send at tti: %d (now is %d)\n", current_tti, current_tti_);
|
||||
transmitted_tti = current_tti;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (srslte_prach_send_tti(config_idx, current_tti, allowed_subframe)) {
|
||||
Info("PRACH Buffer: Ready to send at tti: %d (now is %d)\n", current_tti, current_tti_);
|
||||
transmitted_tti = current_tti;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -103,6 +103,10 @@ SRSLTE_API uint32_t srslte_prach_get_preamble_format(uint32_t config_idx);
|
|||
|
||||
SRSLTE_API srslte_prach_sfn_t srslte_prach_get_sfn(uint32_t config_idx);
|
||||
|
||||
SRSLTE_API bool srslte_prach_send_tti(uint32_t config_idx,
|
||||
uint32_t current_tti,
|
||||
int allowed_subframe);
|
||||
|
||||
SRSLTE_API void srslte_prach_sf_config(uint32_t config_idx,
|
||||
srslte_prach_sf_config_t *sf_config);
|
||||
|
||||
|
|
|
@ -184,6 +184,30 @@ srslte_prach_sfn_t srslte_prach_get_sfn(uint32_t config_idx) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Returns true if current_tti is a valid opportunity for PRACH transmission and the is an allowed subframe,
|
||||
* or allowed_subframe == -1
|
||||
*/
|
||||
bool srslte_prach_send_tti(uint32_t config_idx, uint32_t current_tti, int allowed_subframe) {
|
||||
// Get SFN and sf_idx from the PRACH configuration index
|
||||
srslte_prach_sfn_t prach_sfn = srslte_prach_get_sfn(config_idx);
|
||||
|
||||
if ((prach_sfn == SRSLTE_PRACH_SFN_EVEN && ((current_tti/10)%2)==0) ||
|
||||
prach_sfn == SRSLTE_PRACH_SFN_ANY)
|
||||
{
|
||||
srslte_prach_sf_config_t sf_config;
|
||||
srslte_prach_sf_config(config_idx, &sf_config);
|
||||
for (int i=0;i<sf_config.nof_sf;i++) {
|
||||
if (((current_tti%10) == sf_config.sf[i] && allowed_subframe == -1) ||
|
||||
((current_tti%10) == sf_config.sf[i] && (current_tti%10) == allowed_subframe))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void srslte_prach_sf_config(uint32_t config_idx, srslte_prach_sf_config_t *sf_config) {
|
||||
memcpy(sf_config, &prach_sf_config[config_idx%16], sizeof(srslte_prach_sf_config_t));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue