Commit 40c06a84 authored by Francesco Mani's avatar Francesco Mani

taking into account raster step size in nrarfcn functions

parent 9901cd42
...@@ -352,6 +352,7 @@ typedef struct nr_bandentry_s { ...@@ -352,6 +352,7 @@ typedef struct nr_bandentry_s {
uint64_t dl_max; uint64_t dl_max;
uint64_t step_size; uint64_t step_size;
uint64_t N_OFFs_DL; uint64_t N_OFFs_DL;
uint8_t deltaf_raster;
} nr_bandentry_t; } nr_bandentry_t;
typedef struct nr_band_info_s { typedef struct nr_band_info_s {
......
...@@ -163,6 +163,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -163,6 +163,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
cfg->carrier_config.dl_frequency = from_nrarfcn(*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 scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
for (i=0; i<5; i++) { for (i=0; i<5; i++) {
...@@ -187,6 +188,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -187,6 +188,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA;
cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0], cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0],
*scc->ssbSubcarrierSpacing,
UL_pointA)/1000; // freq in kHz UL_pointA)/1000; // freq in kHz
......
...@@ -68,6 +68,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm ...@@ -68,6 +68,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.dl_bandwidth.value); 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], 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 scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
cfg->carrier_config.dl_frequency.tl.tag = NFAPI_NR_CONFIG_DL_FREQUENCY_TAG; cfg->carrier_config.dl_frequency.tl.tag = NFAPI_NR_CONFIG_DL_FREQUENCY_TAG;
cfg->num_tlv++; cfg->num_tlv++;
...@@ -101,6 +102,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm ...@@ -101,6 +102,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA;
cfg->carrier_config.uplink_frequency.value = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0], cfg->carrier_config.uplink_frequency.value = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0],
*scc->ssbSubcarrierSpacing,
UL_pointA)/1000; // freq in kHz UL_pointA)/1000; // freq in kHz
cfg->carrier_config.uplink_frequency.tl.tag = NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG; cfg->carrier_config.uplink_frequency.tl.tag = NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG;
cfg->num_tlv++; cfg->num_tlv++;
......
...@@ -33,42 +33,50 @@ ...@@ -33,42 +33,50 @@
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
nr_bandentry_t nr_bandtable[] = { nr_bandentry_t nr_bandtable[] = {
{1, 1920000, 1980000, 2110000, 2170000, 20, 422000}, {1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100},
{2, 1850000, 1910000, 1930000, 1990000, 20, 386000}, {2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100},
{3, 1710000, 1785000, 1805000, 1880000, 20, 361000}, {3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100},
{5, 824000, 849000, 869000, 894000, 20, 173800}, {5, 824000, 849000, 869000, 894000, 20, 173800, 100},
{7, 2500000, 2570000, 2620000, 2690000, 20, 524000}, {7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100},
{8, 880000, 915000, 925000, 960000, 20, 185000}, {8, 880000, 915000, 925000, 960000, 20, 185000, 100},
{12, 698000, 716000, 728000, 746000, 20, 145800}, {12, 698000, 716000, 728000, 746000, 20, 145800, 100},
{20, 832000, 862000, 791000, 821000, 20, 158200}, {20, 832000, 862000, 791000, 821000, 20, 158200, 100},
{25, 1850000, 1915000, 1930000, 1995000, 20, 386000}, {25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100},
{28, 703000, 758000, 758000, 813000, 20, 151600}, {28, 703000, 758000, 758000, 813000, 20, 151600, 100},
{34, 2010000, 2025000, 2010000, 2025000, 20, 402000}, {34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100},
{38, 2570000, 2620000, 2570000, 2630000, 20, 514000}, {38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100},
{39, 1880000, 1920000, 1880000, 1920000, 20, 376000}, {39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100},
{40, 2300000, 2400000, 2300000, 2400000, 20, 460000}, {40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100},
{41, 2496000, 2690000, 2496000, 2690000, 3, 499200}, {41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
{50, 1432000, 1517000, 1432000, 1517000, 20, 286400}, {41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
{51, 1427000, 1432000, 1427000, 1432000, 20, 285400}, {50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100},
{66, 1710000, 1780000, 2110000, 2200000, 20, 422000}, {51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100},
{70, 1695000, 1710000, 1995000, 2020000, 20, 399000}, {66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100},
{71, 663000, 698000, 617000, 652000, 20, 123400}, {70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100},
{74, 1427000, 1470000, 1475000, 1518000, 20, 295000}, {71, 663000, 698000, 617000, 652000, 20, 123400, 100},
{75, 000, 000, 1432000, 1517000, 20, 286400}, {74, 1427000, 1470000, 1475000, 1518000, 20, 295000, 100},
{76, 000, 000, 1427000, 1432000, 20, 285400}, {75, 000, 000, 1432000, 1517000, 20, 286400, 100},
{77, 3300000, 4200000, 3300000, 4200000, 1, 620000}, {76, 000, 000, 1427000, 1432000, 20, 285400, 100},
{78, 3300000, 3800000, 3300000, 3800000, 1, 620000}, {77, 3300000, 4200000, 3300000, 4200000, 1, 620000, 15},
{79, 4400000, 5000000, 4400000, 5000000, 2, 693334}, {77, 3300000, 4200000, 3300000, 4200000, 2, 620000, 30},
{80, 1710000, 1785000, 000, 000, 20, 342000}, {78, 3300000, 3800000, 3300000, 3800000, 1, 620000, 15},
{81, 860000, 915000, 000, 000, 20, 176000}, {78, 3300000, 3800000, 3300000, 3800000, 2, 620000, 30},
{82, 832000, 862000, 000, 000, 20, 166400}, {79, 4400000, 5000000, 4400000, 5000000, 1, 693334, 15},
{83, 703000, 748000, 000, 000, 20, 140600}, {79, 4400000, 5000000, 4400000, 5000000, 2, 693334, 30},
{84, 1920000, 1980000, 000, 000, 20, 384000}, {80, 1710000, 1785000, 000, 000, 20, 342000, 100},
{86, 1710000, 1785000, 000, 000, 20, 342000}, {81, 860000, 915000, 000, 000, 20, 176000, 100},
{257,26500000,29500000,26500000,29500000, 1,2054167}, {82, 832000, 862000, 000, 000, 20, 166400, 100},
{258,24250000,27500000,24250000,27500000, 1,2016667}, {83, 703000, 748000, 000, 000, 20, 140600, 100},
{260,37000000,40000000,37000000,40000000, 1,2229167}, {84, 1920000, 1980000, 000, 000, 20, 384000, 100},
{261,27500000,28350000,27500000,28350000, 1,2070833} {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)) #define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t))
...@@ -230,16 +238,22 @@ uint16_t config_bandwidth(int mu, int nb_rb, int nr_band) ...@@ -230,16 +238,22 @@ uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
uint32_t to_nrarfcn(int nr_bandP, uint32_t to_nrarfcn(int nr_bandP,
uint64_t dl_CarrierFreq, uint64_t dl_CarrierFreq,
uint8_t scs_index,
uint32_t bw) uint32_t bw)
{ {
uint64_t dl_CarrierFreq_by_1k = dl_CarrierFreq / 1000; uint64_t dl_CarrierFreq_by_1k = dl_CarrierFreq / 1000;
int bw_kHz = bw / 1000; int bw_kHz = bw / 1000;
int scs_khz = 15<<scs_index;
int i; 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); 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 < 258, "nr_band %d > 257\n", nr_bandP); AssertFatal(nr_bandP < 261, "nr_band %d > 260\n", nr_bandP);
for (i = 0; i < 33 && nr_bandtable[i].band != nr_bandP; i++); 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, AssertFatal(dl_CarrierFreq_by_1k >= nr_bandtable[i].dl_min,
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n", "Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n",
...@@ -250,37 +264,57 @@ uint32_t to_nrarfcn(int nr_bandP, ...@@ -250,37 +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, 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)); (long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz));
int deltaFglobal; int deltaFglobal = 60;
if (dl_CarrierFreq < 3e9) deltaFglobal = 5; if (dl_CarrierFreq < 3e9) deltaFglobal = 15;
else deltaFglobal = 15; if (dl_CarrierFreq < 24.25e9) deltaFglobal = 5;
// This is equation before Table 5.4.2.1-1 in 38101-1-f30 // 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) // F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
return (((dl_CarrierFreq_by_1k - nr_bandtable[i].dl_min)/deltaFglobal) + nrarfcn = (((dl_CarrierFreq_by_1k - nr_bandtable[i].dl_min)/deltaFglobal)+nr_bandtable[i].N_OFFs_DL);
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, uint64_t from_nrarfcn(int nr_bandP,
uint8_t scs_index,
uint32_t dl_nrarfcn) uint32_t dl_nrarfcn)
{ {
int i; int i;
int deltaFglobal; int deltaFglobal = 5;
int scs_khz = 15<<scs_index;
if (nr_bandP < 77 || nr_bandP > 79) deltaFglobal = 5; uint32_t delta_arfcn;
else deltaFglobal = 15;
if (dl_nrarfcn > 599999 && dl_nrarfcn < 2016667)
deltaFglobal = 15;
if (dl_nrarfcn > 2016666 && dl_nrarfcn < 3279166)
deltaFglobal = 60;
AssertFatal(nr_bandP < 258, "nr_band %d > 257\n", nr_bandP); AssertFatal(nr_bandP < 261, "nr_band %d > 260\n", nr_bandP);
for (i = 0; i < 33 && nr_bandtable[i].band != nr_bandP; i++); 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 %llu\n",dl_nrarfcn, (long long unsigned int)nr_bandtable[i].N_OFFs_DL); 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);
// 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", 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)dl_nrarfcn,
(unsigned long long)(1000*(nr_bandtable[i].dl_min + (dl_nrarfcn - nr_bandtable[i].N_OFFs_DL) * deltaFglobal)), (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, (unsigned long long)nr_bandtable[i].dl_min,
i, i,
(unsigned long long)nr_bandtable[i].N_OFFs_DL); (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); return 1000*(nr_bandtable[i].dl_min + (dl_nrarfcn - nr_bandtable[i].N_OFFs_DL) * deltaFglobal);
} }
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn); uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw); uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols); int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment