Commit b7de9abb authored by WEI-TAI CHEN's avatar WEI-TAI CHEN

merge nr-develop

parents 26d61373 bc4f4ad9
cmake_targets/log/
cmake_targets/ran_build/
targets/bin/
...@@ -45,6 +45,14 @@ pipeline { ...@@ -45,6 +45,14 @@ pipeline {
} }
} }
} }
post {
failure {
script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI"
addGitLabMRComment comment: message
}
}
}
} }
stage ("Start VM -- cppcheck") { stage ("Start VM -- cppcheck") {
......
...@@ -69,6 +69,7 @@ VM_TEMPLATE=ci- ...@@ -69,6 +69,7 @@ VM_TEMPLATE=ci-
JOB_NAME=XX JOB_NAME=XX
BUILD_ID=XX BUILD_ID=XX
VM_NAME=ci-enb-usrp VM_NAME=ci-enb-usrp
VM_MEMORY=2048
ARCHIVES_LOC=enb_usrp ARCHIVES_LOC=enb_usrp
LOG_PATTERN=.Rel14.txt LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=4 NB_PATTERN_FILES=4
...@@ -130,6 +131,7 @@ case $key in ...@@ -130,6 +131,7 @@ case $key in
;; ;;
-v4) -v4)
VM_NAME=ci-cppcheck VM_NAME=ci-cppcheck
VM_MEMORY=8192
ARCHIVES_LOC=cppcheck ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1 NB_PATTERN_FILES=1
...@@ -194,6 +196,7 @@ case $key in ...@@ -194,6 +196,7 @@ case $key in
;; ;;
cppcheck) cppcheck)
VM_NAME=ci-cppcheck VM_NAME=ci-cppcheck
VM_MEMORY=8192
ARCHIVES_LOC=cppcheck ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1 NB_PATTERN_FILES=1
...@@ -281,7 +284,7 @@ then ...@@ -281,7 +284,7 @@ then
echo "############################################################" echo "############################################################"
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################" echo "############################################################"
uvt-kvm create $VM_NAME release=xenial --memory 2048 --cpu 4 --unsafe-caching --template ci-scripts/template-host.xml uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu 4 --unsafe-caching --template ci-scripts/template-host.xml
fi fi
echo "Waiting for VM to be started" echo "Waiting for VM to be started"
...@@ -307,7 +310,8 @@ then ...@@ -307,7 +310,8 @@ then
echo "sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS echo "sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS
else else
echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS
echo "sudo apt-get --yes install zip subversion libboost-dev > zip-install.txt 2>&1" >> $VM_CMDS echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
echo "sudo apt-get --yes install zip subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS
fi fi
echo "mkdir tmp" >> $VM_CMDS echo "mkdir tmp" >> $VM_CMDS
echo "cd tmp" >> $VM_CMDS echo "cd tmp" >> $VM_CMDS
......
...@@ -60,6 +60,7 @@ then ...@@ -60,6 +60,7 @@ then
fi fi
VM_TEMPLATE=ci- VM_TEMPLATE=ci-
VM_MEMORY=2048
JOB_NAME=XX JOB_NAME=XX
BUILD_ID=XX BUILD_ID=XX
VM_NAME=ci-enb-usrp VM_NAME=ci-enb-usrp
...@@ -98,6 +99,7 @@ case $key in ...@@ -98,6 +99,7 @@ case $key in
;; ;;
-v4) -v4)
VM_NAME=ci-cppcheck VM_NAME=ci-cppcheck
VM_MEMORY=8192
shift shift
;; ;;
-v5) -v5)
...@@ -130,6 +132,7 @@ case $key in ...@@ -130,6 +132,7 @@ case $key in
;; ;;
cppcheck) cppcheck)
VM_NAME=ci-cppcheck VM_NAME=ci-cppcheck
VM_MEMORY=8192
;; ;;
gnb-usrp) gnb-usrp)
VM_NAME=ci-gnb-usrp VM_NAME=ci-gnb-usrp
...@@ -176,7 +179,7 @@ echo "VM_NAME = $VM_NAME" ...@@ -176,7 +179,7 @@ echo "VM_NAME = $VM_NAME"
echo "############################################################" echo "############################################################"
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################" echo "############################################################"
uvt-kvm create $VM_NAME release=xenial --memory 2048 --cpu 4 --unsafe-caching --template ci-scripts/template-host.xml uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu 4 --unsafe-caching --template ci-scripts/template-host.xml
echo "Waiting for VM to be started" echo "Waiting for VM to be started"
uvt-kvm wait $VM_NAME --insecure uvt-kvm wait $VM_NAME --insecure
......
...@@ -104,6 +104,10 @@ git checkout -f $SOURCE_COMMIT_ID ...@@ -104,6 +104,10 @@ git checkout -f $SOURCE_COMMIT_ID
git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI" git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI"
exit 0 STATUS=`git status | egrep -c "You have unmerged paths.|fix conflicts"`
if [ $STATUS -ne 0 ]
then
echo "There are merge conflicts.. Cannot perform further build tasks"
STATUS=-1
fi
exit $STATUS
...@@ -1316,6 +1316,7 @@ set(PHY_SRC_UE ...@@ -1316,6 +1316,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/INIT/nr_init_ue.c ${OPENAIR1_DIR}/PHY/INIT/nr_init_ue.c
${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c ${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c
#${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_common_ue.c #${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_common_ue.c
${OPENAIR1_DIR}/SCHED_NR_UE/fapi_nr_ue_l1.c
${PHY_POLARSRC} ${PHY_POLARSRC}
) )
...@@ -1341,7 +1342,7 @@ set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC) ...@@ -1341,7 +1342,7 @@ set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC)
set(NR_MAC_DIR ${OPENAIR2_DIR}/LAYER2/NR_MAC_gNB) set(NR_MAC_DIR ${OPENAIR2_DIR}/LAYER2/NR_MAC_gNB)
set(NR_UE_MAC_DIR ${OPENAIR2_DIR}/LAYER2/NR_MAC_UE) set(NR_UE_MAC_DIR ${OPENAIR2_DIR}/LAYER2/NR_MAC_UE)
set(PHY_INTERFACE_DIR ${OPENAIR2_DIR}/PHY_INTERFACE) set(PHY_INTERFACE_DIR ${OPENAIR2_DIR}/PHY_INTERFACE)
set(NR_PHY_INTERFACE_DIR ${OPENAIR2_DIR}/NR_PHY_INTERFACE) set(NR_UE_PHY_INTERFACE_DIR ${OPENAIR2_DIR}/NR_UE_PHY_INTERFACE)
set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC) set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC)
set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0) set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0)
set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0) set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0)
...@@ -1469,6 +1470,7 @@ set (MAC_SRC ...@@ -1469,6 +1470,7 @@ set (MAC_SRC
${NR_MAC_DIR}/gNB_scheduler_bch.c ${NR_MAC_DIR}/gNB_scheduler_bch.c
) )
set (MAC_SRC_UE set (MAC_SRC_UE
${MAC_DIR}/main_ue.c ${MAC_DIR}/main_ue.c
${MAC_DIR}/ue_procedures.c ${MAC_DIR}/ue_procedures.c
...@@ -1476,11 +1478,16 @@ set (MAC_SRC_UE ...@@ -1476,11 +1478,16 @@ set (MAC_SRC_UE
${MAC_DIR}/l1_helpers.c ${MAC_DIR}/l1_helpers.c
${MAC_DIR}/rar_tools_ue.c ${MAC_DIR}/rar_tools_ue.c
${MAC_DIR}/config_ue.c ${MAC_DIR}/config_ue.c
)
set (MAC_NR_SRC_UE
${NR_UE_PHY_INTERFACE_DIR}/NR_IF_Module.c
${NR_UE_MAC_DIR}/config_ue.c ${NR_UE_MAC_DIR}/config_ue.c
${NR_UE_MAC_DIR}/mac_vars.c ${NR_UE_MAC_DIR}/mac_vars.c
${NR_UE_MAC_DIR}/main_ue_nr.c ${NR_UE_MAC_DIR}/main_ue_nr.c
${NR_UE_MAC_DIR}/nr_ue_procedures.c ${NR_UE_MAC_DIR}/nr_ue_procedures.c
) )
set (ENB_APP_SRC set (ENB_APP_SRC
${OPENAIR2_DIR}/ENB_APP/enb_app.c ${OPENAIR2_DIR}/ENB_APP/enb_app.c
...@@ -1503,8 +1510,10 @@ add_library(L2 ...@@ -1503,8 +1510,10 @@ add_library(L2
add_library(L2_UE add_library(L2_UE
${L2_SRC_UE} ${L2_SRC_UE}
${MAC_SRC_UE} ${MAC_SRC_UE}
${MAC_NR_SRC_UE}
) )
include_directories(${NR_UE_PHY_INTERFACE_DIR})
include_directories(${NFAPI_USER_DIR}) include_directories(${NFAPI_USER_DIR})
......
...@@ -146,7 +146,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config, ...@@ -146,7 +146,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config,
frame_parms->samples_per_subframe = (frame_parms->samples_per_subframe_wCP + (frame_parms->nb_prefix_samples0 * frame_parms->slots_per_subframe) + frame_parms->samples_per_subframe = (frame_parms->samples_per_subframe_wCP + (frame_parms->nb_prefix_samples0 * frame_parms->slots_per_subframe) +
(frame_parms->nb_prefix_samples * frame_parms->slots_per_subframe * (frame_parms->symbols_per_slot - 1))); (frame_parms->nb_prefix_samples * frame_parms->slots_per_subframe * (frame_parms->symbols_per_slot - 1)));
frame_parms->samples_per_frame = 10 * frame_parms->samples_per_subframe; frame_parms->samples_per_frame = 10 * frame_parms->samples_per_subframe;
frame_parms->freq_range = (frame_parms->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
return 0; return 0;
} }
...@@ -283,7 +283,7 @@ int nr_init_frame_parms_ue(nfapi_config_request_t* config, ...@@ -283,7 +283,7 @@ int nr_init_frame_parms_ue(nfapi_config_request_t* config,
//frame_parms->samples_per_subframe = (frame_parms->samples_per_subframe_wCP + (frame_parms->nb_prefix_samples0 * frame_parms->slots_per_subframe) + //frame_parms->samples_per_subframe = (frame_parms->samples_per_subframe_wCP + (frame_parms->nb_prefix_samples0 * frame_parms->slots_per_subframe) +
// (frame_parms->nb_prefix_samples * frame_parms->slots_per_subframe * (frame_parms->symbols_per_slot - 1))); // (frame_parms->nb_prefix_samples * frame_parms->slots_per_subframe * (frame_parms->symbols_per_slot - 1)));
frame_parms->samples_per_frame = 10 * frame_parms->samples_per_subframe; frame_parms->samples_per_frame = 10 * frame_parms->samples_per_subframe;
frame_parms->freq_range = (frame_parms->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
return 0; return 0;
} }
......
...@@ -45,22 +45,25 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -45,22 +45,25 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
uint8_t nushift,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
NR_DL_FRAME_PARMS *frame_parms) NR_DL_FRAME_PARMS *frame_parms)
{ {
int k,l; int k,l;
int16_t a; int16_t a;
int16_t mod_dmrs[2 * NR_PBCH_DMRS_LENGTH]; int16_t mod_dmrs[NR_PBCH_DMRS_LENGTH<<1];
uint8_t idx=0;
uint8_t nushift = config->sch_config.physical_cell_id.value &3;
LOG_I(PHY, "PBCH DMRS mapping started at symbol %d shift %d\n", ssb_start_symbol+1, nushift); LOG_I(PHY, "PBCH DMRS mapping started at symbol %d shift %d\n", ssb_start_symbol+1, nushift);
/// BPSK modulation /// QPSK modulation
for (int m=0; m<NR_PBCH_DMRS_LENGTH; m++) { for (int m=0; m<NR_PBCH_DMRS_LENGTH; m++) {
mod_dmrs[m<<1] = nr_mod_table[((NR_MOD_TABLE_BPSK_OFFSET + ((gold_pbch_dmrs[m>>5]&(1<<(m&0x1f)))>>(m&0x1f)))<<1)]; idx = ((((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1)<<1) ^ (((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1);
mod_dmrs[(m<<1)+1] = nr_mod_table[((NR_MOD_TABLE_BPSK_OFFSET + ((gold_pbch_dmrs[m>>5]&(1<<(m&0x1f)))>>(m&0x1f)))<<1) + 1]; mod_dmrs[m<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
mod_dmrs[(m<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1];
#ifdef DEBUG_PBCH_DMRS #ifdef DEBUG_PBCH_DMRS
printf("m %d mod_dmrs %d %d\n", m, mod_dmrs[2*m], mod_dmrs[2*m+1]); printf("m %d idx %d gold seq %d b0-b1 %d-%d mod_dmrs %d %d\n", m, idx, gold_pbch_dmrs[(m<<1)>>5], (((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1),
(((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1), mod_dmrs[(m<<1)], mod_dmrs[(m<<1)+1]);
#endif #endif
} }
...@@ -128,81 +131,166 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -128,81 +131,166 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
return 0; return 0;
} }
void nr_pbch_scrambling(uint32_t Nid, void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
uint32_t Nid,
uint8_t nushift, uint8_t nushift,
uint8_t *pbch_a, uint16_t M,
uint32_t length) uint16_t length,
uint8_t bitwise)
{ {
uint8_t reset; uint8_t reset, offset;
uint32_t x1, x2, s=0; uint32_t x1, x2, s=0;
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;
reset = 1; reset = 1;
// x1 is set in lte_gold_generic // x1 is set in lte_gold_generic
x2 = Nid; x2 = Nid;
// The Gold sequence is shifted by nushift* M, so we skip (nushift*M /32) double words
for (int i=0; i<(uint16_t)ceil((nushift*M)/32); i++) {
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}
// Scrambling is now done with offset (nushift*M)%32
offset = (nushift*M)&0x1f;
#ifdef DEBUG_PBCH_ENCODING
printf("Scrambling params: nushift %d M %d length %d bitwise %d offset %d\n", nushift, M, length, bitwise, offset);
#endif
for (int i=0; i<length; i++) { for (int i=0; i<length; i++) {
if ((i&0x1f)==0) { if (((i+offset)&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset); s = lte_gold_generic(&x1, &x2, reset);
reset = 0; reset = 0;
} }
pbch_a[i] = (pbch_a[i]&1) ^ ((s>>(i&0x1f))&1); #ifdef DEBUG_PBCH_ENCODING
printf("s: %04x\t", s);
#endif
if (bitwise) {
(*pbch_a_prime) ^= ((unscrambling_mask>>i)&1)? (((*pbch_a_interleaved)>>i)&1)<<i : ((((*pbch_a_interleaved)>>i)&1) ^ ((s>>((i+offset)&0x1f))&1))<<i;
}
else
pbch_e[i] = (pbch_e[i]&1) ^ ((s>>((i+offset)&0x1f))&1);
} }
} }
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];
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];
}
int nr_generate_pbch(NR_gNB_PBCH *pbch, int nr_generate_pbch(NR_gNB_PBCH *pbch,
uint8_t *pbch_pdu, uint8_t *pbch_pdu,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
uint8_t nushift,
uint8_t n_hf, uint8_t n_hf,
uint8_t Lmax,
uint8_t ssb_index,
int sfn, int sfn,
int frame_mod8,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
NR_DL_FRAME_PARMS *frame_parms) NR_DL_FRAME_PARMS *frame_parms)
{ {
int k,l,m; int k,l,m;
int16_t a; int16_t a;
int16_t mod_pbch_e[NR_POLAR_PBCH_E<<1]; int16_t mod_pbch_e[NR_POLAR_PBCH_E];
uint8_t sfn_4lsb, idx=0; uint8_t idx=0;
uint16_t M;
uint8_t nushift;
LOG_I(PHY, "PBCH generation started\n"); LOG_I(PHY, "PBCH generation started\n");
///Payload generation ///Payload generation
// Fix byte endian // Fix byte endian
if (!frame_mod8) if (!(sfn&7))
for (int i=0; i<NR_PBCH_PDU_BITS; i++) for (int i=0; i<(NR_PBCH_PDU_BITS>>3); i++)
pbch->pbch_a[NR_PBCH_PDU_BITS-i-1] = pbch_pdu[i]; pbch->pbch_a[(NR_POLAR_PBCH_PAYLOAD_BITS>>3)-i-1] = pbch_pdu[i];
#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]);
// Extra bits generation #endif
sfn_4lsb = sfn&3;
// Extra byte generation
uint8_t *xbyte = pbch->pbch_a;
//memset((void*) xbyte, 0, 1);
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
pbch->pbch_a[NR_PBCH_PDU_BITS+i] = (sfn_4lsb>>i)&1; // 4 lsb of sfn (*xbyte) ^= ((sfn>>i)&1)<<i; // 4 lsb of sfn
pbch->pbch_a[NR_PBCH_PDU_BITS+4] = n_hf; // half frame index bit (*xbyte) ^= n_hf<<4; // half frame index bit
pbch->pbch_a[NR_PBCH_PDU_BITS+5] = (config->sch_config.ssb_subcarrier_offset.value>>5)&1; //MSB of k0 -- Note the case Lssb=64 is not supported (FR2) if (Lmax == 64)
for (int i=0; i<3; i++)
(*xbyte) ^= ((ssb_index>>(3+i))&1)<<(5+i); // resp. 4th, 5th and 6th bits of ssb_index
else
(*xbyte) ^= ((config->sch_config.ssb_subcarrier_offset.value>>5)&1)<<5; //MSB of k_SSB
#ifdef DEBUG_PBCH_ENCODING #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]);
#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));
#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]);
#endif #endif
// Scrambling // Scrambling
nr_pbch_scrambling((uint32_t)config->sch_config.physical_cell_id.value, nushift, pbch->pbch_a, NR_POLAR_PBCH_PAYLOAD_BITS); M = (Lmax == 64)? (NR_POLAR_PBCH_PAYLOAD_BITS - 6) : (NR_POLAR_PBCH_PAYLOAD_BITS - 3);
nushift = (((sfn>>2)&1)<<1) ^ ((sfn>>1)&1);
nr_pbch_scrambling(pbch, (uint32_t)config->sch_config.physical_cell_id.value, nushift, M, NR_POLAR_PBCH_PAYLOAD_BITS, 1);
#ifdef DEBUG_PBCH_ENCODING #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]);
#endif #endif
/// CRC, coding and rate matching /// CRC, coding and rate matching
polar_encoder (pbch->pbch_a, pbch->pbch_e, &frame_parms->pbch_polar_params); polar_encoder (pbch->pbch_a_prime, pbch->pbch_e, &frame_parms->pbch_polar_params);
#ifdef DEBUG_PBCH_ENCODING #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("\n");
#endif
/// Scrambling
M = NR_POLAR_PBCH_E;
nushift = config->sch_config.physical_cell_id.value &3;;
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("\n");
#endif #endif
/// QPSK modulation /// QPSK modulation
for (int i=0; i<NR_POLAR_PBCH_E>>1; i++){ for (int i=0; i<NR_POLAR_PBCH_E>>1; i++){
idx = (pbch->pbch_e[i<<1]&1) ^ ((pbch->pbch_e[(i<<1)+1]&1)<<1); idx = ((pbch->pbch_e[i<<1]&1)<<1) ^ (pbch->pbch_e[(i<<1)+1]&1);
mod_pbch_e[i<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1]; mod_pbch_e[i<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
mod_pbch_e[(i<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1)+1]; mod_pbch_e[(i<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1)+1];
......
...@@ -62,7 +62,6 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -62,7 +62,6 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
uint8_t nushift,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
NR_DL_FRAME_PARMS *frame_parms); NR_DL_FRAME_PARMS *frame_parms);
...@@ -71,10 +70,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -71,10 +70,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
\brief PBCH scrambling function \brief PBCH scrambling function
@param @param
*/ */
void nr_pbch_scrambling(uint32_t Nid, void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
uint32_t Nid,
uint8_t nushift, uint8_t nushift,
uint8_t *pbch_a, uint16_t M,
uint32_t length); uint16_t length,
uint8_t bitwise);
/*! /*!
\fn int nr_generate_pbch \fn int nr_generate_pbch
...@@ -87,11 +88,19 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -87,11 +88,19 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
uint8_t nushift,
uint8_t n_hf, uint8_t n_hf,
uint8_t Lmax,
uint8_t ssb_index,
int sfn, int sfn,
int frame_mod8,
nfapi_nr_config_request_t* config, nfapi_nr_config_request_t* config,
NR_DL_FRAME_PARMS *frame_parms); NR_DL_FRAME_PARMS *frame_parms);
/*!
\fn int nr_generate_pbch
\brief PBCH interleaving function
@param bit index i of the input payload
@returns the bit index of the output
*/
uint8_t nr_pbch_payload_interleaver(uint8_t i);
#endif /*__NR_TRANSPORT__H__*/ #endif /*__NR_TRANSPORT__H__*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" #include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
typedef struct { typedef struct {
uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS]; uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS>>3];
uint8_t pbch_a_interleaved[NR_POLAR_PBCH_PAYLOAD_BITS>>3];
uint8_t pbch_a_prime[NR_POLAR_PBCH_PAYLOAD_BITS>>3];
uint8_t pbch_e[NR_POLAR_PBCH_E]; uint8_t pbch_e[NR_POLAR_PBCH_E];
} NR_gNB_PBCH; } NR_gNB_PBCH;
......
...@@ -578,57 +578,109 @@ typedef struct { ...@@ -578,57 +578,109 @@ typedef struct {
#define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearchSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0) #define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearchSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0)
#ifdef NR_PDCCH_DEFS_NR_UE #ifdef NR_PDCCH_DEFS_NR_UE
#define MAX_NR_DCI_DECODED_SLOT 10
#define NBR_NR_FORMATS 8 #define NBR_NR_FORMATS 8
#define NBR_NR_DCI_FIELDS 48 #define NBR_NR_DCI_FIELDS 56
// The following parameters define 'position' of each DCI field described in TS 38.212
#define CARRIER_IND 0 #define IDENTIFIER_DCI_FORMATS 0
#define SUL_IND_0_1 1 #define CARRIER_IND 1
#define IDENTIFIER_DCI_FORMATS 2 #define SUL_IND_0_1 2
#define SLOT_FORMAT_IND 3 #define SLOT_FORMAT_IND 3
#define PRE_EMPTION_IND 4 #define PRE_EMPTION_IND 4
#define TPC_CMD_NUMBER 5 #define TPC_CMD_NUMBER 5
#define BLOCK_NUMBER 6 #define BLOCK_NUMBER 6
#define BANDWIDTH_PART_IND 7 #define BANDWIDTH_PART_IND 7
#define FREQ_DOM_RESOURCE_ASSIGNMENT_UL 8 #define SHORT_MESSAGE_IND 8
#define FREQ_DOM_RESOURCE_ASSIGNMENT_DL 9 #define SHORT_MESSAGES 9
#define TIME_DOM_RESOURCE_ASSIGNMENT 10 #define FREQ_DOM_RESOURCE_ASSIGNMENT_UL 10
#define VRB_TO_PRB_MAPPING 11 #define FREQ_DOM_RESOURCE_ASSIGNMENT_DL 11
#define PRB_BUNDLING_SIZE_IND 12 #define TIME_DOM_RESOURCE_ASSIGNMENT 12
#define RATE_MATCHING_IND 13 #define VRB_TO_PRB_MAPPING 13
#define ZP_CSI_RS_TRIGGER 14 #define PRB_BUNDLING_SIZE_IND 14
#define FREQ_HOPPING_FLAG 15 #define RATE_MATCHING_IND 15
#define TB1_MCS 16 #define ZP_CSI_RS_TRIGGER 16
#define TB1_NDI 17 #define FREQ_HOPPING_FLAG 17
#define TB1_RV 18 #define TB1_MCS 18
#define TB2_MCS 19 #define TB1_NDI 19
#define TB2_NDI 20 #define TB1_RV 20
#define TB2_RV 21 #define TB2_MCS 21
#define MCS 22 #define TB2_NDI 22
#define NDI 23 #define TB2_RV 23
#define RV 24 #define MCS 24
#define HARQ_PROCESS_NUMBER 25 #define NDI 25
#define DAI_ 26 #define RV 26
#define FIRST_DAI 27 #define HARQ_PROCESS_NUMBER 27
#define SECOND_DAI 28 #define DAI_ 28
#define TPC_PUSCH 29 #define FIRST_DAI 29
#define TPC_PUCCH 30 #define SECOND_DAI 30
#define PUCCH_RESOURCE_IND 31 #define TB_SCALING 31
#define PDSCH_TO_HARQ_FEEDBACK_TIME_IND 32 #define TPC_PUSCH 32
#define SHORT_MESSAGE_IND 33 #define TPC_PUCCH 33
#define SRS_RESOURCE_IND 34 #define PUCCH_RESOURCE_IND 34
#define PRECOD_NBR_LAYERS 35 #define PDSCH_TO_HARQ_FEEDBACK_TIME_IND 35
#define ANTENNA_PORTS 36 //#define SHORT_MESSAGE_IND 33
#define TCI 37 #define SRS_RESOURCE_IND 36
#define SRS_REQUEST 38 #define PRECOD_NBR_LAYERS 37
#define TPC_CMD_NUMBER_FORMAT2_3 39 #define ANTENNA_PORTS 38
#define CSI_REQUEST 40 #define TCI 39
#define CBGTI 41 #define SRS_REQUEST 40
#define CBGFI 42 #define TPC_CMD_NUMBER_FORMAT2_3 41
#define PTRS_DMRS 43 #define CSI_REQUEST 42
#define BETA_OFFSET_IND 44 #define CBGTI 43
#define DMRS_SEQ_INI 45 #define CBGFI 44
#define SUL_IND_0_0 46 #define PTRS_DMRS 45
#define PADDING 47 #define BETA_OFFSET_IND 46
#define DMRS_SEQ_INI 47
#define UL_SCH_IND 48
#define PADDING_NR_DCI 49
#define SUL_IND_0_0 50
#define RA_PREAMBLE_INDEX 51
#define SUL_IND_1_0 52
#define SS_PBCH_INDEX 53
#define PRACH_MASK_INDEX 54
#define RESERVED_NR_DCI 55
typedef enum {
_format_0_0_found=0,
_format_0_1_found=1,
_format_1_0_found=2,
_format_1_1_found=3,
_format_2_0_found=4,
_format_2_1_found=5,
_format_2_2_found=6,
_format_2_3_found=7} format_found_t;
#define TOTAL_NBR_SCRAMBLED_VALUES 13
#define _C_RNTI_ 0
#define _CS_RNTI_ 1
#define _NEW_RNTI_ 2
#define _TC_RNTI_ 3
#define _P_RNTI_ 4
#define _SI_RNTI_ 5
#define _RA_RNTI_ 6
#define _SP_CSI_RNTI_ 7
#define _SFI_RNTI_ 8
#define _INT_RNTI_ 9
#define _TPC_PUSCH_RNTI_ 10
#define _TPC_PUCCH_RNTI_ 11
#define _TPC_SRS_RNTI_ 12
typedef enum {
_c_rnti = _C_RNTI_,
_cs_rnti = _CS_RNTI_,
_new_rnti = _NEW_RNTI_,
_tc_rnti = _TC_RNTI_,
_p_rnti = _P_RNTI_,
_si_rnti = _SI_RNTI_,
_ra_rnti = _RA_RNTI_,
_sp_csi_rnti = _SP_CSI_RNTI_,
_sfi_rnti = _SFI_RNTI_,
_int_rnti = _INT_RNTI_,
_tpc_pusch_rnti = _TPC_PUSCH_RNTI_,
_tpc_pucch_rnti = _TPC_PUCCH_RNTI_,
_tpc_srs_rnti = _TPC_SRS_RNTI_} crc_scrambled_t;
typedef enum {bundle_n2=2,bundle_n3=3,bundle_n6=6} NR_UE_CORESET_REG_bundlesize_t; typedef enum {bundle_n2=2,bundle_n3=3,bundle_n6=6} NR_UE_CORESET_REG_bundlesize_t;
......
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
#define NR_PSS_LENGTH 127 #define NR_PSS_LENGTH 127
#define NR_SSS_LENGTH 127 #define NR_SSS_LENGTH 127
#define NR_PBCH_DMRS_LENGTH 144 #define NR_PBCH_DMRS_LENGTH 144 // in mod symbols
#define NR_PBCH_DMRS_LENGTH_DWORD 5 // roundup(NR_PBCH_DMRS_LENGTH/32) #define NR_PBCH_DMRS_LENGTH_DWORD 10 // roundup(2(QPSK)*NR_PBCH_DMRS_LENGTH/32)
#define NR_MAX_NUM_BWP 4 #define NR_MAX_NUM_BWP 4
...@@ -76,6 +76,11 @@ typedef enum{ ...@@ -76,6 +76,11 @@ typedef enum{
nr_ssb_type_E nr_ssb_type_E
} nr_ssb_type_e; } nr_ssb_type_e;
typedef enum {
nr_FR1 = 0,
nr_FR2
} nr_frequency_range_e;
typedef struct NR_BWP_PARMS { typedef struct NR_BWP_PARMS {
/// Associated numerology index /// Associated numerology index
uint8_t numerology_index; uint8_t numerology_index;
...@@ -88,6 +93,8 @@ typedef struct NR_BWP_PARMS { ...@@ -88,6 +93,8 @@ typedef struct NR_BWP_PARMS {
} NR_BWP_PARMS; } NR_BWP_PARMS;
typedef struct NR_DL_FRAME_PARMS { typedef struct NR_DL_FRAME_PARMS {
/// frequency range
nr_frequency_range_e freq_range;
/// Number of resource blocks (RB) in DL /// Number of resource blocks (RB) in DL
uint8_t N_RB_DL; uint8_t N_RB_DL;
/// Number of resource blocks (RB) in UL /// Number of resource blocks (RB) in UL
......
...@@ -123,16 +123,13 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) { ...@@ -123,16 +123,13 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) {
int **txdataF = gNB->common_vars.txdataF; int **txdataF = gNB->common_vars.txdataF;
uint8_t *pbch_pdu=&gNB->pbch_pdu[0]; uint8_t *pbch_pdu=&gNB->pbch_pdu[0];
int ss_subframe = (cfg->sch_config.half_frame_index.value)? 5 : 0; int ss_subframe = (cfg->sch_config.half_frame_index.value)? 5 : 0;
int sfn = 10*frame + subframe; uint8_t Lmax, ssb_index=0, n_hf=0;
int frame_mod8 = frame&7;
uint8_t Lmax, nushift, ssb_index=0, n_hf=0;
LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe); LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe);
int ssb_start_symbol = nr_get_ssb_start_symbol(cfg, fp); int ssb_start_symbol = nr_get_ssb_start_symbol(cfg, fp);
nr_set_ssb_first_subcarrier(cfg, fp); nr_set_ssb_first_subcarrier(cfg, fp);
Lmax = (fp->dl_CarrierFreq < 3e9)? 4:8; Lmax = (fp->dl_CarrierFreq < 3e9)? 4:8;
nushift = (Lmax < 8)? ssb_index&3 : ssb_index&7;
if (subframe == ss_subframe) if (subframe == ss_subframe)
...@@ -147,8 +144,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) { ...@@ -147,8 +144,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) {
if (gNB->pbch_configured != 1)return; if (gNB->pbch_configured != 1)return;
gNB->pbch_configured = 0; gNB->pbch_configured = 0;
}*/ }*/
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],txdataF, AMP_OVER_2, ssb_start_symbol, nushift, cfg, fp); nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],txdataF, AMP_OVER_2, ssb_start_symbol, cfg, fp);
nr_generate_pbch(&gNB->pbch, pbch_pdu, txdataF, AMP_OVER_2, ssb_start_symbol, nushift, sfn, n_hf, frame_mod8, cfg, fp); nr_generate_pbch(&gNB->pbch, pbch_pdu, txdataF, AMP_OVER_2, ssb_start_symbol, n_hf, Lmax, ssb_index, frame, cfg, fp);
} }
} }
......
/*
* 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_nr_ue_l1.c
* \brief functions for NR UE FAPI-like interface
* \author R. Knopp
* \date 2018
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#include "fapi_nr_ue_interface.h"
#include "fapi_nr_ue_l1.h"
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
return 0;
}
int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){
return 0;
}
\ No newline at end of file
/*
* 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_nr_ue_l1.c
* \brief functions for FAPI L1 interface
* \author R. Knopp
* \date 2018
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __FAPI_NR_UE_L1_H__
#define __FAPI_NR_UE_L1_H__
#include "NR_IF_Module.h"
/**\brief NR UE FAPI-like P7 messages, scheduled response from L2 indicating L1
\param scheduled_response including transmission config(dl_config, ul_config) and data transmission (tx_req)*/
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response);
/**\brief NR UE FAPI-like P5 message, physical configuration from L2 to configure L1
\param scheduled_response including transmission config(dl_config, ul_config) and data transmission (tx_req)*/
int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config);
#endif
\ No newline at end of file
This diff is collapsed.
...@@ -47,7 +47,7 @@ nr_rrc_mac_config_req_ue( ...@@ -47,7 +47,7 @@ nr_rrc_mac_config_req_ue(
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc. // TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
if(mibP != NULL){ if(mibP != NULL){
; mac->mib = mibP; // update by every reception
} }
if(mac_cell_group_configP != NULL){ if(mac_cell_group_configP != NULL){
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#include "NR_SpCellConfig.h" #include "NR_SpCellConfig.h"
#include "NR_ServingCellConfig.h" #include "NR_ServingCellConfig.h"
#include "fapi_nr_ue_interface.h"
#include "NR_IF_Module.h"
#define NB_NR_UE_MAC_INST 1 #define NB_NR_UE_MAC_INST 1
...@@ -73,6 +75,18 @@ typedef struct { ...@@ -73,6 +75,18 @@ typedef struct {
NR_RNTI_Value_t *cs_RNTI; /* OPTIONAL */ NR_RNTI_Value_t *cs_RNTI; /* OPTIONAL */
NR_MIB_t *mib;
//// FAPI-like interface
fapi_nr_tx_request_t tx_request;
fapi_nr_ul_config_request_t ul_config_request;
fapi_nr_dl_config_request_t dl_config_request;
fapi_nr_dci_indication_t dci_indication;
fapi_nr_rx_indication_t rx_indication;
nr_ue_if_module_t *if_module;
nr_scheduled_response_t scheduled_response;
nr_phy_config_t phy_config;
} NR_UE_MAC_INST_t; } NR_UE_MAC_INST_t;
/*@}*/ /*@}*/
......
...@@ -31,19 +31,60 @@ ...@@ -31,19 +31,60 @@
#include "proto.h" #include "proto.h"
#include "RRC/NR_UE/rrc_proto.h" #include "RRC/NR_UE/rrc_proto.h"
void int8_t nr_ue_decode_mib(
nr_ue_decode_mib(
module_id_t module_id, module_id_t module_id,
int CC_id, int CC_id,
uint8_t gNB_index, uint8_t gNB_index,
uint8_t extra_bits, uint8_t extra_bits, // 8bits 38.212 c7.1.1
uint32_t ssb_index, uint32_t l_ssb_equal_64,
uint32_t *frameP, //uint32_t *ssb_index, // from decoded MIB
void *pduP, //uint32_t *frameP, // 10 bits = 6(in decoded MIB)+4(in extra bits from L1)
void *pduP, // encoded MIB
uint16_t pdu_len){ uint16_t pdu_len){
nr_mac_rrc_data_ind_ue( module_id, CC_id, gNB_index, frameP, NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
nr_mac_rrc_data_ind_ue( module_id, CC_id, gNB_index,
NR_BCCH_BCH, (uint8_t *) pduP, pdu_len ); NR_BCCH_BCH, (uint8_t *) pduP, pdu_len );
// frame calculation
uint32_t frame = mac->mib->systemFrameNumber.buf[0];
uint32_t frame_number_4lsb = (uint32_t)(extra_bits & 0xf); // extra bits[0:3]
uint32_t half_frame_bit = (uint32_t)(( extra_bits >> 4 ) & 0x1 ); // extra bits[4]
uint32_t ssb_subcarrier_offset_msb = (uint32_t)(( extra_bits >> 5 ) & 0x1 ); // extra bits[5]
uint32_t ssb_subcarrier_offset = mac->mib->subCarrierSpacingCommon;
uint32_t ssb_index;
frame = frame << 4;
frame = frame | frame_number_4lsb;
if(l_ssb_equal_64){
ssb_index = (( extra_bits >> 5 ) & 0x7 ); // extra bits[5:7]
mac->phy_config.config_req.pbch_config.ssb_index = ssb_index;
}else{
if(ssb_subcarrier_offset_msb){
ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10;
}
}
// fill in the elements in config request inside P5 message
mac->phy_config.config_req.pbch_config.system_frame_number = frame; // after calculation
mac->phy_config.config_req.pbch_config.subcarrier_spacing_common = mac->mib->subCarrierSpacingCommon;
mac->phy_config.config_req.pbch_config.ssb_subcarrier_offset = ssb_subcarrier_offset; // after calculation
mac->phy_config.config_req.pbch_config.dmrs_type_a_position = mac->mib->dmrs_TypeA_Position;
mac->phy_config.config_req.pbch_config.pdcch_config_sib1 = mac->mib->pdcch_ConfigSIB1;
mac->phy_config.config_req.pbch_config.cell_barred = mac->mib->cellBarred;
mac->phy_config.config_req.pbch_config.intra_frquency_reselection = mac->mib->intraFreqReselection;
mac->phy_config.config_req.pbch_config.half_frame_bit = half_frame_bit;
mac->phy_config.config_req.config_mask |= FAPI_NR_CONFIG_REQUEST_MASK_PBCH;
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL){
mac->if_module->phy_config_request(&mac->phy_config);
}
return 0;
} }
...@@ -36,11 +36,10 @@ ...@@ -36,11 +36,10 @@
\param CC_id component carrier id \param CC_id component carrier id
\param gNB_index gNB index \param gNB_index gNB index
\param extra_bits extra bits for frame calculation \param extra_bits extra bits for frame calculation
\param ssb_index SSB index for frame calculation \param l_ssb_equal_64 check if ssb number of candicate is equal 64, 1=equal; 0=non equal. Reference 38.212 7.1.1
\param frameP pointer to frame for revising after frame calculation
\param pduP pointer to pdu \param pduP pointer to pdu
\param pdu_length length of pdu*/ \param pdu_length length of pdu*/
void nr_ue_decode_mib(module_id_t module_id, int CC_id, uint8_t gNB_index, uint8_t extra_bits, uint32_t ssb_index, uint32_t *frameP, void *pduP, uint16_t pdu_len); int8_t nr_ue_decode_mib(module_id_t module_id, int CC_id, uint8_t gNB_index, uint8_t extra_bits, uint32_t l_ssb_equal_64, void *pduP, uint16_t pdu_len);
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config) /**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
......
This diff is collapsed.
This diff is collapsed.
...@@ -38,7 +38,6 @@ nr_mac_rrc_data_ind_ue( ...@@ -38,7 +38,6 @@ nr_mac_rrc_data_ind_ue(
const module_id_t module_id, const module_id_t module_id,
const int CC_id, const int CC_id,
const uint8_t gNB_index, const uint8_t gNB_index,
const uint32_t* frameP,
const channel_t channel, const channel_t channel,
const uint8_t* pduP, const uint8_t* pduP,
const sdu_size_t pdu_len){ const sdu_size_t pdu_len){
......
...@@ -287,6 +287,10 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( ...@@ -287,6 +287,10 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
NR_BCCH_BCH_Message_t *bcch_message = NULL; NR_BCCH_BCH_Message_t *bcch_message = NULL;
NR_MIB_t *mib = NR_UE_rrc_inst->mib; NR_MIB_t *mib = NR_UE_rrc_inst->mib;
if(mib != NULL){
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)mib, 1 );
}
asn_dec_rval_t dec_rval = uper_decode_complete( NULL, asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_BCCH_BCH_Message, &asn_DEF_NR_BCCH_BCH_Message,
(void **)&bcch_message, (void **)&bcch_message,
...@@ -307,10 +311,11 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( ...@@ -307,10 +311,11 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
return -1; return -1;
} }
// copy into rrc instance // link to rrc instance
memcpy( (void *)mib, mib = &bcch_message->message.choice.mib;
(void *)&bcch_message->message.choice.mib, //memcpy( (void *)mib,
sizeof(NR_MIB_t) ); // (void *)&bcch_message->message.choice.mib,
// sizeof(NR_MIB_t) );
nr_rrc_mac_config_req_ue( 0, 0, 0, mib, NULL, NULL, NULL); nr_rrc_mac_config_req_ue( 0, 0, 0, mib, NULL, NULL, NULL);
......
...@@ -97,11 +97,10 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui ...@@ -97,11 +97,10 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui
\param module_id module id \param module_id module id
\param CC_id component carrier id \param CC_id component carrier id
\param gNB_index gNB index \param gNB_index gNB index
\param frameP pointer to frame for calculation
\param channel indicator for channel of the pdu \param channel indicator for channel of the pdu
\param pduP pointer to pdu \param pduP pointer to pdu
\param pdu_len data length of pdu*/ \param pdu_len data length of pdu*/
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const uint32_t *frameP, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len); int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len);
/** @}*/ /** @}*/
#endif #endif
......
This diff is collapsed.
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