configured LDPC on CPU and GPU
This commit is contained in:
parent
da62b92f6e
commit
02dc4ba8ce
@@ -1496,38 +1496,33 @@ schedule_ulsch_rnti(module_id_t module_idP,
|
||||
|
||||
if (status >= RRC_CONNECTED && UE_sched_ctrl_ptr->cqi_req_timer > 30) {
|
||||
if (UE_sched_ctrl_ptr->cqi_received == 0) {
|
||||
if (NFAPI_MODE != NFAPI_MONOLITHIC) {
|
||||
cqi_req = 0;
|
||||
} else {
|
||||
cqi_req = 1;
|
||||
LOG_D(MAC,"Setting CQI_REQ (timer %d)\n",UE_sched_ctrl_ptr->cqi_req_timer);
|
||||
cqi_req = 1;
|
||||
LOG_D(MAC,
|
||||
"Setting CQI_REQ (timer %d)\n",
|
||||
UE_sched_ctrl_ptr->cqi_req_timer);
|
||||
|
||||
/* TDD: to be safe, do not ask CQI in special Subframes:36.213/7.2.3 CQI definition */
|
||||
if (cc[CC_id].tdd_Config) {
|
||||
switch (cc[CC_id].tdd_Config->subframeAssignment) {
|
||||
case 1:
|
||||
if(subframeP == 1 || subframeP == 6) {
|
||||
cqi_req=0;
|
||||
}
|
||||
/* TDD: to be safe, do not ask CQI in special
|
||||
* Subframes:36.213/7.2.3 CQI definition */
|
||||
if (cc[CC_id].tdd_Config) {
|
||||
switch (cc[CC_id].tdd_Config->subframeAssignment) {
|
||||
case 1:
|
||||
if (subframeP == 1 || subframeP == 6)
|
||||
cqi_req = 0;
|
||||
break;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
if (subframeP == 1)
|
||||
cqi_req = 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(subframeP == 1) {
|
||||
cqi_req=0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(MAC," TDD config not supported\n");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_E(MAC, " TDD config not supported\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(cqi_req == 1) {
|
||||
UE_sched_ctrl_ptr->cqi_req_flag |= 1 << sched_subframeP;
|
||||
}
|
||||
if (cqi_req == 1) {
|
||||
UE_sched_ctrl_ptr->cqi_req_flag |= 1 << sched_subframeP;
|
||||
}
|
||||
} else {
|
||||
LOG_D(MAC,"Clearing CQI request timer\n");
|
||||
|
||||
@@ -2158,7 +2158,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) {
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
|
||||
//Substitute with a static value for the MAC layer abstraction (phy_stub mode)
|
||||
phr_p->PH = 40;
|
||||
phr_p->PH = 60;
|
||||
} else {
|
||||
phr_p->PH = get_phr_mapping(module_idP, CC_id, eNB_index);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*! \file nr_mac_common.c
|
||||
* \brief Common MAC functions for NR UE and gNB
|
||||
* \brief Common MAC/PHY functions for NR UE and gNB
|
||||
* \author Florian Kaltenberger and Raymond Knopp
|
||||
* \date 2019
|
||||
* \version 0.1
|
||||
@@ -33,43 +33,55 @@
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
nr_bandentry_t nr_bandtable[] = {
|
||||
{1, 1920000, 1980000, 2110000, 2170000, 20, 422000},
|
||||
{2, 1850000, 1910000, 1930000, 1990000, 20, 386000},
|
||||
{3, 1710000, 1785000, 1805000, 1880000, 20, 361000},
|
||||
{5, 824000, 849000, 869000, 894000, 20, 173800},
|
||||
{7, 2500000, 2570000, 2620000, 2690000, 20, 524000},
|
||||
{8, 880000, 915000, 925000, 960000, 20, 185000},
|
||||
{12, 698000, 716000, 728000, 746000, 20, 145800},
|
||||
{20, 832000, 862000, 791000, 821000, 20, 158200},
|
||||
{25, 1850000, 1915000, 1930000, 1995000, 20, 386000},
|
||||
{28, 703000, 758000, 758000, 813000, 20, 151600},
|
||||
{34, 2010000, 2025000, 2010000, 2025000, 20, 402000},
|
||||
{38, 2570000, 2620000, 2570000, 2630000, 20, 514000},
|
||||
{39, 1880000, 1920000, 1880000, 1920000, 20, 376000},
|
||||
{40, 2300000, 2400000, 2300000, 2400000, 20, 460000},
|
||||
{41, 2496000, 2690000, 2496000, 2690000, 3, 499200},
|
||||
{50, 1432000, 1517000, 1432000, 1517000, 20, 286400},
|
||||
{51, 1427000, 1432000, 1427000, 1432000, 20, 285400},
|
||||
{66, 1710000, 1780000, 2110000, 2200000, 20, 422000},
|
||||
{70, 1695000, 1710000, 1995000, 2020000, 20, 399000},
|
||||
{71, 663000, 698000, 617000, 652000, 20, 123400},
|
||||
{74, 1427000, 1470000, 1475000, 1518000, 20, 295000},
|
||||
{75, 000, 000, 1432000, 1517000, 20, 286400},
|
||||
{76, 000, 000, 1427000, 1432000, 20, 285400},
|
||||
{77, 3300000, 4200000, 3300000, 4200000, 1, 620000},
|
||||
{78, 3300000, 3800000, 3300000, 3800000, 1, 620000},
|
||||
{79, 4400000, 5000000, 4400000, 5000000, 2, 693334},
|
||||
{80, 1710000, 1785000, 000, 000, 20, 342000},
|
||||
{81, 860000, 915000, 000, 000, 20, 176000},
|
||||
{82, 832000, 862000, 000, 000, 20, 166400},
|
||||
{83, 703000, 748000, 000, 000, 20, 140600},
|
||||
{84, 1920000, 1980000, 000, 000, 20, 384000},
|
||||
{86, 1710000, 1785000, 000, 000, 20, 342000}
|
||||
{1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100},
|
||||
{2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100},
|
||||
{3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100},
|
||||
{5, 824000, 849000, 869000, 894000, 20, 173800, 100},
|
||||
{7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100},
|
||||
{8, 880000, 915000, 925000, 960000, 20, 185000, 100},
|
||||
{12, 698000, 716000, 728000, 746000, 20, 145800, 100},
|
||||
{20, 832000, 862000, 791000, 821000, 20, 158200, 100},
|
||||
{25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100},
|
||||
{28, 703000, 758000, 758000, 813000, 20, 151600, 100},
|
||||
{34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100},
|
||||
{38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100},
|
||||
{39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100},
|
||||
{40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100},
|
||||
{41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
|
||||
{41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
|
||||
{50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100},
|
||||
{51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100},
|
||||
{66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100},
|
||||
{70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100},
|
||||
{71, 663000, 698000, 617000, 652000, 20, 123400, 100},
|
||||
{74, 1427000, 1470000, 1475000, 1518000, 20, 295000, 100},
|
||||
{75, 000, 000, 1432000, 1517000, 20, 286400, 100},
|
||||
{76, 000, 000, 1427000, 1432000, 20, 285400, 100},
|
||||
{77, 3300000, 4200000, 3300000, 4200000, 1, 620000, 15},
|
||||
{77, 3300000, 4200000, 3300000, 4200000, 2, 620000, 30},
|
||||
{78, 3300000, 3800000, 3300000, 3800000, 1, 620000, 15},
|
||||
{78, 3300000, 3800000, 3300000, 3800000, 2, 620000, 30},
|
||||
{79, 4400000, 5000000, 4400000, 5000000, 1, 693334, 15},
|
||||
{79, 4400000, 5000000, 4400000, 5000000, 2, 693334, 30},
|
||||
{80, 1710000, 1785000, 000, 000, 20, 342000, 100},
|
||||
{81, 860000, 915000, 000, 000, 20, 176000, 100},
|
||||
{82, 832000, 862000, 000, 000, 20, 166400, 100},
|
||||
{83, 703000, 748000, 000, 000, 20, 140600, 100},
|
||||
{84, 1920000, 1980000, 000, 000, 20, 384000, 100},
|
||||
{86, 1710000, 1785000, 000, 000, 20, 342000, 100},
|
||||
{257,26500000,29500000,26500000,29500000, 1,2054166, 60},
|
||||
{257,26500000,29500000,26500000,29500000, 2,2054167, 120},
|
||||
{258,24250000,27500000,24250000,27500000, 1,2016667, 60},
|
||||
{258,24250000,27500000,24250000,27500000, 2,2016667, 120},
|
||||
{260,37000000,40000000,37000000,40000000, 1,2229166, 60},
|
||||
{260,37000000,40000000,37000000,40000000, 2,2229167, 120},
|
||||
{261,27500000,28350000,27500000,28350000, 1,2070833, 60},
|
||||
{261,27500000,28350000,27500000,28350000, 2,2070833, 120}
|
||||
};
|
||||
|
||||
#define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t))
|
||||
|
||||
void get_band(uint32_t downlink_frequency,
|
||||
void get_band(uint64_t downlink_frequency,
|
||||
uint16_t *current_band,
|
||||
int32_t *current_offset,
|
||||
lte_frame_type_t *current_type)
|
||||
@@ -91,40 +103,157 @@ void get_band(uint32_t downlink_frequency,
|
||||
if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz ) {
|
||||
|
||||
center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min)/2;
|
||||
|
||||
if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){
|
||||
|
||||
*current_band = nr_bandtable[ind].band;
|
||||
*current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000;
|
||||
*current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000;
|
||||
center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz);
|
||||
|
||||
if (*current_offset == 0)
|
||||
*current_type = TDD;
|
||||
else
|
||||
*current_type = FDD;
|
||||
if (*current_offset == 0)
|
||||
*current_type = TDD;
|
||||
else
|
||||
*current_type = FDD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_I( PHY, "DL frequency %"PRIu32": band %d, frame_type %d, UL frequency %"PRIu32"\n",
|
||||
LOG_I( PHY, "DL frequency %"PRIu64": band %d, frame_type %d, UL frequency %"PRIu64"\n",
|
||||
downlink_frequency, *current_band, *current_type, downlink_frequency+*current_offset);
|
||||
|
||||
AssertFatal(*current_band != 0,
|
||||
"Can't find EUTRA band for frequency %u\n", downlink_frequency);
|
||||
"Can't find EUTRA band for frequency %lu\n", downlink_frequency);
|
||||
}
|
||||
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
|
||||
{
|
||||
|
||||
if (nr_band < 100) { //FR1
|
||||
switch(mu) {
|
||||
case 0 :
|
||||
if (nb_rb<=25)
|
||||
return 5;
|
||||
if (nb_rb<=52)
|
||||
return 10;
|
||||
if (nb_rb<=79)
|
||||
return 15;
|
||||
if (nb_rb<=106)
|
||||
return 20;
|
||||
if (nb_rb<=133)
|
||||
return 25;
|
||||
if (nb_rb<=160)
|
||||
return 30;
|
||||
if (nb_rb<=216)
|
||||
return 40;
|
||||
if (nb_rb<=270)
|
||||
return 50;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 1 :
|
||||
if (nb_rb<=11)
|
||||
return 5;
|
||||
if (nb_rb<=24)
|
||||
return 10;
|
||||
if (nb_rb<=38)
|
||||
return 15;
|
||||
if (nb_rb<=51)
|
||||
return 20;
|
||||
if (nb_rb<=65)
|
||||
return 25;
|
||||
if (nb_rb<=78)
|
||||
return 30;
|
||||
if (nb_rb<=106)
|
||||
return 40;
|
||||
if (nb_rb<=133)
|
||||
return 50;
|
||||
if (nb_rb<=162)
|
||||
return 60;
|
||||
if (nb_rb<=189)
|
||||
return 70;
|
||||
if (nb_rb<=217)
|
||||
return 80;
|
||||
if (nb_rb<=245)
|
||||
return 90;
|
||||
if (nb_rb<=273)
|
||||
return 100;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 2 :
|
||||
if (nb_rb<=11)
|
||||
return 10;
|
||||
if (nb_rb<=18)
|
||||
return 15;
|
||||
if (nb_rb<=24)
|
||||
return 20;
|
||||
if (nb_rb<=31)
|
||||
return 25;
|
||||
if (nb_rb<=38)
|
||||
return 30;
|
||||
if (nb_rb<=51)
|
||||
return 40;
|
||||
if (nb_rb<=65)
|
||||
return 50;
|
||||
if (nb_rb<=79)
|
||||
return 60;
|
||||
if (nb_rb<=93)
|
||||
return 70;
|
||||
if (nb_rb<=107)
|
||||
return 80;
|
||||
if (nb_rb<=121)
|
||||
return 90;
|
||||
if (nb_rb<=135)
|
||||
return 100;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch(mu) {
|
||||
case 2 :
|
||||
if (nb_rb<=66)
|
||||
return 50;
|
||||
if (nb_rb<=132)
|
||||
return 100;
|
||||
if (nb_rb<=264)
|
||||
return 200;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 3 :
|
||||
if (nb_rb<=32)
|
||||
return 50;
|
||||
if (nb_rb<=66)
|
||||
return 100;
|
||||
if (nb_rb<=132)
|
||||
return 200;
|
||||
if (nb_rb<=264)
|
||||
return 400;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP,
|
||||
uint64_t dl_CarrierFreq,
|
||||
uint8_t scs_index,
|
||||
uint32_t bw)
|
||||
{
|
||||
uint64_t dl_CarrierFreq_by_1k = dl_CarrierFreq / 1000;
|
||||
int bw_kHz = bw / 1000;
|
||||
|
||||
int scs_khz = 15<<scs_index;
|
||||
int i;
|
||||
uint32_t nrarfcn, delta_arfcn;
|
||||
|
||||
LOG_I(MAC,"Searching for nr band %d DL Carrier frequency %llu bw %u\n",nr_bandP,(long long unsigned int)dl_CarrierFreq,bw);
|
||||
AssertFatal(nr_bandP < 86, "nr_band %d > 86\n", nr_bandP);
|
||||
for (i = 0; i < 30 && nr_bandtable[i].band != nr_bandP; i++);
|
||||
AssertFatal(nr_bandP <= 261, "nr_band %d > 260\n", nr_bandP);
|
||||
for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++);
|
||||
|
||||
// selection of correct Deltaf raster according to SCS
|
||||
if ( (nr_bandtable[i].deltaf_raster != 100) && (nr_bandtable[i].deltaf_raster != scs_khz))
|
||||
i++;
|
||||
|
||||
AssertFatal(dl_CarrierFreq_by_1k >= nr_bandtable[i].dl_min,
|
||||
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n",
|
||||
@@ -135,31 +264,57 @@ uint32_t to_nrarfcn(int nr_bandP,
|
||||
nr_bandP, (long long unsigned int)dl_CarrierFreq,bw, (long long unsigned int)dl_CarrierFreq_by_1k,
|
||||
(long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz));
|
||||
|
||||
int deltaFglobal;
|
||||
int deltaFglobal = 60;
|
||||
|
||||
if (dl_CarrierFreq < 3e9) deltaFglobal = 5;
|
||||
else deltaFglobal = 15;
|
||||
if (dl_CarrierFreq < 3e9) deltaFglobal = 15;
|
||||
if (dl_CarrierFreq < 24.25e9) deltaFglobal = 5;
|
||||
|
||||
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
|
||||
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
|
||||
return (((dl_CarrierFreq_by_1k - nr_bandtable[i].dl_min)/deltaFglobal) +
|
||||
nr_bandtable[i].N_OFFs_DL);
|
||||
nrarfcn = (((dl_CarrierFreq_by_1k - nr_bandtable[i].dl_min)/deltaFglobal)+nr_bandtable[i].N_OFFs_DL);
|
||||
|
||||
delta_arfcn = nrarfcn - nr_bandtable[i].N_OFFs_DL;
|
||||
if(delta_arfcn%(nr_bandtable[i].step_size)!=0)
|
||||
AssertFatal(1==0,"dl_CarrierFreq %lu corresponds to %u which is not on the raster for step size %lu",
|
||||
dl_CarrierFreq,nrarfcn,nr_bandtable[i].step_size);
|
||||
|
||||
return nrarfcn;
|
||||
}
|
||||
|
||||
|
||||
uint64_t from_nrarfcn(int nr_bandP,
|
||||
uint8_t scs_index,
|
||||
uint32_t dl_nrarfcn)
|
||||
{
|
||||
int i;
|
||||
int deltaFglobal;
|
||||
int deltaFglobal = 5;
|
||||
int scs_khz = 15<<scs_index;
|
||||
uint32_t delta_arfcn;
|
||||
|
||||
if (nr_bandP < 77 || nr_bandP > 79) deltaFglobal = 5;
|
||||
else deltaFglobal = 15;
|
||||
if (dl_nrarfcn > 599999 && dl_nrarfcn < 2016667)
|
||||
deltaFglobal = 15;
|
||||
if (dl_nrarfcn > 2016666 && dl_nrarfcn < 3279166)
|
||||
deltaFglobal = 60;
|
||||
|
||||
AssertFatal(nr_bandP < 87, "nr_band %d > 86\n", nr_bandP);
|
||||
for (i = 0; i < 31 && nr_bandtable[i].band != nr_bandP; i++);
|
||||
AssertFatal(dl_nrarfcn>=nr_bandtable[i].N_OFFs_DL,"dl_nrarfcn %u < N_OFFs_DL %llu\n",dl_nrarfcn, (long long unsigned int)nr_bandtable[i].N_OFFs_DL);
|
||||
AssertFatal(nr_bandP <= 261, "nr_band %d > 260\n", nr_bandP);
|
||||
for (i = 0; i < NR_BANDTABLE_SIZE && nr_bandtable[i].band != nr_bandP; i++);
|
||||
AssertFatal(dl_nrarfcn>=nr_bandtable[i].N_OFFs_DL,"dl_nrarfcn %u < N_OFFs_DL[%d] %llu\n",dl_nrarfcn, nr_bandtable[i].band,(long long unsigned int)nr_bandtable[i].N_OFFs_DL);
|
||||
|
||||
// selection of correct Deltaf raster according to SCS
|
||||
if ( (nr_bandtable[i].deltaf_raster != 100) && (nr_bandtable[i].deltaf_raster != scs_khz))
|
||||
i++;
|
||||
|
||||
delta_arfcn = dl_nrarfcn - nr_bandtable[i].N_OFFs_DL;
|
||||
if(delta_arfcn%(nr_bandtable[i].step_size)!=0)
|
||||
AssertFatal(1==0,"dl_nrarfcn %u is not on the raster for step size %lu",dl_nrarfcn,nr_bandtable[i].step_size);
|
||||
|
||||
LOG_I(PHY,"Computing dl_frequency (pointA %llu => %llu (dlmin %llu, nr_bandtable[%d].N_OFFs_DL %llu))\n",
|
||||
(unsigned long long)dl_nrarfcn,
|
||||
(unsigned long long)(1000*(nr_bandtable[i].dl_min + (dl_nrarfcn - nr_bandtable[i].N_OFFs_DL) * deltaFglobal)),
|
||||
(unsigned long long)nr_bandtable[i].dl_min,
|
||||
i,
|
||||
(unsigned long long)nr_bandtable[i].N_OFFs_DL);
|
||||
|
||||
return 1000*(nr_bandtable[i].dl_min + (dl_nrarfcn - nr_bandtable[i].N_OFFs_DL) * deltaFglobal);
|
||||
}
|
||||
|
||||
@@ -174,3 +329,420 @@ int32_t get_nr_uldl_offset(int nr_bandP)
|
||||
|
||||
return (nr_bandtable[i].dl_min - nr_bandtable[i].ul_min);
|
||||
}
|
||||
|
||||
|
||||
void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
int x_overhead) {
|
||||
|
||||
LOG_D(MAC, "TBS calculation\n");
|
||||
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_rel15 = &pdsch_pdu->pdsch_pdu_rel15;
|
||||
uint16_t N_PRB_oh = x_overhead;
|
||||
uint8_t N_PRB_DMRS = (pdsch_rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1)?6:4; //This only works for antenna port 1000
|
||||
uint8_t N_sh_symb = pdsch_rel15->NrOfSymbols;
|
||||
uint8_t Imcs = pdsch_rel15->mcsIndex[0];
|
||||
uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh;
|
||||
LOG_D(MAC, "N_RE_prime %d for %d symbols %d DMRS per PRB and %d overhead\n", N_RE_prime, N_sh_symb, N_PRB_DMRS, N_PRB_oh);
|
||||
|
||||
uint16_t R;
|
||||
uint32_t TBS=0;
|
||||
uint8_t table_idx, Qm;
|
||||
|
||||
/*uint8_t mcs_table = config.pdsch_config.mcs_table.value;
|
||||
uint8_t ss_type = params_rel15.search_space_type;
|
||||
uint8_t dci_format = params_rel15.dci_format;
|
||||
get_table_idx(mcs_table, dci_format, rnti_type, ss_type);*/
|
||||
table_idx = 0;
|
||||
R = nr_get_code_rate_dl(Imcs, table_idx);
|
||||
Qm = nr_get_Qm_dl(Imcs, table_idx);
|
||||
|
||||
TBS = nr_compute_tbs(Qm,
|
||||
R,
|
||||
pdsch_rel15->rbSize,
|
||||
N_sh_symb,
|
||||
N_PRB_DMRS,
|
||||
N_PRB_oh,
|
||||
pdsch_rel15->nrOfLayers)>>3;
|
||||
|
||||
pdsch_rel15->targetCodeRate[0] = R;
|
||||
pdsch_rel15->qamModOrder[0] = Qm;
|
||||
pdsch_rel15->TBSize[0] = TBS;
|
||||
// pdsch_rel15->nb_mod_symbols = N_RE_prime*pdsch_rel15->n_prb*pdsch_rel15->nb_codewords;
|
||||
pdsch_rel15->mcsTable[0] = table_idx;
|
||||
|
||||
LOG_D(MAC, "TBS %d bytes: N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d R %d Qm %d table %d nb_symbols %d\n",
|
||||
TBS, N_PRB_DMRS, N_sh_symb, N_PRB_oh, R, Qm, table_idx,N_RE_prime*pdsch_rel15->rbSize*pdsch_rel15->NrOfCodewords );
|
||||
}
|
||||
|
||||
//Table 5.1.3.1-1 of 38.214
|
||||
uint16_t Table_51311[29][2] = {{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},{4,340},{4,378},{4,434},{4,490},{4,553},{4,616},
|
||||
{4,658},{6,438},{6,466},{6,517},{6,567},{6,616},{6,666},{6,719},{6,772},{6,822},{6,873}, {6,910}, {6,948}};
|
||||
|
||||
//Table 5.1.3.1-2 of 38.214
|
||||
// Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
|
||||
uint16_t Table_51312[28][2] = {{2,120},{2,193},{2,308},{2,449},{2,602},{4,378},{4,434},{4,490},{4,553},{4,616},{4,658},{6,466},{6,517},{6,567},{6,616},{6,666},
|
||||
{6,719},{6,772},{6,822},{6,873},{8,1365},{8,711},{8,754},{8,797},{8,841},{8,885},{8,1833},{8,948}};
|
||||
|
||||
//Table 5.1.3.1-3 of 38.214
|
||||
uint16_t Table_51313[29][2] = {{2,30},{2,40},{2,50},{2,64},{2,78},{2,99},{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{4,340},
|
||||
{4,378},{4,434},{4,490},{4,553},{4,616},{6,438},{6,466},{6,517},{6,567},{6,616},{6,666}, {6,719}, {6,772}};
|
||||
|
||||
//Table 6.1.4.1-1 of 38.214 TODO fix for tp-pi2BPSK
|
||||
uint16_t Table_61411[28][2] = {{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},{4,340},{4,378},{4,434},{4,490},{4,553},{4,616},
|
||||
{4,658},{6,466},{6,517},{6,567},{6,616},{6,666},{6,719},{6,772},{6,822},{6,873}, {6,910}, {6,948}};
|
||||
|
||||
//Table 6.1.4.1-2 of 38.214 TODO fix for tp-pi2BPSK
|
||||
uint16_t Table_61412[28][2] = {{2,30},{2,40},{2,50},{2,64},{2,78},{2,99},{2,120},{2,157},{2,193},{2,251},{2,308},{2,379},{2,449},{2,526},{2,602},{2,679},
|
||||
{4,378},{4,434},{4,490},{4,553},{4,616},{4,658},{4,699},{4,772},{6,567},{6,616},{6,666}, {6,772}};
|
||||
|
||||
|
||||
|
||||
uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx) {
|
||||
switch(table_idx) {
|
||||
case 0:
|
||||
return (Table_51311[Imcs][0]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
return (Table_51312[Imcs][0]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return (Table_51313[Imcs][0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx) {
|
||||
switch(table_idx) {
|
||||
case 0:
|
||||
return (Table_51311[Imcs][1]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
return (Table_51312[Imcs][1]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return (Table_51313[Imcs][1]);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
|
||||
switch(table_idx) {
|
||||
case 0:
|
||||
return (Table_51311[Imcs][0]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
return (Table_51312[Imcs][0]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return (Table_51313[Imcs][0]);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return (Table_61411[Imcs][0]);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
return (Table_61412[Imcs][0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,2])\n", table_idx);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
|
||||
switch(table_idx) {
|
||||
case 0:
|
||||
return (Table_51311[Imcs][1]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
return (Table_51312[Imcs][1]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return (Table_51313[Imcs][1]);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return (Table_61411[Imcs][1]);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
return (Table_61412[Imcs][1]);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,2])\n", table_idx);
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint8_t is_codeword_disabled(uint8_t format, uint8_t Imcs, uint8_t rv) {
|
||||
return ((format==NFAPI_NR_DL_DCI_FORMAT_1_1)&&(Imcs==26)&&(rv==1));
|
||||
}
|
||||
|
||||
static inline uint8_t get_table_idx(uint8_t mcs_table, uint8_t dci_format, uint8_t rnti_type, uint8_t ss_type) {
|
||||
if ((mcs_table == NFAPI_NR_MCS_TABLE_QAM256) && (dci_format == NFAPI_NR_DL_DCI_FORMAT_1_1) && ((rnti_type==NFAPI_NR_RNTI_C)||(rnti_type==NFAPI_NR_RNTI_CS)))
|
||||
return 2;
|
||||
else if ((mcs_table == NFAPI_NR_MCS_TABLE_QAM64_LOW_SE) && (rnti_type!=NFAPI_NR_RNTI_new) && (rnti_type==NFAPI_NR_RNTI_C) && (ss_type==NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC))
|
||||
return 3;
|
||||
else if (rnti_type==NFAPI_NR_RNTI_new)
|
||||
return 3;
|
||||
else if ((mcs_table == NFAPI_NR_MCS_TABLE_QAM256) && (rnti_type==NFAPI_NR_RNTI_CS) && (dci_format == NFAPI_NR_DL_DCI_FORMAT_1_1))
|
||||
return 2; // Condition mcs_table not configured in sps_config necessary here but not yet implemented
|
||||
/*else if((mcs_table == NFAPI_NR_MCS_TABLE_QAM64_LOW_SE) && (rnti_type==NFAPI_NR_RNTI_CS))
|
||||
* table_idx = 3;
|
||||
* Note: the commented block refers to the case where the mcs_table is from sps_config*/
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
int get_num_dmrs(uint16_t dmrs_mask ) {
|
||||
|
||||
int num_dmrs=0;
|
||||
|
||||
for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1);
|
||||
return(num_dmrs);
|
||||
}
|
||||
|
||||
uint16_t nr_dci_size(nr_dci_format_t format,
|
||||
nr_rnti_type_t rnti_type,
|
||||
uint16_t N_RB) {
|
||||
|
||||
uint16_t size = 0;
|
||||
|
||||
switch(format) {
|
||||
/*Only sizes for 0_0 and 1_0 are correct at the moment*/
|
||||
case NR_UL_DCI_FORMAT_0_0:
|
||||
/// fixed: Format identifier 1, Hop flag 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2 Time Domain assgnmt 4 --20
|
||||
size += 20;
|
||||
size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment -- hopping scenario to be updated
|
||||
size += nr_dci_size(NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB) - size; // Padding to match 1_0 size
|
||||
// UL/SUL indicator assumed to be 0
|
||||
break;
|
||||
|
||||
case NR_UL_DCI_FORMAT_0_1:
|
||||
/// fixed: Format identifier 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2, SRS request 2 --17
|
||||
size += 17;
|
||||
// Carrier indicator
|
||||
// UL/SUL indicator
|
||||
// BWP Indicator
|
||||
// Freq domain assignment
|
||||
// Time domain assignment
|
||||
// VRB to PRB mapping
|
||||
// Frequency Hopping flag
|
||||
// 1st DAI
|
||||
// 2nd DAI
|
||||
// SRS resource indicator
|
||||
// Precoding info and number of layers
|
||||
// Antenna ports
|
||||
// CSI request
|
||||
// CBGTI
|
||||
// PTRS - DMRS association
|
||||
// beta offset indicator
|
||||
// DMRS sequence init
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_1_0:
|
||||
/// fixed: Format identifier 1, VRB2PRB 1, MCS 5, NDI 1, RV 2, HARQ PID 4, DAI 2, PUCCH TPC 2, PUCCH RInd 3, PDSCH to HARQ TInd 3 Time Domain assgnmt 4 -- 28
|
||||
size += 28;
|
||||
size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_1_1:
|
||||
// Carrier indicator
|
||||
size += 1; // Format identifier
|
||||
// BWP Indicator
|
||||
// Freq domain assignment
|
||||
// Time domain assignment
|
||||
// VRB to PRB mapping
|
||||
// PRB bundling size indicator
|
||||
// Rate matching indicator
|
||||
// ZP CSI-RS trigger
|
||||
/// TB1- MCS 5, NDI 1, RV 2
|
||||
size += 8;
|
||||
// TB2
|
||||
size += 4 ; // HARQ PID
|
||||
// DAI
|
||||
size += 2; // TPC PUCCH
|
||||
size += 3; // PUCCH resource indicator
|
||||
size += 3; // PDSCH to HARQ timing indicator
|
||||
// Antenna ports
|
||||
// Tx Config Indication
|
||||
size += 2; // SRS request
|
||||
// CBGTI
|
||||
// CBGFI
|
||||
size += 1; // DMRS sequence init
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_2_0:
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_2_1:
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_2_2:
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_2_3:
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1==0, "Invalid NR DCI format %d\n", format);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int tdd_period_to_num[8] = {500,625,1000,1250,2000,2500,5000,10000};
|
||||
|
||||
int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slot) {
|
||||
|
||||
int period,period1,period2=0;
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon==NULL) return(1);
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 &&
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period1 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
else
|
||||
period1 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity];
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern2) {
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1 &&
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period2 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
else
|
||||
period2 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity];
|
||||
}
|
||||
period = period1+period2;
|
||||
int scs=scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
|
||||
int slots=period*(1<<scs)/1000;
|
||||
int slots1=period1*(1<<scs)/1000;
|
||||
int slot_in_period = slot % slots;
|
||||
if (slot_in_period < slots1) return(slot_in_period <= scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0);
|
||||
else return(slot_in_period <= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
||||
}
|
||||
|
||||
int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slot) {
|
||||
|
||||
int period,period1,period2=0;
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon==NULL) return(1);
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 &&
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period1 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
else
|
||||
period1 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity];
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern2) {
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1 &&
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530)
|
||||
period2 = 3000+*scc->tdd_UL_DL_ConfigurationCommon->pattern2->ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
else
|
||||
period2 = tdd_period_to_num[scc->tdd_UL_DL_ConfigurationCommon->pattern2->dl_UL_TransmissionPeriodicity];
|
||||
}
|
||||
period = period1+period2;
|
||||
int scs=scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
|
||||
int slots=period*(1<<scs)/1000;
|
||||
int slots1=period1*(1<<scs)/1000;
|
||||
int slot_in_period = slot % slots;
|
||||
if (slot_in_period < slots1) return(slot_in_period >= scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0);
|
||||
else return(slot_in_period >= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
||||
}
|
||||
|
||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols) {
|
||||
|
||||
int l0;
|
||||
if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2;
|
||||
else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3;
|
||||
else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position);
|
||||
if (pdsch_Config == NULL) { // Initial BWP
|
||||
return(1<<l0);
|
||||
}
|
||||
else {
|
||||
if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA &&
|
||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) {
|
||||
// Relative to start of slot
|
||||
NR_DMRS_DownlinkConfig_t *dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup;
|
||||
AssertFatal(NrOfSymbols>1 && NrOfSymbols < 15,"Illegal NrOfSymbols %d\n",NrOfSymbols);
|
||||
int pos2=0;
|
||||
if (dmrs_config->maxLength == NULL) {
|
||||
// this is Table 7.4.1.1.2-3: PDSCH DM-RS positions l for single-symbol DM-RS
|
||||
if (dmrs_config->dmrs_AdditionalPosition == NULL) pos2=1;
|
||||
else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition == NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0 )
|
||||
return(1<<l0);
|
||||
|
||||
|
||||
switch (NrOfSymbols) {
|
||||
case 2 :
|
||||
case 3 :
|
||||
case 4 :
|
||||
case 5 :
|
||||
case 6 :
|
||||
case 7 :
|
||||
AssertFatal(1==0,"Incoompatible NrOfSymbols %d and dmrs_Additional_Position %d\n",
|
||||
NrOfSymbols,(int)*dmrs_config->dmrs_AdditionalPosition);
|
||||
break;
|
||||
case 8 :
|
||||
case 9:
|
||||
return(1<<l0 | 1<<7);
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
||||
return(1<<l0 | 1<<9);
|
||||
else
|
||||
return(1<<l0 | 1<<6 | 1<<9);
|
||||
break;
|
||||
case 12:
|
||||
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
||||
return(1<<l0 | 1<<9);
|
||||
else if (pos2==1)
|
||||
return(1<<l0 | 1<<6 | 1<<9);
|
||||
else if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3)
|
||||
return(1<<l0 | 1<<5 | 1<<8 | 1<<11);
|
||||
break;
|
||||
case 13:
|
||||
case 14:
|
||||
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1)
|
||||
return(1<<l0 | 1<<11);
|
||||
else if (pos2==1)
|
||||
return(1<<l0 | 1<<7 | 1<<11);
|
||||
else if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3)
|
||||
return(1<<l0 | 1<<5 | 1<<8 | 1<<11);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Table 7.4.1.1.2-4: PDSCH DM-RS positions l for double-symbol DM-RS.
|
||||
AssertFatal(NrOfSymbols>3,"Illegal NrOfSymbols %d for len2 DMRS\n",NrOfSymbols);
|
||||
if (NrOfSymbols < 10) return(1<<l0);
|
||||
if (NrOfSymbols < 13 && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
|
||||
if (NrOfSymbols < 13 && *dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0 | 1<<8);
|
||||
if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
|
||||
if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<<l0 | 1<<10);
|
||||
}
|
||||
}
|
||||
else if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB &&
|
||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) {
|
||||
// Relative to start of PDSCH resource
|
||||
AssertFatal(1==0,"TypeB DMRS not supported yet\n");
|
||||
}
|
||||
}
|
||||
AssertFatal(1==0,"Shouldn't get here\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -35,133 +35,340 @@
|
||||
|
||||
#include "NR_MAC-CellGroupConfig.h"
|
||||
|
||||
#include "../NR_MAC_gNB/nr_mac_common.h"
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
|
||||
int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg,
|
||||
int mu,
|
||||
int nrofDownlinkSlots, int nrofDownlinkSymbols,
|
||||
int nrofUplinkSlots, int nrofUplinkSymbols) {
|
||||
|
||||
int slot_number = 0;
|
||||
int nb_periods_per_frame;
|
||||
int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||
|
||||
switch(cfg->tdd_table.tdd_period) {
|
||||
case 0:
|
||||
nb_periods_per_frame = 20; // 10ms/0p5ms
|
||||
break;
|
||||
|
||||
case 1:
|
||||
nb_periods_per_frame = 16; // 10ms/0p625ms
|
||||
break;
|
||||
|
||||
case 2:
|
||||
nb_periods_per_frame = 10; // 10ms/1ms
|
||||
break;
|
||||
|
||||
case 3:
|
||||
nb_periods_per_frame = 8; // 10ms/1p25ms
|
||||
break;
|
||||
|
||||
case 4:
|
||||
nb_periods_per_frame = 5; // 10ms/2ms
|
||||
break;
|
||||
|
||||
case 5:
|
||||
nb_periods_per_frame = 4; // 10ms/2p5ms
|
||||
break;
|
||||
|
||||
case 6:
|
||||
nb_periods_per_frame = 2; // 10ms/5ms
|
||||
break;
|
||||
|
||||
case 7:
|
||||
nb_periods_per_frame = 1; // 10ms/10ms
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1==0,"Undefined tdd period %d\n", cfg->tdd_table.tdd_period);
|
||||
}
|
||||
|
||||
int nb_slots_per_period = ((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame;
|
||||
|
||||
if ( (nrofDownlinkSymbols + nrofUplinkSymbols) == 0 )
|
||||
AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots),
|
||||
"set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nb_slots_per_period %d \n",
|
||||
nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
|
||||
else {
|
||||
AssertFatal(nrofDownlinkSymbols + nrofUplinkSymbols < 14,"illegal symbol configuration DL %d, UL %d\n",nrofDownlinkSymbols,nrofUplinkSymbols);
|
||||
AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots + 1),
|
||||
"set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nrofMixed slots 1, nb_slots_per_period %d \n",
|
||||
nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
|
||||
}
|
||||
|
||||
cfg->tdd_table.max_tdd_periodicity_list = (fapi_nr_max_tdd_periodicity_t *) malloc(nb_slots_to_set*sizeof(fapi_nr_max_tdd_periodicity_t));
|
||||
|
||||
for(int memory_alloc =0 ; memory_alloc<nb_slots_to_set; memory_alloc++)
|
||||
cfg->tdd_table.max_tdd_periodicity_list[memory_alloc].max_num_of_symbol_per_slot_list = (fapi_nr_max_num_of_symbol_per_slot_t *) malloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT*sizeof(
|
||||
fapi_nr_max_num_of_symbol_per_slot_t));
|
||||
|
||||
while(slot_number != nb_slots_to_set) {
|
||||
if(nrofDownlinkSlots != 0) {
|
||||
for (int number_of_symbol = 0; number_of_symbol < nrofDownlinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config= 0;
|
||||
|
||||
if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
|
||||
slot_number++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) {
|
||||
for(int number_of_symbol =0; number_of_symbol < nrofDownlinkSymbols; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config= 0;
|
||||
}
|
||||
|
||||
for(int number_of_symbol = nrofDownlinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config= 2;
|
||||
}
|
||||
|
||||
for(int number_of_symbol = NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config= 1;
|
||||
}
|
||||
|
||||
slot_number++;
|
||||
}
|
||||
|
||||
if(nrofUplinkSlots != 0) {
|
||||
for (int number_of_symbol = 0; number_of_symbol < nrofUplinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config= 1;
|
||||
|
||||
if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
|
||||
slot_number++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
module_id_t module_id,
|
||||
int cc_idP) {
|
||||
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
int i;
|
||||
|
||||
mac->phy_config.Mod_id = module_id;
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
|
||||
// carrier config
|
||||
|
||||
LOG_I(MAC,"UE Config Common\n");
|
||||
|
||||
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
|
||||
|
||||
cfg->carrier_config.dl_frequency = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.dl_grid_size[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.dl_k0[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.dl_grid_size[i] = 0;
|
||||
cfg->carrier_config.dl_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]);
|
||||
|
||||
int UL_pointA;
|
||||
if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL)
|
||||
UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
else
|
||||
UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA;
|
||||
|
||||
cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
UL_pointA)/1000; // freq in kHz
|
||||
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.ul_grid_size[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.ul_k0[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.ul_grid_size[i] = 0;
|
||||
cfg->carrier_config.ul_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// cell config
|
||||
|
||||
cfg->cell_config.phy_cell_id = *scc->physCellId;
|
||||
cfg->cell_config.frame_duplex_type = 1;
|
||||
|
||||
|
||||
// SSB config
|
||||
cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower;
|
||||
cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing;
|
||||
|
||||
// SSB Table config
|
||||
int scs_scaling = 1<<(cfg->ssb_config.scs_common);
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000)
|
||||
scs_scaling = scs_scaling*3;
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
||||
scs_scaling = scs_scaling>>2;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10;
|
||||
cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell;
|
||||
cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
|
||||
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case 1 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
|
||||
break;
|
||||
case 2 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]<<24;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
|
||||
break;
|
||||
case 3 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask = 0;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
|
||||
for (i=0; i<4; i++) {
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[i+4]<<i*8);
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[i]<<i*8);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present);
|
||||
}
|
||||
|
||||
// TDD Table Configuration
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL)
|
||||
cfg->tdd_table.tdd_period = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
|
||||
else {
|
||||
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL,
|
||||
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
||||
cfg->tdd_table.tdd_period = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
}
|
||||
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period);
|
||||
if(cfg->cell_config.frame_duplex_type == TDD){
|
||||
int return_tdd = set_tdd_config_nr_ue(cfg,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols
|
||||
);
|
||||
|
||||
if (return_tdd !=0)
|
||||
LOG_E(PHY,"TDD configuration can not be done\n");
|
||||
else
|
||||
LOG_I(PHY,"TDD has been properly configurated\n");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
int nr_rrc_mac_config_req_ue(
|
||||
module_id_t module_id,
|
||||
int cc_idP,
|
||||
uint8_t gNB_index,
|
||||
NR_MIB_t *mibP,
|
||||
NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
|
||||
NR_PhysicalCellGroupConfig_t *phy_cell_group_configP,
|
||||
NR_SpCellConfig_t *spcell_configP ){
|
||||
// NR_ServingCellConfigCommon_t *sccP,
|
||||
// NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
|
||||
// NR_PhysicalCellGroupConfig_t *phy_cell_group_configP,
|
||||
NR_SpCellConfig_t *spCell_ConfigP ){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
|
||||
// NR_ServingCellConfig_t *serving_cell_config = spcell_configP->spCellConfigDedicated;
|
||||
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
|
||||
// NR_ServingCellConfig_t *serving_cell_config = spcell_configP->spCellConfigDedicated;
|
||||
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
|
||||
|
||||
|
||||
if(mibP != NULL){
|
||||
mac->mib = mibP; // update by every reception
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP != NULL){
|
||||
if(mac_cell_group_configP->drx_Config != NULL ){
|
||||
switch(mac_cell_group_configP->drx_Config->present){
|
||||
case NR_SetupRelease_DRX_Config_PR_NOTHING:
|
||||
break;
|
||||
case NR_SetupRelease_DRX_Config_PR_release:
|
||||
mac->drx_Config = NULL;
|
||||
break;
|
||||
case NR_SetupRelease_DRX_Config_PR_setup:
|
||||
mac->drx_Config = mac_cell_group_configP->drx_Config->choice.setup;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP->schedulingRequestConfig != NULL ){
|
||||
mac->schedulingRequestConfig = mac_cell_group_configP->schedulingRequestConfig;
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP->bsr_Config != NULL ){
|
||||
mac->bsr_Config = mac_cell_group_configP->bsr_Config;
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP->tag_Config != NULL ){
|
||||
mac->tag_Config = mac_cell_group_configP->tag_Config;
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP->phr_Config != NULL ){
|
||||
switch(mac_cell_group_configP->phr_Config->present){
|
||||
case NR_SetupRelease_PHR_Config_PR_NOTHING:
|
||||
break;
|
||||
case NR_SetupRelease_PHR_Config_PR_release:
|
||||
mac->phr_Config = NULL;
|
||||
break;
|
||||
case NR_SetupRelease_PHR_Config_PR_setup:
|
||||
mac->phr_Config = mac_cell_group_configP->phr_Config->choice.setup;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(phy_cell_group_configP->cs_RNTI != NULL ){
|
||||
switch(phy_cell_group_configP->cs_RNTI->present){
|
||||
case NR_SetupRelease_RNTI_Value_PR_NOTHING:
|
||||
break;
|
||||
case NR_SetupRelease_RNTI_Value_PR_release:
|
||||
mac->cs_RNTI = NULL;
|
||||
break;
|
||||
case NR_SetupRelease_RNTI_Value_PR_setup:
|
||||
mac->cs_RNTI = &phy_cell_group_configP->cs_RNTI->choice.setup;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mac->mib = mibP; // update by every reception
|
||||
}
|
||||
|
||||
if(phy_cell_group_configP != NULL ){
|
||||
//config_phy(phy_cell_group_config, NULL);
|
||||
}
|
||||
|
||||
// TODO check
|
||||
#if 0
|
||||
if(serving_cell_config_configP != NULL ){
|
||||
//config_phy(NULL, spcell_config);
|
||||
mac->servCellIndex = spcell_config->servCellIndex;
|
||||
}
|
||||
|
||||
|
||||
if(serving_cell_config != NULL ){
|
||||
if(serving_cell_config->tdd_UL_DL_ConfigurationDedicated != NULL ){
|
||||
mac->tdd_UL_DL_ConfigurationDedicated = serving_cell_config->tdd_UL_DL_ConfigurationDedicated;
|
||||
}
|
||||
|
||||
if(spcell_config->initialDownlinkBWP != NULL ){
|
||||
mac->init_DL_BWP = spcell_config->initialDownlinkBWP;
|
||||
}
|
||||
|
||||
// storage list of DL BWP config. TODO should be modify to maintain(add/release) a list inside MAC instance, this implementation just use for one-shot RRC configuration setting.
|
||||
if(spcell_config->downlinkBWP_ToAddModList != NULL ){
|
||||
mac->BWP_Downlink_list = spcell_config->downlinkBWP_ToAddModList->list;
|
||||
mac->BWP_Downlink_count = spcell_config->downlinkBWP_ToAddModList->count;
|
||||
}
|
||||
|
||||
if(spcell_config->bwp_InactivityTimer != NULL ){
|
||||
mac->bwp_InactivityTimer = spcell_config->bwp_InactivityTimer;
|
||||
}
|
||||
|
||||
if(spcell_config->defaultDownlinkBWP_Id != NULL ){
|
||||
mac->defaultDownlinkBWP_Id = spcell_config->defaultDownlinkBWP_Id;
|
||||
}
|
||||
|
||||
if(spcell_config->pdsch_ServingCellConfig != NULL ){
|
||||
mac->pdsch_ServingCellConfig = spcell_config->pdsch_ServingCellConfig;
|
||||
}
|
||||
|
||||
if(spcell_config->csi_MeasConfig != NULL ){
|
||||
mac->csi_MeasConfig = spcell_config->csi_MeasConfig;
|
||||
}
|
||||
|
||||
spcell_config->tag_Id = spcell_config.tag_Id;
|
||||
}
|
||||
#endif
|
||||
//scell config not yet
|
||||
|
||||
if(spCell_ConfigP != NULL ){
|
||||
mac->servCellIndex = *spCell_ConfigP->servCellIndex;
|
||||
if (spCell_ConfigP->reconfigurationWithSync) {
|
||||
mac->scc = spCell_ConfigP->reconfigurationWithSync->spCellConfigCommon;
|
||||
config_common_ue(mac,module_id,cc_idP);
|
||||
mac->crnti = spCell_ConfigP->reconfigurationWithSync->newUE_Identity;
|
||||
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
|
||||
}
|
||||
mac->scd = spCell_ConfigP->spCellConfigDedicated;
|
||||
|
||||
/*
|
||||
if(mac_cell_group_configP != NULL){
|
||||
if(mac_cell_group_configP->drx_Config != NULL ){
|
||||
switch(mac_cell_group_configP->drx_Config->present){
|
||||
case NR_SetupRelease_DRX_Config_PR_NOTHING:
|
||||
break;
|
||||
case NR_SetupRelease_DRX_Config_PR_release:
|
||||
mac->drx_Config = NULL;
|
||||
break;
|
||||
case NR_SetupRelease_DRX_Config_PR_setup:
|
||||
mac->drx_Config = mac_cell_group_configP->drx_Config->choice.setup;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP->schedulingRequestConfig != NULL ){
|
||||
mac->schedulingRequestConfig = mac_cell_group_configP->schedulingRequestConfig;
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP->bsr_Config != NULL ){
|
||||
mac->bsr_Config = mac_cell_group_configP->bsr_Config;
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP->tag_Config != NULL ){
|
||||
mac->tag_Config = mac_cell_group_configP->tag_Config;
|
||||
}
|
||||
|
||||
if(mac_cell_group_configP->phr_Config != NULL ){
|
||||
switch(mac_cell_group_configP->phr_Config->present){
|
||||
case NR_SetupRelease_PHR_Config_PR_NOTHING:
|
||||
break;
|
||||
case NR_SetupRelease_PHR_Config_PR_release:
|
||||
mac->phr_Config = NULL;
|
||||
break;
|
||||
case NR_SetupRelease_PHR_Config_PR_setup:
|
||||
mac->phr_Config = mac_cell_group_configP->phr_Config->choice.setup;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(phy_cell_group_configP != NULL ){
|
||||
if(phy_cell_group_configP->cs_RNTI != NULL ){
|
||||
switch(phy_cell_group_configP->cs_RNTI->present){
|
||||
case NR_SetupRelease_RNTI_Value_PR_NOTHING:
|
||||
break;
|
||||
case NR_SetupRelease_RNTI_Value_PR_release:
|
||||
mac->cs_RNTI = NULL;
|
||||
break;
|
||||
case NR_SetupRelease_RNTI_Value_PR_setup:
|
||||
mac->cs_RNTI = &phy_cell_group_configP->cs_RNTI->choice.setup;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "NR_ServingCellConfig.h"
|
||||
#include "fapi_nr_ue_interface.h"
|
||||
#include "NR_IF_Module.h"
|
||||
#include "../NR_MAC_gNB/nr_mac_common.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
|
||||
@@ -129,33 +130,48 @@ typedef struct {
|
||||
} NR_UE_SCHEDULING_INFO;
|
||||
|
||||
|
||||
#define MAX_NUM_BWP 2
|
||||
|
||||
typedef enum {
|
||||
RA_IDLE=0,
|
||||
WAIT_RAR=1,
|
||||
WAIT_CONTENTION_RESOLUTION=2
|
||||
} RA_state_t;
|
||||
/*!\brief Top level UE MAC structure */
|
||||
typedef struct {
|
||||
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc;
|
||||
NR_ServingCellConfig_t *scd;
|
||||
int servCellIndex;
|
||||
//// MAC config
|
||||
NR_DRX_Config_t *drx_Config;
|
||||
NR_SchedulingRequestConfig_t *schedulingRequestConfig;
|
||||
NR_BSR_Config_t *bsr_Config;
|
||||
NR_TAG_Config_t *tag_Config;
|
||||
NR_PHR_Config_t *phr_Config;
|
||||
NR_RNTI_Value_t *cs_RNTI;
|
||||
NR_MIB_t *mib;
|
||||
|
||||
NR_DRX_Config_t *drx_Config;
|
||||
NR_SchedulingRequestConfig_t *schedulingRequestConfig;
|
||||
NR_BSR_Config_t *bsr_Config;
|
||||
NR_TAG_Config_t *tag_Config;
|
||||
NR_PHR_Config_t *phr_Config;
|
||||
NR_RNTI_Value_t *cs_RNTI;
|
||||
NR_MIB_t *mib;
|
||||
|
||||
NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP];
|
||||
NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP];
|
||||
NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP];
|
||||
NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP][FAPI_NR_MAX_SS_PER_CORESET];
|
||||
|
||||
/// Type0-PDCCH seach space
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t type0_pdcch_dci_config;
|
||||
uint32_t type0_pdcch_ss_mux_pattern;
|
||||
SFN_C_TYPE type0_pdcch_ss_sfn_c;
|
||||
uint32_t type0_pdcch_ss_n_c;
|
||||
uint32_t type0_pdcch_consecutive_slots;
|
||||
|
||||
/// Random access parameter
|
||||
/// state of RA procedure
|
||||
RA_state_t ra_state;
|
||||
/// RA-rnti
|
||||
uint16_t ra_rnti;
|
||||
/// Temporary CRNTI
|
||||
uint16_t t_crnti;
|
||||
/// CRNTI
|
||||
uint16_t crnti;
|
||||
|
||||
//BWP params
|
||||
NR_BWP_PARMS initial_bwp_dl;
|
||||
NR_BWP_PARMS initial_bwp_ul;
|
||||
|
||||
//// FAPI-like interface message
|
||||
fapi_nr_tx_request_t tx_request;
|
||||
fapi_nr_ul_config_request_t ul_config_request;
|
||||
@@ -204,7 +220,139 @@ typedef enum frequency_range_e {
|
||||
FR2
|
||||
} frequency_range_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t identifier_dci_formats ; // 0 IDENTIFIER_DCI_FORMATS:
|
||||
uint8_t carrier_ind ; // 1 CARRIER_IND: 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213]
|
||||
uint8_t sul_ind_0_1 ; // 2 SUL_IND_0_1:
|
||||
uint8_t slot_format_ind ; // 3 SLOT_FORMAT_IND: size of DCI format 2_0 is configurable by higher layers up to 128 bits, according to Subclause 11.1.1 of [5, TS 38.213]
|
||||
uint8_t pre_emption_ind ; // 4 PRE_EMPTION_IND: size of DCI format 2_1 is configurable by higher layers up to 126 bits, according to Subclause 11.2 of [5, TS 38.213]. Each pre-emption indication is 14 bits
|
||||
uint8_t block_number ; // 5 BLOCK_NUMBER: starting position of a block is determined by the parameter startingBitOfFormat2_3
|
||||
uint8_t close_loop_ind ; // 6 CLOSE_LOOP_IND:
|
||||
uint8_t bandwidth_part_ind ; // 7 BANDWIDTH_PART_IND:
|
||||
uint8_t short_message_ind ; // 8 SHORT_MESSAGE_IND:
|
||||
uint8_t short_messages ; // 9 SHORT_MESSAGES:
|
||||
uint16_t freq_dom_resource_assignment_UL; // 10 FREQ_DOM_RESOURCE_ASSIGNMENT_UL: PUSCH hopping with resource allocation type 1 not considered
|
||||
// (NOTE 1) If DCI format 0_0 is monitored in common search space
|
||||
// and if the number of information bits in the DCI format 0_0 prior to padding
|
||||
// is larger than the payload size of the DCI format 1_0 monitored in common search space
|
||||
// the bitwidth of the frequency domain resource allocation field in the DCI format 0_0
|
||||
// is reduced such that the size of DCI format 0_0 equals to the size of the DCI format 1_0
|
||||
uint16_t freq_dom_resource_assignment_DL; // 11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
|
||||
uint8_t time_dom_resource_assignment ; // 12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 6.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
|
||||
// where I the number of entries in the higher layer parameter pusch-AllocationList
|
||||
uint8_t vrb_to_prb_mapping ; // 13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
|
||||
uint8_t prb_bundling_size_ind ; // 14 PRB_BUNDLING_SIZE_IND:0 bit if the higher layer parameter PRB_bundling is not configured or is set to 'static', or 1 bit if the higher layer parameter PRB_bundling is set to 'dynamic' according to Subclause 5.1.2.3 of [6, TS 38.214]
|
||||
uint8_t rate_matching_ind ; // 15 RATE_MATCHING_IND: 0, 1, or 2 bits according to higher layer parameter rate-match-PDSCH-resource-set
|
||||
uint8_t zp_csi_rs_trigger ; // 16 ZP_CSI_RS_TRIGGER:
|
||||
uint8_t freq_hopping_flag ; // 17 FREQ_HOPPING_FLAG: 0 bit if only resource allocation type 0
|
||||
uint8_t tb1_mcs ; // 18 TB1_MCS:
|
||||
uint8_t tb1_ndi ; // 19 TB1_NDI:
|
||||
uint8_t tb1_rv ; // 20 TB1_RV:
|
||||
uint8_t tb2_mcs ; // 21 TB2_MCS:
|
||||
uint8_t tb2_ndi ; // 22 TB2_NDI:
|
||||
uint8_t tb2_rv ; // 23 TB2_RV:
|
||||
uint8_t mcs ; // 24 MCS:
|
||||
uint8_t ndi ; // 25 NDI:
|
||||
uint8_t rv ; // 26 RV:
|
||||
uint8_t harq_process_number ; // 27 HARQ_PROCESS_NUMBER:
|
||||
uint8_t dai ; // 28 DAI: For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
|
||||
// 2 if one serving cell is configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 bits are the counter DAI
|
||||
// 0 otherwise
|
||||
uint8_t first_dai ; // 29 FIRST_DAI: (1 or 2 bits) 1 bit for semi-static HARQ-ACK
|
||||
uint8_t second_dai ; // 30 SECOND_DAI: (0 or 2 bits) 2 bits for dynamic HARQ-ACK codebook with two HARQ-ACK sub-codebooks
|
||||
uint8_t tb_scaling ; // 31 TB_SCALING:
|
||||
uint8_t tpc_pusch ; // 32 TPC_PUSCH:
|
||||
uint8_t tpc_pucch ; // 33 TPC_PUCCH:
|
||||
uint8_t pucch_resource_ind ; // 34 PUCCH_RESOURCE_IND:
|
||||
uint8_t pdsch_to_harq_feedback_time_ind ; // 35 PDSCH_TO_HARQ_FEEDBACK_TIME_IND:
|
||||
uint8_t srs_resource_ind ; // 36 SRS_RESOURCE_IND:
|
||||
uint8_t precod_nbr_layers ; // 37 PRECOD_NBR_LAYERS:
|
||||
uint8_t antenna_ports ; // 38 ANTENNA_PORTS:
|
||||
uint8_t tci ; // 39 TCI: 0 bit if higher layer parameter tci-PresentInDCI is not enabled; otherwise 3 bits
|
||||
uint8_t srs_request ; // 40 SRS_REQUEST:
|
||||
uint8_t tpc_cmd ; // 41 TPC_CMD:
|
||||
uint8_t csi_request ; // 42 CSI_REQUEST:
|
||||
uint8_t cbgti ; // 43 CBGTI: 0, 2, 4, 6, or 8 bits determined by higher layer parameter maxCodeBlockGroupsPerTransportBlock for the PDSCH
|
||||
uint8_t cbgfi ; // 44 CBGFI: 0 or 1 bit determined by higher layer parameter codeBlockGroupFlushIndicator
|
||||
uint8_t ptrs_dmrs ; // 45 PTRS_DMRS:
|
||||
uint8_t beta_offset_ind ; // 46 BETA_OFFSET_IND:
|
||||
uint8_t dmrs_seq_ini ; // 47 DMRS_SEQ_INI: 1 bit if the cell has two ULs and the number of bits for DCI format 1_0 before padding
|
||||
// is larger than the number of bits for DCI format 0_0 before padding; 0 bit otherwise
|
||||
uint8_t ul_sch_ind ; // 48 UL_SCH_IND: value of "1" indicates UL-SCH shall be transmitted on the PUSCH and a value of "0" indicates UL-SCH shall not be transmitted on the PUSCH
|
||||
uint16_t padding_nr_dci ; // 49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
|
||||
// and if the number of information bits in the DCI format 0_0 prior to padding
|
||||
// is less than the payload size of the DCI format 1_0 monitored in common search space
|
||||
// zeros shall be appended to the DCI format 0_0
|
||||
// until the payload size equals that of the DCI format 1_0
|
||||
uint8_t sul_ind_0_0 ; // 50 SUL_IND_0_0:
|
||||
uint8_t ra_preamble_index ; // 51 RA_PREAMBLE_INDEX:
|
||||
uint8_t sul_ind_1_0 ; // 52 SUL_IND_1_0:
|
||||
uint8_t ss_pbch_index ; // 53 SS_PBCH_INDEX
|
||||
uint8_t prach_mask_index ; // 54 PRACH_MASK_INDEX
|
||||
uint8_t reserved_nr_dci ; // 55 RESERVED_NR_DCI
|
||||
} nr_dci_pdu_rel15_t;
|
||||
|
||||
#define NUM_SLOT_FRAME 10
|
||||
|
||||
#define NBR_NR_FORMATS 8 // The number of formats is 8 (0_0, 0_1, 1_0, 1_1, 2_0, 2_1, 2_2, 2_3)
|
||||
#define NBR_NR_DCI_FIELDS 56 // The number of different dci fields defined in TS 38.212 subclause 7.3.1
|
||||
|
||||
#define IDENTIFIER_DCI_FORMATS 0
|
||||
#define CARRIER_IND 1
|
||||
#define SUL_IND_0_1 2
|
||||
#define SLOT_FORMAT_IND 3
|
||||
#define PRE_EMPTION_IND 4
|
||||
#define BLOCK_NUMBER 5
|
||||
#define CLOSE_LOOP_IND 6
|
||||
#define BANDWIDTH_PART_IND 7
|
||||
#define SHORT_MESSAGE_IND 8
|
||||
#define SHORT_MESSAGES 9
|
||||
#define FREQ_DOM_RESOURCE_ASSIGNMENT_UL 10
|
||||
#define FREQ_DOM_RESOURCE_ASSIGNMENT_DL 11
|
||||
#define TIME_DOM_RESOURCE_ASSIGNMENT 12
|
||||
#define VRB_TO_PRB_MAPPING 13
|
||||
#define PRB_BUNDLING_SIZE_IND 14
|
||||
#define RATE_MATCHING_IND 15
|
||||
#define ZP_CSI_RS_TRIGGER 16
|
||||
#define FREQ_HOPPING_FLAG 17
|
||||
#define TB1_MCS 18
|
||||
#define TB1_NDI 19
|
||||
#define TB1_RV 20
|
||||
#define TB2_MCS 21
|
||||
#define TB2_NDI 22
|
||||
#define TB2_RV 23
|
||||
#define MCS 24
|
||||
#define NDI 25
|
||||
#define RV 26
|
||||
#define HARQ_PROCESS_NUMBER 27
|
||||
#define DAI_ 28
|
||||
#define FIRST_DAI 29
|
||||
#define SECOND_DAI 30
|
||||
#define TB_SCALING 31
|
||||
#define TPC_PUSCH 32
|
||||
#define TPC_PUCCH 33
|
||||
#define PUCCH_RESOURCE_IND 34
|
||||
#define PDSCH_TO_HARQ_FEEDBACK_TIME_IND 35
|
||||
#define SRS_RESOURCE_IND 36
|
||||
#define PRECOD_NBR_LAYERS 37
|
||||
#define ANTENNA_PORTS 38
|
||||
#define TCI 39
|
||||
#define SRS_REQUEST 40
|
||||
#define TPC_CMD 41
|
||||
#define CSI_REQUEST 42
|
||||
#define CBGTI 43
|
||||
#define CBGFI 44
|
||||
#define PTRS_DMRS 45
|
||||
#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
|
||||
|
||||
/*@}*/
|
||||
#endif /*__LAYER2_MAC_DEFS_H__ */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/* \file proto.h
|
||||
* \brief MAC functions prototypes for eNB and UE
|
||||
* \brief MAC functions prototypes for gNB and UE
|
||||
* \author R. Knopp, K.H. HSU
|
||||
* \date 2018
|
||||
* \version 0.1
|
||||
@@ -35,7 +35,9 @@
|
||||
|
||||
#include "mac_defs.h"
|
||||
#include "mac.h"
|
||||
#include <openair1/PHY/defs_nr_UE.h>
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "RRC/NR_UE/rrc_defs.h"
|
||||
|
||||
|
||||
/**\brief decode mib pdu in NR_UE, from if_module ul_ind with P7 tx_ind message
|
||||
\param module_id module id
|
||||
@@ -47,7 +49,6 @@
|
||||
\param pdu_length length of pdu
|
||||
\param cell_id cell id */
|
||||
int8_t nr_ue_decode_mib(
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
module_id_t module_id,
|
||||
int cc_id,
|
||||
uint8_t gNB_index,
|
||||
@@ -63,20 +64,18 @@ int8_t nr_ue_decode_mib(
|
||||
\param cc_id component carrier id
|
||||
\param gNB_index gNB index
|
||||
\param mibP pointer to RRC message MIB
|
||||
\param mac_cell_group_configP pointer to RRC message MAC-related in cell group config
|
||||
\param phy_cell_group_configP pointer to RRC message PHY-related in cell group config
|
||||
\param sccP pointer to ServingCellConfigCommon structure,
|
||||
\param spcell_configP pointer to RRC message serving cell config*/
|
||||
int nr_rrc_mac_config_req_ue(
|
||||
module_id_t module_id,
|
||||
int cc_id,
|
||||
uint8_t gNB_index,
|
||||
NR_MIB_t *mibP,
|
||||
NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
|
||||
NR_PhysicalCellGroupConfig_t *phy_cell_group_configP,
|
||||
NR_SpCellConfig_t *spcell_configP );
|
||||
|
||||
int nr_rrc_mac_config_req_ue(
|
||||
module_id_t module_id,
|
||||
int cc_idP,
|
||||
uint8_t gNB_index,
|
||||
NR_MIB_t *mibP,
|
||||
//NR_ServingCellConfigCommon_t *sccP,
|
||||
NR_SpCellConfig_t *spCell_ConfigP);
|
||||
|
||||
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
|
||||
int nr_l2_init_ue(void);
|
||||
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst);
|
||||
|
||||
/**\brief fetch MAC instance by module_id, within 0 - (NB_NR_UE_MAC_INST-1)
|
||||
\param module_id index of MAC instance(s)*/
|
||||
@@ -116,7 +115,8 @@ uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
|
||||
int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
||||
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
|
||||
int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_index,fapi_nr_dci_indication_pdu_t *dci);
|
||||
|
||||
uint32_t get_ssb_frame(uint32_t test);
|
||||
uint32_t get_ssb_slot(uint32_t ssb_index);
|
||||
@@ -130,38 +130,45 @@ uint32_t mr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t
|
||||
@param module_idP Instance id of UE in machine
|
||||
@param CC_id Component Carrier index
|
||||
@param frameP Current Rx frame
|
||||
@param ttiP Current Rx tti subframe
|
||||
@param slotP Current Rx slot
|
||||
@param pdu Pointer to the MAC PDU
|
||||
@param pdu_len Length of the MAC PDU
|
||||
@param eNB_id Index of eNB that UE is attached to
|
||||
@param gNB_id Index of gNB that UE is attached to
|
||||
@param ul_time_alignment of struct handling the timing advance parameters
|
||||
@returns void
|
||||
*/
|
||||
void nr_ue_send_sdu(module_id_t module_idP,uint8_t CC_id, frame_t frameP, uint8_t ttiP,
|
||||
uint8_t * pdu, uint16_t pdu_len, uint8_t gNB_index, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
void nr_ue_send_sdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
int slotP,
|
||||
uint8_t * pdu,
|
||||
uint16_t pdu_len,
|
||||
uint8_t gNB_index,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
|
||||
void nr_ue_process_mac_pdu(
|
||||
module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
uint8_t *pduP,
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t eNB_index,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
void nr_ue_process_mac_pdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
uint8_t *pduP,
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t gNB_index,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
|
||||
int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len);
|
||||
|
||||
uint8_t nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
sub_frame_t subframe, uint8_t eNB_index,
|
||||
uint8_t *ulsch_buffer, uint16_t buflen, uint8_t *access_mode);
|
||||
void ue_dci_configuration(NR_UE_MAC_INST_t *mac,fapi_nr_dl_config_request_t *dl_config,int frame,int slot);
|
||||
|
||||
uint16_t
|
||||
nr_generate_ulsch_pdu(uint8_t *mac_pdu,
|
||||
uint8_t *sdus_payload,
|
||||
uint8_t num_sdus,
|
||||
uint16_t *sdu_lengths,
|
||||
uint8_t *sdu_lcids,
|
||||
uint16_t *crnti,
|
||||
uint16_t buflen);
|
||||
void nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
int dci_format,
|
||||
uint8_t dci_length,
|
||||
uint16_t rnti,
|
||||
uint64_t *dci_pdu,
|
||||
nr_dci_pdu_rel15_t *nr_pdci_info_extracted);
|
||||
|
||||
|
||||
int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg, int mu,
|
||||
int nrofDownlinkSlots, int nrofDownlinkSymbols,
|
||||
int nrofUplinkSlots, int nrofUplinkSymbols);
|
||||
|
||||
#endif
|
||||
/** @}*/
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
|
||||
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
|
||||
|
||||
int
|
||||
nr_l2_init_ue(void)
|
||||
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
|
||||
{
|
||||
//LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
|
||||
|
||||
@@ -52,17 +51,20 @@ nr_l2_init_ue(void)
|
||||
|
||||
//init mac here
|
||||
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST);
|
||||
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
if (rrc_inst) {
|
||||
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config->spCellConfig);
|
||||
|
||||
if (IS_SOFTMODEM_NOS1){
|
||||
if (rlc_module_init(0) != 0) {
|
||||
LOG_I(RLC, "Problem at RLC initiation \n");
|
||||
LOG_I(RLC, "Problem at RLC initiation \n");
|
||||
}
|
||||
pdcp_layer_init();
|
||||
nr_ip_over_LTE_DRB_preconfiguration();
|
||||
}
|
||||
}
|
||||
else LOG_I(MAC,"Running without RRC instance\n");
|
||||
|
||||
|
||||
return (1);
|
||||
return (nr_ue_mac_inst);
|
||||
}
|
||||
|
||||
NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id){
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+307
-152
@@ -41,8 +41,10 @@
|
||||
#include "NR_ServingCellConfigCommon.h"
|
||||
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
|
||||
#include "NR_MIB.h"
|
||||
#include "nr_mac_common.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
//extern int l2_init_gNB(void);
|
||||
@@ -50,170 +52,323 @@ extern void mac_top_init_gNB(void);
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
|
||||
void config_nr_mib(int Mod_idP,
|
||||
int CC_idP,
|
||||
int p_gNBP,
|
||||
int subCarrierSpacingCommon,
|
||||
uint32_t ssb_SubcarrierOffset,
|
||||
int dmrs_TypeA_Position,
|
||||
uint32_t pdcch_ConfigSIB1,
|
||||
int cellBarred,
|
||||
int intraFreqReselection
|
||||
){
|
||||
nfapi_nr_config_request_t *cfg = &RC.nrmac[Mod_idP]->config[CC_idP];
|
||||
void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) {
|
||||
|
||||
cfg->num_tlv=0;
|
||||
|
||||
cfg->rf_config.dl_subcarrierspacing.value = subCarrierSpacingCommon;
|
||||
nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0];
|
||||
RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon = scc;
|
||||
int i;
|
||||
|
||||
cfg->rf_config.dl_subcarrierspacing.tl.tag = NFAPI_NR_RF_CONFIG_DL_SUBCARRIERSPACING_TAG;
|
||||
// Carrier configuration
|
||||
|
||||
cfg->carrier_config.dl_bandwidth.value = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
|
||||
cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; //temporary
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->rf_config.ul_subcarrierspacing.value = subCarrierSpacingCommon;
|
||||
cfg->rf_config.ul_subcarrierspacing.tl.tag = NFAPI_NR_RF_CONFIG_UL_SUBCARRIERSPACING_TAG;
|
||||
LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.dl_bandwidth.value);
|
||||
|
||||
cfg->carrier_config.dl_frequency.value = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
|
||||
cfg->carrier_config.dl_frequency.tl.tag = NFAPI_NR_CONFIG_DL_FREQUENCY_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->sch_config.ssb_subcarrier_offset.value = ssb_SubcarrierOffset;
|
||||
cfg->sch_config.ssb_subcarrier_offset.tl.tag = NFAPI_NR_SCH_CONFIG_SSB_SUBCARRIER_OFFSET_TAG;
|
||||
cfg->num_tlv++;
|
||||
}
|
||||
|
||||
void config_common(int Mod_idP,
|
||||
int CC_idP,
|
||||
int cellid,
|
||||
int nr_bandP,
|
||||
uint64_t ssb_pattern,
|
||||
uint16_t ssb_periodicity,
|
||||
uint64_t dl_CarrierFreqP,
|
||||
uint32_t dl_BandwidthP)
|
||||
{
|
||||
nfapi_nr_config_request_t *cfg = &RC.nrmac[Mod_idP]->config[CC_idP];
|
||||
|
||||
int mu = 1;
|
||||
|
||||
cfg->sch_config.physical_cell_id.value = cellid;
|
||||
cfg->sch_config.ssb_scg_position_in_burst.value = ssb_pattern;
|
||||
cfg->sch_config.ssb_periodicity.value = ssb_periodicity;
|
||||
|
||||
// FDD
|
||||
cfg->subframe_config.duplex_mode.value = 1;
|
||||
cfg->subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
/// In NR DL and UL will be different band
|
||||
cfg->nfapi_config.rf_bands.number_rf_bands = 1;
|
||||
cfg->nfapi_config.rf_bands.rf_band[0] = nr_bandP;
|
||||
cfg->nfapi_config.rf_bands.tl.tag = NFAPI_PHY_RF_BANDS_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->nfapi_config.nrarfcn.value = to_nrarfcn(nr_bandP,dl_CarrierFreqP,dl_BandwidthP*180000*(1+mu));
|
||||
cfg->nfapi_config.nrarfcn.tl.tag = NFAPI_NR_NFAPI_NRARFCN_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->subframe_config.numerology_index_mu.value = mu;
|
||||
//cfg->subframe_config.tl.tag =
|
||||
//cfg->num_tlv++;
|
||||
|
||||
cfg->rf_config.dl_carrier_bandwidth.value = dl_BandwidthP;
|
||||
cfg->rf_config.dl_carrier_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG; //temporary
|
||||
cfg->num_tlv++;
|
||||
LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, dl_BandwidthP);
|
||||
|
||||
cfg->rf_config.ul_carrier_bandwidth.value = dl_BandwidthP;
|
||||
cfg->rf_config.ul_carrier_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG; //temporary
|
||||
cfg->num_tlv++;
|
||||
|
||||
//cfg->sch_config.half_frame_index.value = 0; Fix in PHY
|
||||
//cfg->sch_config.n_ssb_crb.value = 86; Fix in PHY
|
||||
|
||||
}
|
||||
|
||||
/*void config_servingcellconfigcommon(){
|
||||
|
||||
}*/
|
||||
|
||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int CC_idP,
|
||||
int cellid,
|
||||
int p_gNB,
|
||||
int nr_bandP,
|
||||
uint64_t ssb_pattern,
|
||||
uint16_t ssb_enum_periodicity,
|
||||
uint64_t dl_CarrierFreqP,
|
||||
int dl_BandwidthP,
|
||||
NR_BCCH_BCH_Message_t *mib,
|
||||
NR_ServingCellConfigCommon_t *servingcellconfigcommon)
|
||||
{
|
||||
uint16_t ssb_periodicity=0;
|
||||
|
||||
switch (ssb_enum_periodicity) {
|
||||
case 0:
|
||||
ssb_periodicity = 5;
|
||||
break;
|
||||
case 1:
|
||||
ssb_periodicity = 10;
|
||||
break;
|
||||
case 2:
|
||||
ssb_periodicity = 20;
|
||||
break;
|
||||
case 3:
|
||||
ssb_periodicity = 40;
|
||||
break;
|
||||
case 4:
|
||||
ssb_periodicity = 80;
|
||||
break;
|
||||
case 5:
|
||||
ssb_periodicity = 160;
|
||||
break;
|
||||
}
|
||||
|
||||
if( mib != NULL ){
|
||||
config_nr_mib(Mod_idP,
|
||||
CC_idP,
|
||||
p_gNB,
|
||||
mib->message.choice.mib->subCarrierSpacingCommon,
|
||||
mib->message.choice.mib->ssb_SubcarrierOffset,
|
||||
mib->message.choice.mib->dmrs_TypeA_Position,
|
||||
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero * 16 + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero,
|
||||
mib->message.choice.mib->cellBarred,
|
||||
mib->message.choice.mib->intraFreqReselection
|
||||
);
|
||||
}// END if( mib != NULL )
|
||||
|
||||
|
||||
if( servingcellconfigcommon != NULL ){
|
||||
config_common(Mod_idP,
|
||||
CC_idP,
|
||||
cellid,
|
||||
nr_bandP,
|
||||
ssb_pattern,
|
||||
ssb_periodicity,
|
||||
dl_CarrierFreqP,
|
||||
dl_BandwidthP
|
||||
);
|
||||
}//END if( servingcellconfigcommon != NULL )
|
||||
|
||||
LOG_E(MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
|
||||
|
||||
// if in nFAPI mode
|
||||
if ( (nfapi_mode == 1 || nfapi_mode == 2) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){
|
||||
while(RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) {
|
||||
// DJP AssertFatal(RC.nrmac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
|
||||
usleep(100 * 1000);
|
||||
printf("Waiting for PHY_config_req\n");
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.dl_grid_size[i].value = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.dl_k0[i].value = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
cfg->carrier_config.dl_grid_size[i].tl.tag = NFAPI_NR_CONFIG_DL_GRID_SIZE_TAG;
|
||||
cfg->carrier_config.dl_k0[i].tl.tag = NFAPI_NR_CONFIG_DL_K0_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->num_tlv++;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.dl_grid_size[i].value = 0;
|
||||
cfg->carrier_config.dl_k0[i].value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (servingcellconfigcommon != NULL){
|
||||
cfg->carrier_config.uplink_bandwidth.value = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]);
|
||||
cfg->carrier_config.uplink_bandwidth.tl.tag = NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG; //temporary
|
||||
cfg->num_tlv++;
|
||||
LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.uplink_bandwidth.value);
|
||||
|
||||
int UL_pointA;
|
||||
if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL)
|
||||
UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
else
|
||||
UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA;
|
||||
|
||||
cfg->carrier_config.uplink_frequency.value = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0],
|
||||
*scc->ssbSubcarrierSpacing,
|
||||
UL_pointA)/1000; // freq in kHz
|
||||
cfg->carrier_config.uplink_frequency.tl.tag = NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.ul_grid_size[i].value = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.ul_k0[i].value = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
cfg->carrier_config.ul_grid_size[i].tl.tag = NFAPI_NR_CONFIG_UL_GRID_SIZE_TAG;
|
||||
cfg->carrier_config.ul_k0[i].tl.tag = NFAPI_NR_CONFIG_UL_K0_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->num_tlv++;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.ul_grid_size[i].value = 0;
|
||||
cfg->carrier_config.ul_k0[i].value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Cell configuration
|
||||
cfg->cell_config.phy_cell_id.value = *scc->physCellId;
|
||||
cfg->cell_config.phy_cell_id.tl.tag = NFAPI_NR_CONFIG_PHY_CELL_ID_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->cell_config.frame_duplex_type.value = 1;
|
||||
cfg->cell_config.frame_duplex_type.tl.tag = NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
|
||||
// SSB configuration
|
||||
cfg->ssb_config.ss_pbch_power.value = scc->ss_PBCH_BlockPower;
|
||||
cfg->ssb_config.ss_pbch_power.tl.tag = NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->ssb_config.scs_common.value = *scc->ssbSubcarrierSpacing;
|
||||
cfg->ssb_config.scs_common.tl.tag = NFAPI_NR_CONFIG_SCS_COMMON_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
// PRACH configuration
|
||||
|
||||
cfg->prach_config.prach_sequence_length.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present;
|
||||
cfg->prach_config.prach_sequence_length.tl.tag = NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing)
|
||||
cfg->prach_config.prach_sub_c_spacing.value = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing;
|
||||
else
|
||||
cfg->prach_config.prach_sub_c_spacing.value = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
cfg->prach_config.prach_sub_c_spacing.tl.tag = NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->prach_config.restricted_set_config.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig;
|
||||
cfg->prach_config.restricted_set_config.tl.tag = NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
switch (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) {
|
||||
case 0 :
|
||||
cfg->prach_config.num_prach_fd_occasions.value = 1;
|
||||
break;
|
||||
case 1 :
|
||||
cfg->prach_config.num_prach_fd_occasions.value = 2;
|
||||
break;
|
||||
case 2 :
|
||||
cfg->prach_config.num_prach_fd_occasions.value = 4;
|
||||
break;
|
||||
case 3 :
|
||||
cfg->prach_config.num_prach_fd_occasions.value = 8;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM);
|
||||
}
|
||||
cfg->prach_config.num_prach_fd_occasions.tl.tag = NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions.value*sizeof(nfapi_nr_num_prach_fd_occasions_t));
|
||||
for (i=0; i<cfg->prach_config.num_prach_fd_occasions.value; i++) {
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i;
|
||||
if (cfg->prach_config.prach_sequence_length.value)
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139;
|
||||
else
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.tl.tag = NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG;
|
||||
cfg->num_tlv++;
|
||||
//cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences.value = ???
|
||||
}
|
||||
|
||||
cfg->prach_config.ssb_per_rach.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present;
|
||||
cfg->prach_config.ssb_per_rach.tl.tag = NFAPI_NR_CONFIG_SSB_PER_RACH_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
// SSB Table Configuration
|
||||
int scs_scaling = 1<<(cfg->ssb_config.scs_common.value);
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000)
|
||||
scs_scaling = scs_scaling*3;
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
||||
scs_scaling = scs_scaling>>2;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
uint16_t sco = absolute_diff%(12*scs_scaling);
|
||||
AssertFatal(sco==0,"absoluteFrequencySSB has a subcarrier offset of %d while it should be alligned with CRBs\n",sco);
|
||||
cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total
|
||||
cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG;
|
||||
cfg->num_tlv++;
|
||||
cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell;
|
||||
cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case 1 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0;
|
||||
break;
|
||||
case 2 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]<<24;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0;
|
||||
break;
|
||||
case 3 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = 0;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0;
|
||||
for (i=0; i<4; i++) {
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask.value += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[i+4]<<i*8);
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask.value += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[i]<<i*8);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present);
|
||||
}
|
||||
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG;
|
||||
cfg->num_tlv++;
|
||||
|
||||
cfg->carrier_config.num_tx_ant.value = pdsch_AntennaPorts;
|
||||
AssertFatal(pdsch_AntennaPorts > 0 && pdsch_AntennaPorts < 13, "pdsch_AntennaPorts in 1...12\n");
|
||||
cfg->carrier_config.num_tx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_TX_ANT_TAG;
|
||||
int num_ssb=0;
|
||||
for (int i=0;i<32;i++) {
|
||||
num_ssb += (cfg->ssb_table.ssb_mask_list[0].ssb_mask.value>>i)&1;
|
||||
num_ssb += (cfg->ssb_table.ssb_mask_list[1].ssb_mask.value>>i)&1;
|
||||
}
|
||||
|
||||
cfg->carrier_config.num_rx_ant.value = cfg->carrier_config.num_tx_ant.value;
|
||||
cfg->carrier_config.num_rx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_RX_ANT_TAG;
|
||||
LOG_I(MAC,"Set TX/RX antenna number to %d (num ssb %d: %x,%x)\n",cfg->carrier_config.num_tx_ant.value,num_ssb,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value);
|
||||
AssertFatal(cfg->carrier_config.num_tx_ant.value > 0,"carrier_config.num_tx_ant.value %d !\n",cfg->carrier_config.num_tx_ant.value );
|
||||
cfg->num_tlv++;
|
||||
cfg->num_tlv++;
|
||||
|
||||
// TDD Table Configuration
|
||||
//cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
|
||||
cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG;
|
||||
cfg->num_tlv++;
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL)
|
||||
cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
|
||||
else {
|
||||
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL,
|
||||
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
||||
cfg->tdd_table.tdd_period.value = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
}
|
||||
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value);
|
||||
if(cfg->cell_config.frame_duplex_type.value == TDD){
|
||||
int return_tdd = set_tdd_config_nr(cfg,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols
|
||||
);
|
||||
|
||||
if (return_tdd !=0){
|
||||
LOG_E(PHY,"TDD configuration can not be done\n");
|
||||
}
|
||||
else LOG_I(PHY,"TDD has been properly configurated\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// PDCCH-ConfigCommon
|
||||
cfg->pdcch_config.controlResourceSetZero.value = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero;
|
||||
cfg->pdcch_config.searchSpaceZero.value = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero;
|
||||
|
||||
// PDSCH-ConfigCommon
|
||||
cfg->pdsch_config.num_PDSCHTimeDomainResourceAllocations.value = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;
|
||||
cfg->pdsch_config.dmrs_TypeA_Position.value = scc->dmrs_TypeA_Position;
|
||||
AssertFatal(cfg->pdsch_config.num_PDSCHTimeDomainResourceAllocations.value<=NFAPI_NR_PDSCH_CONFIG_MAXALLOCATIONS,"illegal TimeDomainAllocation count %d\n",cfg->pdsch_config.num_PDSCHTimeDomainResourceAllocations.value);
|
||||
for (int i=0;i<cfg->pdsch_config.num_PDSCHTimeDomainResourceAllocations.value;i++) {
|
||||
cfg->pdsch_config.PDSCHTimeDomainResourceAllocation_k0[i].value=*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
|
||||
cfg->pdsch_config.PDSCHTimeDomainResourceAllocation_mappingType[i].value=scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType;
|
||||
cfg->pdsch_config.PDSCHTimeDomainResourceAllocation_startSymbolAndLength[i].value=scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
|
||||
}
|
||||
|
||||
// PUSCH-ConfigCommon
|
||||
cfg->pusch_config.num_PUSCHTimeDomainResourceAllocations.value = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.count;
|
||||
cfg->pusch_config.dmrs_TypeA_Position.value = scc->dmrs_TypeA_Position+2;
|
||||
AssertFatal(cfg->pusch_config.num_PUSCHTimeDomainResourceAllocations.value<=NFAPI_NR_PUSCH_CONFIG_MAXALLOCATIONS,"illegal TimeDomainAllocation count %d\n",cfg->pusch_config.num_PUSCHTimeDomainResourceAllocations.value);
|
||||
for (int i=0;i<cfg->pusch_config.num_PUSCHTimeDomainResourceAllocations.value;i++) {
|
||||
cfg->pusch_config.PUSCHTimeDomainResourceAllocation_k2[i].value=*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
int pdsch_AntennaPorts,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int add_ue,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup
|
||||
){
|
||||
|
||||
if (scc != NULL ) {
|
||||
AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
|
||||
|
||||
LOG_I(MAC,"Configuring common parameters from NR ServingCellConfig\n");
|
||||
|
||||
config_common(Mod_idP,
|
||||
pdsch_AntennaPorts,
|
||||
scc);
|
||||
LOG_E(MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
|
||||
|
||||
// if in nFAPI mode
|
||||
if ( (nfapi_mode == 1 || nfapi_mode == 2) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){
|
||||
while(RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) {
|
||||
// DJP AssertFatal(RC.nrmac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
|
||||
usleep(100 * 1000);
|
||||
printf("Waiting for PHY_config_req\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NR_PHY_Config_t phycfg;
|
||||
phycfg.Mod_id = Mod_idP;
|
||||
phycfg.CC_id = CC_idP;
|
||||
phycfg.cfg = &RC.nrmac[Mod_idP]->config[CC_idP];
|
||||
|
||||
phycfg.CC_id = 0;
|
||||
phycfg.cfg = &RC.nrmac[Mod_idP]->config[0];
|
||||
|
||||
phycfg.cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset;
|
||||
phycfg.cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG;
|
||||
phycfg.cfg->num_tlv++;
|
||||
|
||||
if (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req) RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req(&phycfg);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
}
|
||||
|
||||
if (secondaryCellGroup) {
|
||||
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list;
|
||||
int UE_id;
|
||||
if (add_ue == 1) {
|
||||
UE_id = add_new_nr_ue(Mod_idP,rnti);
|
||||
UE_list->secondaryCellGroup[UE_id] = secondaryCellGroup;
|
||||
LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti);
|
||||
}
|
||||
else { // secondaryCellGroup has been updated
|
||||
UE_id = find_nr_UE_id(Mod_idP,rnti);
|
||||
UE_list->secondaryCellGroup[UE_id] = secondaryCellGroup;
|
||||
LOG_I(PHY,"Modified UE_id %d/%x with secondaryCellGroup\n",UE_id,rnti);
|
||||
}
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
|
||||
@@ -57,11 +57,7 @@
|
||||
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "assertions.h"
|
||||
#include <openair1/PHY/LTE_TRANSPORT/transport_proto.h>
|
||||
|
||||
#define ENABLE_MAC_PAYLOAD_DEBUG
|
||||
#define DEBUG_eNB_SCHEDULER 1
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
|
||||
|
||||
@@ -70,30 +66,33 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP){
|
||||
|
||||
nfapi_nr_dl_config_request_t *DL_req = &gNB->DL_req[0];
|
||||
nfapi_nr_ul_tti_request_t *UL_tti_req = &gNB->UL_tti_req[0];
|
||||
nfapi_hi_dci0_request_t * HI_DCI0_req = &gNB->HI_DCI0_req[0];
|
||||
nfapi_tx_request_t *TX_req = &gNB->TX_req[0];
|
||||
nfapi_nr_dl_tti_request_t *DL_req = &gNB->DL_req[0];
|
||||
nfapi_nr_ul_tti_request_t *UL_tti_req = &gNB->UL_tti_req[0];
|
||||
nfapi_nr_ul_dci_request_t *UL_dci_req = &gNB->UL_dci_req[0];
|
||||
nfapi_nr_tx_data_request_t *TX_req = &gNB->TX_req[0];
|
||||
|
||||
gNB->pdu_index[CC_idP] = 0;
|
||||
|
||||
if (nfapi_mode==0 || nfapi_mode == 1) { // monolithic or PNF
|
||||
|
||||
DL_req[CC_idP].dl_config_request_body.number_dci = 0;
|
||||
DL_req[CC_idP].dl_config_request_body.number_pdu = 0;
|
||||
DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti = 0;
|
||||
//DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich = 6000;
|
||||
|
||||
HI_DCI0_req[CC_idP].hi_dci0_request_body.sfnsf = slotP + (frameP<<7);
|
||||
HI_DCI0_req[CC_idP].hi_dci0_request_body.number_of_dci = 0;
|
||||
DL_req[CC_idP].SFN = frameP;
|
||||
DL_req[CC_idP].Slot = slotP;
|
||||
DL_req[CC_idP].dl_tti_request_body.nPDUs = 0;
|
||||
DL_req[CC_idP].dl_tti_request_body.nGroup = 0;
|
||||
//DL_req[CC_idP].dl_tti_request_body.transmission_power_pcfich = 6000;
|
||||
|
||||
UL_dci_req[CC_idP].SFN = frameP;
|
||||
UL_dci_req[CC_idP].Slot = slotP;
|
||||
UL_dci_req[CC_idP].numPdus = 0;
|
||||
|
||||
UL_tti_req[CC_idP].SFN = frameP;
|
||||
UL_tti_req[CC_idP].Slot = slotP;
|
||||
UL_tti_req[CC_idP].n_pdus = 0;
|
||||
UL_tti_req[CC_idP].n_ulsch = 0;
|
||||
UL_tti_req[CC_idP].n_ulcch = 0;
|
||||
UL_tti_req[CC_idP].n_group = 0;
|
||||
|
||||
TX_req[CC_idP].tx_request_body.number_of_pdus = 0;
|
||||
TX_req[CC_idP].Number_of_PDUs = 0;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -105,7 +104,7 @@ void check_nr_ul_failure(module_id_t module_idP,
|
||||
sub_frame_t slotP) {
|
||||
|
||||
UE_list_t *UE_list = &RC.nrmac[module_idP]->UE_list;
|
||||
nfapi_nr_dl_config_request_t *DL_req = &RC.nrmac[module_idP]->DL_req[0];
|
||||
nfapi_nr_dl_dci_request_t *DL_req = &RC.nrmac[module_idP]->DL_req[0];
|
||||
uint16_t rnti = UE_RNTI(module_idP, UE_id);
|
||||
NR_COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels;
|
||||
|
||||
@@ -118,11 +117,11 @@ void check_nr_ul_failure(module_id_t module_idP,
|
||||
UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent = 1;
|
||||
|
||||
// add a format 1A dci for this UE to request an RA procedure (only one UE per subframe)
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_pdu = &DL_req[CC_id].dl_config_request_body.dl_config_pdu_list[DL_req[CC_id].dl_config_request_body.number_pdu];
|
||||
memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_config_request_pdu_t));
|
||||
nfapi_nr_dl_dci_request_pdu_t *dl_config_pdu = &DL_req[CC_id].dl_tti_request_body.dl_config_pdu_list[DL_req[CC_id].dl_tti_request_body.number_pdu];
|
||||
memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_dci_request_pdu_t));
|
||||
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_DCI_REQUEST_DCI_DL_PDU_REL8_TAG;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1A;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP, CC_id),
|
||||
UE_list->UE_sched_ctrl[UE_id].
|
||||
@@ -135,9 +134,9 @@ void check_nr_ul_failure(module_id_t module_idP,
|
||||
"illegal dl_Bandwidth %d\n",
|
||||
(int) cc[CC_id].mib->message.dl_Bandwidth);
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = nr_pdcch_order_table[cc[CC_id].mib->message.dl_Bandwidth];
|
||||
DL_req[CC_id].dl_config_request_body.number_dci++;
|
||||
DL_req[CC_id].dl_config_request_body.number_pdu++;
|
||||
DL_req[CC_id].dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
DL_req[CC_id].dl_tti_request_body.number_dci++;
|
||||
DL_req[CC_id].dl_tti_request_body.number_pdu++;
|
||||
DL_req[CC_id].dl_tti_request_body.tl.tag = NFAPI_DL_TTI_REQUEST_BODY_TAG;
|
||||
LOG_I(MAC,
|
||||
"UE %d rnti %x: sending PDCCH order for RAPROC (failure timer %d), resource_block_coding %d \n",
|
||||
UE_id, rnti,
|
||||
@@ -258,6 +257,19 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
|
||||
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
|
||||
// schedule PRACH for iniital BWP
|
||||
|
||||
if (is_initialBWP_prach_subframe(frameP,subframeP)<0) return;
|
||||
|
||||
// fill FAPI
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
{
|
||||
@@ -266,9 +278,7 @@ void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
nfapi_ul_config_request_t *ul_req_tmp = &mac->UL_req_tmp[CC_id][slotP];
|
||||
nfapi_ul_config_request_t *ul_req = &mac->UL_req[CC_id];
|
||||
nfapi_ul_config_request_pdu_t *ul_req_pdu = ul_req->ul_config_request_body.ul_config_pdu_list;
|
||||
nfapi_ul_config_request_t *ul_req = &mac->UL_tti_req[CC_id];
|
||||
|
||||
*ul_req = *ul_req_tmp;
|
||||
|
||||
@@ -294,23 +304,30 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
sub_frame_t slot_rxP,
|
||||
frame_t frame_txP,
|
||||
sub_frame_t slot_txP){
|
||||
|
||||
//printf("gNB_dlsch_ulsch_scheduler frameRX %d slotRX %d frameTX %d slotTX %d\n",frame_rxP,slot_rxP,frame_txP,slot_txP);
|
||||
|
||||
protocol_ctxt_t ctxt;
|
||||
|
||||
int CC_id, i = -1, UE_id = 0;
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame_txP, slot_txP,module_idP);
|
||||
int CC_id, UE_id = 0;
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
UE_list_t *UE_list = &gNB->UE_list;
|
||||
rnti_t rnti;
|
||||
NR_UE_list_t *UE_list = &gNB->UE_list;
|
||||
UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
NR_COMMON_channels_t *cc = gNB->common_channels;
|
||||
|
||||
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
|
||||
|
||||
pdcp_run(&ctxt);
|
||||
//rrc_rx_tx(&ctxt, CC_id);
|
||||
|
||||
RC.nrmac[module_idP]->frame = frame_rxP;
|
||||
RC.nrmac[module_idP]->slot = slot_rxP;
|
||||
|
||||
// Check if there are downlink symbols in the slot,
|
||||
if (is_nr_DL_slot(cc->ServingCellConfigCommon,slot_txP)) {
|
||||
|
||||
memset(RC.nrmac[module_idP]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int));
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
//mbsfn_status[CC_id] = 0;
|
||||
|
||||
@@ -322,55 +339,26 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
}
|
||||
|
||||
// refresh UE list based on UEs dropped by PHY in previous subframe
|
||||
/*
|
||||
for (i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
||||
if (0 /*UE_list->active[i]*/) {
|
||||
if (UE_list->active[i]) {
|
||||
|
||||
nfapi_nr_config_request_t *cfg = &RC.nrmac[module_idP]->config[CC_id];
|
||||
|
||||
nfapi_nr_coreset_t coreset = RC.nrmac[module_idP]->coreset[CC_id][1];
|
||||
nfapi_nr_search_space_t search_space = RC.nrmac[module_idP]->search_space[CC_id][1];
|
||||
|
||||
if (nr_is_dci_opportunity(search_space,
|
||||
coreset,
|
||||
frame_txP,
|
||||
slot_txP,
|
||||
*cfg)){
|
||||
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP, NULL);
|
||||
}
|
||||
|
||||
rnti = UE_RNTI(module_idP, i);
|
||||
CC_id = UE_PCCID(module_idP, i);
|
||||
//int spf = get_spf(cfg);
|
||||
|
||||
if (((frame_txP&127) == 0) && (slot_txP == 0)) {
|
||||
LOG_I(MAC,
|
||||
"UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n",
|
||||
rnti,
|
||||
UE_list->UE_sched_ctrl[i].ul_out_of_sync ==
|
||||
0 ? "in synch" : "out of sync",
|
||||
UE_list->UE_template[CC_id][i].phr_info,
|
||||
UE_list->UE_sched_ctrl[i].dl_cqi[CC_id],
|
||||
(UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2,
|
||||
(UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
|
||||
}
|
||||
|
||||
|
||||
rnti = 0;//UE_RNTI(module_idP, i);
|
||||
CC_id = 0;//UE_PCCID(module_idP, i);
|
||||
|
||||
} //END if (UE_list->active[i])
|
||||
} //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++)
|
||||
*/
|
||||
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,NOT_A_RNTI, frame_txP, slot_txP,module_idP);
|
||||
|
||||
pdcp_run(&ctxt);
|
||||
|
||||
//rrc_rx_tx(&ctxt, CC_id);
|
||||
|
||||
// This schedules MIB
|
||||
if((slot_txP == 0) && (frame_txP & 7) == 0){
|
||||
schedule_nr_mib(module_idP, frame_txP, slot_txP);
|
||||
}
|
||||
|
||||
// Phytest scheduling
|
||||
|
||||
// TODO once RACH is available, start ta_timer when UE is connected
|
||||
// TbD once RACH is available, start ta_timer when UE is connected
|
||||
if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--;
|
||||
|
||||
if (ue_sched_ctl->ta_timer == 0) {
|
||||
@@ -384,11 +372,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
gNB->ta_len = 2;
|
||||
}
|
||||
|
||||
if (slot_rxP == NR_UPLINK_SLOT){
|
||||
nr_schedule_uss_ulsch_phytest(&RC.nrmac[module_idP]->UL_tti_req[0], frame_rxP, slot_rxP);
|
||||
}
|
||||
|
||||
if (slot_txP == NR_DOWNLINK_SLOT){
|
||||
// Phytest scheduling
|
||||
if (get_softmodem_params()->phy_test && slot_txP==1){
|
||||
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP,NULL);
|
||||
// resetting ta flag
|
||||
gNB->ta_len = 0;
|
||||
@@ -400,6 +385,14 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
allocate_CCEs(module_idP, CC_id, subframeP, 0);
|
||||
*/
|
||||
|
||||
} //is_nr_DL_slot
|
||||
|
||||
if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) {
|
||||
if (get_softmodem_params()->phy_test && slot_rxP==8){
|
||||
nr_schedule_uss_ulsch_phytest(module_idP, frame_rxP, slot_rxP);
|
||||
}
|
||||
}
|
||||
|
||||
stop_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
|
||||
|
||||
@@ -60,23 +60,20 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
NR_COMMON_channels_t *cc;
|
||||
|
||||
nfapi_nr_dl_config_request_t *dl_config_request;
|
||||
nfapi_nr_dl_config_request_body_t *dl_req;
|
||||
nfapi_nr_dl_config_request_pdu_t *dl_config_pdu;
|
||||
nfapi_tx_request_pdu_t *TX_req;
|
||||
nfapi_nr_dl_tti_request_t *dl_tti_request;
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req;
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu;
|
||||
|
||||
int mib_sdu_length;
|
||||
int CC_id;
|
||||
|
||||
uint16_t sfn_sf = frameP << 7 | slotP;
|
||||
|
||||
AssertFatal(slotP == 0, "Subframe must be 0\n");
|
||||
AssertFatal((frameP & 7) == 0, "Frame must be a multiple of 8\n");
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
dl_config_request = &gNB->DL_req[CC_id];
|
||||
dl_req = &dl_config_request->dl_config_request_body;
|
||||
dl_tti_request = &gNB->DL_req[CC_id];
|
||||
dl_req = &dl_tti_request->dl_tti_request_body;
|
||||
cc = &gNB->common_channels[CC_id];
|
||||
|
||||
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]); // not used in this case
|
||||
@@ -85,38 +82,61 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
|
||||
|
||||
if (mib_sdu_length > 0) {
|
||||
|
||||
LOG_D(MAC, "Frame %d, slot %d: Adding BCH PDU in position %d (length %d)\n", frameP, slotP, dl_req->number_pdu, mib_sdu_length);
|
||||
LOG_I(MAC, "Frame %d, slot %d: Adding BCH PDU in position %d (length %d)\n", frameP, slotP, dl_req->nPDUs, mib_sdu_length);
|
||||
|
||||
if ((frameP & 1023) < 80){
|
||||
LOG_D(MAC,"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",module_idP, frameP, CC_id, mib_sdu_length);
|
||||
LOG_I(MAC,"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",module_idP, frameP, CC_id, mib_sdu_length);
|
||||
}
|
||||
|
||||
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
memset((void *) dl_config_pdu, 0,sizeof(nfapi_nr_dl_config_request_pdu_t));
|
||||
dl_config_pdu->pdu_type = NFAPI_NR_DL_CONFIG_BCH_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size =2 + sizeof(nfapi_nr_dl_config_bch_pdu_rel15_t);
|
||||
dl_config_pdu->bch_pdu_rel15.tl.tag = NFAPI_NR_DL_CONFIG_REQUEST_BCH_PDU_REL15_TAG;
|
||||
dl_config_pdu->bch_pdu_rel15.length = mib_sdu_length;
|
||||
dl_config_pdu->bch_pdu_rel15.pdu_index = gNB->pdu_index[CC_id];
|
||||
dl_config_pdu->bch_pdu_rel15.transmission_power = 6000;
|
||||
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
dl_req->number_pdu++;
|
||||
dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
|
||||
dl_config_request->sfn_sf = sfn_sf;
|
||||
dl_config_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
memset((void *) dl_config_pdu, 0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||
dl_config_pdu->PDUType = NFAPI_NR_DL_TTI_SSB_PDU_TYPE;
|
||||
dl_config_pdu->PDUSize =2 + sizeof(nfapi_nr_dl_tti_ssb_pdu_rel15_t);
|
||||
|
||||
LOG_D(MAC, "gNB->DL_req[0].number_pdu %d (%p)\n", dl_req->number_pdu, &dl_req->number_pdu);
|
||||
// DL request
|
||||
|
||||
TX_req = &gNB->TX_req[CC_id].tx_request_body.tx_pdu_list[gNB->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
TX_req->pdu_length = 3;
|
||||
TX_req->pdu_index = gNB->pdu_index[CC_id]++;
|
||||
TX_req->num_segments = 1;
|
||||
TX_req->segments[0].segment_length = 3;
|
||||
TX_req->segments[0].segment_data = cc[CC_id].MIB_pdu.payload;
|
||||
gNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
gNB->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
gNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
gNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
AssertFatal(cc->ServingCellConfigCommon->physCellId!=NULL,"cc->ServingCellConfigCommon->physCellId is null\n");
|
||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.PhysCellId = *cc->ServingCellConfigCommon->physCellId;
|
||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.BetaPss = 0;
|
||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0;
|
||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon!=NULL,"scc->downlinkConfigCommonL is null\n");
|
||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL is null\n");
|
||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB is null\n");
|
||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count==1,"Frequency Band list does not have 1 element (%d)\n",cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count);
|
||||
AssertFatal(cc->ServingCellConfigCommon->ssbSubcarrierSpacing,"ssbSubcarrierSpacing is null\n");
|
||||
AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],"band is null\n");
|
||||
long band = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
uint32_t ssb_offset0 = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
int ratio;
|
||||
switch (*cc->ServingCellConfigCommon->ssbSubcarrierSpacing) {
|
||||
case NR_SubcarrierSpacing_kHz15:
|
||||
AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band);
|
||||
if (band<77) // below 3GHz
|
||||
ratio=3; // NRARFCN step is 5 kHz
|
||||
else
|
||||
ratio=1; // NRARFCN step is 15 kHz
|
||||
break;
|
||||
case NR_SubcarrierSpacing_kHz30:
|
||||
AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band);
|
||||
if (band<77) // below 3GHz
|
||||
ratio=6; // NRARFCN step is 5 kHz
|
||||
else
|
||||
ratio=2; // NRARFCN step is 15 kHz
|
||||
break;
|
||||
case NR_SubcarrierSpacing_kHz120:
|
||||
AssertFatal(band >= 257, "Band %ld is not possible for SSB with 120 kHz SCS\n",band);
|
||||
ratio=2; // NRARFCN step is 15 kHz
|
||||
break;
|
||||
case NR_SubcarrierSpacing_kHz240:
|
||||
AssertFatal(band >= 257, "Band %ld is not possible for SSB with 240 kHz SCS\n",band);
|
||||
ratio=4; // NRARFCN step is 15 kHz
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"SCS %ld not allowed for SSB \n", *cc->ServingCellConfigCommon->ssbSubcarrierSpacing);
|
||||
}
|
||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = 0; //kSSB
|
||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/(ratio*12) - 10; // absoluteFrequencySSB is the center of SSB
|
||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1;
|
||||
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1);
|
||||
dl_req->nPDUs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -222,7 +222,10 @@ void nr_process_mac_pdu(
|
||||
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
|
||||
AssertFatal(pdu_len >= 0, "[MAC] nr_process_mac_pdu, residual mac pdu length < 0!\n");
|
||||
if (pdu_len < 0) {
|
||||
LOG_E(MAC, "%s() residual mac pdu length < 0!\n", __func__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,20 +244,18 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
const uint8_t ul_cqi){
|
||||
int current_rnti = 0, UE_id = -1, harq_pid = 0;
|
||||
gNB_MAC_INST *gNB_mac = NULL;
|
||||
UE_list_t *UE_list = NULL;
|
||||
NR_UE_list_t *UE_list = NULL;
|
||||
UE_sched_ctrl_t *UE_scheduling_control = NULL;
|
||||
|
||||
current_rnti = rntiP;
|
||||
UE_id = find_nrUE_id(gnb_mod_idP, current_rnti);
|
||||
UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti);
|
||||
gNB_mac = RC.nrmac[gnb_mod_idP];
|
||||
UE_list = &gNB_mac->UE_list;
|
||||
|
||||
UE_id = 0;
|
||||
|
||||
if (UE_id != -1) {
|
||||
UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]);
|
||||
|
||||
LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
|
||||
LOG_D(MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
|
||||
gnb_mod_idP,
|
||||
harq_pid,
|
||||
CC_idP,
|
||||
|
||||
@@ -40,27 +40,18 @@ void set_cset_offset(uint16_t);
|
||||
void mac_top_init_gNB(void);
|
||||
|
||||
void config_common(int Mod_idP,
|
||||
int CC_idP,
|
||||
int Nid_cell,
|
||||
int nr_bandP,
|
||||
uint64_t ssb_pattern,
|
||||
uint16_t ssb_periodicity,
|
||||
uint64_t dl_CarrierFreqP,
|
||||
uint32_t dl_BandwidthP);
|
||||
int pdsch_AntennaPorts,
|
||||
NR_ServingCellConfigCommon_t *scc
|
||||
);
|
||||
|
||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int CC_id,
|
||||
int cellid,
|
||||
int p_gNB,
|
||||
int nr_bandP,
|
||||
uint64_t ssb_pattern,
|
||||
uint16_t ssb_periodicity,
|
||||
uint64_t dl_CarrierFreqP,
|
||||
int dl_BandwidthP,
|
||||
NR_BCCH_BCH_Message_t *mib,
|
||||
NR_ServingCellConfigCommon_t *servingcellconfigcommon);
|
||||
|
||||
int is_nr_UL_slot(NR_COMMON_channels_t * ccP, int slotP);
|
||||
int ssb_SubcarrierOffset,
|
||||
int pdsch_AntennaPorts,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int nsa_flag,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup
|
||||
);
|
||||
|
||||
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
int CC_idP,
|
||||
@@ -89,27 +80,33 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP);
|
||||
|
||||
int configure_fapi_dl_pdu(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_nr_config_request_t *cfg,
|
||||
nfapi_nr_coreset_t* coreset,
|
||||
nfapi_nr_search_space_t* search_space,
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config);
|
||||
int configure_fapi_dl_pdu(int Mod_id,
|
||||
int *CCEIndeces,
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
||||
uint8_t *mcsIndex,
|
||||
uint16_t *rbSize,
|
||||
uint16_t *rbStart);
|
||||
|
||||
void configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
|
||||
nfapi_tx_request_pdu_t *tx_req,
|
||||
void config_uldci(NR_BWP_Uplink_t *ubwp,nfapi_nr_pusch_pdu_t *pusch_pdu,nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, dci_pdu_rel15_t *dci_pdu_rel15, int *dci_formats, int *rnti_types);
|
||||
|
||||
void configure_fapi_dl_Tx(module_id_t Mod_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req,
|
||||
nfapi_nr_pdu_t *tx_req,
|
||||
int tbs_bytes,
|
||||
int16_t pdu_index);
|
||||
|
||||
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config);
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_config);
|
||||
|
||||
void nr_schedule_uss_ulsch_phytest(nfapi_nr_ul_tti_request_t *UL_tti_req,
|
||||
void nr_schedule_uss_ulsch_phytest(int Mod_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP);
|
||||
|
||||
void nr_configure_css_dci_initial(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params,
|
||||
void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
nr_scs_e scs_common,
|
||||
nr_scs_e pdcch_scs,
|
||||
nr_frequency_range_e freq_range,
|
||||
@@ -120,41 +117,76 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_config_pdcch_parameters_rel15_t* p
|
||||
uint8_t n_ssb,
|
||||
uint16_t nb_slots_per_frame,
|
||||
uint16_t N_RB);
|
||||
|
||||
/*
|
||||
int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space,
|
||||
nfapi_nr_coreset_t coreset,
|
||||
uint16_t frame,
|
||||
uint16_t slot,
|
||||
nfapi_nr_config_request_t cfg);
|
||||
nfapi_nr_config_request_scf_t cfg);
|
||||
*/
|
||||
|
||||
void nr_configure_dci_from_pdcch_config(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params,
|
||||
nfapi_nr_coreset_t* coreset,
|
||||
nfapi_nr_search_space_t* search_space,
|
||||
nfapi_nr_config_request_t cfg,
|
||||
uint16_t N_RB);
|
||||
void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
int ss_type,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Downlink_t *bwp);
|
||||
|
||||
void fill_dci_pdu_rel15(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
int *dci_formats,
|
||||
int *rnti_types);
|
||||
|
||||
int get_spf(nfapi_nr_config_request_scf_t *cfg);
|
||||
|
||||
int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot);
|
||||
|
||||
void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type);
|
||||
|
||||
void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
int x_overhead);
|
||||
/** \brief Computes Q based on I_MCS PDSCH and table_idx for downlink. Implements MCS Tables from 38.214. */
|
||||
uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx);
|
||||
uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
|
||||
|
||||
/** \brief Computes Q based on I_MCS PDSCH and table_idx for uplink. Implements MCS Tables from 38.214. */
|
||||
uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx);
|
||||
uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx);
|
||||
|
||||
int NRRIV2BW(int locationAndBandwidth,int N_RB);
|
||||
|
||||
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
|
||||
|
||||
void dump_nr_ue_list(NR_UE_list_t *listP, int ul_flag);
|
||||
|
||||
int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP);
|
||||
|
||||
int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP);
|
||||
|
||||
int get_num_dmrs(uint16_t dmrs_mask );
|
||||
|
||||
uint16_t nr_dci_size(nr_dci_format_t format,
|
||||
nr_rnti_type_t rnti_type,
|
||||
uint16_t N_RB);
|
||||
|
||||
int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
||||
int bwp_id,
|
||||
int coreset_id,
|
||||
int aggregation,
|
||||
int search_space, // 0 common, 1 ue-specific
|
||||
int UE_id,
|
||||
int m
|
||||
);
|
||||
|
||||
int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP);
|
||||
int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP);
|
||||
|
||||
int get_dlscs(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
int get_ulscs(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
int get_spf(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
int to_absslot(nfapi_nr_config_request_t *cfg,int frame,int slot);
|
||||
|
||||
int get_symbolsperslot(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
void get_band(uint32_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type);
|
||||
|
||||
uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn);
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw);
|
||||
|
||||
int32_t get_nr_uldl_offset(int nr_bandP);
|
||||
|
||||
int find_nrUE_id(module_id_t mod_idP, rnti_t rntiP);
|
||||
|
||||
int nrUE_PCCID(module_id_t mod_idP, int ue_idP);
|
||||
|
||||
void config_nr_mib(int Mod_idP,
|
||||
int CC_idP,
|
||||
int p_gNBP,
|
||||
@@ -183,12 +215,12 @@ void nr_process_mac_pdu(
|
||||
@param ul_cqi Uplink CQI estimate after this pdu (SNR quantized to 8 bits, -64 ... 63.5 dB in .5dB steps)
|
||||
*/
|
||||
void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const rnti_t rntiP,
|
||||
uint8_t * sduP,
|
||||
const uint16_t sdu_lenP,
|
||||
const uint16_t timing_advance, const uint8_t ul_cqi);
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t subframeP,
|
||||
const rnti_t rntiP,
|
||||
uint8_t * sduP,
|
||||
const uint16_t sdu_lenP,
|
||||
const uint16_t timing_advance, const uint8_t ul_cqi);
|
||||
|
||||
#endif /*__LAYER2_NR_MAC_PROTO_H__*/
|
||||
|
||||
@@ -44,43 +44,12 @@
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
void set_cset_offset(uint16_t offset_bits) {
|
||||
RC.nrmac[0]->coreset[0][1].frequency_domain_resources >>= offset_bits;
|
||||
}
|
||||
|
||||
void nr_init_coreset(nfapi_nr_coreset_t *coreset) {
|
||||
|
||||
coreset->coreset_id = 1;
|
||||
coreset->frequency_domain_resources = 0x1E0000000000;//0x1FFFE0000000; // 96 RB starting from CRB0
|
||||
coreset->duration = 2;
|
||||
coreset->cce_reg_mapping_type = NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED;
|
||||
coreset->reg_bundle_size = 6;
|
||||
coreset->interleaver_size = 2;
|
||||
coreset->precoder_granularity = NFAPI_NR_CSET_SAME_AS_REG_BUNDLE;
|
||||
coreset->tci_present_in_dci = 0;
|
||||
coreset->dmrs_scrambling_id = 0;
|
||||
}
|
||||
|
||||
void nr_init_search_space(nfapi_nr_search_space_t *search_space)
|
||||
{
|
||||
search_space->search_space_id = 1;
|
||||
search_space->coreset_id = 1;
|
||||
search_space->search_space_type = NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC;
|
||||
search_space->duration = 5;
|
||||
search_space->slot_monitoring_periodicity = NFAPI_NR_SS_PERIODICITY_SL10;
|
||||
search_space->slot_monitoring_offset = 1;
|
||||
search_space->monitoring_symbols_in_slot = 0x3000; // 14 bits field
|
||||
search_space->css_formats_0_0_and_1_0 = 1;
|
||||
search_space->uss_dci_formats = 0; // enum to be defined-- formats 0.0 and 1.0
|
||||
for (int i=0; i<NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS; i++)
|
||||
search_space->number_of_candidates[i] = 4; // TODO
|
||||
}
|
||||
|
||||
void mac_top_init_gNB(void)
|
||||
{
|
||||
module_id_t i,j;
|
||||
module_id_t i;
|
||||
int list_el;
|
||||
UE_list_t *UE_list;
|
||||
NR_UE_list_t *UE_list;
|
||||
gNB_MAC_INST *nrmac;
|
||||
|
||||
LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst);
|
||||
@@ -88,58 +57,41 @@ void mac_top_init_gNB(void)
|
||||
if (RC.nb_nr_macrlc_inst > 0) {
|
||||
|
||||
RC.nrmac = (gNB_MAC_INST **) malloc16(RC.nb_nr_macrlc_inst *sizeof(gNB_MAC_INST *));
|
||||
|
||||
|
||||
AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
|
||||
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
|
||||
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));
|
||||
|
||||
for (i = 0; i < RC.nb_nr_macrlc_inst; i++) {
|
||||
RC.nrmac[i] = (gNB_MAC_INST *) malloc16(sizeof(gNB_MAC_INST));
|
||||
|
||||
AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
|
||||
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
|
||||
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));
|
||||
RC.nrmac[i] = (gNB_MAC_INST *) malloc16(sizeof(gNB_MAC_INST));
|
||||
|
||||
AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
|
||||
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
|
||||
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));
|
||||
|
||||
LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d gNB_MAC_INST @ %p\n",sizeof(gNB_MAC_INST), RC.nb_nr_macrlc_inst, RC.mac);
|
||||
|
||||
bzero(RC.nrmac[i], sizeof(gNB_MAC_INST));
|
||||
|
||||
RC.nrmac[i]->Mod_id = i;
|
||||
|
||||
LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d gNB_MAC_INST @ %p\n",sizeof(gNB_MAC_INST), RC.nb_nr_macrlc_inst, RC.mac);
|
||||
|
||||
bzero(RC.nrmac[i], sizeof(gNB_MAC_INST));
|
||||
|
||||
RC.nrmac[i]->Mod_id = i;
|
||||
|
||||
RC.nrmac[i]->tag = (NR_TAG_t*)malloc(sizeof(NR_TAG_t));
|
||||
memset((void*)RC.nrmac[i]->tag,0,sizeof(NR_TAG_t));
|
||||
|
||||
|
||||
for (j = 0; j < MAX_NUM_CCs; j++) {
|
||||
RC.nrmac[i]->DL_req[j].dl_config_request_body.dl_config_pdu_list = RC.nrmac[i]->dl_config_pdu_list[j];
|
||||
|
||||
//FK changed UL_req to UL_tti_req, which does not contain a pointer to the pdu_list
|
||||
//RC.nrmac[i]->UL_req[j].ul_config_request_body.ul_config_pdu_list = RC.nrmac[i]->ul_config_pdu_list[j];
|
||||
|
||||
//for (int k = 0; k < 10; k++)
|
||||
// RC.nrmac[i]->UL_req_tmp[j][k].ul_config_request_body.ul_config_pdu_list =RC.nrmac[i]->ul_config_pdu_list_tmp[j][k];
|
||||
RC.nrmac[i]->tag = (NR_TAG_t*)malloc(sizeof(NR_TAG_t));
|
||||
memset((void*)RC.nrmac[i]->tag,0,sizeof(NR_TAG_t));
|
||||
|
||||
RC.nrmac[i]->HI_DCI0_req[j].hi_dci0_request_body.hi_dci0_pdu_list = RC.nrmac[i]->hi_dci0_pdu_list[j];
|
||||
RC.nrmac[i]->TX_req[j].tx_request_body.tx_pdu_list = RC.nrmac[i]->tx_request_pdu[j];
|
||||
RC.nrmac[i]->ul_handle = 0;
|
||||
|
||||
// Init PDCCH structures
|
||||
nr_init_coreset(&RC.nrmac[i]->coreset[j][1]);
|
||||
nr_init_search_space(&RC.nrmac[i]->search_space[j][1]);
|
||||
}
|
||||
|
||||
RC.nrmac[i]->ul_handle = 0;
|
||||
|
||||
}//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
|
||||
|
||||
AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n");
|
||||
AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n");
|
||||
|
||||
// These should be out of here later
|
||||
pdcp_layer_init();
|
||||
// These should be out of here later
|
||||
pdcp_layer_init();
|
||||
|
||||
if(IS_SOFTMODEM_NOS1)
|
||||
nr_ip_over_LTE_DRB_preconfiguration();
|
||||
if(IS_SOFTMODEM_NOS1)
|
||||
nr_ip_over_LTE_DRB_preconfiguration();
|
||||
|
||||
rrc_init_nr_global_param();
|
||||
rrc_init_nr_global_param();
|
||||
|
||||
}else {
|
||||
RC.nrmac = NULL;
|
||||
@@ -150,25 +102,23 @@ void mac_top_init_gNB(void)
|
||||
|
||||
nrmac = RC.nrmac[i];
|
||||
nrmac->if_inst = NR_IF_Module_init(i);
|
||||
|
||||
|
||||
UE_list = &nrmac->UE_list;
|
||||
UE_list->num_UEs = 0;
|
||||
UE_list->head = -1;
|
||||
UE_list->head_ul = -1;
|
||||
UE_list->avail = 0;
|
||||
|
||||
for (list_el = 0; list_el < MAX_MOBILES_PER_ENB - 1; list_el++) {
|
||||
UE_list->next[list_el] = list_el + 1;
|
||||
for (list_el = 0; list_el < MAX_MOBILES_PER_GNB - 1; list_el++) {
|
||||
UE_list->next[list_el] = list_el + 1;
|
||||
UE_list->next_ul[list_el] = list_el + 1;
|
||||
UE_list->active[list_el] = FALSE;
|
||||
}
|
||||
|
||||
UE_list->next[list_el] = -1;
|
||||
UE_list->next_ul[list_el] = -1;
|
||||
/*memset(UE_list->DLSCH_pdu, 0, sizeof(UE_list->DLSCH_pdu));
|
||||
memset(UE_list->UE_template, 0, sizeof(UE_list->UE_template));
|
||||
memset(UE_list->eNB_UE_stats, 0, sizeof(UE_list->eNB_UE_stats));
|
||||
memset(UE_list->UE_sched_ctrl, 0, sizeof(UE_list->UE_sched_ctrl));
|
||||
memset(UE_list->active, 0, sizeof(UE_list->active));*/
|
||||
UE_list->active[list_el] = FALSE;
|
||||
}
|
||||
|
||||
srand48(0);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "NR_ServingCellConfigCommon.h"
|
||||
#include "NR_MeasConfig.h"
|
||||
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
|
||||
@@ -60,44 +59,71 @@
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
#include "targets/ARCH/COMMON/common_lib.h"
|
||||
|
||||
#include "nr_mac_common.h"
|
||||
|
||||
#define MAX_NUM_BWP 2
|
||||
#define MAX_NUM_CORESET 2
|
||||
#define MAX_NUM_CCE 90
|
||||
|
||||
#include "NR_TAG.h"
|
||||
|
||||
/*! \brief gNB common channels */
|
||||
typedef struct {
|
||||
int physCellId;
|
||||
int p_gNB;
|
||||
int Ncp;
|
||||
int nr_band;
|
||||
uint32_t dl_CarrierFreq;
|
||||
NR_BCCH_BCH_Message_t *mib;
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd_Config;
|
||||
NR_ARFCN_ValueEUTRA_t ul_CarrierFreq;
|
||||
long ul_Bandwidth;
|
||||
/// Outgoing MIB PDU for PHY
|
||||
MIB_PDU MIB_pdu;
|
||||
/// Outgoing BCCH pdu for PHY
|
||||
BCCH_PDU BCCH_pdu;
|
||||
/// Outgoing BCCH DCI allocation
|
||||
uint32_t BCCH_alloc_pdu;
|
||||
/// Outgoing CCCH pdu for PHY
|
||||
CCCH_PDU CCCH_pdu;
|
||||
/// Outgoing PCCH DCI allocation
|
||||
uint32_t PCCH_alloc_pdu;
|
||||
/// Outgoing PCCH pdu for PHY
|
||||
PCCH_PDU PCCH_pdu;
|
||||
/// Outgoing RAR pdu for PHY
|
||||
RAR_PDU RAR_pdu;
|
||||
/// Template for RA computations
|
||||
RA_t ra[NB_RA_PROC_MAX];
|
||||
/// VRB map for common channels
|
||||
uint8_t vrb_map[100];
|
||||
/// VRB map for common channels and retransmissions by PHICH
|
||||
uint8_t vrb_map_UL[100];
|
||||
/// number of subframe allocation pattern available for MBSFN sync area
|
||||
uint8_t num_sf_allocation_pattern;
|
||||
int physCellId;
|
||||
int p_gNB;
|
||||
int Ncp;
|
||||
int nr_band;
|
||||
uint64_t dl_CarrierFreq;
|
||||
NR_BCCH_BCH_Message_t *mib;
|
||||
NR_ServingCellConfigCommon_t *ServingCellConfigCommon;
|
||||
NR_ARFCN_ValueEUTRA_t ul_CarrierFreq;
|
||||
long ul_Bandwidth;
|
||||
/// Outgoing MIB PDU for PHY
|
||||
MIB_PDU MIB_pdu;
|
||||
/// Outgoing BCCH pdu for PHY
|
||||
BCCH_PDU BCCH_pdu;
|
||||
/// Outgoing BCCH DCI allocation
|
||||
uint32_t BCCH_alloc_pdu;
|
||||
/// Outgoing CCCH pdu for PHY
|
||||
CCCH_PDU CCCH_pdu;
|
||||
/// Outgoing PCCH DCI allocation
|
||||
uint32_t PCCH_alloc_pdu;
|
||||
/// Outgoing PCCH pdu for PHY
|
||||
PCCH_PDU PCCH_pdu;
|
||||
/// Outgoing RAR pdu for PHY
|
||||
RAR_PDU RAR_pdu;
|
||||
/// Template for RA computations
|
||||
RA_t ra[NB_RA_PROC_MAX];
|
||||
/// VRB map for common channels
|
||||
uint8_t vrb_map[100];
|
||||
/// VRB map for common channels and retransmissions by PHICH
|
||||
uint8_t vrb_map_UL[100];
|
||||
/// number of subframe allocation pattern available for MBSFN sync area
|
||||
uint8_t num_sf_allocation_pattern;
|
||||
} NR_COMMON_channels_t;
|
||||
|
||||
/*! \brief scheduling control information set through an API (not used)*/
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} NR_UE_sched_ctrl_t;
|
||||
|
||||
/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
|
||||
typedef struct {
|
||||
|
||||
DLSCH_PDU DLSCH_pdu[4][MAX_MOBILES_PER_GNB];
|
||||
/// scheduling control info
|
||||
UE_sched_ctrl_t UE_sched_ctrl[MAX_MOBILES_PER_GNB];
|
||||
int next[MAX_MOBILES_PER_GNB];
|
||||
int head;
|
||||
int next_ul[MAX_MOBILES_PER_GNB];
|
||||
int head_ul;
|
||||
int avail;
|
||||
int num_UEs;
|
||||
boolean_t active[MAX_MOBILES_PER_GNB];
|
||||
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB];
|
||||
} NR_UE_list_t;
|
||||
|
||||
/*! \brief top level eNB MAC structure */
|
||||
typedef struct gNB_MAC_INST_s {
|
||||
/// Ethernet parameters for northbound midhaul interface
|
||||
@@ -124,28 +150,17 @@ typedef struct gNB_MAC_INST_s {
|
||||
uint16_t pdu_index[NFAPI_CC_MAX];
|
||||
|
||||
/// NFAPI Config Request Structure
|
||||
nfapi_nr_config_request_t config[NFAPI_CC_MAX];
|
||||
nfapi_nr_config_request_scf_t config[NFAPI_CC_MAX];
|
||||
/// NFAPI DL Config Request Structure
|
||||
nfapi_nr_dl_config_request_t DL_req[NFAPI_CC_MAX];
|
||||
nfapi_nr_dl_tti_request_t DL_req[NFAPI_CC_MAX];
|
||||
/// NFAPI UL TTI Request Structure (this is from the new SCF specs)
|
||||
nfapi_nr_ul_tti_request_t UL_tti_req[NFAPI_CC_MAX];
|
||||
/// Preallocated DL pdu list
|
||||
nfapi_nr_dl_config_request_pdu_t dl_config_pdu_list[NFAPI_CC_MAX][MAX_NUM_DL_PDU];
|
||||
/// Preallocated HI_DCI0 pdu list
|
||||
nfapi_hi_dci0_request_pdu_t hi_dci0_pdu_list[NFAPI_CC_MAX][MAX_NUM_HI_DCI0_PDU];
|
||||
/// NFAPI HI/DCI0 Config Request Structure
|
||||
nfapi_hi_dci0_request_t HI_DCI0_req[NFAPI_CC_MAX];
|
||||
/// Prealocated TX pdu list
|
||||
nfapi_tx_request_pdu_t tx_request_pdu[NFAPI_CC_MAX][MAX_NUM_TX_REQUEST_PDU];
|
||||
nfapi_nr_ul_dci_request_t UL_dci_req[NFAPI_CC_MAX];
|
||||
/// NFAPI DL PDU structure
|
||||
nfapi_tx_request_t TX_req[NFAPI_CC_MAX];
|
||||
/// NFAPI coreset structure
|
||||
nfapi_nr_coreset_t coreset[NFAPI_CC_MAX][NFAPI_NR_MAX_NB_CORESETS];
|
||||
/// NFAPI search space structure
|
||||
nfapi_nr_search_space_t search_space[NFAPI_CC_MAX][NFAPI_NR_MAX_NB_SEARCH_SPACES];
|
||||
nfapi_nr_tx_data_request_t TX_req[NFAPI_CC_MAX];
|
||||
|
||||
/// this is an LTE structure and needs to be urgenly updated
|
||||
UE_list_t UE_list;
|
||||
NR_UE_list_t UE_list;
|
||||
|
||||
/// UL handle
|
||||
uint32_t ul_handle;
|
||||
@@ -171,6 +186,72 @@ typedef struct gNB_MAC_INST_s {
|
||||
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
|
||||
/// processing time of eNB PCH scheduler
|
||||
time_stats_t schedule_pch;
|
||||
/// CCE lists
|
||||
int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE];
|
||||
} gNB_MAC_INST;
|
||||
|
||||
typedef struct {
|
||||
|
||||
|
||||
uint8_t format_indicator; //1 bit
|
||||
uint16_t frequency_domain_assignment; //up to 16 bits
|
||||
uint8_t time_domain_assignment; // 4 bits
|
||||
uint8_t frequency_hopping_flag; //1 bit
|
||||
|
||||
uint8_t ra_preamble_index; //6 bits
|
||||
uint8_t ss_pbch_index; //6 bits
|
||||
uint8_t prach_mask_index; //4 bits
|
||||
|
||||
uint8_t vrb_to_prb_mapping; //0 or 1 bit
|
||||
uint8_t mcs; //5 bits
|
||||
uint8_t ndi; //1 bit
|
||||
uint8_t rv; //2 bits
|
||||
uint8_t harq_pid; //4 bits
|
||||
uint8_t dai; //0, 2 or 4 bits
|
||||
uint8_t dai1; //1 or 2 bits
|
||||
uint8_t dai2; //0 or 2 bits
|
||||
uint8_t tpc; //2 bits
|
||||
uint8_t pucch_resource_indicator; //3 bits
|
||||
uint8_t pdsch_to_harq_feedback_timing_indicator; //0, 1, 2 or 3 bits
|
||||
|
||||
uint8_t short_messages_indicator; //2 bits
|
||||
uint8_t short_messages; //8 bits
|
||||
uint8_t tb_scaling; //2 bits
|
||||
|
||||
uint8_t carrier_indicator; //0 or 3 bits
|
||||
uint8_t bwp_indicator; //0, 1 or 2 bits
|
||||
uint8_t prb_bundling_size_indicator; //0 or 1 bits
|
||||
uint8_t rate_matching_indicator; //0, 1 or 2 bits
|
||||
uint8_t zp_csi_rs_trigger; //0, 1 or 2 bits
|
||||
uint8_t transmission_configuration_indication; //0 or 3 bits
|
||||
uint8_t srs_request; //2 bits
|
||||
uint8_t cbgti; //CBG Transmission Information: 0, 2, 4, 6 or 8 bits
|
||||
uint8_t cbgfi; //CBG Flushing Out Information: 0 or 1 bit
|
||||
uint8_t dmrs_sequence_initialization; //0 or 1 bit
|
||||
|
||||
uint8_t srs_resource_indicator;
|
||||
uint8_t precoding_information;
|
||||
uint8_t csi_request;
|
||||
uint8_t ptrs_dmrs_association;
|
||||
uint8_t beta_offset_indicator; //0 or 2 bits
|
||||
|
||||
uint8_t slot_format_indicator_count;
|
||||
uint8_t *slot_format_indicators;
|
||||
|
||||
uint8_t pre_emption_indication_count;
|
||||
uint16_t *pre_emption_indications; //14 bit
|
||||
|
||||
uint8_t block_number_count;
|
||||
uint8_t *block_numbers;
|
||||
|
||||
uint8_t ul_sul_indicator; //0 or 1 bit
|
||||
uint8_t antenna_ports;
|
||||
|
||||
uint16_t reserved; //1_0/C-RNTI:10 bits, 1_0/P-RNTI: 6 bits, 1_0/SI-&RA-RNTI: 16 bits
|
||||
uint16_t padding;
|
||||
|
||||
} dci_pdu_rel15_t;
|
||||
|
||||
|
||||
|
||||
#endif /*__LAYER2_NR_MAC_GNB_H__ */
|
||||
|
||||
@@ -2299,14 +2299,14 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
|
||||
netlink_init_tun("ue",num_if);
|
||||
if (IS_SOFTMODEM_NOS1)
|
||||
nas_config(1, 1, 2, "ue");
|
||||
netlink_init_mbms_tun("uem",num_if);
|
||||
netlink_init_mbms_tun("uem");
|
||||
nas_config_mbms(1, 2, 2, "uem");
|
||||
LOG_I(PDCP, "UE pdcp will use tun interface\n");
|
||||
} else if(ENB_NAS_USE_TUN) {
|
||||
netlink_init_tun("enb",1);
|
||||
nas_config(1, 1, 1, "enb");
|
||||
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
|
||||
netlink_init_mbms_tun("enm",1);
|
||||
netlink_init_mbms_tun("enm");
|
||||
nas_config_mbms(1, 2, 1, "enm");
|
||||
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
|
||||
}
|
||||
@@ -2318,7 +2318,7 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
|
||||
}else{
|
||||
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
|
||||
LOG_W(PDCP, "ENB pdcp will use tun interface for MBMS\n");
|
||||
netlink_init_mbms_tun("enm",1);
|
||||
netlink_init_mbms_tun("enm");
|
||||
nas_config_mbms_s1(1, 2, 1, "enm");
|
||||
}else
|
||||
LOG_E(PDCP, "ENB pdcp will not use tun interface\n");
|
||||
|
||||
@@ -77,7 +77,7 @@ extern struct iovec nas_iov_rx;
|
||||
|
||||
extern int nas_sock_fd[MAX_MOBILES_PER_ENB];
|
||||
|
||||
extern int nas_sock_mbms_fd[8];
|
||||
extern int nas_sock_mbms_fd;
|
||||
|
||||
extern int mbms_rab_id;
|
||||
|
||||
@@ -133,7 +133,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
|
||||
} else if (UE_NAS_USE_TUN) {
|
||||
//ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
|
||||
if(rb_id == mbms_rab_id){
|
||||
ret = write(nas_sock_mbms_fd[0], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
|
||||
ret = write(nas_sock_mbms_fd, &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
|
||||
LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH MBMS DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite);
|
||||
}
|
||||
else
|
||||
@@ -299,7 +299,7 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p
|
||||
do {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ, 1 );
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ_BUFFER, 1 );
|
||||
len = read(UE_NAS_USE_TUN?nas_sock_mbms_fd[0]:nas_sock_mbms_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
|
||||
len = read(nas_sock_mbms_fd, &nl_rx_buf, NL_MAX_PAYLOAD);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ_BUFFER, 0 );
|
||||
|
||||
if (len<=0) continue;
|
||||
|
||||
Reference in New Issue
Block a user