Merge branch 'develop-nr' into nr_pdcch
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "SCHED_NR/fapi_nr_l1.h"
|
||||
|
||||
extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
|
||||
extern int32_t get_uldl_offset(int eutra_bandP);
|
||||
@@ -65,8 +66,8 @@ int l1_north_init_gNB() {
|
||||
|
||||
LOG_I(PHY,"%s() RC.gNB[%d][%d] installing callbacks\n", __FUNCTION__, i, j);
|
||||
|
||||
RC.gNB[i][j]->if_inst->PHY_config_req = nr_phy_config_request;
|
||||
RC.gNB[i][j]->if_inst->schedule_response = schedule_response;
|
||||
RC.gNB[i][j]->if_inst->NR_PHY_config_req = nr_phy_config_request;
|
||||
RC.gNB[i][j]->if_inst->NR_Schedule_response = nr_schedule_response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
|
||||
uint8_t *pbch_e = pbch->pbch_e;
|
||||
uint32_t *pbch_a_prime = (uint32_t*)pbch->pbch_a_prime;
|
||||
uint32_t *pbch_a_interleaved = (uint32_t*)pbch->pbch_a_interleaved;
|
||||
uint32_t unscrambling_mask = 0x87002D;
|
||||
uint32_t unscrambling_mask = 0x100006D;
|
||||
|
||||
reset = 1;
|
||||
// x1 is set in lte_gold_generic
|
||||
@@ -177,21 +177,26 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
|
||||
/* This portion of code is temporarily kept until the optimized version is validated
|
||||
* uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
|
||||
9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31};
|
||||
|
||||
uint8_t nr_pbch_payload_interleaver(uint8_t i) {
|
||||
uint8_t j_sfn=0, j_hrf=10, j_ssb=11, j_other=14;
|
||||
|
||||
if (24<=i && i<=27) //Sfn bits
|
||||
return nr_pbch_payload_interleaving_pattern[j_sfn + i -24];
|
||||
if (18<=i && i<=27) //Sfn bits
|
||||
return nr_pbch_payload_interleaving_pattern[j_sfn + i -18];
|
||||
else if (i==28) // Hrf bit
|
||||
return nr_pbch_payload_interleaving_pattern[j_hrf];
|
||||
else if (29<=i) // Ssb bits
|
||||
return nr_pbch_payload_interleaving_pattern[j_ssb + (i-29)];
|
||||
else
|
||||
return nr_pbch_payload_interleaving_pattern[j_other + i];
|
||||
}
|
||||
}*/
|
||||
|
||||
/*This pattern takes into account the adjustments for the field specific counters j_sfn, j_hrf, j_ssb and j_other*/
|
||||
uint8_t nr_pbch_payload_interleaving_pattern[32] = {1,4,9,11,12,13,14,15,19,20,21,22,25,26,27,28,
|
||||
29,31,16,23,18,17,8,30,10,6,24,7,0,5,3,2};
|
||||
|
||||
int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
uint8_t *pbch_pdu,
|
||||
@@ -212,6 +217,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
uint8_t idx=0;
|
||||
uint16_t M;
|
||||
uint8_t nushift;
|
||||
uint8_t *xbyte = pbch->pbch_a;
|
||||
memset((void*) xbyte, 0, 1);
|
||||
|
||||
LOG_I(PHY, "PBCH generation started\n");
|
||||
|
||||
@@ -223,13 +230,10 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("Byte endian fix:\n");
|
||||
for (int i=0; i<4; i++)
|
||||
printf("pbch_a[%d]: 0x%04x\n", i, pbch->pbch_a[i]);
|
||||
|
||||
printf("pbch_a[%d]: 0x%02x\n", i, pbch->pbch_a[i]);
|
||||
#endif
|
||||
|
||||
// Extra byte generation
|
||||
uint8_t *xbyte = pbch->pbch_a;
|
||||
//memset((void*) xbyte, 0, 1);
|
||||
for (int i=0; i<4; i++)
|
||||
(*xbyte) ^= ((sfn>>i)&1)<<i; // 4 lsb of sfn
|
||||
|
||||
@@ -243,18 +247,28 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("Extra byte:\n");
|
||||
for (int i=0; i<4; i++)
|
||||
printf("pbch_a[%d]: 0x%04x\n", i, pbch->pbch_a[i]);
|
||||
printf("pbch_a[%d]: 0x%02x\n", i, pbch->pbch_a[i]);
|
||||
#endif
|
||||
|
||||
// Payload interleaving
|
||||
uint32_t* input = (uint32_t*)pbch->pbch_a;
|
||||
uint32_t* output = (uint32_t*)pbch->pbch_a_interleaved;
|
||||
for (int i=0; i<32; i++)
|
||||
(*output) |= (((*input)>>i)&1)<<(nr_pbch_payload_interleaver(i));
|
||||
uint32_t in=0, out=0;
|
||||
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS>>3; i++)
|
||||
in |= (uint32_t)(pbch->pbch_a[i]<<((3-i)<<3));
|
||||
|
||||
for (int i=0; i<32; i++) {
|
||||
out |= ((in>>i)&1)<<(nr_pbch_payload_interleaving_pattern[i]);
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, in, out, nr_pbch_payload_interleaving_pattern[i], (in>>i)&1);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS>>3; i++)
|
||||
pbch->pbch_a_interleaved[i] = (uint8_t)((out>>(i<<3))&0xff);
|
||||
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("Interleaving:\n");
|
||||
for (int i=0; i<4; i++)
|
||||
printf("pbch_a_interleaved[%d]: 0x%04x\n", i, pbch->pbch_a_interleaved[i]);
|
||||
printf("pbch_a_interleaved[%d]: 0x%02x\n", i, pbch->pbch_a_interleaved[i]);
|
||||
#endif
|
||||
|
||||
// Scrambling
|
||||
@@ -264,7 +278,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("Payload scrambling:\n");
|
||||
for (int i=0; i<4; i++)
|
||||
printf("pbch_a_prime[%d]: 0x%04x\n", i, pbch->pbch_a_prime[i]);
|
||||
printf("pbch_a_prime[%d]: 0x%02x\n", i, pbch->pbch_a_prime[i]);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -273,18 +287,18 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("Channel coding:\n");
|
||||
for (int i=0; i<NR_POLAR_PBCH_E>>3; i++)
|
||||
printf("pbch_e[%d]: 0x%04x\t", i, pbch->pbch_e[i]);
|
||||
printf("pbch_e[%d]: 0x%02x\t", i, pbch->pbch_e[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
/// Scrambling
|
||||
M = NR_POLAR_PBCH_E;
|
||||
nushift = config->sch_config.physical_cell_id.value &3;;
|
||||
nushift = (Lmax==4)? ssb_index&3 : ssb_index&7;
|
||||
nr_pbch_scrambling(pbch, (uint32_t)config->sch_config.physical_cell_id.value, nushift, M, NR_POLAR_PBCH_E, 0);
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("Scrambling:\n");
|
||||
for (int i=0; i<NR_POLAR_PBCH_E>>3; i++)
|
||||
printf("pbch_e[%d]: 0x%04x\t", i, pbch->pbch_e[i]);
|
||||
printf("pbch_e[%d]: 0x%02x\t", i, pbch->pbch_e[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
@@ -300,6 +314,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
}
|
||||
|
||||
/// Resource mapping
|
||||
nushift = config->sch_config.physical_cell_id.value &3;
|
||||
a = (config->rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||
|
||||
for (int aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#define __PHY_EXTERN_UE__H__
|
||||
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "common/ran_context.h"
|
||||
//#include "common/ran_context.h"
|
||||
|
||||
extern char* namepointer_chMag ;
|
||||
extern char* namepointer_log2;
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file fapi_l1.c
|
||||
* \brief functions for FAPI L1 interface
|
||||
* \author R. Knopp
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "fapi_nr_l1.h"
|
||||
|
||||
int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req);
|
||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req);
|
||||
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
void handle_nr_nfapi_bch_pdu(PHY_VARS_gNB *gNB,
|
||||
gNB_rxtx_proc_t *proc,
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_pdu,
|
||||
uint8_t *sdu)
|
||||
{
|
||||
|
||||
AssertFatal(dl_config_pdu->bch_pdu_rel15.length == 3, "BCH PDU has length %d != 3\n",
|
||||
dl_config_pdu->bch_pdu_rel15.length);
|
||||
|
||||
LOG_I(PHY,"pbch_pdu[0]: %x,pbch_pdu[1]: %x,gNB->pbch_pdu[2]: %x\n",sdu[0],sdu[1],sdu[2]);
|
||||
gNB->pbch_pdu[0] = sdu[2];
|
||||
gNB->pbch_pdu[1] = sdu[1];
|
||||
gNB->pbch_pdu[2] = sdu[0];
|
||||
|
||||
// adjust transmit amplitude here based on NFAPI info
|
||||
}
|
||||
|
||||
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
PHY_VARS_gNB *gNB;
|
||||
gNB_rxtx_proc_t *proc;
|
||||
// copy data from L2 interface into L1 structures
|
||||
module_id_t Mod_id = Sched_INFO->module_id;
|
||||
uint8_t CC_id = Sched_INFO->CC_id;
|
||||
nfapi_nr_dl_config_request_t *DL_req = Sched_INFO->DL_req;
|
||||
nfapi_tx_request_t *TX_req = Sched_INFO->TX_req;
|
||||
frame_t frame = Sched_INFO->frame;
|
||||
sub_frame_t subframe = Sched_INFO->subframe;
|
||||
|
||||
AssertFatal(RC.gNB!=NULL,"RC.gNB is null\n");
|
||||
AssertFatal(RC.gNB[Mod_id]!=NULL,"RC.gNB[%d] is null\n",Mod_id);
|
||||
AssertFatal(RC.gNB[Mod_id][CC_id]!=NULL,"RC.gNB[%d][%d] is null\n",Mod_id,CC_id);
|
||||
|
||||
gNB = RC.gNB[Mod_id][CC_id];
|
||||
proc = &gNB->proc.proc_rxtx[0];
|
||||
|
||||
uint8_t number_dl_pdu = DL_req->dl_config_request_body.number_pdu;
|
||||
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_pdu;
|
||||
|
||||
int i;
|
||||
|
||||
LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SF:%04d%d DL_req:SFN/SF:%04d%d:dl_pdu:%d tx_req:SFN/SF:%04d%d:pdus:%d \n",
|
||||
frame,subframe,
|
||||
NFAPI_SFNSF2SFN(DL_req->sfn_sf),NFAPI_SFNSF2SF(DL_req->sfn_sf),number_dl_pdu,
|
||||
NFAPI_SFNSF2SFN(TX_req->sfn_sf),NFAPI_SFNSF2SF(TX_req->sfn_sf),TX_req->tx_request_body.number_of_pdus);
|
||||
|
||||
int do_oai =0;
|
||||
int dont_send =0;
|
||||
|
||||
for (i=0;i<number_dl_pdu;i++) {
|
||||
dl_config_pdu = &DL_req->dl_config_request_body.dl_config_pdu_list[i];
|
||||
//LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_config_pdu->pdu_type);
|
||||
switch (dl_config_pdu->pdu_type) {
|
||||
case NFAPI_NR_DL_CONFIG_BCH_PDU_TYPE:
|
||||
AssertFatal(dl_config_pdu->bch_pdu_rel15.pdu_index < TX_req->tx_request_body.number_of_pdus,
|
||||
"bch_pdu_rel8.pdu_index>=TX_req->number_of_pdus (%d>%d)\n",
|
||||
dl_config_pdu->bch_pdu_rel15.pdu_index,
|
||||
TX_req->tx_request_body.number_of_pdus);
|
||||
gNB->pbch_configured=1;
|
||||
do_oai=1;
|
||||
|
||||
handle_nr_nfapi_bch_pdu(gNB,
|
||||
proc,
|
||||
dl_config_pdu,
|
||||
TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->bch_pdu_rel15.pdu_index].segments[0].segment_data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nfapi_mode && do_oai && !dont_send) {
|
||||
oai_nfapi_tx_req(Sched_INFO->TX_req);
|
||||
|
||||
oai_nfapi_nr_dl_config_req(Sched_INFO->DL_req); // DJP - .dl_config_request_body.dl_config_pdu_list[0]); // DJP - FIXME TODO - yuk - only copes with 1 pdu
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file fapi_l1.h
|
||||
* \brief function prototypes for FAPI L1 interface
|
||||
* \author R. Knopp
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "SCHED/sched_common.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
#include "nfapi_nr_interface.h"
|
||||
|
||||
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO);
|
||||
@@ -60,7 +60,7 @@
|
||||
#endif
|
||||
|
||||
#include "LAYER2/NR_MAC_UE/extern.h"
|
||||
#include "LAYER2/NR_MAC_UE/defs.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_defs.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
#ifdef EMOS
|
||||
|
||||
Reference in New Issue
Block a user