Commit e8834e96 authored by Raymond Knopp's avatar Raymond Knopp

added FAPI interfaces int gNB prach receiver functions...

added FAPI interfaces int gNB prach receiver functions (rx_nr_prach,rx_nr_prach_ru) and in indication to MAC.
parent 498ce5fe
......@@ -165,14 +165,14 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus||
gNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs ||
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs ||
gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles ||
gNB->UL_INFO.rach_ind.number_of_pdus ||
gNB->UL_INFO.cqi_ind.number_of_cqis
) {
LOG_D(PHY, "UL_info[rx_ind:%05d:%d harqs:%05d:%d crcs:%05d:%d preambles:%05d:%d cqis:%d] RX:%04d%d TX:%04d%d \n",
LOG_D(PHY, "UL_info[rx_ind:%05d:%d harqs:%05d:%d crcs:%05d:%d rach_pdus:%0d.%d:%d cqis:%d] RX:%04d%d TX:%04d%d \n",
NFAPI_SFNSF2DEC(gNB->UL_INFO.rx_ind.sfn_sf), gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus,
NFAPI_SFNSF2DEC(gNB->UL_INFO.harq_ind.sfn_sf), gNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs,
NFAPI_SFNSF2DEC(gNB->UL_INFO.crc_ind.sfn_sf), gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs,
NFAPI_SFNSF2DEC(gNB->UL_INFO.rach_ind.sfn_sf), gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles,
gNB->UL_INFO.rach_ind.sfn, gNB->UL_INFO.rach_ind.slot,gNB->UL_INFO.rach_ind.number_of_pdus,
gNB->UL_INFO.cqi_ind.number_of_cqis,
frame_rx, slot_rx,
frame_tx, slot_tx);
......
......@@ -85,7 +85,7 @@ typedef enum {
NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION= 0X86,
NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION= 0X87,
NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION= 0X88,
NFAPI_NR_PHY_MSG_TYPE_PACH_INDICATION= 0X89
NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89
//RESERVED 0X8a ~ 0xff
} nfapi_nr_phy_msg_type_e;
......
This diff is collapsed.
......@@ -112,6 +112,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
uint16_t N_RB);
void rx_nr_prach(PHY_VARS_gNB *gNB,
nfapi_nr_prach_pdu_t *prach_pdu,
int frame,
int subframe,
uint16_t *max_preamble,
......@@ -120,6 +121,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
);
void rx_nr_prach_ru(RU_t *ru,
nfapi_nr_prach_pdu_t *prach_pdu,
int frame,
int subframe);
......
......@@ -214,6 +214,7 @@ uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx);
uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
void rx_nr_prach(PHY_VARS_gNB *gNB,
nfapi_nr_prach_pdu_t *prach_pdu,
int frame,
int subframe,
uint16_t *max_preamble,
......
......@@ -38,7 +38,7 @@
#include "openairinterface5g_limits.h"
#include "PHY/TOOLS/time_meas.h"
#include "defs_common.h"
#include "nfapi_nr_interface_scf.h"
#define MAX_BANDS_PER_RRU 4
#define MAX_RRU_CONFIG_SIZE 1024
......@@ -480,6 +480,8 @@ typedef struct RU_t_s {
int att_tx;
/// flag to indicate precoding operation in RU
int do_precoding;
/// FAPI confiuration
nfapi_nr_config_request_scf_t config;
/// Frame parameters
struct LTE_DL_FRAME_PARMS *frame_parms;
struct NR_DL_FRAME_PARMS *nr_frame_parms;
......
......@@ -582,6 +582,9 @@ typedef struct {
int prach_I0;
} PHY_MEASUREMENTS_gNB;
#define MAX_NUM_NR_RX_RACH_PDUS 4
#define MAX_NUM_NR_RX_PRACH_PREAMBLES 4
/// Top-level PHY Data Structure for gNB
typedef struct PHY_VARS_gNB_s {
/// Module ID indicator for this instance
......@@ -620,7 +623,9 @@ typedef struct PHY_VARS_gNB_s {
/// NFAPI CQI information (raw component)
nfapi_cqi_indication_raw_pdu_t cqi_raw_pdu_list[NFAPI_CQI_IND_MAX_PDU];
/// NFAPI PRACH information
nfapi_preamble_pdu_t preamble_list[MAX_NUM_RX_PRACH_PREAMBLES];
nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS];
/// NFAPI PRACH information
nfapi_nr_prach_indication_preamble_t preamble_list[MAX_NUM_NR_RX_PRACH_PREAMBLES];
//Sched_Rsp_t Sched_INFO;
nfapi_nr_ul_tti_request_t UL_tti_req;
......
......@@ -52,12 +52,14 @@ extern uint32_t nfapi_mode;
extern int oai_nfapi_nr_rach_ind(nfapi_rach_indication_t *rach_ind);
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int subframe) {
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_prach_pdu_t *prach_pdu) {
uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
uint16_t i;
gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles=0;
gNB->UL_INFO.rach_ind.number_of_pdus=0;
RU_t *ru;
int aa=0;
......@@ -75,16 +77,18 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int subframe) {
}
}
rx_nr_prach(gNB,
prach_pdu,
frame,
subframe,
slot,
&max_preamble[0],
&max_preamble_energy[0],
&max_preamble_delay[0]
);
LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
frame,subframe,
LOG_D(PHY,"[RAPROC] Frame %d, slot %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
frame,slot,
max_preamble[0],
max_preamble_energy[0]/10,
max_preamble_delay[0],
......@@ -93,49 +97,42 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int subframe) {
if ((gNB->prach_energy_counter == 100) &&
(max_preamble_energy[0] > gNB->measurements.prach_I0+100)) {
LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
gNB->Mod_id,
frame,
subframe,
slot,
max_preamble[0],
max_preamble_energy[0]/10,
max_preamble_energy[0]%10,
max_preamble_delay[0]);
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(gNB->Mod_id), T_INT(frame), T_INT(subframe),
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(gNB->Mod_id), T_INT(frame), T_INT(slot),
T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 1;
gNB->UL_INFO.rach_ind.rach_indication_body.preamble_list = &gNB->preamble_list[0];
gNB->UL_INFO.rach_ind.rach_indication_body.tl.tag = NFAPI_RACH_INDICATION_BODY_TAG;
gNB->UL_INFO.rach_ind.header.message_id = NFAPI_RACH_INDICATION;
gNB->UL_INFO.rach_ind.sfn_sf = frame<<4 | subframe;
gNB->preamble_list[0].preamble_rel8.tl.tag = NFAPI_PREAMBLE_REL8_TAG;
gNB->preamble_list[0].preamble_rel8.timing_advance = max_preamble_delay[0];
gNB->preamble_list[0].preamble_rel8.preamble = max_preamble[0];
gNB->preamble_list[0].preamble_rel8.rnti = 1+subframe; // note: fid is implicitly 0 here
gNB->preamble_list[0].instance_length = 0; //don't know exactly what this is
gNB->UL_INFO.rach_ind.number_of_pdus = 1;
gNB->UL_INFO.rach_ind.pdu_list = &gNB->prach_pdu_indication_list[0];
gNB->UL_INFO.rach_ind.sfn = frame;
gNB->UL_INFO.rach_ind.slot = slot;
if (nfapi_mode == 1) { // If NFAPI PNF then we need to send the message to the VNF
gNB->prach_pdu_indication_list[0].phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value;
gNB->prach_pdu_indication_list[0].symbol_index = prach_pdu->prach_start_symbol;
gNB->prach_pdu_indication_list[0].slot_index = slot;
gNB->prach_pdu_indication_list[0].freq_index = 0; // single frequency for now
gNB->prach_pdu_indication_list[0].avg_rssi = (max_preamble_energy[0]<631) ? (128+(max_preamble_energy[0]/5)) : 254;
gNB->prach_pdu_indication_list[0].avg_snr = 0xff; // invalid for now
LOG_D(PHY,"Filling NFAPI indication for NR RACH : SFN_SF:%d TA %d, Preamble %d, rnti %x\n",
NFAPI_SFNSF2DEC(gNB->UL_INFO.rach_ind.sfn_sf),
gNB->preamble_list[0].preamble_rel8.timing_advance,
gNB->preamble_list[0].preamble_rel8.preamble,
gNB->preamble_list[0].preamble_rel8.rnti);
AssertFatal(1==0,"shouldn't be here yet..\n");
//oai_nfapi_nr_rach_ind(&gNB->UL_INFO.rach_ind);
gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 0;
gNB->prach_pdu_indication_list[0].num_preamble = 1;
gNB->prach_pdu_indication_list[0].preamble_list = gNB->preamble_list;
gNB->prach_pdu_indication_list[0].preamble_list[0].preamble_index = max_preamble[0];
gNB->prach_pdu_indication_list[0].preamble_list[0].timing_advance = max_preamble_delay[0];
gNB->prach_pdu_indication_list[0].preamble_list[0].preamble_pwr = 0xffffffff;
}
} // max_preamble_energy > prach_I0 + 100
else {
gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10);
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
if (gNB->prach_energy_counter < 100) gNB->prach_energy_counter++;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
}
......@@ -57,8 +57,9 @@ void nr_initiate_ra_proc(module_id_t module_idP,
frame_t frameP,
sub_frame_t slotP,
uint16_t preamble_index,
int16_t timing_offset,
uint16_t ra_rnti){
int16_t timing_offset){
uint16_t ra_rnti=157;
uint8_t i;
uint16_t msg2_frame = frameP, msg2_slot = slotP;
int offset;
......@@ -186,14 +187,6 @@ void nr_generate_Msg2(module_id_t module_idP,
if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) {
// todo
// Allocate 4 PRBS starting in RB 0
// first_rb = 0;
// vrb_map[first_rb] = 1;
// vrb_map[first_rb + 1] = 1;
// vrb_map[first_rb + 2] = 1;
// vrb_map[first_rb + 3] = 1;
nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body;
nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
......
......@@ -90,11 +90,7 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP);
@param rach_resource type (0=non BL/CE,1 CE level 0,2 CE level 1, 3 CE level 2,4 CE level 3)
*/
void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP,
uint16_t preamble_index, int16_t timing_offset, uint16_t rnti
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
, uint8_t rach_resource_type
#endif
);
uint16_t preamble_index, int16_t timing_offset);
void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP);
......
......@@ -53,18 +53,23 @@ extern uint8_t nfapi_mode;
extern uint16_t sf_ahead;
void handle_nr_rach(NR_UL_IND_t *UL_info) {
if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) {
AssertFatal(UL_info->rach_ind.rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n");
UL_info->rach_ind.rach_indication_body.number_of_preambles=0;
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SF:%d\n",UL_info->frame,UL_info->slot, NFAPI_SFNSF2DEC(UL_info->rach_ind.sfn_sf));
if (UL_info->rach_ind.number_of_pdus>0) {
AssertFatal(UL_info->rach_ind.number_of_pdus==1,"More than 1 RACH pdu not supported\n");
UL_info->rach_ind.number_of_pdus=0;
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot);
if (UL_info->rach_ind.pdu_list[0].num_preamble>0)
AssertFatal(UL_info->rach_ind.pdu_list[0].num_preamble==1,
"More than 1 preamble not supported\n");
nr_initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rach_ind.sfn_sf),
NFAPI_SFNSF2SF(UL_info->rach_ind.sfn_sf),
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble,
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti);
UL_info->rach_ind.sfn,
UL_info->rach_ind.slot,
UL_info->rach_ind.pdu_list[0].preamble_list[0].preamble_index,
UL_info->rach_ind.pdu_list[0].preamble_list[0].timing_advance);
}
}
......@@ -220,11 +225,11 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
NR_Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id];
NR_IF_Module_t *ifi = if_inst[module_id];
gNB_MAC_INST *mac = RC.nrmac[module_id];
LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n",
LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d rach_pdus:%d sr_ind:%d]\n",
UL_info->frame,UL_info->slot,
module_id,CC_id,
UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis,
UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs);
UL_info->rach_ind.number_of_pdus, UL_info->sr_ind.sr_indication_body.number_of_srs);
if (nfapi_mode != 1) {
if (ifi->CC_mask==0) {
......
......@@ -74,10 +74,7 @@ typedef struct {
nfapi_cqi_indication_body_t cqi_ind;
/// RACH indication list
nfapi_rach_indication_t rach_ind;
/// RACH indication list for BR UEs
nfapi_rach_indication_t rach_ind_br;
nfapi_nr_rach_indication_t rach_ind;
/// SRS indication list
nfapi_srs_indication_body_t srs_ind;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment