@@ -51,7 +51,7 @@ struct nr_band_raster {
5151// lower-bound and upper-bound. (FDD, TDD or SDL).
5252//
5353// NOTE: It only includes FDD, TDD, and SDL bands.
54- // NOTE: Band 2 is a subset of band 25
54+ // NOTE: Band 2 is a subset of band 25.
5555// NOTE: Band 41 has two different Freq raster, we only consider raster 15kHz.
5656// NOTE: FR2 bands have two different Freq raster, we only consider raster 120kHz.
5757const uint32_t nof_nr_DL_bands = 83 ;
@@ -81,6 +81,9 @@ static constexpr std::array<nr_band_raster, nof_nr_DL_bands> nr_band_table = {
8181 {nr_band::n40, delta_freq_raster::kHz100 , 460000 , 20 , 480000 , 460000 , 20 , 480000 },
8282 {nr_band::n41, delta_freq_raster::kHz15 , 499200 , 3 , 537999 , 499200 , 3 , 537999 },
8383 {nr_band::n41, delta_freq_raster::kHz30 , 499200 , 6 , 537996 , 499200 , 6 , 537996 },
84+ // Band n46 has a raster definded in Table 5.4.2.3-1, TS 38.104, but according to the table notes, only a few ARFCN
85+ // values are valid. This range is reported below for completeness, but only the applicable ARFCN given in the
86+ // notes will be used.
8487 {nr_band::n46, delta_freq_raster::kHz15 , 743334 , 1 , 795000 , 743334 , 1 , 795000 },
8588 {nr_band::n48, delta_freq_raster::kHz15 , 636667 , 1 , 646666 , 636667 , 1 , 646666 },
8689 {nr_band::n48, delta_freq_raster::kHz30 , 636668 , 2 , 646666 , 636668 , 2 , 646666 },
@@ -117,12 +120,18 @@ static constexpr std::array<nr_band_raster, nof_nr_DL_bands> nr_band_table = {
117120 {nr_band::n93, delta_freq_raster::kHz100 , 176000 , 20 , 183000 , 285400 , 20 , 286400 },
118121 {nr_band::n94, delta_freq_raster::kHz100 , 176000 , 20 , 183000 , 286400 , 20 , 303400 },
119122 {nr_band::n95, delta_freq_raster::kHz100 , 402000 , 20 , 405000 , 0 , 0 , 0 },
123+ // Band n96 has a raster definded in Table 5.4.2.3-1, TS 38.104, but according to the table notes, only a few ARFCN
124+ // values are valid. This range is reported below for completeness, but only the applicable ARFCN given in the
125+ // notes will be used.
120126 {nr_band::n96, delta_freq_raster::kHz15 , 795000 , 1 , 875000 , 795000 , 1 , 875000 },
121127 {nr_band::n97, delta_freq_raster::kHz100 , 460000 , 20 , 480000 , 0 , 0 , 0 },
122128 {nr_band::n98, delta_freq_raster::kHz100 , 376000 , 20 , 384000 , 0 , 0 , 0 },
123129 {nr_band::n99, delta_freq_raster::kHz100 , 325300 , 20 , 332100 , 0 , 0 , 0 },
124130 {nr_band::n100, delta_freq_raster::kHz100 , 174880 , 20 , 176000 , 183880 , 20 , 185000 },
125131 {nr_band::n101, delta_freq_raster::kHz100 , 380000 , 20 , 382000 , 380000 , 20 , 382000 },
132+ // Band n102 has a raster definded in Table 5.4.2.3-1, TS 38.104, but according to the table notes, only a few
133+ // ARFCN values are valid. This range is reported below for completeness, but only the applicable ARFCN given in
134+ // the notes will be used.
126135 {nr_band::n102, delta_freq_raster::kHz15 , 796334 , 1 , 828333 , 796334 , 1 , 828333 },
127136 {nr_band::n104, delta_freq_raster::kHz15 , 828334 , 1 , 875000 , 828334 , 1 , 875000 },
128137 {nr_band::n104, delta_freq_raster::kHz30 , 828334 , 2 , 875000 , 828334 , 2 , 875000 },
@@ -446,12 +455,8 @@ static nr_raster_params get_raster_params(double freq)
446455
447456static bool is_valid_raster_param (const nr_raster_params& raster)
448457{
449- for (const nr_raster_params& fr : nr_fr_params) {
450- if (fr == raster) {
451- return true ;
452- }
453- }
454- return false ;
458+ return std::any_of (
459+ nr_fr_params.begin (), nr_fr_params.end (), [raster](const nr_raster_params& fr) { return fr == raster; });
455460}
456461
457462// Validates band n28, which has an additional ARFCN value to the given interval, as per Table 5.4.2.3-1, TS 38.104,
@@ -489,41 +494,35 @@ static error_type<std::string> validate_band_n28(uint32_t arfcn, bs_channel_band
489494// version 17.8.0.
490495static error_type<std::string> validate_band_n46 (uint32_t arfcn, bs_channel_bandwidth bw)
491496{
492- const std::array<unsigned , 2 > n46_b_10_dlarfnc = {782000 , 788668 };
493- const std::array<unsigned , 32 > n46_b_20_dlarfnc = {
497+ constexpr std::array<unsigned , 2 > n46_b_10_dlarfnc = {782000 , 788668 };
498+ constexpr std::array<unsigned , 32 > n46_b_20_dlarfnc = {
494499 // clang-format off
495500 744000 , 745332 , 746668 , 748000 , 749332 , 750668 , 752000 , 753332 , 754668 , 756000 , 765332 , 766668 , 768000 , 769332 ,
496501 770668 , 772000 , 773332 , 774668 , 776000 , 777332 , 778668 , 780000 , 781332 , 783000 , 784332 , 785668 , 787000 , 788332 ,
497502 789668 , 791000 , 792332 , 793668
498503 // clang-format on
499504 };
500- const std::array<unsigned , 18 > n46_b_40_dlarfnc = {
505+ constexpr std::array<unsigned , 18 > n46_b_40_dlarfnc = {
501506 // clang-format off
502507 744668 , 746000 , 748668 , 751332 , 754000 , 755332 , 766000 , 767332 , 770000 , 772668 , 775332 , 778000 , 780668 , 783668 ,
503508 786332 , 787668 , 790332 , 793000
504509 // clang-format on
505510 };
506- const std::array<unsigned , 17 > n46_b_60_dlarfnc = {
511+ constexpr std::array<unsigned , 17 > n46_b_60_dlarfnc = {
507512 // clang-format off
508513 745332 , 746668 , 748000 , 752000 , 753332 , 754668 , 766668 , 768000 , 769332 , 773332 , 774668 , 778668 , 780000 , 784332 ,
509514 785668 , 791000 , 792332
510515 // clang-format on
511516 };
512- const std::array<unsigned , 10 > n46_b_80_dlarfnc = {
517+ constexpr std::array<unsigned , 10 > n46_b_80_dlarfnc = {
513518 746000 , 747332 , 752668 , 754000 , 767332 , 768668 , 774000 , 779332 , 785000 , 791668 };
514- const std::array<unsigned , 4 > n46_b_100_dlarfnc = {746668 , 753332 , 768000 , 791000 };
515-
516- const nr_band_raster band_raster = fetch_band_raster (nr_band::n46, {});
517- if (band_raster.band == srsran::nr_band::invalid or arfcn < band_raster.dl_nref_first or
518- arfcn > band_raster.dl_nref_last ) {
519- return make_unexpected (fmt::format (" Band n46 channel raster not found" ));
520- }
519+ constexpr std::array<unsigned , 4 > n46_b_100_dlarfnc = {746668 , 753332 , 768000 , 791000 };
520+ const char * error_msg = {" Only a restricted set of DL-ARFCN values are allowed in band n46" };
521521
522522 auto dl_arfcn_exist = [](span<const unsigned > band_list, unsigned dl_arfcn) {
523523 return std::find (band_list.begin (), band_list.end (), dl_arfcn) != band_list.end ();
524524 };
525525
526- const char * error_msg = {" Only a restricted set of DL-ARFCN values are allowed in band n46" };
527526 switch (bw) {
528527 case bs_channel_bandwidth::MHz10: {
529528 return dl_arfcn_exist (span<const unsigned >(n46_b_10_dlarfnc), arfcn) ? error_type<std::string>{}
@@ -558,7 +557,7 @@ static error_type<std::string> validate_band_n46(uint32_t arfcn, bs_channel_band
558557// version 17.8.0.
559558static error_type<std::string> validate_band_n96 (uint32_t arfcn, bs_channel_bandwidth bw)
560559{
561- const std::array<unsigned , 59 > b_20_dlarfnc = {
560+ constexpr std::array<unsigned , 59 > b_20_dlarfnc = {
562561 // clang-format off
563562 797000 , 798332 , 799668 , 801000 , 802332 , 803668 , 805000 , 806332 , 807668 , 809000 , 810332 , 811668 , 813000 , 814332 ,
564563 815668 , 817000 , 818332 , 819668 , 821000 , 822332 , 823668 , 825000 , 826332 , 827668 , 829000 , 830332 , 831668 , 833000 ,
@@ -567,38 +566,32 @@ static error_type<std::string> validate_band_n96(uint32_t arfcn, bs_channel_band
567566 871668 , 873000 , 874332
568567 // clang-format on
569568 };
570- const std::array<unsigned , 29 > b_40_dlarfnc = {
569+ constexpr std::array<unsigned , 29 > b_40_dlarfnc = {
571570 // clang-format off
572571 797668 , 800332 , 803000 , 805668 , 808332 , 811000 , 813668 , 816332 , 819000 , 821668 , 824332 , 827000 , 829668 , 832332 ,
573572 835000 , 837668 , 840332 , 843000 , 845668 , 848332 , 851000 , 853668 , 856332 , 859000 , 861668 , 864332 , 867000 , 869668 ,
574573 872332
575574 // clang-format on
576575 };
577- const std::array<unsigned , 29 > b_60_dlarfnc = {
576+ constexpr std::array<unsigned , 29 > b_60_dlarfnc = {
578577 // clang-format off
579578 798332 , 799668 , 803668 , 805000 , 809000 , 810332 , 814332 , 815668 , 819668 , 821000 , 825000 , 826332 , 830332 , 831668 ,
580579 835668 , 837000 , 841000 , 842332 , 846332 , 847668 , 851668 , 853000 , 857000 , 858332 , 862332 , 863668 , 867668 , 869000 ,
581580 873000
582581 // clang-format on
583582 };
584- const std::array<unsigned , 14 > b_80_dlarfnc = {
583+ constexpr std::array<unsigned , 14 > b_80_dlarfnc = {
585584 // clang-format off
586585 799000 , 804332 , 809668 , 815000 , 820332 , 825668 , 831000 , 836332 , 841668 , 847000 , 852332 , 857668 , 863000 , 868332
587586 // clang-format on
588587 };
589- const std::array<unsigned , 17 > b_100_dlarfnc = {
588+ constexpr std::array<unsigned , 17 > b_100_dlarfnc = {
590589 // clang-format off
591590 799668 , 803668 , 810332 , 814332 , 821000 , 825000 , 831668 , 835668 , 842332 , 846332 , 853000 , 857000 , 863668 , 867668 ,
592591 869000 , 870332 , 871668
593592 // clang-format on
594593 };
595594
596- const nr_band_raster band_raster = fetch_band_raster (nr_band::n96, {});
597- if (band_raster.band == srsran::nr_band::invalid or arfcn < band_raster.dl_nref_first or
598- arfcn > band_raster.dl_nref_last ) {
599- return make_unexpected (fmt::format (" Band n96 channel raster not found" ));
600- }
601-
602595 auto dl_arfcn_exist = [](span<const unsigned > band_list, unsigned dl_arfcn) {
603596 return std::find (band_list.begin (), band_list.end (), dl_arfcn) != band_list.end ();
604597 };
@@ -634,24 +627,24 @@ static error_type<std::string> validate_band_n96(uint32_t arfcn, bs_channel_band
634627// version 17.8.0.
635628static error_type<std::string> validate_band_n102 (uint32_t arfcn, bs_channel_bandwidth bw)
636629{
637- const std::array<unsigned , 24 > b_20_dlarfnc = {
630+ constexpr std::array<unsigned , 24 > b_20_dlarfnc = {
638631 // clang-format off
639632 797000 , 798332 , 799668 , 801000 , 802332 , 803668 , 805000 , 806332 , 807668 , 809000 , 810332 , 811668 , 813000 , 814332 ,
640633 815668 , 817000 , 818332 , 819668 , 821000 , 822332 , 823668 , 825000 , 826332 , 827668
641634 // clang-format on
642635 };
643- const std::array<unsigned , 12 > b_40_dlarfnc = {
636+ constexpr std::array<unsigned , 12 > b_40_dlarfnc = {
644637 // clang-format off
645638 797668 , 800332 , 803000 , 805668 , 808332 , 811000 , 813668 , 816332 , 819000 , 821668 , 824332 , 827000
646639 // clang-format on
647640 };
648- const std::array<unsigned , 12 > b_60_dlarfnc = {
641+ constexpr std::array<unsigned , 12 > b_60_dlarfnc = {
649642 // clang-format off
650643 798332 , 799668 , 803668 , 805000 , 809000 , 810332 , 814332 , 815668 , 819668 , 821000 , 825000 , 826332
651644 // clang-format on
652645 };
653- const std::array<unsigned , 6 > b_80_dlarfnc = {799000 , 804332 , 809668 , 815000 , 820332 , 825668 };
654- const std::array<unsigned , 6 > b_100_dlarfnc = {799668 , 803668 , 810332 , 814332 , 821000 , 825000 };
646+ constexpr std::array<unsigned , 6 > b_80_dlarfnc = {799000 , 804332 , 809668 , 815000 , 820332 , 825668 };
647+ constexpr std::array<unsigned , 6 > b_100_dlarfnc = {799668 , 803668 , 810332 , 814332 , 821000 , 825000 };
655648
656649 const nr_band_raster band_raster = fetch_band_raster (nr_band::n102, {});
657650 if (band_raster.band == srsran::nr_band::invalid or arfcn < band_raster.dl_nref_first or
@@ -850,8 +843,11 @@ uint32_t srsran::band_helper::get_ul_arfcn_from_dl_arfcn(uint32_t dl_arfcn, std:
850843 // Derive UL ARFCN for FDD bands.
851844 for (const nr_band_raster& b_it : nr_band_table) {
852845 if (b_it.band == operating_band) {
853- const uint32_t offset = (dl_arfcn - b_it.dl_nref_first ) / b_it.dl_nref_step ;
854- return (b_it.ul_nref_first + offset * b_it.ul_nref_step );
846+ const uint32_t offset = (dl_arfcn - b_it.dl_nref_first ) / b_it.dl_nref_step ;
847+ const uint32_t candidate_ul_arfcn = b_it.ul_nref_first + offset * b_it.ul_nref_step ;
848+ // For band n65, n66, n70, n92, n94, the UL spectrum is smaller than the corresponding DL spectrum, therefore we
849+ // need to cap the UL ARFCN to its upper-bound.
850+ return std::min (candidate_ul_arfcn, b_it.ul_nref_last );
855851 }
856852 }
857853
0 commit comments