[0-9\.]+)', str(line))
+ if ret is not None:
+ CCR.versions[vId] = ret.group('version')
+ if re.search('RUN cat cmake_targets/log/cppcheck.xml', str(line)) is not None:
+ xmlStart = True
+ if xmlStart:
+ if re.search('severity="error"', str(line)) is not None:
+ CCR.nbErrors[vId] += 1
+ if re.search('severity="warning"', str(line)) is not None:
+ CCR.nbWarnings[vId] += 1
+ if re.search('id="memleak"', str(line)) is not None:
+ CCR.nbMemLeaks[vId] += 1
+ if re.search('id="nullPointer"', str(line)) is not None:
+ CCR.nbNullPtrs[vId] += 1
+ if re.search('id="uninitvar"', str(line)) is not None:
+ CCR.nbUninitVars[vId] += 1
+ if re.search('id="invalidPrintfArgType_sint"|id="invalidPrintfArgType_uint"', str(line)) is not None:
+ CCR.nbInvalidPrintf[vId] += 1
+ if re.search('id="moduloAlwaysTrueFalse"', str(line)) is not None:
+ CCR.nbModuloAlways[vId] += 1
+ if re.search('id="shiftTooManyBitsSigned"', str(line)) is not None:
+ CCR.nbTooManyBitsShift[vId] += 1
+ if re.search('id="integerOverflow"', str(line)) is not None:
+ CCR.nbIntegerOverflow[vId] += 1
+ if re.search('id="wrongPrintfScanfArgNum"|id="invalidScanfArgType_int"', str(line)) is not None:
+ CCR.nbWrongScanfArg[vId] += 1
+ if re.search('id="pointerAdditionResultNotNull"', str(line)) is not None:
+ CCR.nbPtrAddNotNull[vId] += 1
+ if re.search('id="oppositeInnerCondition"', str(line)) is not None:
+ CCR.nbOppoInnerCondition[vId] += 1
+ logging.debug('======== Variant ' + variant + ' - ' + CCR.versions[vId] + ' ========')
+ logging.debug(' ' + str(CCR.nbErrors[vId]) + ' errors')
+ logging.debug(' ' + str(CCR.nbWarnings[vId]) + ' warnings')
+ logging.debug(' -- Details --')
+ logging.debug(' Memory leak: ' + str(CCR.nbMemLeaks[vId]))
+ logging.debug(' Possible null pointer deference: ' + str(CCR.nbNullPtrs[vId]))
+ logging.debug(' Uninitialized variable: ' + str(CCR.nbUninitVars[vId]))
+ logging.debug(' Undefined behaviour shifting: ' + str(CCR.nbTooManyBitsShift[vId]))
+ logging.debug(' Signed integer overflow: ' + str(CCR.nbIntegerOverflow[vId]))
+ logging.debug('')
+ logging.debug(' Printf formatting issue: ' + str(CCR.nbInvalidPrintf[vId]))
+ logging.debug(' Modulo result is predetermined: ' + str(CCR.nbModuloAlways[vId]))
+ logging.debug(' Opposite Condition -> dead code: ' + str(CCR.nbOppoInnerCondition[vId]))
+ logging.debug(' Wrong Scanf Nb Args: ' + str(CCR.nbWrongScanfArg[vId]))
+ logging.debug('')
+ vId += 1
+
+ HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
+ HTML.CreateHtmlTestRowCppCheckResults(CCR)
+ logging.info('\u001B[1m Static Code Analysis Pass\u001B[0m')
+
+ return 0
+
diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf
index 0dfe7854ee..9adead3a68 100644
--- a/ci-scripts/conf_files/benetel-5g.conf
+++ b/ci-scripts/conf_files/benetel-5g.conf
@@ -23,6 +23,7 @@ gNBs =
ssb_SubcarrierOffset = 31; //0;
pdsch_AntennaPorts = 1;
+ pusch_AntennaPorts = 1;
#pusch_TargetSNRx10 = 200;
#pucch_TargetSNRx10 = 200;
pusch_TargetSNRx10 = 200;
@@ -50,7 +51,7 @@ gNBs =
#initialDownlinkBWP
#genericParameters
# this is RBstart=84,L=13 (275*(L-1))+RBstart
- initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384;
+ initialDLBWPlocationAndBandwidth = 6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
@@ -59,27 +60,14 @@ gNBs =
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
- initialDLBWPk0_0 = 0;
- #initialULBWPmappingType
- #0=typeA,1=typeB
- initialDLBWPmappingType_0 = 0;
- #this is SS=1,L=13
- initialDLBWPstartSymbolAndLength_0 = 40;
+ initialDLBWPk0_0 = 0; #for DL slot
+ initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB
+ initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13
- initialDLBWPk0_1 = 0;
- initialDLBWPmappingType_1 = 0;
- #this is SS=2,L=12
- initialDLBWPstartSymbolAndLength_1 = 53;
+ initialDLBWPk0_1 = 0; #for mixed slot
+ initialDLBWPmappingType_1 = 0;
+ initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5
- initialDLBWPk0_2 = 0;
- initialDLBWPmappingType_2 = 0;
- #this is SS=1,L=12
- initialDLBWPstartSymbolAndLength_2 = 54;
-
- initialDLBWPk0_3 = 0;
- initialDLBWPmappingType_3 = 0;
- #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57)
- initialDLBWPstartSymbolAndLength_3 = 57; //43; //57;
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 78;
@@ -92,7 +80,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
- initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384;
+ initialULBWPlocationAndBandwidth = 6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
@@ -104,9 +92,9 @@ gNBs =
prach_msg1_FDM = 0;
prach_msg1_FrequencyStart = 74;
zeroCorrelationZoneConfig = 13;
- preambleReceivedTargetPower = -118;
+ #preambleReceivedTargetPower = -118;
#preambleReceivedTargetPower = -104;
- #preambleReceivedTargetPower = -108;
+ preambleReceivedTargetPower = -108;
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
preambleTransMax = 6;
#powerRampingStep
@@ -136,20 +124,18 @@ gNBs =
# 0=unrestricted, 1=restricted type A, 2=restricted type B
restrictedSetConfig = 0,
# pusch-ConfigCommon (up to 16 elements)
- initialULBWPk2_0 = 2;
+ initialULBWPk2_0 = 2; # used for UL slot
initialULBWPmappingType_0 = 1
- # this is SS=0 L=11
- initialULBWPstartSymbolAndLength_0 = 55;
-
- initialULBWPk2_1 = 2;
- initialULBWPmappingType_1 = 1;
- # this is SS=0 L=12
- initialULBWPstartSymbolAndLength_1 = 69;
+ initialULBWPstartSymbolAndLength_0 = 55; # this is SS=0 L=12
- initialULBWPk2_2 = 7;
+ initialULBWPk2_1 = 2; # used for mixed slot
+ initialULBWPmappingType_1 = 1;
+ initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2
+
+ initialULBWPk2_2 = 7; # used for Msg.3 during RA
initialULBWPmappingType_2 = 1;
- # this is SS=10 L=4
- initialULBWPstartSymbolAndLength_2 = 52;
+ initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4
+
msg3_DeltaPreamble = 1;
#p0_NominalWithGrant =-90;
diff --git a/ci-scripts/conf_files/channelmod_rfsimu.conf b/ci-scripts/conf_files/channelmod_rfsimu.conf
new file mode 100644
index 0000000000..9a6ded24f1
--- /dev/null
+++ b/ci-scripts/conf_files/channelmod_rfsimu.conf
@@ -0,0 +1,57 @@
+#/* configuration for channel modelisation */
+#/* To be included in main config file when */
+#/* channel modelisation is used (rfsimulator with chanmod options enabled) */
+channelmod = {
+ max_chan=10;
+ modellist="modellist_rfsimu_1";
+ modellist_rfsimu_1 = (
+ {
+ model_name = "rfsimu_channel_enB0"
+ type = "AWGN";
+ ploss_dB = 0;
+ noise_power_dB = -10;
+ forgetfact = 0;
+ offset = 0;
+ ds_tdl = 0;
+ },
+ {
+ model_name = "rfsimu_channel_ue1"
+ type = "AWGN";
+ ploss_dB = 0;
+ noise_power_dB = 0;
+ forgetfact = 0;
+ offset = 0;
+ ds_tdl = 0;
+ }
+ );
+ modellist_rfsimu_2 = (
+ {
+ model_name = "rfsimu_channel_ue0"
+ type = "AWGN";
+ ploss_dB = 0;
+ noise_power_dB = 0;
+ forgetfact = 0;
+ offset = 0;
+ ds_tdl = 0;
+ },
+ {
+ model_name = "rfsimu_channel_ue1"
+ type = "AWGN";
+ ploss_dB = 0;
+ noise_power_dB = 0;
+ forgetfact = 0;
+ offset = 0;
+ ds_tdl = 0;
+ },
+ {
+ model_name = "rfsimu_channel_ue2"
+ type = "AWGN";
+ ploss_dB = 0;
+ noise_power_dB = 0;
+ forgetfact = 0;
+ offset = 0;
+ ds_tdl = 0;
+ }
+ );
+};
+
diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
index 4d89ad96da..087ee37f01 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
@@ -260,7 +260,6 @@ NETWORK_CONTROLLER :
FLEXRAN_CACHE = "/mnt/oai_agent_cache";
FLEXRAN_AWAIT_RECONF = "no";
};
-
log_config :
{
global_log_level ="info";
@@ -279,3 +278,4 @@ NETWORK_CONTROLLER :
rrc_log_verbosity ="medium";
};
+@include "channelmod_rfsimu.conf"
diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf
new file mode 100644
index 0000000000..e7dd563e45
--- /dev/null
+++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf
@@ -0,0 +1,289 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+ ////////// Identification parameters:
+ gNB_ID = 0xe00;
+
+ cell_type = "CELL_MACRO_GNB";
+
+ gNB_name = "gNB-Eurecom-5GNRBox";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+
+ plmn_list = ({mcc = 311; mnc = 480; mnc_length = 3;});
+
+ tr_s_preference = "local_mac"
+
+ ////////// Physical parameters:
+
+ ssb_SubcarrierOffset = 0;
+ pdsch_AntennaPorts = 1;
+ pusch_AntennaPorts = 1;
+ pusch_TargetSNRx10 = 200;
+ pucch_TargetSNRx10 = 200;
+
+ servingCellConfigCommon = (
+ {
+ #spCellConfigCommon
+
+ physCellId = 0;
+
+# downlinkConfigCommon
+ #frequencyInfoDL
+ # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP)
+ absoluteFrequencySSB = 2071241;
+ dl_frequencyBand = 261;
+ # this is 27.900 GHz
+ dl_absoluteFrequencyPointA = 2070833;
+ #scs-SpecificCarrierList
+ dl_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ dl_subcarrierSpacing = 3;
+ dl_carrierBandwidth = 32;
+ #initialDownlinkBWP
+ #genericParameters
+ # this is RBstart=0,L=32 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 8525;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialDLBWPsubcarrierSpacing = 3;
+ #pdcch-ConfigCommon
+ initialDLBWPcontrolResourceSetZero = 12;
+ initialDLBWPsearchSpaceZero = 0;
+ #pdsch-ConfigCommon
+ #pdschTimeDomainAllocationList (up to 16 entries)
+ initialDLBWPk0_0 = 0; #for DL slot
+ initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB
+ initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13
+
+ initialDLBWPk0_3 = 0; #for mixed slot
+ initialDLBWPmappingType_3 = 0;
+ initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5
+
+ #uplinkConfigCommon
+ #frequencyInfoUL
+ ul_frequencyBand = 261;
+ #scs-SpecificCarrierList
+ ul_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ ul_subcarrierSpacing = 3;
+ ul_carrierBandwidth = 32;
+ pMax = 20;
+ #initialUplinkBWP
+ #genericParameters
+ initialULBWPlocationAndBandwidth = 8525;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialULBWPsubcarrierSpacing = 3;
+ #rach-ConfigCommon
+ #rach-ConfigGeneric
+ prach_ConfigurationIndex = 52;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+ prach_msg1_FDM = 0;
+ prach_msg1_FrequencyStart = 0;
+ zeroCorrelationZoneConfig = 13;
+ preambleReceivedTargetPower = -118;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+ preambleTransMax = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+ powerRampingStep = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+ ra_ResponseWindow = 7;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
+#oneHalf (0..15) 4,8,12,16,...60,64
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+ ra_ContentionResolutionTimer = 7;
+ rsrp_ThresholdSSB = 19;
+#prach-RootSequenceIndex_PR
+#1 = 839, 2 = 139
+ prach_RootSequenceIndex_PR = 2;
+ prach_RootSequenceIndex = 1;
+ # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+ #
+ msg1_SubcarrierSpacing = 3,
+
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+ restrictedSetConfig = 0,
+ # pusch-ConfigCommon (up to 16 elements)
+ initialULBWPk2_0 = 6;
+ initialULBWPmappingType_0 = 1
+ # this is SS=0 L=11
+ initialULBWPstartSymbolAndLength_0 = 41;
+
+ initialULBWPk2_1 = 6;
+ initialULBWPmappingType_1 = 1;
+ # this is SS=0 L=12
+ initialULBWPstartSymbolAndLength_1 = 69;
+
+ initialULBWPk2_2 = 14;
+ initialULBWPmappingType_2 = 1;
+ # this is SS=10 L=4
+ initialULBWPstartSymbolAndLength_2 = 52;
+
+ msg3_DeltaPreamble = 1;
+ p0_NominalWithGrant =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+ pucchGroupHopping = 0;
+ hoppingId = 40;
+ p0_nominal = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+ ssb_PositionsInBurst_PR = 3;
+ ssb_PositionsInBurst_Bitmap = 0x0001000100010001L;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
+ ssb_periodicityServingCell = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+ dmrs_TypeA_Position = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ subcarrierSpacing = 3;
+
+
+ #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ referenceSubcarrierSpacing = 3;
+ # pattern1
+ # dl_UL_TransmissionPeriodicity
+ # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+ dl_UL_TransmissionPeriodicity = 3;
+ nrofDownlinkSlots = 7;
+ nrofDownlinkSymbols = 6;
+ nrofUplinkSlots = 2;
+ nrofUplinkSymbols = 4;
+
+ ssPBCH_BlockPower = 10;
+ }
+
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// MME parameters:
+ mme_ip_address = ( { ipv4 = "192.168.18.99";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+ t_dc_prep = 1000; /* unit: millisecond */
+ t_dc_overall = 2000; /* unit: millisecond */
+ target_enb_x2_ip_address = (
+ { ipv4 = "192.168.18.199";
+ ipv6 = "192:168:30::17";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES :
+ {
+
+ GNB_INTERFACE_NAME_FOR_S1_MME = "eth0";
+ GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24";
+ GNB_INTERFACE_NAME_FOR_S1U = "eth0";
+ GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24";
+ GNB_PORT_FOR_S1U = 2152; # Spec 2152
+ GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24";
+ GNB_PORT_FOR_X2C = 36422; # Spec 36422
+ };
+ }
+);
+
+MACRLCs = (
+ {
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "local_RRC";
+ ulsch_max_slots_inactivity = 1;
+ }
+);
+
+L1s = (
+ {
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ pusch_proc_threads = 8;
+ }
+);
+
+RUs = (
+ {
+ local_rf = "yes"
+ nb_tx = 1;
+ nb_rx = 1;
+ att_tx = 0;
+ att_rx = 0;
+ bands = [7];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 75;
+ eNB_instances = [0];
+ sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2";
+ if_freq = 5124520000L;
+ clock_src = "external";
+ time_src = "external";
+ }
+);
+
+THREAD_STRUCT = (
+ {
+ #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+ parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
+ #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+ worker_config = "WORKER_ENABLE";
+ }
+);
+
+ log_config :
+ {
+ global_log_level ="info";
+ global_log_verbosity ="medium";
+ hw_log_level ="info";
+ hw_log_verbosity ="medium";
+ phy_log_level ="info";
+ phy_log_verbosity ="medium";
+ mac_log_level ="info";
+ mac_log_verbosity ="high";
+ rlc_log_level ="info";
+ rlc_log_verbosity ="medium";
+ pdcp_log_level ="info";
+ pdcp_log_verbosity ="medium";
+ rrc_log_level ="info";
+ rrc_log_verbosity ="medium";
+ };
+
diff --git a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf
index 32de0aa4f5..1209a6f227 100644
--- a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf
+++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf
@@ -23,6 +23,7 @@ gNBs =
ssb_SubcarrierOffset = 0;
pdsch_AntennaPorts = 1;
+ pusch_AntennaPorts = 1;
servingCellConfigCommon = (
{
@@ -55,27 +56,14 @@ gNBs =
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
- initialDLBWPk0_0 = 0;
- #initialULBWPmappingType
- #0=typeA,1=typeB
- initialDLBWPmappingType_0 = 0;
- #this is SS=1,L=13
- initialDLBWPstartSymbolAndLength_0 = 40;
+ initialDLBWPk0_0 = 0; #for DL slot
+ initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB
+ initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13
- initialDLBWPk0_1 = 0;
- initialDLBWPmappingType_1 = 0;
- #this is SS=2,L=12
- initialDLBWPstartSymbolAndLength_1 = 53;
+ initialDLBWPk0_3 = 0; #for mixed slot
+ initialDLBWPmappingType_3 = 0;
+ initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5
- initialDLBWPk0_2 = 0;
- initialDLBWPmappingType_2 = 0;
- #this is SS=1,L=12
- initialDLBWPstartSymbolAndLength_2 = 54;
-
- initialDLBWPk0_3 = 0;
- initialDLBWPmappingType_3 = 0;
- #this is SS=1,L=4
- initialDLBWPstartSymbolAndLength_3 = 57;
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 66;
@@ -131,20 +119,18 @@ gNBs =
# 0=unrestricted, 1=restricted type A, 2=restricted type B
restrictedSetConfig = 0,
# pusch-ConfigCommon (up to 16 elements)
- initialULBWPk2_0 = 6;
+ initialULBWPk2_0 = 6; # used for UL slot
initialULBWPmappingType_0 = 1
- # this is SS=0 L=11
- initialULBWPstartSymbolAndLength_0 = 55;
+ initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13
- initialULBWPk2_1 = 6;
+ initialULBWPk2_1 = 6; # used for mixed slot
initialULBWPmappingType_1 = 1;
- # this is SS=0 L=12
- initialULBWPstartSymbolAndLength_1 = 69;
+ initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2
- initialULBWPk2_2 = 7;
+ initialULBWPk2_2 = 7; # used for Msg.3 during RA
initialULBWPmappingType_2 = 1;
- # this is SS=10 L=4
- initialULBWPstartSymbolAndLength_2 = 52;
+ initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4
+
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
@@ -185,7 +171,7 @@ gNBs =
nrofUplinkSlots = 2;
nrofUplinkSymbols = 4;
- ssPBCH_BlockPower = 10;
+ ssPBCH_BlockPower = -25;
}
);
diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf
index decaa392d7..bc9dcb47cc 100644
--- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf
+++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf
@@ -23,6 +23,7 @@ gNBs =
ssb_SubcarrierOffset = 0;
pdsch_AntennaPorts = 1;
+ pusch_AntennaPorts = 1;
servingCellConfigCommon = (
{
@@ -46,7 +47,7 @@ gNBs =
#initialDownlinkBWP
#genericParameters
# this is RBstart=41,L=24 (275*(L-1))+RBstart
- initialDLBWPlocationAndBandwidth = 6366;
+ initialDLBWPlocationAndBandwidth = 6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
@@ -55,27 +56,13 @@ gNBs =
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
- initialDLBWPk0_0 = 0;
- #initialULBWPmappingType
- #0=typeA,1=typeB
- initialDLBWPmappingType_0 = 0;
- #this is SS=1,L=13
- initialDLBWPstartSymbolAndLength_0 = 40;
+ initialDLBWPk0_0 = 0; #for DL slot
+ initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB
+ initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13
- initialDLBWPk0_1 = 0;
- initialDLBWPmappingType_1 = 0;
- #this is SS=2,L=12
- initialDLBWPstartSymbolAndLength_1 = 53;
-
- initialDLBWPk0_2 = 0;
- initialDLBWPmappingType_2 = 0;
- #this is SS=1,L=12
- initialDLBWPstartSymbolAndLength_2 = 54;
-
- initialDLBWPk0_3 = 0;
- initialDLBWPmappingType_3 = 0;
- #this is SS=1,L=5
- initialDLBWPstartSymbolAndLength_3 = 57;
+ initialDLBWPk0_1 = 0; #for mixed slot
+ initialDLBWPmappingType_1 = 0;
+ initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5
#uplinkConfigCommon
#frequencyInfoUL
@@ -89,7 +76,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
- initialULBWPlocationAndBandwidth = 6366;
+ initialULBWPlocationAndBandwidth = 6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
@@ -131,20 +118,17 @@ gNBs =
restrictedSetConfig = 0,
# pusch-ConfigCommon (up to 16 elements)
- initialULBWPk2_0 = 6;
+ initialULBWPk2_0 = 6; # used for UL slot
initialULBWPmappingType_0 = 1
- # this is SS=0 L=11
- initialULBWPstartSymbolAndLength_0 = 55;
+ initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13
- initialULBWPk2_1 = 6;
+ initialULBWPk2_1 = 6; # used for mixed slot
initialULBWPmappingType_1 = 1;
- # this is SS=0 L=12
- initialULBWPstartSymbolAndLength_1 = 69;
+ initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2
- initialULBWPk2_2 = 7;
+ initialULBWPk2_2 = 7; # used for Msg.3 during RA
initialULBWPmappingType_2 = 1;
- # this is SS=10 L=4
- initialULBWPstartSymbolAndLength_2 = 52;
+ initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
@@ -186,7 +170,7 @@ gNBs =
nrofUplinkSlots = 2;
nrofUplinkSymbols = 4;
- ssPBCH_BlockPower = 10;
+ ssPBCH_BlockPower = -25;
}
);
@@ -227,6 +211,7 @@ MACRLCs = (
num_cc = 1;
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
+ ulsch_max_slots_inactivity = 1;
}
);
@@ -240,21 +225,21 @@ L1s = (
RUs = (
{
- local_rf = "yes"
+ local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 0
att_rx = 0;
bands = [7];
max_pdschReferenceSignalPower = -27;
- max_rxgain = 75;
+ max_rxgain = 50;
eNB_instances = [0];
- ##beamforming 1x2 matrix: 1 layer x 2 antennas
+ ## beamforming 1x2 matrix: 1 layer x 2 antennas
bf_weights = [0x00007fff, 0x0000];
- ##beamforming 1x4 matrix: 1 layer x 4 antennas
+ ## beamforming 1x4 matrix: 1 layer x 4 antennas
#bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000];
## beamforming 2x2 matrix:
- # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff];
+ #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff];
## beamforming 4x4 matrix:
#bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff];
diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf
index 258618e7f0..f0d5130f83 100644
--- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf
@@ -22,6 +22,7 @@ gNBs =
ssb_SubcarrierOffset = 31; //0;
pdsch_AntennaPorts = 1;
+ pusch_AntennaPorts = 1;
pusch_TargetSNRx10 = 200;
pucch_TargetSNRx10 = 200;
@@ -48,7 +49,7 @@ gNBs =
#initialDownlinkBWP
#genericParameters
# this is RBstart=84,L=13 (275*(L-1))+RBstart
- initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384;
+ initialDLBWPlocationAndBandwidth = 6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
@@ -57,27 +58,14 @@ gNBs =
initialDLBWPsearchSpaceZero = 0;
#pdsch-ConfigCommon
#pdschTimeDomainAllocationList (up to 16 entries)
- initialDLBWPk0_0 = 0;
- #initialULBWPmappingType
- #0=typeA,1=typeB
- initialDLBWPmappingType_0 = 0;
- #this is SS=1,L=13
- initialDLBWPstartSymbolAndLength_0 = 40;
+ initialDLBWPk0_0 = 0; #for DL slot
+ initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB
+ initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13
- initialDLBWPk0_1 = 0;
- initialDLBWPmappingType_1 = 0;
- #this is SS=2,L=12
- initialDLBWPstartSymbolAndLength_1 = 53;
+ initialDLBWPk0_1 = 0; #for mixed slot
+ initialDLBWPmappingType_1 = 0;
+ initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5
- initialDLBWPk0_2 = 0;
- initialDLBWPmappingType_2 = 0;
- #this is SS=1,L=12
- initialDLBWPstartSymbolAndLength_2 = 54;
-
- initialDLBWPk0_3 = 0;
- initialDLBWPmappingType_3 = 0;
- #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57)
- initialDLBWPstartSymbolAndLength_3 = 57; //43; //57;
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 78;
@@ -90,7 +78,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
- initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384;
+ initialULBWPlocationAndBandwidth = 6368;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
@@ -132,20 +120,17 @@ gNBs =
# 0=unrestricted, 1=restricted type A, 2=restricted type B
restrictedSetConfig = 0,
# pusch-ConfigCommon (up to 16 elements)
- initialULBWPk2_0 = 2;
+ initialULBWPk2_0 = 2; # used for UL slot
initialULBWPmappingType_0 = 1
- # this is SS=0 L=11
- initialULBWPstartSymbolAndLength_0 = 55;
-
- initialULBWPk2_1 = 2;
- initialULBWPmappingType_1 = 1;
- # this is SS=0 L=12
- initialULBWPstartSymbolAndLength_1 = 69;
+ initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13
- initialULBWPk2_2 = 7;
+ initialULBWPk2_1 = 2; # used for mixed slot
+ initialULBWPmappingType_1 = 1;
+ initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2
+
+ initialULBWPk2_2 = 7; # used for Msg.3 during RA
initialULBWPmappingType_2 = 1;
- # this is SS=10 L=4
- initialULBWPstartSymbolAndLength_2 = 52;
+ initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
@@ -250,7 +235,7 @@ L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
- pusch_proc_threads = 8;
+ pusch_proc_threads = 6;
}
);
diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf
new file mode 100644
index 0000000000..cb3e69faf3
--- /dev/null
+++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf
@@ -0,0 +1,296 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+
+gNBs =
+(
+ {
+ ////////// Identification parameters:
+ gNB_ID = 0xe00;
+
+ cell_type = "CELL_MACRO_GNB";
+ gNB_name = "gNB-Eurecom-5GNRBox";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;});
+
+ tr_s_preference = "local_mac"
+
+ ////////// Physical parameters:
+
+ ssb_SubcarrierOffset = 31; //0;
+ pdsch_AntennaPorts = 1;
+ pusch_AntennaPorts = 1;
+ pusch_TargetSNRx10 = 200;
+ pucch_TargetSNRx10 = 200;
+
+
+ servingCellConfigCommon = (
+ {
+ #spCellConfigCommon
+
+ physCellId = 0;
+
+# downlinkConfigCommon
+ #frequencyInfoDL
+ # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP)
+ absoluteFrequencySSB = 641272; //641032; #641968; 641968=start of ssb at 3600MHz + 82 RBs 641032=center of SSB at center of cell
+ dl_frequencyBand = 78;
+ # this is 3600 MHz
+ dl_absoluteFrequencyPointA = 640000;
+ #scs-SpecificCarrierList
+ dl_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ dl_subcarrierSpacing = 1;
+ dl_carrierBandwidth = 106;
+ #initialDownlinkBWP
+ #genericParameters
+ # this is RBstart=84,L=13 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 6368;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialDLBWPsubcarrierSpacing = 1;
+ #pdcch-ConfigCommon
+ initialDLBWPcontrolResourceSetZero = 0;
+ initialDLBWPsearchSpaceZero = 0;
+ #pdsch-ConfigCommon
+ #pdschTimeDomainAllocationList (up to 16 entries)
+ initialDLBWPk0_0 = 0;
+ #initialULBWPmappingType
+ #0=typeA,1=typeB
+ initialDLBWPmappingType_0 = 0;#for DL slot
+ #this is SS=1,L=13
+ initialDLBWPstartSymbolAndLength_0 = 40;
+
+ initialDLBWPk0_1 = 0;#for mixed slot
+ initialDLBWPmappingType_1 = 0;
+ #this is SS=1,L=5
+ initialDLBWPstartSymbolAndLength_1 = 57;
+
+ #uplinkConfigCommon
+ #frequencyInfoUL
+ ul_frequencyBand = 78;
+ #scs-SpecificCarrierList
+ ul_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ ul_subcarrierSpacing = 1;
+ ul_carrierBandwidth = 106;
+ pMax = 20;
+ #initialUplinkBWP
+ #genericParameters
+ initialULBWPlocationAndBandwidth = 6368;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialULBWPsubcarrierSpacing = 1;
+ #rach-ConfigCommon
+ #rach-ConfigGeneric
+ prach_ConfigurationIndex = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+ prach_msg1_FDM = 0;
+ prach_msg1_FrequencyStart = 0;
+ zeroCorrelationZoneConfig = 13;
+ preambleReceivedTargetPower = -90;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+ preambleTransMax = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+ powerRampingStep = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+ ra_ResponseWindow = 5;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
+#oneHalf (0..15) 4,8,12,16,...60,64
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; //15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+ ra_ContentionResolutionTimer = 7;
+ rsrp_ThresholdSSB = 19;
+#prach-RootSequenceIndex_PR
+#1 = 839, 2 = 139
+ prach_RootSequenceIndex_PR = 2;
+ prach_RootSequenceIndex = 1;
+ # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+ #
+ msg1_SubcarrierSpacing = 1,
+
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+ restrictedSetConfig = 0,
+ # pusch-ConfigCommon (up to 16 elements)
+ initialULBWPk2_0 = 2;
+ initialULBWPmappingType_0 = 1
+ # this is SS=0 L=11
+ initialULBWPstartSymbolAndLength_0 = 41;
+
+ initialULBWPk2_1 = 2;
+ initialULBWPmappingType_1 = 1;
+ # this is SS=0 L=12
+ initialULBWPstartSymbolAndLength_1 = 69;
+
+ initialULBWPk2_2 = 7;
+ initialULBWPmappingType_2 = 1;
+ # this is SS=10 L=4
+ initialULBWPstartSymbolAndLength_2 = 52;
+
+ msg3_DeltaPreamble = 1;
+ p0_NominalWithGrant =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+ pucchGroupHopping = 0;
+ hoppingId = 40;
+ p0_nominal = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+ ssb_PositionsInBurst_PR = 2;
+ ssb_PositionsInBurst_Bitmap = 1; #0x80;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
+ ssb_periodicityServingCell = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+ dmrs_TypeA_Position = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ subcarrierSpacing = 1;
+
+
+ #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ referenceSubcarrierSpacing = 1;
+ # pattern1
+ # dl_UL_TransmissionPeriodicity
+ # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+ dl_UL_TransmissionPeriodicity = 6;
+ nrofDownlinkSlots = 7; //8; //7;
+ nrofDownlinkSymbols = 6; //0; //6;
+ nrofUplinkSlots = 2;
+ nrofUplinkSymbols = 4; //0; //4;
+
+ ssPBCH_BlockPower = -15;
+ }
+
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// MME parameters:
+ mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
+ ipv6 = "192:168:30::17";
+ port = 36412 ;
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ ///X2
+ enable_x2 = "yes";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+ t_dc_prep = 1000; /* unit: millisecond */
+ t_dc_overall = 2000; /* unit: millisecond */
+ target_enb_x2_ip_address = (
+ { ipv4 = "CI_FR1_CTL_ENB_IP_ADDR";
+ ipv6 = "192:168:30::17";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES :
+ {
+
+ GNB_INTERFACE_NAME_FOR_S1_MME = "eth0";
+ GNB_IPV4_ADDRESS_FOR_S1_MME = "CI_GNB_IP_ADDR";
+ GNB_INTERFACE_NAME_FOR_S1U = "eth0";
+ GNB_IPV4_ADDRESS_FOR_S1U = "CI_GNB_IP_ADDR";
+ GNB_PORT_FOR_S1U = 2152; # Spec 2152
+ GNB_IPV4_ADDRESS_FOR_X2C = "CI_GNB_IP_ADDR";
+ GNB_PORT_FOR_X2C = 36422; # Spec 36422
+ };
+ }
+);
+
+MACRLCs = (
+ {
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "local_RRC";
+ }
+);
+
+L1s = (
+ {
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ pusch_proc_threads = 6;
+ }
+);
+
+RUs = (
+ {
+ local_rf = "yes"
+ nb_tx = 1
+ nb_rx = 1
+ att_tx = 0
+ att_rx = 0;
+ bands = [7];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 75; #114
+ eNB_instances = [0];
+ sdr_addrs = "addr=192.168.80.50"
+ clock_src = "internal"
+
+ }
+);
+
+THREAD_STRUCT = (
+ {
+ #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+ parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
+ //parallel_config = "PARALLEL_SINGLE_THREAD";
+ #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+ worker_config = "WORKER_ENABLE";
+ }
+);
+
+ log_config :
+ {
+ global_log_level ="info";
+ global_log_verbosity ="medium";
+ hw_log_level ="info";
+ hw_log_verbosity ="medium";
+ phy_log_level ="info";
+ phy_log_verbosity ="medium";
+ mac_log_level ="info";
+ mac_log_verbosity ="high";
+ rlc_log_level ="info";
+ rlc_log_verbosity ="medium";
+ pdcp_log_level ="info";
+ pdcp_log_verbosity ="medium";
+ rrc_log_level ="info";
+ rrc_log_verbosity ="medium";
+ };
+
+uicc: {
+opc = "testopc";
+};
diff --git a/ci-scripts/constants.py b/ci-scripts/constants.py
index a0e1ac5c45..bb110bc0e8 100644
--- a/ci-scripts/constants.py
+++ b/ci-scripts/constants.py
@@ -60,6 +60,11 @@ OAI_UE_PROCESS_SEG_FAULT = -25
OAI_UE_PROCESS_NO_MBMS_MSGS = -26
OAI_UE_PROCESS_OK = +6
INVALID_PARAMETER = -50
+PHYSIM_IMAGE_ABSENT = -60
+OC_LOGIN_FAIL = -61
+OC_PROJECT_FAIL = -62
+OC_IS_FAIL = -63
+OC_PHYSIM_DEPLOY_FAIL = -64
UE_STATUS_DETACHED = 0
UE_STATUS_DETACHING = 1
diff --git a/ci-scripts/createVM.sh b/ci-scripts/createVM.sh
index b67668f0bc..f3f8ddaca2 100755
--- a/ci-scripts/createVM.sh
+++ b/ci-scripts/createVM.sh
@@ -87,7 +87,7 @@ function create_vm {
echo "VM_CPU = $VM_CPU"
echo "VM_DISK = $VM_DISK GBytes"
- if [[ "$VM_NAME" == *"-enb-usrp"* ]]
+ if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]]
then
echo "This VM type is no longer supported in the pipeline framework"
return
diff --git a/ci-scripts/datalog_rt_stats.yaml b/ci-scripts/datalog_rt_stats.yaml
new file mode 100644
index 0000000000..3680d2a19b
--- /dev/null
+++ b/ci-scripts/datalog_rt_stats.yaml
@@ -0,0 +1,33 @@
+#this is a configuration file
+#used to build real time processing statistics
+#for 5G NR phy test (gNB terminate)
+Title : Processing Time (us)
+ColNames :
+ - Metric
+ - Average
+ - Max
+ - Average vs Reference Deviation (Reference Value ; Acceptability Threshold)
+Ref :
+ feprx : 60.0
+ feptx_prec : 8.0
+ feptx_ofdm : 85.0
+ feptx_total : 75.0
+ L1 Tx processing : 300.0
+ DLSCH encoding : 230.0
+ L1 Rx processing : 175.0
+ PUSCH inner-receiver : 100.0
+ PUSCH decoding : 140.0
+ DL & UL scheduling timing stats : 15.0
+ UL Indication : 20.0
+Threshold :
+ feprx : 1.25
+ feptx_prec : 1.25
+ feptx_ofdm : 1.25
+ feptx_total : 1.25
+ L1 Tx processing : 1.25
+ DLSCH encoding : 1.25
+ L1 Rx processing : 1.25
+ PUSCH inner-receiver : 1.25
+ PUSCH decoding : 1.25
+ DL & UL scheduling timing stats : 1.25
+ UL Indication : 1.25
diff --git a/ci-scripts/docker/Dockerfile.cppcheck.xenial b/ci-scripts/docker/Dockerfile.cppcheck.xenial
new file mode 100644
index 0000000000..0aecc62037
--- /dev/null
+++ b/ci-scripts/docker/Dockerfile.cppcheck.xenial
@@ -0,0 +1,31 @@
+FROM ubuntu:xenial AS oai-cppcheck
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
+ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
+ build-essential \
+ vim \
+ cppcheck
+
+WORKDIR /oai-ran
+COPY . .
+
+WORKDIR /oai-ran/common/utils/T
+RUN make
+
+WORKDIR /oai-ran
+RUN mkdir -p cmake_targets/log && \
+ cppcheck --enable=warning --force --xml --xml-version=2 \
+ -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c \
+ --suppressions-list=ci-scripts/cppcheck_suppressions.list \
+ -I common/utils \
+ -I openair3/NAS/COMMON/UTIL \
+ -j`nproc` . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt
+
+RUN egrep -c 'severity="error' cmake_targets/log/cppcheck.xml
+
+RUN egrep -c 'severity="warning' cmake_targets/log/cppcheck.xml
+
+RUN cat cmake_targets/log/cppcheck.xml
diff --git a/ci-scripts/html.py b/ci-scripts/html.py
index b3ee00e7dc..9eadf30279 100644
--- a/ci-scripts/html.py
+++ b/ci-scripts/html.py
@@ -47,7 +47,7 @@ import constants as CONST
class HTMLManagement():
def __init__(self):
-
+
self.htmlFile = ''
self.htmlHeaderCreated = False
self.htmlFooterCreated = False
@@ -86,13 +86,13 @@ class HTMLManagement():
#-----------------------------------------------------------
# Setters and Getters
#-----------------------------------------------------------
-
+
def SethtmlUEConnected(self, nbUEs):
if nbUEs > 0:
self.htmlUEConnected = nbUEs
else:
self.htmlUEConnected = 1
-
+
#-----------------------------------------------------------
@@ -365,6 +365,16 @@ class HTMLManagement():
self.htmlFile.write(' KO - SPGW process not found \n')
elif (processesStatus == CONST.UE_IP_ADDRESS_ISSUE):
self.htmlFile.write(' KO - Could not retrieve UE IP address \n')
+ elif (processesStatus == CONST.PHYSIM_IMAGE_ABSENT):
+ self.htmlFile.write(' KO - No such image oai-physim \n')
+ elif (processesStatus == CONST.OC_LOGIN_FAIL):
+ self.htmlFile.write(' KO - Could not log onto cluster \n')
+ elif (processesStatus == CONST.OC_PROJECT_FAIL):
+ self.htmlFile.write(' KO - Could not register into cluster project \n')
+ elif (processesStatus == CONST.OC_IS_FAIL):
+ self.htmlFile.write(' KO - Could not create Image Stream \n')
+ elif (processesStatus == CONST.OC_PHYSIM_DEPLOY_FAIL):
+ self.htmlFile.write(' KO - Could not properly deploy physim on cluster \n')
else:
self.htmlFile.write(' ' + str(status) + ' \n')
else:
@@ -412,7 +422,12 @@ class HTMLManagement():
for image in collectInfo:
files = collectInfo[image]
# TabHeader for image logs on built shared and target images
- self.htmlFile.write(' \n')
+ if allImagesSize[image].count('unknown') > 0:
+ self.htmlFile.write(' \n')
+ elif allImagesSize[image].count('Build Failed') > 0:
+ self.htmlFile.write(' \n')
+ else:
+ self.htmlFile.write(' \n')
self.htmlFile.write(' ---- ' + image + ' IMAGE STATUS ----> Size ' + allImagesSize[image] + ' \n')
self.htmlFile.write(' \n')
self.htmlFile.write(' \n')
@@ -431,21 +446,54 @@ class HTMLManagement():
self.htmlFile.write(' ' + str(parameters['errors']) + ' \n')
else:
self.htmlFile.write(' ' + str(parameters['errors']) + ' \n')
- if (parameters['warnings'] == 0):
+ if (parameters['errors'] > 0):
+ self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
+ elif (parameters['warnings'] == 0):
self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)):
self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
else:
- self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
+ self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
if (parameters['errors'] == 0) and (parameters['warnings'] == 0):
self.htmlFile.write(' OK \n')
elif (parameters['errors'] == 0) and ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)):
self.htmlFile.write(' OK \n')
else:
- self.htmlFile.write(' NOT OK \n')
+ self.htmlFile.write(' NOT OK \n')
self.htmlFile.write(' \n')
self.htmlFile.close()
+ #for the moment it is limited to 4 columns, to be made generic later
+ def CreateHtmlDataLogTable(self, DataLog):
+ if (self.htmlFooterCreated or (not self.htmlHeaderCreated)):
+ return
+ self.htmlFile = open('test_results.html', 'a')
+
+ # TabHeader
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ---- ' + DataLog['Title'] + ' ---- \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' '+ DataLog['ColNames'][0] +' \n')
+ self.htmlFile.write(' ' + DataLog['ColNames'][1] + ' \n')
+ self.htmlFile.write(' ' + DataLog['ColNames'][2] + ' \n')
+ self.htmlFile.write(' '+ DataLog['ColNames'][3] +' \n')
+ self.htmlFile.write(' \n')
+
+ for k in DataLog['Data']:
+ # TestRow
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ' + k + ' \n')
+ self.htmlFile.write(' ' + DataLog['Data'][k][0] + ' \n')
+ self.htmlFile.write(' ' + DataLog['Data'][k][1] + ' \n')
+ if float(DataLog['Data'][k][2])> DataLog['Threshold'][k]:
+ self.htmlFile.write(' ' + DataLog['Data'][k][2] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + ' \n')
+ else:
+ self.htmlFile.write(' ' + DataLog['Data'][k][2] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.close()
+
+
def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue):
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
self.htmlFile = open('test_results.html', 'a')
@@ -479,3 +527,140 @@ class HTMLManagement():
self.htmlFile.write(' \n')
self.htmlFile.close()
+ def CreateHtmlTestRowCppCheckResults(self, CCR):
+ if (self.htmlFooterCreated or (not self.htmlHeaderCreated)):
+ return
+ self.htmlFile = open('test_results.html', 'a')
+ vId = 0
+ for version in CCR.versions:
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Results for cppcheck v ' + version + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' NB ERRORS \n')
+ if CCR.nbErrors[vId] == 0:
+ myColor = 'lightgreen'
+ elif CCR.nbErrors[vId] < 20:
+ myColor = 'orange'
+ else:
+ myColor = 'lightcoral'
+ self.htmlFile.write(' ' + str(CCR.nbErrors[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' NB WARNINGS \n')
+ if CCR.nbWarnings[vId] == 0:
+ myColor = 'lightgreen'
+ elif CCR.nbWarnings[vId] < 20:
+ myColor = 'orange'
+ else:
+ myColor = 'lightcoral'
+ self.htmlFile.write(' ' + str(CCR.nbWarnings[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ----------------- \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Memory leak \n')
+ self.htmlFile.write(' ' + str(CCR.nbMemLeaks[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Possible null pointer deference \n')
+ self.htmlFile.write(' ' + str(CCR.nbNullPtrs[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Uninitialized variable \n')
+ self.htmlFile.write(' ' + str(CCR.nbUninitVars[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Undefined behaviour shifting \n')
+ self.htmlFile.write(' ' + str(CCR.nbTooManyBitsShift[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Signed integer overflow \n')
+ self.htmlFile.write(' ' + str(CCR.nbIntegerOverflow[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Printf formatting issues \n')
+ self.htmlFile.write(' ' + str(CCR.nbInvalidPrintf[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Modulo result is predetermined \n')
+ self.htmlFile.write(' ' + str(CCR.nbModuloAlways[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Opposite Condition -> dead code \n')
+ self.htmlFile.write(' ' + str(CCR.nbOppoInnerCondition[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Wrong Scanf Nb Args \n')
+ self.htmlFile.write(' ' + str(CCR.nbWrongScanfArg[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ vId += 1
+
+ def CreateHtmlTestRowPhySimTestResult(self, testSummary, testResult):
+ if (self.htmlFooterCreated or (not self.htmlHeaderCreated)):
+ return
+ self.htmlFile = open('test_results.html', 'a')
+ if bool(testResult) == False and bool(testSummary) == False:
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ----PHYSIM TESTING FAILED - Unable to recover the test logs ---- \n')
+ self.htmlFile.write(' \n')
+ else:
+ # Tab header
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ---- PHYSIM TEST SUMMARY---- \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' LogFile Name \n')
+ self.htmlFile.write(' Nb Tests \n')
+ self.htmlFile.write(' Nb Failure \n')
+ self.htmlFile.write(' Nb Pass \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' physim_test.txt \n')
+ self.htmlFile.write(' ' + str(testSummary['Nbtests']) + ' \n')
+ if testSummary['Nbfail'] == 0:
+ self.htmlFile.write(' ' + str(testSummary['Nbfail']) + ' \n')
+ else:
+ self.htmlFile.write(' ' + str(testSummary['Nbfail']) + ' \n')
+ self.htmlFile.write(' ' + str(testSummary['Nbpass']) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ---- PHYSIM TEST DETAIL INFO---- \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Test Name \n')
+ self.htmlFile.write(' Test Description \n')
+ self.htmlFile.write(' Result \n')
+ self.htmlFile.write(' \n')
+ y = ''
+ for key, value in testResult.items():
+ x = key.split(".")
+ if x[0] != y:
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' "' + x[0] + '" series \n')
+ self.htmlFile.write(' \n')
+ y = x[0]
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ' + key + ' \n')
+ self.htmlFile.write(' ' + value[0] + ' \n')
+ if 'PASS' in value:
+ self.htmlFile.write(' ' + value[1] + ' \n')
+ else:
+ self.htmlFile.write(' ' + value[1] + ' \n')
+
+ self.htmlFile.close()
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 3094197c54..3f5b57e016 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -38,11 +38,13 @@ import helpreadme as HELP
import constants as CONST
-import cls_oaicitest #main class for OAI CI test framework
-import cls_physim #class PhySim for physical simulators build and test
-import cls_cots_ue #class CotsUe for Airplane mode control
-import cls_containerize #class Containerize for all container-based operations on RAN/UE objects
-
+import cls_oaicitest #main class for OAI CI test framework
+import cls_physim #class PhySim for physical simulators build and test
+import cls_cots_ue #class CotsUe for Airplane mode control
+import cls_containerize #class Containerize for all container-based operations on RAN/UE objects
+import cls_static_code_analysis #class for static code analysis
+import cls_ci_ueinfra #class defining the multi Ue infrastrucure
+import cls_physim1 #class PhySim for physical simulators deploy and run
import sshconnection
import epc
@@ -192,6 +194,20 @@ def GetParametersFromXML(action):
else :
RAN.air_interface[RAN.eNB_instance] = 'ocp-enb'
+ elif action == 'Initialize_UE':
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
+
+ elif action == 'Detach_UE':
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
+
elif action == 'Attach_UE':
nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach')
if (nbMaxUEtoAttach is None):
@@ -252,9 +268,20 @@ def GetParametersFromXML(action):
elif (action == 'Ping') or (action == 'Ping_CatM_module'):
CiTestObj.ping_args = test.findtext('ping_args')
CiTestObj.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold')
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
elif action == 'Iperf':
CiTestObj.iperf_args = test.findtext('iperf_args')
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
+ CiTestObj.iperf_direction = test.findtext('direction')#used for modules only
CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold')
CiTestObj.iperf_profile = test.findtext('iperf_profile')
if (CiTestObj.iperf_profile is None):
@@ -369,6 +396,20 @@ with open(yaml_file,'r') as f:
+#loading UE infrastructure from yaml
+ue_infra_file='ci_ueinfra.yaml'
+if (os.path.isfile(ue_infra_file)):
+ yaml_file=ue_infra_file
+elif (os.path.isfile('ci-scripts/'+ue_infra_file)):
+ yaml_file='ci-scripts/'+ue_infra_file
+else:
+ logging.error("UE infrastructure yaml file cannot be found")
+ sys.exit("UE infrastructure file cannot be found")
+InfraUE=cls_ci_ueinfra.InfraUE() #initialize UE infrastructure class
+InfraUE.Get_UE_Infra(yaml_file) #read the UE infra, filename is hardcoded and unique for the moment but should be passed as parameter from the test suite
+
+
+
mode = ''
CiTestObj = cls_oaicitest.OaiCiTest()
@@ -378,17 +419,18 @@ EPC = epc.EPCManagement()
RAN = ran.RANManagement()
HTML = html.HTMLManagement()
CONTAINERS = cls_containerize.Containerize()
+SCA = cls_static_code_analysis.StaticCodeAnalysis()
+PHYSIM = cls_physim1.PhySim()
ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build
-
#-----------------------------------------------------------
# Parsing Command Line Arguments
#-----------------------------------------------------------
import args_parse
-py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP)
+py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM)
@@ -671,13 +713,13 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'Terminate_eNB':
RAN.TerminateeNB(HTML, EPC)
elif action == 'Initialize_UE':
- CiTestObj.InitializeUE(HTML,COTS_UE)
+ CiTestObj.InitializeUE(HTML,RAN, EPC, COTS_UE, InfraUE)
elif action == 'Terminate_UE':
CiTestObj.TerminateUE(HTML,COTS_UE)
elif action == 'Attach_UE':
CiTestObj.AttachUE(HTML,RAN,EPC,COTS_UE)
elif action == 'Detach_UE':
- CiTestObj.DetachUE(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.DetachUE(HTML,RAN,EPC,COTS_UE,InfraUE)
elif action == 'DataDisable_UE':
CiTestObj.DataDisableUE(HTML)
elif action == 'DataEnable_UE':
@@ -701,9 +743,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'Ping_CatM_module':
CiTestObj.PingCatM(HTML,RAN,EPC,COTS_UE,EPC)
elif action == 'Ping':
- CiTestObj.Ping(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.Ping(HTML,RAN,EPC,COTS_UE, InfraUE)
elif action == 'Iperf':
- CiTestObj.Iperf(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.Iperf(HTML,RAN,EPC,COTS_UE, InfraUE)
elif action == 'Reboot_UE':
CiTestObj.RebootUE(HTML,RAN,EPC)
elif action == 'Initialize_HSS':
@@ -741,6 +783,10 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
CONTAINERS.DeployObject(HTML, EPC)
elif action == 'Undeploy_Object':
CONTAINERS.UndeployObject(HTML, RAN)
+ elif action == 'Cppcheck_Analysis':
+ SCA.CppCheckAnalysis(HTML)
+ elif action == 'Deploy_Run_PhySim':
+ PHYSIM.Deploy_PhySim(HTML, RAN)
else:
sys.exit('Invalid class (action) from xml')
if not RAN.prematureExit:
diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py
index 783adb98e6..31027d7234 100644
--- a/ci-scripts/ran.py
+++ b/ci-scripts/ran.py
@@ -37,6 +37,8 @@ import logging
import os
import time
from multiprocessing import Process, Lock, SimpleQueue
+import yaml
+
#-----------------------------------------------------------
# OAI Testing modules
@@ -90,6 +92,7 @@ class RANManagement():
self.testCase_id = ''
self.epcPcapFile = ''
self.runtime_stats= ''
+ self.datalog_rt_stats={}
@@ -127,12 +130,16 @@ class RANManagement():
result = re.search('--eNBocp', self.Build_eNB_args)
if result is not None:
self.air_interface[self.eNB_instance] = 'ocp-enb'
- else:
- result = re.search('--gNB', self.Build_eNB_args)
+ else:
+ result = re.search('--RU', self.Build_eNB_args)
if result is not None:
- self.air_interface[self.eNB_instance] = 'nr-softmodem'
+ self.air_interface[self.eNB_instance] = 'oairu'
else:
- self.air_interface[self.eNB_instance] = 'lte-softmodem'
+ result = re.search('--gNB', self.Build_eNB_args)
+ if result is not None:
+ self.air_interface[self.eNB_instance] = 'nr-softmodem'
+ else:
+ self.air_interface[self.eNB_instance] = 'lte-softmodem'
# Worakround for some servers, we need to erase completely the workspace
if self.Build_eNB_forced_workspace_cleanup:
@@ -141,7 +148,7 @@ class RANManagement():
# on RedHat/CentOS .git extension is mandatory
result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository)
if result is not None:
- full_ran_repo_name = self.ranRepository
+ full_ran_repo_name = self.ranRepository.replace('git/', 'git')
else:
full_ran_repo_name = self.ranRepository + '.git'
mySSH.command('mkdir -p ' + lSourcePath, '\$', 5)
@@ -184,7 +191,7 @@ class RANManagement():
mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30)
# if the commit ID is provided use it to point to it
if self.ranCommitID != '':
- mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5)
+ mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30)
# if the branch is not develop, then it is a merge request and we need to do
# the potential merge. Note that merge conflicts should already been checked earlier
if (self.ranAllowMerge):
@@ -294,7 +301,7 @@ class RANManagement():
mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
mySSH.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5)
#-qq quiet / -u update orcreate files
- mySSH.command('unzip -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5)
+ mySSH.command('unzip -o -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5)
mySSH.command('rm -f tmp_build' + testcaseId + '.zip', '\$', 5)
mySSH.close()
else:
@@ -382,13 +389,13 @@ class RANManagement():
# do not reset board twice in IF4.5 case
result = re.search('^rru|^enb|^du.band', str(config_file))
if result is not None:
- mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 60)
+ mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 90)
result = re.search('type: b200', mySSH.getBefore())
if result is not None:
logging.debug('Found a B2xx device --> resetting it')
mySSH.command('echo ' + lPassWord + ' | sudo -S b2xx_fx3_utils --reset-device', '\$', 10)
# Reloading FGPA bin firmware
- mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 60)
+ mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 90)
# Make a copy and adapt to EPC / eNB IP addresses
mySSH.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5)
localMmeIpAddr = EPC.MmeIPAddress
@@ -633,6 +640,9 @@ class RANManagement():
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
else:
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
+ #display rt stats for gNB only
+ if len(self.datalog_rt_stats)!=0 and nodeB_prefix == 'g':
+ HTML.CreateHtmlDataLogTable(self.datalog_rt_stats)
self.eNBmbmsEnables[int(self.eNB_instance)] = False
self.eNBstatuses[int(self.eNB_instance)] = -1
@@ -694,12 +704,30 @@ class RANManagement():
NSA_RAPROC_PUSCH_check = 0
#dlsch and ulsch statistics (dictionary)
dlsch_ulsch_stats = {}
- #count "L1 thread not ready" msg
- L1_thread_not_ready_cnt = 0
+ #real time statistics (dictionary)
+ real_time_stats = {}
#count "problem receiving samples" msg
pb_receiving_samples_cnt = 0
+ #NSA specific log markers
+ nsa_markers ={'SgNBReleaseRequestAcknowledge': [],'FAILURE': [], 'scgFailureInformationNR-r15': [], 'SgNBReleaseRequest': []}
+ #the datalog config file has to be loaded
+ datalog_rt_stats_file='datalog_rt_stats.yaml'
+ if (os.path.isfile(datalog_rt_stats_file)):
+ yaml_file=datalog_rt_stats_file
+ elif (os.path.isfile('ci-scripts/'+datalog_rt_stats_file)):
+ yaml_file='ci-scripts/'+datalog_rt_stats_file
+ else:
+ logging.error("Datalog RT stats yaml file cannot be found")
+ sys.exit("Datalog RT stats yaml file cannot be found")
+
+ with open(yaml_file,'r') as f:
+ datalog_rt_stats = yaml.load(f,Loader=yaml.FullLoader)
+ rt_keys = datalog_rt_stats['Ref'] #we use the keys from the Ref field
+
+ line_cnt=0 #log file line counter
for line in enb_log_file.readlines():
+ line_cnt+=1
# Runtime statistics
result = re.search('Run time:' ,str(line))
if result is not None:
@@ -857,20 +885,31 @@ class RANManagement():
#keys below are the markers we are loooking for, loop over this keys list
#everytime these markers are found in the log file, the previous ones are overwritten in the dict
#eventually we record and print only the last occurence
- keys = {'dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled'}
+ keys = {'UE ID','dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled'}
for k in keys:
result = re.search(k, line)
if result is not None:
#remove 1- all useless char before relevant info (ulsch or dlsch) 2- trailing char
dlsch_ulsch_stats[k]=re.sub(r'^.*\]\s+', r'' , line.rstrip())
- #count "L1 thread not ready" msg
- result = re.search('\[PHY\]\s+L1_thread isn\'t ready', str(line))
- if result is not None:
- L1_thread_not_ready_cnt += 1
+ #real time statistics for gNB
+ for k in rt_keys:
+ result = re.search(k, line)
+ if result is not None:
+ #remove 1- all useless char before relevant info 2- trailing char
+ line=line.replace('[0m','')
+ tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex
+ real_time_stats[k]=tmp.group(1)
+
#count "problem receiving samples" msg
result = re.search('\[PHY\]\s+problem receiving samples', str(line))
if result is not None:
- pb_receiving_samples_cnt += 1
+ pb_receiving_samples_cnt += 1
+
+ #nsa markers logging
+ for k in nsa_markers:
+ result = re.search(k, line)
+ if result is not None:
+ nsa_markers[k].append(line_cnt)
enb_log_file.close()
logging.debug(' File analysis completed')
@@ -879,7 +918,7 @@ class RANManagement():
else:
nodeB_prefix = 'g'
- if self.air_interface[self.eNB_instance] == 'nr-softmodem':
+ if nodeB_prefix == 'g':
if ulschReceiveOK > 0:
statMsg = nodeB_prefix + 'NB showed ' + str(ulschReceiveOK) + ' "ULSCH received ok" message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
@@ -897,20 +936,31 @@ class RANManagement():
statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : PASS '
htmlMsg = statMsg+'\n'
else:
- statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL '
+ statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL or not relevant'
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
- #L1 thread not ready log
- statMsg = '[PHY] L1 thread is not ready msg count = '+str(L1_thread_not_ready_cnt)
- htmlMsg = statMsg+'\n'
- logging.debug(statMsg)
- htmleNBFailureMsg += htmlMsg
#problem receiving samples log
statMsg = '[PHY] problem receiving samples msg count = '+str(pb_receiving_samples_cnt)
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
+ #nsa markers
+ statMsg = 'logfile line count = ' + str(line_cnt)
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ if len(nsa_markers['SgNBReleaseRequestAcknowledge'])!=0:
+ statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(nsa_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences , starting line ' + str(nsa_markers['SgNBReleaseRequestAcknowledge'][0])
+ else:
+ statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(nsa_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ statMsg = 'FAILURE = ' + str(len(nsa_markers['FAILURE'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
#ulsch and dlsch statistics
if len(dlsch_ulsch_stats)!=0: #check if dictionary is not empty
@@ -920,6 +970,47 @@ class RANManagement():
logging.debug(dlsch_ulsch_stats[key])
htmleNBFailureMsg += statMsg
+ #real time statistics
+ datalog_rt_stats['Data']={}
+ if len(real_time_stats)!=0: #check if dictionary is not empty
+ for k in real_time_stats:
+ tmp=re.match(r'^(?P.*):\s+(?P\d+\.\d+) us;\s+\d+;\s+(?P\d+\.\d+) us;',real_time_stats[k])
+ if tmp is not None:
+ metric=tmp.group('metric')
+ avg=float(tmp.group('avg'))
+ max=float(tmp.group('max'))
+ datalog_rt_stats['Data'][metric]=["{:.0f}".format(avg),"{:.0f}".format(max),"{:.2f}".format(avg/datalog_rt_stats['Ref'][metric])]
+ #once all metrics are collected, store the data as a class attribute to build a dedicated HTML table afterward
+ self.datalog_rt_stats=datalog_rt_stats
+ #check if there is a fail => will render the test as failed
+ for k in datalog_rt_stats['Data']:
+ if float(datalog_rt_stats['Data'][k][2])> datalog_rt_stats['Threshold'][k]: #condition for fail : avg/ref is greater than the fixed threshold
+ #setting prematureExit is ok although not the best option
+ self.prematureExit=True
+ else:
+ statMsg = 'No real time stats found in the log file\n'
+ logging.debug('No real time stats found in the log file')
+ htmleNBFailureMsg += statMsg
+
+ else:
+ #nsa markers
+ statMsg = 'logfile line count = ' + str(line_cnt)
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ if len(nsa_markers['SgNBReleaseRequest'])!=0:
+ statMsg = 'SgNBReleaseRequest = ' + str(len(nsa_markers['SgNBReleaseRequest'])) + ' occurences , starting line ' + str(nsa_markers['SgNBReleaseRequest'][0])
+ else:
+ statMsg = 'SgNBReleaseRequest = ' + str(len(nsa_markers['SgNBReleaseRequest'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ statMsg = 'scgFailureInformationNR-r15 = ' + str(len(nsa_markers['scgFailureInformationNR-r15'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+
+
if uciStatMsgCount > 0:
statMsg = nodeB_prefix + 'NB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
diff --git a/ci-scripts/ran_dashboard.py b/ci-scripts/ran_dashboard.py
new file mode 100644
index 0000000000..4f18638e68
--- /dev/null
+++ b/ci-scripts/ran_dashboard.py
@@ -0,0 +1,299 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+# Merge Requests Dashboard for RAN on googleSheet
+#
+# Required Python Version
+# Python 3.x
+#
+#---------------------------------------------------------------------
+
+#-----------------------------------------------------------
+# Import
+#-----------------------------------------------------------
+
+#import google spreadsheet API
+import gspread
+from oauth2client.service_account import ServiceAccountCredentials
+
+
+import subprocess
+import shlex #lexical analysis
+import json #json structures
+import datetime #now() and date formating
+from datetime import datetime
+import re
+import gitlab
+
+#-----------------------------------------------------------
+# Class Declaration
+#-----------------------------------------------------------
+
+class gDashboard:
+ def __init__(self, creds_file, spreadsheet, worksheet): #"creds.json", 'OAI RAN Dashboard', 'MR Status'
+ self.scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]
+ self.creds = ServiceAccountCredentials.from_json_keyfile_name(creds_file, self.scope)
+ self.client = gspread.authorize(self.creds)
+ #spreadsheet
+ self.ss = self.client.open(spreadsheet)
+ #worksheet
+ self.sheet = self.ss.worksheet(worksheet)
+ self.ss.del_worksheet(self.sheet) #start by deleting the old sheet
+ self.sheet = self.ss.add_worksheet(title=worksheet, rows="100", cols="20") #create a new one
+
+ self.d = {} #data dictionary
+
+
+ def fetchData(self,cmd):
+ #cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """
+ process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
+ output = process.stdout.readline()
+ tmp=output.decode("utf-8")
+ self.d = json.loads(tmp)
+
+
+ def gBuild(self, destinationSheetName):
+
+ #line 1 : update date/time, format dd/mm/YY H:M:S
+ now = datetime.now()
+ dt_string = "Update : " + now.strftime("%d/%m/%Y %H:%M")
+ row =[dt_string]
+ self.sheet.insert_row(row, index=1, value_input_option='RAW')
+
+ #line 2 empty
+ #line 3 is for the column names
+ i=3
+ row =["MR","Created_at","Author","Title","Assignee", "Reviewer", "CAN START","IN PROGRESS","COMPLETED","Review Form","OK MERGE","Merge conflicts"]
+ self.sheet.insert_row(row, index=i, value_input_option='RAW')
+
+ #line 4 onward, MR data lines
+ for x in range(len(self.d)):
+ i=i+1
+ date_time_str = self.d[x]['created_at']
+ date_time_obj = datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ')
+
+ milestone1=milestone2=milestone3=milestone4=""
+ if self.d[x]['milestone']!=None:
+ if self.d[x]['milestone']['title']=="REVIEW_CAN_START":
+ milestone1="X"
+ elif self.d[x]['milestone']['title']=="REVIEW_IN_PROGRESS":
+ milestone2="X"
+ elif self.d[x]['milestone']['title']=="REVIEW_COMPLETED_AND_APPROVED":
+ milestone3="X"
+ elif self.d[x]['milestone']['title']=="OK_TO_BE_MERGED":
+ milestone4="X"
+ else:
+ pass
+ else:
+ pass
+
+ #check if empty or not
+ if self.d[x]['assignee']!=None:
+ assignee = str(self.d[x]['assignee']['name'])
+ else:
+ assignee = ""
+
+ #check if empty or not
+ if len(self.d[x]['reviewers'])!=0:
+ reviewer = str(self.d[x]['reviewers'][0]['name'])
+ else:
+ reviewer = ""
+
+ if self.d[x]['has_conflicts']==True:
+ conflicts = "YES"
+ else:
+ conflicts = ""
+
+
+ #add a column flagging that the review form is present
+ #we use gitlab API to parse the MR notes
+ gl = gitlab.Gitlab.from_config('OAI')
+ project_id = 223
+ project = gl.projects.get(project_id)
+ #get the opened MR in the project
+ mrs = project.mergerequests.list(state='opened')
+ for m in range (0,len(mrs)):
+ if mrs[m].iid==self.d[x]['iid']:#check the iid is the one we are on
+ mr_notes = mrs[m].notes.list(all=True)
+ n=0
+ found=False
+ review_form=""
+ while found==False and nUbuntu 16.04 LTS -- Summary" >> ./build_results.html
- sca_summary_table_header ./archives/cppcheck/cppcheck.xml "OAI Static Code Analysis with CPPCHECK"
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder
- sca_summary_table_footer ./archives/cppcheck/cppcheck.xml
-
-# summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_usrp
-# summary_table_row "LTE SoftModem - Release 15" ./archives/enb_usrp/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_usrp_row1.html
-# summary_table_row "Coding - Release 15" ./archives/enb_usrp/coding.Rel15.txt "Built target coding" ./enb_usrp_row2.html
-# summary_table_row "OAI USRP device if - Release 15" ./archives/enb_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_usrp_row3.html
-# summary_table_row "OAI ETHERNET transport - Release 15" ./archives/enb_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./enb_usrp_row4.html
-# summary_table_row "Parameters Lib Config - Release 15" ./archives/enb_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./enb_usrp_row5.html
-# summary_table_row "NASMESH - Release 15" ./archives/enb_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./enb_usrp_row6.html
-# summary_table_row "RB Tool - Release 15" ./archives/enb_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./enb_usrp_row7.html
-# summary_table_row "RF Simulator - Release 15" ./archives/enb_usrp/rfsimulator.Rel15.txt "Built target rfsimulator" ./enb_usrp_row8.html
-# summary_table_row "TCP Bridge - Release 15" ./archives/enb_usrp/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_usrp_row9.html
-# summary_table_footer
-#
summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_eth
summary_table_row "LTE SoftModem - Release 15" ./archives/enb_eth/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_eth_row1.html
summary_table_row "Coding - Release 15" ./archives/enb_eth/coding.Rel15.txt "Built target coding" ./enb_eth_row2.html
@@ -634,48 +610,6 @@ function report_build {
summary_table_row "NVRAM - Release 15" ./archives/basic_sim/nvram.Rel15.txt "Built target nvram" ./basic_sim_row13.html
summary_table_footer
- summary_table_header "OAI Build: 4G LTE / 5G NR Physical simulators option" ./archives/phy_sim
- summary_table_row "LTE DL Simulator - Release 15" ./archives/phy_sim/dlsim.Rel15.txt "Built target dlsim" ./phy_sim_row1.html
- summary_table_row "LTE UL Simulator - Release 15" ./archives/phy_sim/ulsim.Rel15.txt "Built target ulsim" ./phy_sim_row2.html
- summary_table_row "Coding - Release 15" ./archives/phy_sim/coding.Rel15.txt "Built target coding" ./phy_sim_row3.html
- if [ -f ./archives/phy_sim/ldpctest.Rel15.txt ]
- then
- summary_table_row "NR LDPC Test - Release 15" ./archives/phy_sim/ldpctest.Rel15.txt "Built target ldpctest" ./phy_sim_row4.html
- fi
- if [ -f ./archives/phy_sim/polartest.Rel15.txt ]
- then
- summary_table_row "NR Polar Test - Release 15" ./archives/phy_sim/polartest.Rel15.txt "Built target polartest" ./phy_sim_row5.html
- fi
- if [ -f ./archives/phy_sim/nr_pbchsim.Rel15.txt ]
- then
- summary_table_row "NR PBCH Test - Release 15" ./archives/phy_sim/nr_pbchsim.Rel15.txt "Built target nr_pbchsim" ./phy_sim_row6.html
- fi
- if [ -f ./archives/phy_sim/nr_dlschsim.Rel15.txt ]
- then
- summary_table_row "NR DLSCH Test - Release 15" ./archives/phy_sim/nr_dlschsim.Rel15.txt "Built target nr_dlschsim" ./phy_sim_row7.html
- fi
- if [ -f ./archives/phy_sim/nr_pucchsim.Rel15.txt ]
- then
- summary_table_row "NR PUCCH Test - Release 15" ./archives/phy_sim/nr_pucchsim.Rel15.txt "Built target nr_pucchsim" ./phy_sim_row8.html
- fi
- if [ -f ./archives/phy_sim/smallblocktest.Rel15.txt ]
- then
- summary_table_row "NR Small Block Test - Release 15" ./archives/phy_sim/smallblocktest.Rel15.txt "Built target smallblocktest" ./phy_sim_row9.html
- fi
- if [ -f ./archives/phy_sim/nr_dlsim.Rel15.txt ]
- then
- summary_table_row "NR DL Sim Test - Release 15" ./archives/phy_sim/nr_dlsim.Rel15.txt "Built target nr_dlsim" ./phy_sim_row10.html
- fi
- if [ -f ./archives/phy_sim/nr_ulschsim.Rel15.txt ]
- then
- summary_table_row "NR ULSCH Test - Release 15" ./archives/phy_sim/nr_ulschsim.Rel15.txt "Built target nr_ulschsim" ./phy_sim_row11.html
- fi
- if [ -f ./archives/phy_sim/nr_ulsim.Rel15.txt ]
- then
- summary_table_row "NR UL Sim Test - Release 15" ./archives/phy_sim/nr_ulsim.Rel15.txt "Built target nr_ulsim" ./phy_sim_row12.html
- fi
- summary_table_footer
-
if [ -f archives/gnb_usrp/nr-softmodem.Rel15.txt ]
then
summary_table_header "OAI Build: 5G NR gNB -- USRP option" ./archives/gnb_usrp
@@ -718,13 +652,6 @@ function report_build {
echo " Details for Compilation Errors and Warnings " >> ./build_results.html
echo " " >> ./build_results.html
-# if [ -f ./enb_usrp_row1.html ] || [ -f ./enb_usrp_row2.html ] || [ -f ./enb_usrp_row3.html ] || [ -f ./enb_usrp_row4.html ]
-# then
-# for DETAILS_TABLE in `ls ./enb_usrp_row*.html`
-# do
-# cat $DETAILS_TABLE >> ./build_results.html
-# done
-# fi
if [ -f ./enb_eth_row1.html ] || [ -f ./enb_eth_row2.html ] || [ -f ./enb_eth_row3.html ] || [ -f ./enb_eth_row4.html ] || [ -f ./enb_eth_row5.html ] || [ -f ./enb_eth_row6.html ] || [ -f ./enb_eth_row7.html ] || [ -f ./enb_eth_row8.html ] || [ -f ./enb_eth_row9.html ]
then
for DETAILS_TABLE in `ls ./enb_eth_row*.html`
@@ -746,13 +673,6 @@ function report_build {
cat $DETAILS_TABLE >> ./build_results.html
done
fi
- if [ -f ./phy_sim_row1.html ] || [ -f ./phy_sim_row2.html ] || [ -f ./phy_sim_row3.html ] || [ -f ./phy_sim_row4.html ] || [ -f ./phy_sim_row5.html ] || [ -f ./phy_sim_row6.html ] || [ -f ./phy_sim_row7.html ] || [ -f ./phy_sim_row8.html ]
- then
- for DETAILS_TABLE in `ls ./phy_sim_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- fi
if [ -f ./gnb_usrp_row1.html ] || [ -f ./gnb_usrp_row2.html ] || [ -f ./gnb_usrp_row3.html ] || [ -f ./gnb_usrp_row4.html ]
then
for DETAILS_TABLE in `ls ./gnb_usrp_row*.html`
@@ -767,13 +687,6 @@ function report_build {
cat $DETAILS_TABLE >> ./build_results.html
done
fi
- if [ -f ./enb_usrp_rh_row1.html ] || [ -f ./enb_usrp_rh_row2.html ] || [ -f ./enb_usrp_rh_row3.html ] || [ -f ./enb_usrp_rh_row4.html ]
- then
- for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- fi
rm -f ./*_row*.html
echo "
" >> ./build_results.html
diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh
index 415ded57a4..105c95786f 100755
--- a/ci-scripts/reportTestLocally.sh
+++ b/ci-scripts/reportTestLocally.sh
@@ -309,14 +309,14 @@ function report_test {
NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG`
NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG`
- if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
+ if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
then
echo " OK " >> ./test_simulator_results.html
else
echo " KO " >> ./test_simulator_results.html
fi
echo " " >> ./test_simulator_results.html
- if [ $NB_ENB_GOT_SYNC -eq 1 ]
+ if [ $NB_ENB_GOT_SYNC -gt 0 ]
then
echo "- eNB --> got sync " >> ./test_simulator_results.html
else
@@ -749,6 +749,77 @@ function report_test {
echo " " >> ./test_simulator_results.html
EPC_CONFIGS=("noS1")
+ TRANS_MODES=("tdd")
+ FR_MODE=("FR2")
+ BW_CASES=(32)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
+ do
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ for BW in ${BW_CASES[@]}
+ do
+ echo " " >> ./test_simulator_results.html
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
+ else
+ echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+
+
+ #FR2 RA test (--do-ra option)
+
+ #build log files names tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_fr2_test.log
+
+ RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_fr2_test.log
+ RA_UE_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ue_ra_fr2_test.log
+ if [ -f $RA_ENB_LOG ] && [ -f $RA_UE_LOG ]
+ then
+ #get rid of full path
+ NAME_ENB=`echo $RA_ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+ NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+ echo " " >> ./test_simulator_results.html
+ echo " $NAME_ENB --- $NAME_UE " >> ./test_simulator_results.html
+ echo " Check if FR2 RA proc succeeded " >> ./test_simulator_results.html
+
+ #gNB RA check
+ GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG`
+ #UE RA check
+ UE_RA_PROC_OK=`egrep -c "\[RAPROC\] RA procedure succeeded" $RA_UE_LOG`
+
+
+ if [ $GNB_RECEIVED -gt 0 ] && [ $UE_RA_PROC_OK -gt 0 ]
+ then
+ echo " OK " >> ./test_simulator_results.html
+ else
+ echo " KO " >> ./test_simulator_results.html
+ fi
+
+ echo " " >> ./test_simulator_results.html
+ if [ $GNB_RECEIVED -gt 0 ]
+ then
+ echo "- gNB --> RA received " >> ./test_simulator_results.html
+ else
+ echo "- gNB RA NOT RECEIVED " >> ./test_simulator_results.html
+ fi
+ if [ $UE_RA_PROC_OK -gt 0 ]
+ then
+ echo "- NR UE --> RA procedure succeded " >> ./test_simulator_results.html
+ else
+ echo "- NR UE RA procedure failed " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
+
+ done
+ done
+ done
+
+
+ EPC_CONFIGS=("noS1")
+ FR_MODE=("FR1")
TRANS_MODES=("fdd" "tdd")
BW_CASES=(106)
for CN_CONFIG in ${EPC_CONFIGS[@]}
@@ -760,13 +831,14 @@ function report_test {
echo " " >> ./test_simulator_results.html
if [[ $CN_CONFIG =~ .*wS1.* ]]
then
- echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB " >> ./test_simulator_results.html
+ echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
else
- echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB " >> ./test_simulator_results.html
+ echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
fi
echo " " >> ./test_simulator_results.html
- #RA test (--do-ra option)
+
+ #FR1 RA test (--do-ra option)
#build log files names
RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_test.log
@@ -778,7 +850,7 @@ function report_test {
NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
echo " " >> ./test_simulator_results.html
echo " $NAME_ENB --- $NAME_UE " >> ./test_simulator_results.html
- echo " Check if RA proc succeeded " >> ./test_simulator_results.html
+ echo " Check if FR1 RA proc succeeded " >> ./test_simulator_results.html
#gNB RA check
GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG`
diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index f818685049..7bd261fa0a 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -1235,9 +1235,9 @@ function start_rf_sim_gnb {
then
if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
then
- echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test\" > ./my-nr-softmodem-run.sh " >> $1
+ echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
else #RA test => use --do-ra option
- echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra\" > ./my-nr-softmodem-run.sh " >> $1
+ echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
fi
fi
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
@@ -1478,13 +1478,13 @@ function run_test_on_vm {
echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
fi
- if [ "$RUN_OPTIONS" == "none" ]
+ if [ "$RUN_OPTIONS" == "none" ] || [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]]
then
echo "No run on VM testing for this variant currently"
return
fi
- if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]]
+ if [[ $RUN_OPTIONS =~ .*run_XXXX_autotests.* ]]
then
echo "############################################################"
echo "Running test script on VM ($VM_NAME)"
@@ -2189,6 +2189,115 @@ function run_test_on_vm {
if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]]
then
+ echo "############################################################"
+ echo "RA TEST FR2"
+ echo "############################################################"
+ #RA FR2 test, attention : has a different config file from the rest of the test
+ CN_CONFIG="noS1"
+ CONF_FILE=gnb.band261.tm1.32PRB.usrpn300.conf
+ S1_NOS1_CFG=0
+ PRB=32
+ FREQUENCY=28000 #28GHz
+
+ if [ ! -d $ARCHIVES_LOC ]
+ then
+ mkdir --parents $ARCHIVES_LOC
+ fi
+
+ CN_CONFIG="noS1"
+ S1_NOS1_CFG=0
+
+ ######### start of RA TEST loop
+ # for the moment only TDD
+ TRANS_MODES=("tdd")
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ CONF_FILE=gnb.band66.tm1.106PRB.usrpn300.conf
+ PRB=106
+ FREQUENCY=37000
+ else
+ CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
+ PRB=106
+ FREQUENCY=3510
+ fi
+
+ local try_cnt=0
+ NR_STATUS=0
+ while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI
+
+ do
+ SYNC_STATUS=0
+ RA_FR2_STATUS=0
+ rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_fr2_test.log
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (RA TEST)"
+ echo "############################################################"
+ CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_fr2_test.log
+ #last argument = 1 is to enable --do-ra for RA test
+ start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 1
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (RA TEST)"
+ echo "############################################################"
+ CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_ra_fr2_test.log
+ #last argument = 1 is to enable --do-ra for RA test
+ start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1
+ if [ $NR_UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ gNB and NR-UE not syncing"
+ terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2
+ terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1
+ scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC
+ SYNC_STATUS=-1
+ try_cnt=$((try_cnt+1))
+ continue
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Terminate gNB/NR-UE simulators"
+ echo "############################################################"
+ sleep 20
+ terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2
+ terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1
+ scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC
+
+ #check RA markers in gNB and NR UE log files
+ echo "############################################################"
+ echo "${CN_CONFIG} : Checking FR2 RA on gNB / NR-UE"
+ echo "############################################################"
+
+ # Proper check to be done when RA test is working!
+ check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE
+ if [ $RA_FR2_STATUS -ne 0 ]
+ then
+ echo "RA FR2 test NOT OK"
+ echo "try_cnt = " $try_cnt
+ try_cnt=$((try_cnt+1))
+ else
+ try_cnt=$((try_cnt+10))
+ fi
+ done
+ ########### end RA FR2 test
+
+ sleep 30
+
+
+ echo "############################################################"
+ echo "RA TEST FR1"
+ echo "############################################################"
+ ######### redefine config for the rest of the test
+
+ CN_CONFIG="noS1"
+ CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
+ S1_NOS1_CFG=0
+ PRB=106
+ FREQUENCY=3510
+
if [ ! -d $ARCHIVES_LOC ]
then
mkdir --parents $ARCHIVES_LOC
@@ -2258,14 +2367,14 @@ function run_test_on_vm {
#check RA markers in gNB and NR UE log files
echo "############################################################"
- echo "${CN_CONFIG} : Checking RA on gNB / NR-UE"
+ echo "${CN_CONFIG} : Checking FR1 RA on gNB / NR-UE"
echo "############################################################"
# Proper check to be done when RA test is working!
check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE
if [ $RA_STATUS -ne 0 ]
then
- echo "RA test NOT OK"
+ echo "RA FR1 test NOT OK"
echo "try_cnt = " $try_cnt
try_cnt=$((try_cnt+1))
else
@@ -2401,6 +2510,7 @@ function run_test_on_vm {
echo "Checking run status"
echo "############################################################"
+ if [ $RA_FR2_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $RA_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $SYNC_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $PING_STATUS -ne 0 ]; then NR_STATUS=-1; fi
diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py
index 5bfe5da70f..b4087c9695 100644
--- a/ci-scripts/sshconnection.py
+++ b/ci-scripts/sshconnection.py
@@ -35,6 +35,7 @@ import pexpect # pexpect
import logging
import time # sleep
import re
+import subprocess
import sys
#-----------------------------------------------------------
@@ -44,6 +45,9 @@ class SSHConnection():
def __init__(self):
self.ssh = ''
self.picocom_closure = False
+ self.ipaddress = ''
+ self.username = ''
+ self.cmd2Results = ''
def disablePicocomClosure(self):
self.picocom_closure = False
@@ -98,6 +102,8 @@ class SSHConnection():
pass
else:
sys.exit('SSH Connection Failed')
+ self.ipaddress = ipaddress
+ self.username = username
@@ -111,11 +117,20 @@ class SSHConnection():
self.sshresponse = self.ssh.expect(expected)
return self.sshresponse
- def command(self, commandline, expectedline, timeout):
- logging.debug(commandline)
+ def command(self, commandline, expectedline, timeout, silent=False, resync=False):
+ if not silent:
+ logging.debug(commandline)
self.ssh.timeout = timeout
- self.ssh.sendline(commandline)
- self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT])
+ # Nasty patch when pexpect output is out of sync.
+ # Much pronounced when running back-to-back-back oc commands
+ if resync:
+ self.ssh.send(commandline)
+ self.ssh.expect([commandline, pexpect.TIMEOUT])
+ self.ssh.send('\r\n')
+ self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT])
+ else:
+ self.ssh.sendline(commandline)
+ self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
return 0
elif self.sshresponse == 1:
@@ -137,10 +152,23 @@ class SSHConnection():
logging.debug('Expected Line : ' + expectedline)
sys.exit(self.sshresponse)
+ def command2(self, commandline, timeout, silent=False):
+ if not silent:
+ logging.debug(commandline)
+ self.cmd2Results = ''
+ myHost = self.username + '@' + self.ipaddress
+ # CAUTION: THIS METHOD IMPLIES THAT THERE ARE VALID SSH KEYS
+ # BETWEEN THE PYTHON EXECUTOR NODE AND THE REMOTE HOST
+ # OTHERWISE IT WON'T WORK
+ lSsh = subprocess.Popen(["ssh", "%s" % myHost, commandline],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ self.cmd2Results = str(lSsh.stdout.readlines())
+
def close(self):
self.ssh.timeout = 5
self.ssh.sendline('exit')
self.sshresponse = self.ssh.expect([pexpect.EOF, pexpect.TIMEOUT])
+ self.ipaddress = ''
+ self.username = ''
if self.sshresponse == 0:
pass
elif self.sshresponse == 1:
diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh
index ff2129a187..4a604a1fe9 100755
--- a/ci-scripts/waitBuildOnVM.sh
+++ b/ci-scripts/waitBuildOnVM.sh
@@ -47,7 +47,7 @@ function wait_on_vm_build {
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
echo "BUILD_OPTIONS = $BUILD_OPTIONS"
- if [[ "$VM_NAME" == *"-enb-usrp"* ]]
+ if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]]
then
echo "This VM type is no longer supported in the pipeline framework"
return
@@ -73,6 +73,9 @@ function wait_on_vm_build {
echo "############################################################"
echo "Waiting build process to end on VM ($VM_NAME)"
echo "############################################################"
+ # Since the last VM was cppcheck and is removed
+ # we are going too fast in wait and the build_oai is not yet started
+ sleep 120
if [[ "$VM_NAME" == *"-cppcheck"* ]]
then
@@ -90,7 +93,7 @@ function wait_on_vm_build {
}
function check_on_vm_build {
- if [[ "$VM_NAME" == *"-enb-usrp"* ]]
+ if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]]
then
echo "This VM type is no longer supported in the pipeline framework"
return
diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml
index 0e00a2e7d4..2282e101e5 100755
--- a/ci-scripts/xml_class_list.yml
+++ b/ci-scripts/xml_class_list.yml
@@ -37,3 +37,5 @@
- Build_Image
- Deploy_Object
- Undeploy_Object
+ - Cppcheck_Analysis
+ - Deploy_Run_PhySim
\ No newline at end of file
diff --git a/ci-scripts/xml_files/benetel_nsa_quectel.xml b/ci-scripts/xml_files/benetel_nsa_quectel.xml
new file mode 100644
index 0000000000..ed93f59e81
--- /dev/null
+++ b/ci-scripts/xml_files/benetel_nsa_quectel.xml
@@ -0,0 +1,147 @@
+
+
+ TEST-NSA-FR1-TM1
+ NSA Ping DL UL with QUECTEL
+ tasks
+ 3
+
+ 030000
+ 040000
+ 000002
+ 010000
+ 050000
+ 050001
+ 000001
+ 070000
+ 000001
+ 070001
+ 000001
+ 010002
+ 000001
+ 080001
+ 080000
+
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ idefix
+
+
+
+
+ Detach_UE
+ Detach UE
+ idefix
+
+
+
+
+ Initialize_eNB
+ Initialize eNB
+ -O ci-scripts/conf_files/benetel-4g.conf
+ 0
+ 0
+ lte
+
+
+
+
+ Initialize_eNB
+ Initialize gNB
+ -O ci-scripts/conf_files/benetel-5g.conf -q
+ 1
+ 1
+ nr
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 20
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ idefix
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ idefix
+ -c 100 -i 0.2
+ 50
+
+
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 20M -t 60 -i 1
+ DL
+ idefix
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 3M -t 60 -i 1
+ UL
+ idefix
+ 50
+ single-ue
+
+
+
+
+ Terminate_eNB
+ Terminate eNB
+ 0
+ 0
+ lte
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ 1
+ 1
+ nr
+
+
+
+
diff --git a/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml b/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml
new file mode 100644
index 0000000000..93c0c5a00a
--- /dev/null
+++ b/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml
@@ -0,0 +1,149 @@
+
+
+ TEST-NSA-FR1-TM1
+ NSA Ping DL UL with QUECTEL
+ tasks
+ 3
+
+ 030000
+ 040000
+ 000002
+ 010000
+ 000001
+ 050000
+ 050001
+ 000001
+ 070000
+ 000001
+ 070001
+ 000001
+ 010002
+ 000001
+ 080001
+ 080000
+
+
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ idefix
+
+
+
+
+ Detach_UE
+ Detach UE
+ idefix
+
+
+
+
+ Initialize_eNB
+ Initialize eNB
+ -O ci-scripts/conf_files/benetel-4g.conf
+ 0
+ 0
+ lte
+
+
+
+
+ Initialize_eNB
+ Initialize gNB
+ -O ci-scripts/conf_files/benetel-5g.conf -q
+ 1
+ 1
+ nr
+
+
+
+ IdleSleep
+ Sleep
+ 10
+
+
+
+ IdleSleep
+ Sleep
+ 30
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ idefix
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ idefix
+ -c 100 -i 0.2
+ 50
+
+
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(20 min)(single-ue profile)
+ -u -b 20M -t 1200 -i 1
+ DL
+ idefix
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(20 min)(single-ue profile)
+ -u -b 2M -t 1200 -i 1
+ UL
+ idefix
+ 50
+ single-ue
+
+
+
+
+ Terminate_eNB
+ Terminate eNB
+ 0
+ 0
+ lte
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ 1
+ 1
+ nr
+
+
+
+
diff --git a/ci-scripts/xml_files/container_image_build.xml b/ci-scripts/xml_files/container_image_build.xml
index 430729c49c..e7eabc0794 100644
--- a/ci-scripts/xml_files/container_image_build.xml
+++ b/ci-scripts/xml_files/container_image_build.xml
@@ -35,6 +35,7 @@
all
0
0
+ True
diff --git a/ci-scripts/xml_files/cppcheck.xml b/ci-scripts/xml_files/cppcheck.xml
new file mode 100644
index 0000000000..dd90d88f7e
--- /dev/null
+++ b/ci-scripts/xml_files/cppcheck.xml
@@ -0,0 +1,37 @@
+
+
+ build-tab
+ CPPCHECK Analysis
+ wrench
+
+ 000001
+
+
+
+
+ Cppcheck_Analysis
+ Static Code Analysis with cppcheck
+
+
+
diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml
new file mode 100644
index 0000000000..6c2bd6bd26
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml
@@ -0,0 +1,147 @@
+
+
+ TEST-NSA-FR1-TM1
+ NSA Ping DL UL with QUECTEL
+ tasks
+ 3
+
+ 030000
+ 040000
+ 000002
+ 010000
+ 050000
+ 050001
+ 000001
+ 070000
+ 000001
+ 070000
+ 000001
+ 010002
+ 000001
+ 080001
+ 080000
+
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ idefix
+
+
+
+
+ Detach_UE
+ Detach UE
+ idefix
+
+
+
+
+ Initialize_eNB
+ Initialize eNB
+ -O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf
+ 0
+ 0
+ lte
+
+
+
+
+ Initialize_eNB
+ Initialize gNB
+ -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf -q
+ 1
+ 1
+ nr
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 20
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ idefix
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ idefix
+ -c 100 -i 0.2
+ 50
+
+
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 20M -t 60 -i 1
+ DL
+ idefix
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 3M -t 60 -i 1
+ UL
+ idefix
+ 50
+ single-ue
+
+
+
+
+ Terminate_eNB
+ Terminate eNB
+ 0
+ 0
+ lte
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ 1
+ 1
+ nr
+
+
+
+
diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml
new file mode 100644
index 0000000000..9e798afdc4
--- /dev/null
+++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml
@@ -0,0 +1,53 @@
+
+
+ gNB-PHY-Test
+ Run-gNB-PHY-Test
+ tasks
+ 3
+
+090101 000001 090109
+
+
+
+
+ Initialize_eNB
+ Initialize gNB USRP
+ -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106
+ NR
+
+
+
+ IdleSleep
+ Sleep
+ 300
+
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ NR
+
+
+
diff --git a/ci-scripts/xml_files/multi_rru_band38_build.xml b/ci-scripts/xml_files/multi_rru_band38_build.xml
index ba45eab10a..1370a3a396 100644
--- a/ci-scripts/xml_files/multi_rru_band38_build.xml
+++ b/ci-scripts/xml_files/multi_rru_band38_build.xml
@@ -26,7 +26,7 @@
wrench
010101 010102 010103
- 000101 000102 000103
+ 000102 000103 000101
@@ -50,7 +50,7 @@
Build_eNB
Build Master RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
1
1
True
@@ -59,7 +59,7 @@
WaitEndBuild_eNB
Wait for end of Build Master RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
1
1
@@ -67,7 +67,7 @@
Build_eNB
Build Slave RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
2
2
True
@@ -76,7 +76,7 @@
WaitEndBuild_eNB
Wait for end of Build Slave RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
2
2
diff --git a/ci-scripts/xml_files/physim_deploy_run.xml b/ci-scripts/xml_files/physim_deploy_run.xml
new file mode 100644
index 0000000000..63152c1fb5
--- /dev/null
+++ b/ci-scripts/xml_files/physim_deploy_run.xml
@@ -0,0 +1,37 @@
+
+
+ build-tab
+ Physical Simulators Check
+ wrench
+
+ 010201
+
+
+
+
+ Deploy_Run_PhySim
+ Deploy and run physical simulator on openshift
+
+
+
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 626d938625..8d8e88455a 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -45,6 +45,8 @@ include_directories(${CONFIG_INCLUDE_DIRS})
pkg_search_module(CRYPTO libcrypto REQUIRED)
include_directories(${CRYPTO_INCLUDE_DIRS})
+#uhd 4.0 and iris installs by default in /usr/local
+include_directories("/usr/local/include/")
#use native cmake method as this package is not in pkg-config
if (${RF_BOARD} STREQUAL "OAI_USRP")
find_package(Boost REQUIRED)
@@ -52,7 +54,7 @@ if (${RF_BOARD} STREQUAL "OAI_USRP")
elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/")
- include_directories("/usr/local/include/")
+
set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp)
LINK_DIRECTORIES("/usr/local/lib")
@@ -60,6 +62,8 @@ elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
endif (${RF_BOARD} STREQUAL "OAI_USRP")
+message("RU=${RU}")
+
pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2)
if(NOT ${OPENPGM_FOUND})
message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built")
@@ -333,6 +337,11 @@ else (CUDA_FOUND)
)
endif ()
+if (SANITIZE_ADDRESS)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
+endif ()
+
add_definitions("-DASN_DISABLE_OER_SUPPORT")
#########################
@@ -405,6 +414,7 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs
add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace")
add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace")
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
+add_boolean_option(NEW_GTPU False "NEW_GTP")
set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti)
add_library(ITTI
@@ -413,7 +423,6 @@ add_library(ITTI
)
add_dependencies(ITTI rrc_flag)
set(ITTI_LIB ITTI)
- set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
##################################################
@@ -430,7 +439,6 @@ set(asn1_generated_dir ${OPENAIR_BIN_DIR})
set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf")
set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
-
# RRC
######
set (RRC_ASN1_VERSION "Rel15")
@@ -441,15 +449,18 @@ add_definitions(-DLTE_RRC_VERSION=${LTE_RRC_VERSION})
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
- RESULT_VARIABLE ret)
+if (${RU} STREQUAL 0)
+ execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "LTE_" " " "${RRC_FULL_DIR}" "${RRC_GRAMMAR}"
+ RESULT_VARIABLE ret)
+endif (${RU} STREQUAL 0)
+
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
add_custom_target (
rrc_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "LTE_" " " "${RRC_FULL_DIR}" "${RRC_GRAMMAR}"
DEPENDS ${RRC_GRAMMAR}
)
@@ -470,16 +481,18 @@ add_definitions(-DNR_RRC_VERSION=${NR_RRC_VERSION})
set (NR_RRC_FULL_DIR ${asn1_generated_dir}/RRC_${NR_RRC_ASN1_VERSION})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice"
- RESULT_VARIABLE ret)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NR_" "-findirect-choice" "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}"
+ RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif ()
file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c)
file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h)
+
add_custom_target (
nr_rrc_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice"
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NR_" "-findirect-choice" "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}"
DEPENDS ${NR_RRC_GRAMMAR}
)
@@ -504,31 +517,34 @@ set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${S1AP_RELEASE})
set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${S1AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
-file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
+if (${RU} STREQUAL 0)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "S1AP_" -fno-include-deps "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+ file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
+endif (${RU} STREQUAL 0)
-add_custom_target (
- s1ap_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
- DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
-)
-
-add_library(S1AP_LIB
- ${S1AP_source}
- ${S1AP_DIR}/s1ap_common.c
+ add_custom_target (
+ s1ap_flag ALL
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "S1AP_" -fno-include-deps "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
+ DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
)
-add_dependencies(S1AP_LIB rrc_flag s1ap_flag)
-include_directories ("${S1AP_C_DIR}")
-include_directories ("${S1AP_DIR}")
+ add_library(S1AP_LIB
+ ${S1AP_source}
+ ${S1AP_DIR}/s1ap_common.c
+ )
+ add_dependencies(S1AP_LIB rrc_flag s1ap_flag)
+
+ include_directories ("${S1AP_C_DIR}")
+ include_directories ("${S1AP_DIR}")
add_library(S1AP_ENB
- ${S1AP_DIR}/s1ap_eNB.c
- ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
+ ${S1AP_DIR}/s1ap_eNB.c
+ ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
${S1AP_DIR}/s1ap_eNB_decoder.c
${S1AP_DIR}/s1ap_eNB_encoder.c
${S1AP_DIR}/s1ap_eNB_handlers.c
@@ -558,8 +574,9 @@ set(NGAP_ASN_DIR ${NGAP_DIR}/MESSAGES/ASN1/ASN1_files)
set(NGAP_C_DIR ${asn1_generated_dir}/NGAP_${NGAP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" "NGAP_" -fno-include-deps -findirect-choice
- RESULT_VARIABLE ret)
+execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NGAP_" "-fno-include-deps -findirect-choice" "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}"
+ RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
@@ -567,7 +584,7 @@ file(GLOB NGAP_source ${NGAP_C_DIR}/*.c)
add_custom_target (
ngap_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" "NGAP_" -fno-include-deps
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NGAP_" "-fno-include-deps -findirect-choice" "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}"
DEPENDS "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}"
)
@@ -624,17 +641,20 @@ set(M2AP_ASN_DIR ${M2AP_DIR}/MESSAGES/ASN1/${M2AP_RELEASE})
set(M2AP_C_DIR ${asn1_generated_dir}/M2AP_${M2AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" "M2AP_" -fno-include-deps -DEMIT_ASN_DEBUG=1
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+if (${RU} STREQUAL 0)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps -DEMIT_ASN_DEBUG=1" "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}"
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB M2AP_source ${M2AP_C_DIR}/*.c)
add_custom_target (
m2_flag ALL
- COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" "M2AP_" -fno-include-deps
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps -DEMIT_ASN_DEBUG=1" "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}"
DEPENDS ${M2AP_ASN_DIR}/${M2AP_ASN_FILES}
)
@@ -694,17 +714,20 @@ set(M3AP_ASN_DIR ${M3AP_DIR}/MESSAGES/ASN1/${M3AP_RELEASE})
set(M3AP_C_DIR ${asn1_generated_dir}/M3AP_${M3AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" "M3AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+if (${RU} STREQUAL 0)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M3AP_" -fno-include-deps "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}"
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB M3AP_source ${M3AP_C_DIR}/*.c)
add_custom_target (
m3_flag ALL
- COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" "M3AP_" -fno-include-deps
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M3AP_" -fno-include-deps "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}"
DEPENDS ${M3AP_ASN_DIR}/${M3AP_ASN_FILES}
)
@@ -748,17 +771,20 @@ add_definitions(-DX2AP_VERSION=${X2AP_VERSION})
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${X2AP_RELEASE})
set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${X2AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+if (${RU} STREQUAL 0)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "X2AP_" -fno-include-deps "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}"
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB X2AP_source ${X2AP_C_DIR}/*.c)
add_custom_target (
x2_flag ALL
- COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "X2AP_" -fno-include-deps "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}"
DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
)
@@ -787,12 +813,12 @@ add_dependencies(X2AP_ENB X2AP_LIB rrc_flag x2_flag)
# F1AP
##############
-add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15)
+add_list1_option(F1AP_RELEASE R16 "F1AP ASN.1 grammar version" R16)
set(F1AP_DIR ${OPENAIR2_DIR}/F1AP)
-if (${F1AP_RELEASE} STREQUAL "R15")
- make_version(F1AP_VERSION 15 2 1)
- set (ASN1RELDIR R15.2.1)
-endif(${F1AP_RELEASE} STREQUAL "R15")
+if (${F1AP_RELEASE} STREQUAL "R16")
+ make_version(F1AP_VERSION 16 3 1)
+ set (ASN1RELDIR R16.3.1)
+endif(${F1AP_RELEASE} STREQUAL "R16")
add_definitions(-DF1AP_VERSION=${F1AP_VERSION})
set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(F1AP_ASN_FILES
@@ -804,22 +830,28 @@ set(F1AP_ASN_FILES
${F1AP_ASN_DIR}/F1AP-Containers.asn
)
-set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
-message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}")
-execute_process(COMMAND mkdir -p ${F1AP_ASN_GENERATED_C_DIR}
- COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
- RESULT_VARIABLE ret
- OUTPUT_QUIET
- ERROR_QUIET)
+if (${RU} STREQUAL 0)
+ set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
+ message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}")
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
+ RESULT_VARIABLE ret
+ )
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "asn1c: error")
-endif (NOT ${ret} STREQUAL 0)
-
-file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c)
-add_library(F1AP_LIB
- ${F1AP_ASN_GENERATED_C_FILES}
-)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "asn1c: error")
+ endif (NOT ${ret} STREQUAL 0)
+
+ add_custom_target (
+ f1_flag ALL
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
+ DEPENDS ${F1AP_ASN_FILES}
+ )
+ file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c)
+ add_library(F1AP_LIB
+ ${F1AP_ASN_GENERATED_C_FILES}
+ )
+ add_dependencies (F1AP_LIB f1_flag)
include_directories ("${F1AP_ASN_GENERATED_C_DIR}")
include_directories ("${F1AP_DIR}")
@@ -829,16 +861,15 @@ add_library(F1AP
${F1AP_C_FILES}
)
+endif (${RU} STREQUAL 0)
# Hardware dependant options
###################################
-add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
+add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU")
-
-
add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
#NOKIA config enhancement
set (CONFIG_ROOTDIR
@@ -1635,7 +1666,6 @@ set(PHY_SRC_COMMON
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
${OPENAIR1_DIR}/PHY/INIT/init_top.c
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
- ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
${OPENAIR1_DIR}/PHY/TOOLS/dfts_load.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
@@ -1973,6 +2003,7 @@ set(NR_PDCP_SRC
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_sdu.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c
+ ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
)
@@ -2227,26 +2258,21 @@ add_library(CN_UTILS
)
set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U)
-set (GTPV1U_SRC
- ${RRC_DIR}/rrc_eNB_GTPV1U.c
- ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c
- ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c
- ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c
- ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c
- ${GTPV1U_DIR}/gtpv1u_teid_pool.c
-)
-add_library(GTPV1U ${GTPV1U_SRC})
-add_dependencies(GTPV1U rrc_flag)
-#add_library (GTPV1U_OCP
-#${OPENAIR3_DIR}/ocp-gtp/gtp_itf.cpp
-#)
-#include_directories(${OPENAIR3_DIR}/ocp-gtp)
+add_library (GTPV1U_OCP
+ ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
+ ${RRC_DIR}/rrc_eNB_GTPV1U.c
+${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp
+)
+add_dependencies(GTPV1U_OCP rrc_flag)
+include_directories(${OPENAIR3_DIR}/ocp-gtp)
#NR case
set (NR_GTPV1U_SRC
${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
${RRC_DIR}/rrc_eNB_GTPV1U.c
+ ${GTPV1U_DIR}/gtpv1u_eNB.c
+ ${GTPV1U_DIR}/gtpv1u_gNB.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c
@@ -2256,6 +2282,12 @@ set (NR_GTPV1U_SRC
add_library(NR_GTPV1U ${NR_GTPV1U_SRC})
add_dependencies(NR_GTPV1U rrc_flag)
+if (${NEW_GTPU})
+set(GTPV1U GTPV1U_OCP)
+else()
+set(GTPV1U NR_GTPV1U)
+endif()
+
set (MME_APP_SRC
${OPENAIR3_DIR}/MME_APP/mme_app.c
${OPENAIR3_DIR}/MME_APP/mme_config.c
@@ -2794,6 +2826,7 @@ add_library(rfsimulator MODULE
${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c
${OPENAIR_TARGETS}/ARCH/rfsimulator/apply_channelmod.c
${OPENAIR_TARGETS}/ARCH/rfsimulator/new_channel_sim.c
+ ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
)
target_link_libraries(rfsimulator SIMU_COMMON ${ATLAS_LIBRARIES})
@@ -2808,6 +2841,7 @@ include_directories("${OPENAIR_DIR}/common/utils/T")
if (${T_TRACER})
set(T_SOURCE
+ ${OPENAIR_DIR}/common/utils/T/T_IDs.h
${OPENAIR_DIR}/common/utils/T/T.c
${OPENAIR_DIR}/common/utils/T/local_tracer.c)
set(T_LIB "rt")
@@ -2817,8 +2851,6 @@ endif (${T_TRACER})
#This rule and the following deal with it.
add_custom_command (
OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h
- COMMAND make clean
- COMMAND make -j2
COMMAND make check_vcd
WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T
DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt
@@ -2826,6 +2858,10 @@ add_custom_command (
${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.h
)
+execute_process (
+ COMMAND make check_vcd
+ WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T
+)
#This rule is specifically needed to generate T files
#before anything else in a project that uses the T.
#See below, there are some 'add_dependencies' showing that.
@@ -2895,7 +2931,8 @@ add_executable(lte-softmodem
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
- ${GTPU_need_ITTI}
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -2905,7 +2942,8 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
target_link_libraries (lte-softmodem
-Wl,--start-group
- RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
+
+ RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
-Wl,--end-group z dl)
@@ -2936,7 +2974,8 @@ add_executable(ocp-enb
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
- ${GTPU_need_ITTI}
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -2946,7 +2985,8 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l
target_link_libraries (ocp-enb
-Wl,--start-group
- RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
+
+ RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
-Wl,--end-group z dl)
@@ -2980,6 +3020,33 @@ target_link_libraries(du_test
${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB}
)
+add_executable(oairu
+ ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
+ ${OPENAIR_TARGETS}/RT/USER/ru_control.c
+ ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
+ ${OPENAIR_DIR}/executables/softmodem-common.c
+ ${OPENAIR_DIR}/openair1/SCHED/phy_procedures_lte_common.c
+ ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
+ ${OPENAIR_DIR}/executables/main_ru.c
+ ${T_SOURCE}
+ ${OPENAIR_DIR}/common/utils/LOG/log.c
+ ${CONFIG_SOURCES}
+ ${OPENAIR_DIR}/common/utils/utils.c
+ ${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
+ ${SHLIB_LOADER_SOURCES}
+)
+target_link_libraries (oairu
+ -Wl,--start-group
+ SCHED_RU_LIB
+ PHY_COMMON PHY_RU
+ -Wl,--end-group z dl)
+
+target_link_libraries (oairu pthread m ${CONFIG_LIB} rt ${CMAKE_DL_LIBS} ${T_LIB})
+
+
# lte-uesoftmodem is UE implementation
#######################################
@@ -2988,9 +3055,6 @@ add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR_DIR}/executables/softmodem-common.c
- ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
- ${OPENAIR_TARGETS}/RT/USER/ru_control.c
- ${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
@@ -3002,6 +3066,8 @@ add_executable(lte-uesoftmodem
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -3016,7 +3082,8 @@ endif()
target_link_libraries (lte-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP F1AP_LIB
- GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
+
+ ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES}
-Wl,--end-group z dl)
@@ -3044,21 +3111,22 @@ add_executable(nr-softmodem
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
- ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
- ${GTPU_need_ITTI}
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
+ ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c
)
target_link_libraries (nr-softmodem
-Wl,--start-group
- UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
+ UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
@@ -3088,7 +3156,6 @@ add_executable(ocp-gnb
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
- ${GTPU_need_ITTI}
${XFORMS_SOURCE_NR}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -3098,7 +3165,7 @@ add_executable(ocp-gnb
target_link_libraries (ocp-gnb
-Wl,--start-group
- UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
+ UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON
@@ -3147,7 +3214,7 @@ target_link_libraries (nr-uesoftmodem
NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
- ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB ${NAS_SIM_LIB}
-Wl,--end-group z dl)
target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
@@ -3177,6 +3244,17 @@ target_link_libraries (dlsim_tm4
pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB}
)
+add_executable(rftest
+ ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_test.c
+ ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_scope.c
+ ${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ ${OPENAIR_DIR}/executables/softmodem-common.c
+ ${CONFIG_SOURCES}
+ ${SHLIB_LOADER_SOURCES}
+)
+target_link_libraries(rftest minimal_lib PHY_NR_COMMON pthread dl m forms ${T_LIB} )
+
add_executable(polartest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c
${OPENAIR_DIR}/common/utils/backtrace.c
@@ -3323,7 +3401,7 @@ add_executable(nr_dlsim
)
target_link_libraries(nr_dlsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
- m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
+ m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl
)
target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR)
@@ -3342,7 +3420,7 @@ add_executable(nr_prachsim
${SHLIB_LOADER_SOURCES})
target_link_libraries(nr_prachsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
- m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
+ m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl)
add_executable(nr_ulschsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
@@ -3375,7 +3453,7 @@ add_executable(nr_ulsim
)
target_link_libraries(nr_ulsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
- m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
+ m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl
)
target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR)
@@ -3387,6 +3465,9 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/utils.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
+ ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${XFORMS_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -3409,7 +3490,7 @@ add_executable(test_epc_generate_scenario
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
)
target_link_libraries (test_epc_generate_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
+ -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP ${GTPV1U} LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
)
add_executable(test_epc_play_scenario
@@ -3428,7 +3509,7 @@ add_executable(test_epc_play_scenario
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
+ -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP ${GTPV1U} LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
)
@@ -3474,7 +3555,7 @@ if (${T_TRACER})
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB
- CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
+ CN_UTILS ${GTPV1U} SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts)
if (TARGET ${i})
add_dependencies(${i} generate_T)
@@ -3565,14 +3646,15 @@ add_executable(nr-ittisim
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
- ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${GTPU_need_ITTI}
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
+ ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -3581,11 +3663,11 @@ add_executable(nr-ittisim
target_link_libraries (nr-ittisim
-Wl,--start-group
- UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
+ UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
- PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE
+ PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE
-Wl,--end-group z dl)
target_link_libraries (nr-ittisim ${LIBXML2_LIBRARIES})
diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/core.py b/cmake_targets/autotests/core.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/log.py b/cmake_targets/autotests/log.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/openair.py b/cmake_targets/autotests/openair.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/templates/index.html b/cmake_targets/autotests/templates/index.html
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/templates/testcase_report.html b/cmake_targets/autotests/templates/testcase_report.html
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
old mode 100644
new mode 100755
index 016c76dc06..29257e482f
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -1099,8 +1099,9 @@
(Test14: 3 PTRS, 8 Interpolated Symbols),
(Test15: 6 PTRS, 5 Interpolated Symbols),
(Test16: 11 PTRS, 0 Interpolated Symbols),
- (Test17: 2 DMRS Symbols),
- (Test18: 3 DMRS Symbols)
+ (Test17: Mapping type A, 2 DMRS Symbols),
+ (Test18: Mapping type A, 3 DMRS Symbols),
+ (Test19: Mapping type B, 4 DMRS Symbols)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1124,8 +1125,9 @@
-n100 -s5 -T 2 1 2
-n100 -s5 -T 2 0 4
-n100 -s2 -U 2 0 1
- -n100 -s2 -U 2 0 2
- nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18
+ -n100 -s2 -U 2 0 2
+ -n100 -s2 -U 2 1 3
+ nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18 nr_dlsim.test19
PDSCH test OK
segmentation fault|assertion|exiting|fatal
3
@@ -1287,15 +1289,16 @@
(Test3: MCS 28 50 PRBs),
(Test4: MCS 9 217 PRBs),
(Test5: MCS 9 273 PRBs),
- (Test6: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols),
- (Test7: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols),
- (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
- (Test9: SC-FDMA, 50 PRBs),
- (Test10: SC-FDMA, 75 PRBs),
- (Test11: SC-FDMA, 216 PRBs),
- (Test12: SC-FDMA, 273 PRBs),
- (Test13: SC-FDMA, 3 DMRS),
- (Test14: MCS 16 50 PRBs 2 RX_Antenna)
+ (Test6: DMRS Type A, 2 DMRS Symbols),
+ (Test7: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols),
+ (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols),
+ (Test9: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
+ (Test10: SC-FDMA, 50 PRBs),
+ (Test11: SC-FDMA, 75 PRBs),
+ (Test12: SC-FDMA, 216 PRBs),
+ (Test13: SC-FDMA, 273 PRBs),
+ (Test14: SC-FDMA, 3 DMRS),
+ (Test15: MCS 16 50 PRBs 2 RX_Antenna)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1307,6 +1310,7 @@
-n100 -m28 -s20
-n100 -m9 -R217 -r217 -s5
-n100 -m9 -R273 -r273 -s5
+ -n100 -s5 -U 2 0 1
-n100 -s5 -T 2 1 2 -U 2 0 2
-n100 -s5 -T 2 2 2 -U 2 1 2
-n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3
@@ -1317,7 +1321,7 @@
-n100 -s2 -Z -U 2 0 2
-n100 -m16 -s10 -z2
- nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14
+ nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14 nr_ulsim.test15
PUSCH test OK
segmentation fault|assertion|exiting|fatal
3
@@ -1330,7 +1334,8 @@
(Test3: 30kHz SCS, 273 PRBs, Prach format A2),
(Test4: 30kHz SCS, 106 PRBs, Prach format 0),
(Test5: 120kHz SCS, 32 PRBs, Prach format A2),
- (Test6: 120kHz SCS, 66 PRBs, Prach format A2)
+ (Test6: 120kHz SCS, 66 PRBs, Prach format A2),
+ (Test7: 120kHz SCS, 66 PRBs, High Speed Enabled)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1342,8 +1347,9 @@
-a -s -30 -n 100 -p 63 -R 273
-a -s -30 -n 100 -p 63 -R 106 -c 4
-a -s -30 -n 100 -p 32 -R 32 -m 3 -c52
- -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52
- nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 nr_prachsim.test5 nr_prachsim.test6
+ -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52
+ -a -s -30 -n 100 -R 66 -m 3 -c52 -H
+ nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 nr_prachsim.test5 nr_prachsim.test6 nr_prachsim.test7
PRACH test OK
segmentation fault|assertion|exiting|fatal
3
diff --git a/cmake_targets/autotests/testsuite_ue_noS1.xml b/cmake_targets/autotests/testsuite_ue_noS1.xml
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/testsuite_ue_noS1_TCL.xml b/cmake_targets/autotests/testsuite_ue_noS1_TCL.xml
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/lib_autotest.py b/cmake_targets/autotests/tools/lib_autotest.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/lib_autotest_analyser.py b/cmake_targets/autotests/tools/lib_autotest_analyser.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/wdial.bandrich.conf b/cmake_targets/autotests/tools/wdial.bandrich.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/3276.txt b/cmake_targets/autotests/v2/actions/3276.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_epc.bash b/cmake_targets/autotests/v2/actions/alu_epc.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_epc_stop.bash b/cmake_targets/autotests/v2/actions/alu_epc_stop.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_hss.bash b/cmake_targets/autotests/v2/actions/alu_hss.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/bandrich.txt b/cmake_targets/autotests/v2/actions/bandrich.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/client_tcp.bash b/cmake_targets/autotests/v2/actions/client_tcp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/client_udp.bash b/cmake_targets/autotests/v2/actions/client_udp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/clone_repository.bash b/cmake_targets/autotests/v2/actions/clone_repository.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/compilation.bash b/cmake_targets/autotests/v2/actions/compilation.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/execution.bash b/cmake_targets/autotests/v2/actions/execution.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/execution_compile.bash b/cmake_targets/autotests/v2/actions/execution_compile.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/modem.py b/cmake_targets/autotests/v2/actions/modem.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/run_enb.bash b/cmake_targets/autotests/v2/actions/run_enb.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/server_tcp.bash b/cmake_targets/autotests/v2/actions/server_tcp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/server_udp.bash b/cmake_targets/autotests/v2/actions/server_udp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_3276.bash b/cmake_targets/autotests/v2/actions/start_3276.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_3276.py b/cmake_targets/autotests/v2/actions/start_3276.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_bandrich.bash b/cmake_targets/autotests/v2/actions/start_bandrich.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_bandrich.py b/cmake_targets/autotests/v2/actions/start_bandrich.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/stop_3276.py b/cmake_targets/autotests/v2/actions/stop_3276.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/stop_bandrich.py b/cmake_targets/autotests/v2/actions/stop_bandrich.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/wvdial.3276.conf b/cmake_targets/autotests/v2/actions/wvdial.3276.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/wvdial.bandrich.conf b/cmake_targets/autotests/v2/actions/wvdial.bandrich.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/alu_test.py b/cmake_targets/autotests/v2/alu_test.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/connection.py b/cmake_targets/autotests/v2/connection.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/machine_list.py b/cmake_targets/autotests/v2/machine_list.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/main.py b/cmake_targets/autotests/v2/main.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/task.py b/cmake_targets/autotests/v2/task.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/utils.py b/cmake_targets/autotests/v2/utils.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index dba6d7da6d..279b9489e0 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -68,7 +68,9 @@ USRP_REC_PLAY="False"
BUILD_ECLIPSE=0
NR="False"
ITTI_SIM="False"
+SANITIZE_ADDRESS="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
+RU=0
trap handle_ctrl_c INT
function print_help() {
@@ -103,6 +105,8 @@ Options
Makes the NR softmodem
--nrUE
Makes the NR UE softmodem
+--RU
+ Makes the OAI RRU (without full stack)
--UE
Makes the UE specific parts (ue_ip, usim, nvram) from the given configuration file
--UE-conf-nvram [configuration file]
@@ -240,25 +244,34 @@ function main() {
shift;;
--eNB)
eNB=1
+ RU=0
echo_info "Will compile eNB"
shift;;
--eNBocp)
eNBocp=1
+ RU=0
echo_info "Will compile OCP eNB"
shift;;
--gNB)
gNB=1
+ RU=0
NR="True"
echo_info "Will compile gNB"
shift;;
+ --RU)
+ RU=1
+ echo_info "Will compile RRU"
+ shift;;
-a | --agent)
echo_info "FlexRAN support is always compiled into the eNB"
shift;;
--UE)
+ RU=0
UE=1
echo_info "Will compile UE"
shift;;
--nrUE)
+ RU=0
nrUE=1
NR="True"
echo_info "Will compile NR UE"
@@ -295,6 +308,7 @@ function main() {
shift 2;;
-P | --phy_simulators)
SIMUS_PHY=1
+ RU=0
echo_info "Will compile dlsim, ulsim, ..."
shift;;
-S | --core_simulators)
@@ -424,6 +438,9 @@ function main() {
CMAKE_CMD="$CMAKE_CMD -GNinja"
MAKE_CMD=ninja
shift;;
+ --sanitize-address | -fsanitize=address)
+ SANITIZE_ADDRESS=True
+ shift;;
--ittiSIM)
ittiSIM=1
ITTI_SIM="True"
@@ -460,7 +477,7 @@ function main() {
########################################################
# to be discussed
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" -o "$RU" = "1" ] ; then
if [ "$HW" = "None" -a "$TP" = "None" ] ; then
echo_info "No local radio head and no transport protocol selected"
fi
@@ -587,7 +604,7 @@ function main() {
config_libconfig_shlib=params_libconfig
# first generate the CMakefile in the right directory
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then
# softmodem compilation
@@ -611,7 +628,9 @@ function main() {
echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file
echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file
echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
+ echo "set ( RU $RU )" >> $cmake_file
echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
+ echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$build_dir/build
eval $CMAKE_CMD
@@ -626,6 +645,9 @@ function main() {
if [ "$gNB" = "1" ] ; then
execlist="$execlist nr-softmodem"
fi
+ if [ "$RU" = "1" ] ; then
+ execlist="$execlist oairu"
+ fi
if [ "$UE" = 1 ] ; then
execlist="$execlist lte-uesoftmodem"
fi
@@ -654,28 +676,29 @@ function main() {
$build_dir $config_libconfig_shlib \
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
- compilations \
- $build_dir coding \
- libcoding.so $dbin/libcoding.so
-
-
- #check if we run inside a container or not
- #IS_CONTAINER variable is defined in build_helper file
- #compile nasmesh and rb_tool only if NOT running in a container
- if [ $IS_CONTAINER -eq 0 ]
- then
- compilations \
- $build_dir nasmesh \
- CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+ if [ "$RU" = "0" ] ; then
compilations \
- $build_dir rb_tool \
- rb_tool $dbin/rb_tool
+ $build_dir coding \
+ libcoding.so $dbin/libcoding.so
- cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
- fi #IS_CONTAINER
+ #check if we run inside a container or not
+ #IS_CONTAINER variable is defined in build_helper file
+ #compile nasmesh and rb_tool only if NOT running in a container
+ if [ $IS_CONTAINER -eq 0 ]
+ then
+ compilations \
+ $build_dir nasmesh \
+ CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+
+ compilations \
+ $build_dir rb_tool \
+ rb_tool $dbin/rb_tool
+
+ cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
+ fi #IS_CONTAINER
+ fi
fi
-
fi
if [ "$UE" = 1 ] ; then
@@ -857,7 +880,7 @@ function main() {
####################################################
# Build RF device and transport protocol libraries #
####################################################
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
# build RF device libraries
if [ "$HW" != "None" ] ; then
diff --git a/cmake_targets/doxygen/CMakeLists.txt b/cmake_targets/doxygen/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template
old mode 100644
new mode 100755
diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20
index 9ef79be9c2..4b1cda42f8 100755
--- a/cmake_targets/install_external_packages.ubuntu20
+++ b/cmake_targets/install_external_packages.ubuntu20
@@ -83,6 +83,8 @@ get_distribution_release() {
check_supported_distribution() {
case $(get_distribution_release) in
"ubuntu20.04") return 0 ;;
+ "ubuntu20.10") return 0 ;;
+ "ubuntu21.04") return 0 ;;
esac
return 1
}
@@ -157,8 +159,16 @@ install_protobuf_from_source(){
#cd protobuf-2.6.1/
rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0
wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
- tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner
- cd protobuf-3.3.0/ || exit
+ tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner
+ cd protobuf-3.3.0/
+ else
+ export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs
+ rm -rf /tmp/protobuf
+ git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf
+ cd /tmp/protobuf
+ git submodule update --init --recursive
+ ./autogen.sh
+ fi
./configure
echo "Compiling protobuf"
make -j"$(nproc)"
@@ -198,15 +208,15 @@ install_usrp_uhd_driver_from_source(){
rm -rf /tmp/uhd
git clone https://github.com/EttusResearch/uhd.git
cd uhd || exit
- git checkout tags/v3.13.0.2
+ git checkout UHD-3.15.LTS
mkdir -p host/build
cd host/build || exit
- $CMAKE ../
+ $CMAKE ../ -GNinja
echo "Compiling UHD"
- make -j"$(nproc)"
- make test
- $SUDO make install
+ ninja
+ $SUDO ninja install
$SUDO ldconfig
+ $SUDO /usr/lib/uhd/utils/uhd_images_downloader.py
) >& "$uhd_install_log"
}
@@ -329,6 +339,7 @@ check_install_ubuntu_packages() {
$SUDO apt install -y software-properties-common
case "$(get_distribution_release)" in
"ubuntu20.04")
+ "ubuntu21.04")
specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev"
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
@@ -345,7 +356,6 @@ check_install_ubuntu_packages() {
openvpn \
pkg-config \
python3-dev \
- python-pexpect \
sshfs \
swig \
tshark \
@@ -358,7 +368,6 @@ check_install_ubuntu_packages() {
iperf3 \
android-tools-adb \
wvdial \
- python-numpy \
sshpass \
nscd \
bc \
@@ -379,7 +388,6 @@ check_install_ubuntu_packages() {
git \
graphviz \
gtkwave \
- guile-2.0-dev \
iperf \
iptables \
libxtables-dev \
@@ -419,7 +427,8 @@ check_install_ubuntu_packages() {
libxpm-dev \
libboost-all-dev \
nettle-dev \
- nettle-bin
+ nettle-bin \
+ libreadline-dev
fi
$SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET"
diff --git a/cmake_targets/nas_sim_tools/CMakeLists.txt b/cmake_targets/nas_sim_tools/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/phy_simulators/CMakeLists.txt b/cmake_targets/phy_simulators/CMakeLists.txt
old mode 100644
new mode 100755
index 447e90bcab..f8c659959f
--- a/cmake_targets/phy_simulators/CMakeLists.txt
+++ b/cmake_targets/phy_simulators/CMakeLists.txt
@@ -17,4 +17,5 @@ set ( UE_TIMING_TRACE False )
set ( USRP_REC_PLAY False )
set ( SKIP_SHARED_LIB_FLAG False )
set ( PHYSIM True)
+set ( RU 0)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/Kbuild.cmake b/cmake_targets/tools/Kbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeParseArguments.cmake b/cmake_targets/tools/MODULES/CMakeParseArguments.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserFindMySQL.cmake b/cmake_targets/tools/MODULES/CMakeUserFindMySQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserUseBison.cmake b/cmake_targets/tools/MODULES/CMakeUserUseBison.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserUseFlex.cmake b/cmake_targets/tools/MODULES/CMakeUserUseFlex.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindFreeDiameter.cmake b/cmake_targets/tools/MODULES/FindFreeDiameter.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGCCXML.cmake b/cmake_targets/tools/MODULES/FindGCCXML.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGcrypt.cmake b/cmake_targets/tools/MODULES/FindGcrypt.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGnuTLS.cmake b/cmake_targets/tools/MODULES/FindGnuTLS.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindKbuild.cmake b/cmake_targets/tools/MODULES/FindKbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindLibXml2.cmake b/cmake_targets/tools/MODULES/FindLibXml2.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindMySQL.cmake b/cmake_targets/tools/MODULES/FindMySQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindNettle.cmake b/cmake_targets/tools/MODULES/FindNettle.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindPostgreSQL.cmake b/cmake_targets/tools/MODULES/FindPostgreSQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindSCTP.cmake b/cmake_targets/tools/MODULES/FindSCTP.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/Kbuild.cmake b/cmake_targets/tools/MODULES/Kbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/cmake_useful.cmake b/cmake_targets/tools/MODULES/cmake_useful.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/kbuild_system.cmake b/cmake_targets/tools/MODULES/kbuild_system.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/kmodule.cmake b/cmake_targets/tools/MODULES/kmodule.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/path_prefixes.cmake b/cmake_targets/tools/MODULES/path_prefixes.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/asn1tostruct.py b/cmake_targets/tools/asn1tostruct.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 9b8363fc2b..30fdb7eb1e 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -113,6 +113,7 @@ check_supported_distribution() {
"rhel7.6") return 0 ;;
"rhel7.7") return 0 ;;
"rhel7.8") return 0 ;;
+ "rhel7.9") return 0 ;;
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
"rhel8.4") return 0 ;;
diff --git a/cmake_targets/tools/example_enb_exmimo_mme_hss.txt b/cmake_targets/tools/example_enb_exmimo_mme_hss.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt b/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo2_2arxg.lime b/cmake_targets/tools/exmimo2_2arxg.lime
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo2_2brxg.lime b/cmake_targets/tools/exmimo2_2brxg.lime
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo_stop_octave.m b/cmake_targets/tools/exmimo_stop_octave.m
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff b/cmake_targets/tools/fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/make_asn1c_includes.sh b/cmake_targets/tools/make_asn1c_includes.sh
index 1598678a73..00c88d6497 100755
--- a/cmake_targets/tools/make_asn1c_includes.sh
+++ b/cmake_targets/tools/make_asn1c_includes.sh
@@ -1,13 +1,19 @@
#!/bin/bash
-GENERATED_FULL_DIR=$1
-shift
-ASN1_SOURCE_DIR=$1
-shift
export ASN1C_PREFIX=$1
shift
-options=$*
+options=$1
+shift
+GENERATED_FULL_DIR=$1
+shift
+ASN1_SOURCE_DIR=$*
done_flag="$GENERATED_FULL_DIR"/done
-if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
+rebuild=0
+for f in $ASN1_SOURCE_DIR ; do
+ if [ "$done_flag" -ot "$f" ] ; then
+ rebuild=1
+ fi
+done
+if [ $rebuild -eq 1 ] ; then
rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h
mkdir -p "$GENERATED_FULL_DIR"
asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u
diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp
index e119126683..1a4c6b10b8 100755
--- a/cmake_targets/tools/run_enb_s1_usrp
+++ b/cmake_targets/tools/run_enb_s1_usrp
@@ -101,7 +101,6 @@ function main()
local -i run_gdb=0
local -i show_stdout=0
local exe_arguments=""
- local itti_dump_file=""
until [ -z "$1" ]
do
@@ -154,18 +153,6 @@ function main()
exe_arguments="$exe_arguments --rf-config-file=$rf_config_file"
fi
;;
- -K | --itti-dump-file)
- itti_dump_file=$2
- # can omit file name if last arg on the line
- if [ "x$itti_dump_file" = "x" ]; then
- itti_dump_file="/tmp/enb_s1_usrp_itti.log"
- shift 1;
- else
- shift 2;
- fi
- echo "setting ITTI dump file to: $itti_dump_file"
- exe_arguments="$exe_arguments -K $itti_dump_file"
- ;;
-m | --mscgen)
g_msc_dir=$2
# can omit file name if last arg on the line
diff --git a/cmake_targets/tools/test_helper b/cmake_targets/tools/test_helper
old mode 100644
new mode 100755
diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c
index 6d01d98c65..1df1bc16f7 100644
--- a/common/config/config_cmdline.c
+++ b/common/config/config_cmdline.c
@@ -255,7 +255,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) || /* long option beginning with "--" */
((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgoptions[n].optname) == 0) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ||
- ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
+ ((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
char *valptr=NULL;
int ret;
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h
index 8baaa99bb8..0688f6531f 100644
--- a/common/config/config_load_configmodule.h
+++ b/common/config/config_load_configmodule.h
@@ -82,10 +82,12 @@ typedef struct configmodule_interface {
#ifdef CONFIG_LOADCONFIG_MAIN
configmodule_interface_t *cfgptr=NULL;
-static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]> \n \
- debugflags can also be defined in the config_libconfig section of the config file\n \
+static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \
+ debugflags can also be defined in the config section of the config file\n \
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
- 4->print command line processing debug messages\n ";
+ 4->print command line processing debug messages\n \
+ incp parameter can be used to define the include path used for config files (@include directive)\n \
+ defaults is set to the path of the main config file.\n";
#define CONFIG_SECTIONNAME "config"
#define CONFIGPARAM_DEBUGFLAGS_IDX 0
diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c
index eb08a70183..17266246f0 100644
--- a/common/config/libconfig/config_libconfig.c
+++ b/common/config/libconfig/config_libconfig.c
@@ -33,8 +33,9 @@
#include
#include
+#include
+ #include
-#include
#include "config_libconfig.h"
#include "config_libconfig_private.h"
@@ -347,17 +348,35 @@ int config_libconfig_init(char *cfgP[], int numP) {
config_get_if()->numptrs=0;
memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS);
memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated));
-
+ /* search for include path parameter and set config file include path accordingly */
+ for (int i=0; i
+
+
+#include "PHY/LTE_TRANSPORT/transport_common.h"
+
+// This is table 5.7.1-4 from 36.211
+PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
+ // TDD Configuration Index 0
+ { {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}},
+ // TDD Configuration Index 1
+ { {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}},
+ // TDD Configuration Index 2
+ { {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}},
+ // TDD Configuration Index 3
+ { {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}},
+ // TDD Configuration Index 4
+ { {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}},
+ // TDD Configuration Index 5
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+ // TDD Configuration Index 6
+ { {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}},
+ // TDD Configuration Index 7
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+ // TDD Configuration Index 8
+ { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}},
+ // TDD Configuration Index 9
+ { {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}},
+ // TDD Configuration Index 10
+ { {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}},
+ // TDD Configuration Index 11
+ { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}},
+ // TDD Configuration Index 12
+ { {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}},
+ {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}},
+ {4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 13
+ { {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 14
+ { {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 15
+ { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}},
+ {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}},
+ {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}},
+ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 16
+ { {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}},
+ {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}},
+ {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
+ },
+ // TDD Configuration Index 17
+ { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
+ },
+ // TDD Configuration Index 18
+ { {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}},
+ {6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}}
+ },
+ // TDD Configuration Index 19
+ { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}
+ },
+ // TDD Configuration Index 20
+ { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
+ // TDD Configuration Index 21
+ { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
+
+ // TDD Configuration Index 22
+ { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
+
+ // TDD Configuration Index 23
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+
+ // TDD Configuration Index 24
+ { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
+
+ // TDD Configuration Index 25
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+
+ // TDD Configuration Index 26
+ { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
+
+ // TDD Configuration Index 27
+ { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
+ },
+
+ // TDD Configuration Index 28
+ { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
+ {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
+ },
+
+ // TDD Configuration Index 29
+ { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
+ },
+
+
+ // TDD Configuration Index 30
+ { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
+
+ // TDD Configuration Index 31
+ { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
+
+ // TDD Configuration Index 32
+ { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
+
+ // TDD Configuration Index 33
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+
+ // TDD Configuration Index 34
+ { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
+
+ // TDD Configuration Index 35
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+
+ // TDD Configuration Index 36
+ { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
+
+ // TDD Configuration Index 37
+ { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
+ },
+
+ // TDD Configuration Index 38
+ { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
+ {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
+ },
+
+ // TDD Configuration Index 39
+ { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
+ },
+
+ // TDD Configuration Index 40
+ { {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}},
+ // TDD Configuration Index 41
+ { {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}},
+
+ // TDD Configuration Index 42
+ { {1,{{0,1,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 43
+ { {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 44
+ { {1,{{0,0,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 45
+ { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}},
+
+ // TDD Configuration Index 46
+ { {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}},
+
+ // TDD Configuration Index 47
+ { {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}
+ }
+};
+
+
+uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type) {
+ if (frame_type == FDD) // FDD
+ return(prach_ConfigIndex>>4);
+ else {
+ if (prach_ConfigIndex < 20)
+ return (0);
+
+ if (prach_ConfigIndex < 30)
+ return (1);
+
+ if (prach_ConfigIndex < 40)
+ return (2);
+
+ if (prach_ConfigIndex < 48)
+ return (3);
+ else
+ return (4);
+ }
+}
+
+uint8_t get_prach_prb_offset(int frame_type,
+ int tdd_config,
+ int N_RB_UL,
+ uint8_t prach_ConfigIndex,
+ uint8_t n_ra_prboffset,
+ uint8_t tdd_mapindex, uint16_t Nf) {
+ uint8_t n_ra_prb;
+ uint8_t f_ra,t1_ra;
+ uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
+ uint8_t Nsp=2;
+
+ if (frame_type == TDD) { // TDD
+ if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
+ LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex);
+ return(-1);
+ }
+
+ // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
+ f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
+
+ if (prach_fmt < 4) {
+ if ((f_ra&1) == 0) {
+ n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
+ } else {
+ n_ra_prb = N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
+ }
+ } else {
+ if ((tdd_config >2) && (tdd_config<6))
+ Nsp = 2;
+
+ t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
+
+ if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
+ n_ra_prb = 6*f_ra;
+ } else {
+ n_ra_prb = N_RB_UL - 6*(f_ra+1);
+ }
+ }
+ } else { //FDD
+ n_ra_prb = n_ra_prboffset;
+ }
+
+ return(n_ra_prb);
+}
+
+int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) {
+ uint8_t t0_ra;
+ uint8_t t1_ra;
+ uint8_t t2_ra;
+ int prach_mask = 0;
+
+ if (frame_type == FDD) { //FDD
+ //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
+ if ((((frame&1) == 1) && (subframe < 9)) ||
+ (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
+ if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
+ ((prach_ConfigIndex&0x1f)==18) || // 18,50
+ ((prach_ConfigIndex&0xf)==15)) // 15,47
+ return(0);
+
+ switch (prach_ConfigIndex&0x1f) {
+ case 0:
+ case 3:
+ if (subframe==1) prach_mask = 1;
+
+ break;
+
+ case 1:
+ case 4:
+ if (subframe==4) prach_mask = 1;
+
+ break;
+
+ case 2:
+ case 5:
+ if (subframe==7) prach_mask = 1;
+
+ break;
+
+ case 6:
+ if ((subframe==1) || (subframe==6)) prach_mask=1;
+
+ break;
+
+ case 7:
+ if ((subframe==2) || (subframe==7)) prach_mask=1;
+
+ break;
+
+ case 8:
+ if ((subframe==3) || (subframe==8)) prach_mask=1;
+
+ break;
+
+ case 9:
+ if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
+
+ break;
+
+ case 10:
+ if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
+
+ break;
+
+ case 11:
+ if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
+
+ break;
+
+ case 12:
+ if ((subframe&1)==0) prach_mask=1;
+
+ break;
+
+ case 13:
+ if ((subframe&1)==1) prach_mask=1;
+
+ break;
+
+ case 14:
+ prach_mask=1;
+ break;
+
+ case 15:
+ if (subframe==9) prach_mask=1;
+
+ break;
+ }
+ } else { // TDD
+ AssertFatal(prach_ConfigIndex<64,
+ "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
+ AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
+ "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
+ t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
+ t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
+ t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
+#ifdef PRACH_DEBUG
+ LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
+ prach_ConfigIndex,
+ subframe,
+ t0_ra,t1_ra,t2_ra);
+#endif
+
+ if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames
+ ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames
+ (t0_ra == 0)) && // PRACH is in all frames
+ (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame
+ (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame
+ if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe
+ (((subframe%5)-2)==t2_ra)) prach_mask=1;
+ else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS
+ }
+ }
+
+ return(prach_mask);
+}
+
diff --git a/common/utils/lte/prach_utils.h b/common/utils/lte/prach_utils.h
new file mode 100644
index 0000000000..995805fbd2
--- /dev/null
+++ b/common/utils/lte/prach_utils.h
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file common/utils/prach_utils.h
+* \brief computation of some PRACH variables used in both MAC and PHY
+* \author R. Knopp
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
+* \note
+* \warning
+*/
+uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type);
+
+uint8_t get_prach_prb_offset(int frame_type,
+ int tdd_config,
+ int N_RB_UL,
+ uint8_t prach_ConfigIndex,
+ uint8_t n_ra_prboffset,
+ uint8_t tdd_mapindex, uint16_t Nf);
+int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe);
diff --git a/common/utils/lte/ue_power.c b/common/utils/lte/ue_power.c
new file mode 100644
index 0000000000..b377abf2ff
--- /dev/null
+++ b/common/utils/lte/ue_power.c
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file ue_power.c
+* \brief Routines to compute UE TX power according to 36.213
+* \author R. Knopp, F. Kaltenberger
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \note
+* \warning
+*/
+
+#include
+#include
+#include "PHY/defs_eNB.h"
+#include "PHY/TOOLS/dB_routines.h"
+
+extern int16_t hundred_times_delta_TF[100];
+extern uint16_t hundred_times_log10_NPRB[100];
+
+int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs)
+{
+
+ /// The payload + CRC size in bits, "B"
+ uint32_t B;
+ /// Number of code segments
+ uint32_t C;
+ /// Number of "small" code segments
+ uint32_t Cminus;
+ /// Number of "large" code segments
+ uint32_t Cplus;
+ /// Number of bits in "small" code segments (<6144)
+ uint32_t Kminus;
+ /// Number of bits in "large" code segments (<6144)
+ uint32_t Kplus;
+ /// Total number of bits across all segments
+ uint32_t sumKr;
+ /// Number of "Filler" bits
+ uint32_t F;
+ // num resource elements
+ uint32_t num_re=0.0;
+ // num symbols
+ uint32_t num_symb=0.0;
+ /// effective spectral efficiency of the PUSCH
+ uint32_t MPR_x100=0;
+ /// beta_offset
+ uint16_t beta_offset_pusch_x8=8;
+ /// delta mcs
+ float delta_mcs=0.0;
+ /// bandwidth factor
+ float bw_factor=0.0;
+
+ B= tbs+24;
+ lte_segmentation(NULL,
+ NULL,
+ B,
+ &C,
+ &Cplus,
+ &Cminus,
+ &Kplus,
+ &Kminus,
+ &F);
+
+
+ sumKr = Cminus*Kminus + Cplus*Kplus;
+ num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
+ num_re = num_symb * nb_rb * 12;
+
+ if (num_re == 0)
+ return(0);
+
+ MPR_x100 = 100*sumKr/num_re;
+
+ if (control_only == 1 )
+ beta_offset_pusch_x8=8; // fixme
+
+ //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
+
+ // if deltamcs_enabledm
+ delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0);
+
+ bw_factor = (norm!=0) ? 0 : (hundred_times_log10_NPRB[nb_rb-1]/100.0);
+ LOG_D(PHY,"estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
+ (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
+ return (int16_t)ceil(delta_mcs + bw_factor);
+
+}
+
diff --git a/targets/RT/USER/rfsim.h b/common/utils/lte/ue_power.h
similarity index 69%
rename from targets/RT/USER/rfsim.h
rename to common/utils/lte/ue_power.h
index 801ab5eb56..caeebec2c8 100644
--- a/targets/RT/USER/rfsim.h
+++ b/common/utils/lte/ue_power.h
@@ -18,23 +18,17 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
-#ifndef __RFSIM__H__
-#define __RFSIM__H__
-#include "lte-softmodem.h"
-#include "openair1/SIMULATION/TOOLS/sim.h"
-#include "platform_constants.h"
-#include "common/ran_context.h"
-#include "PHY/defs_UE.h"
-#include "PHY/defs_eNB.h"
-void init_ocm(void);
+/*! \file ue_power.h
+* \brief support routines used in MAC and PHY
+* \author R. Knopp, F. Kaltenberger
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \note
+* \warning
+*/
-void update_ocm(double snr_dB,double sinr_dB);
+int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
-//extern pthread_mutex_t async_server_lock;
-//extern pthread_cond_t async_server_notify;
-//extern int async_server_shutdown;
-
-void init_channel_vars(void);
-
-#endif
diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c
index 7cc5f79f90..84b723b022 100644
--- a/common/utils/msc/msc.c
+++ b/common/utils/msc/msc.c
@@ -52,6 +52,7 @@
FILE *g_msc_fd;
char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
+msc_interface_t msc_interface;
typedef unsigned long msc_message_number_t;
typedef struct msc_queue_item_s {
diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h
index aab872cfe1..adb0d9e657 100644
--- a/common/utils/msc/msc.h
+++ b/common/utils/msc/msc.h
@@ -117,7 +117,7 @@ void msc_log_message(
#define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded
-msc_interface_t msc_interface;
+extern msc_interface_t msc_interface;
#define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2)
#define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use
#define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end
diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp
index 2189be9fe8..c774da57e6 100644
--- a/common/utils/ocp_itti/intertask_interface.cpp
+++ b/common/utils/ocp_itti/intertask_interface.cpp
@@ -339,7 +339,9 @@ extern "C" {
int itti_create_queue(const task_info_t *taskInfo) {
pthread_mutex_lock (&lock_nb_queues);
int newQueue=nb_queues++;
- AssertFatal(tasks=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)),"");
+ task_list_t **new_tasks = (task_list_t **)realloc(tasks, nb_queues * sizeof(*tasks));
+ AssertFatal(new_tasks != NULL, "could not realloc() tasks list");
+ tasks = new_tasks;
tasks[newQueue]= new task_list_t;
pthread_mutex_unlock (&lock_nb_queues);
LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue);
diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h
index 18a8f7868c..944ca12b01 100644
--- a/common/utils/ocp_itti/intertask_interface.h
+++ b/common/utils/ocp_itti/intertask_interface.h
@@ -340,6 +340,7 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
+ TASK_DEF(OCP_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\
TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
@@ -471,6 +472,9 @@ void itti_subscribe_event_fd(task_id_t task_id, int fd);
void itti_unsubscribe_event_fd(task_id_t task_id, int fd);
/** \brief Return the list of events excluding the fd associated with itti
+ \the fd associated with itti can return, but it is marked events[i].events &= ~EPOLLIN
+ \as it is not EPOLLIN, the reader should ignore this fd
+ \or it can manage the list of fd's in his interest, so ignore the other ones
\param task_id Task ID of the task
\param events events list
@returns number of events to handle
diff --git a/common/utils/system.c b/common/utils/system.c
index 1bd5c7d39b..4c6c1a4dc0 100644
--- a/common/utils/system.c
+++ b/common/utils/system.c
@@ -199,15 +199,32 @@ void start_background_system(void) {
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){
pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
- pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
+ int ret;
+ ret=pthread_attr_init(&attr);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ if(prioritysched_get_priority_max(SCHED_FIFO)) {
+ LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n",
+ priority,
+ sched_get_priority_min(SCHED_OAI),
+ sched_get_priority_max(SCHED_OAI));
+ if(prioritysched_get_priority_max(SCHED_OAI))
+ priority=sched_get_priority_max(SCHED_OAI);
+ }
+ AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),"");
struct sched_param sparam={0};
sparam.sched_priority = priority;
- pthread_attr_setschedparam(&attr, &sparam);
-
- pthread_create(t, &attr, func, param);
+ ret=pthread_attr_setschedparam(&attr, &sparam);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ ret=pthread_create(t, &attr, func, param);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
pthread_setname_np(*t, name);
if (affinity != -1 ) {
@@ -216,7 +233,6 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
CPU_SET(affinity, &cpuset);
AssertFatal( pthread_setaffinity_np(*t, sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity");
}
-
pthread_attr_destroy(&attr);
}
diff --git a/common/utils/system.h b/common/utils/system.h
index a89a6c5b17..fbfd338a1a 100644
--- a/common/utils/system.h
+++ b/common/utils/system.h
@@ -46,9 +46,11 @@ void set_latency_target(void);
void configure_linux(void);
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority);
-#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_FIFO)
-#define OAI_PRIORITY_RT sched_get_priority_max(SCHED_FIFO)-10
-#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_FIFO)
+
+#define SCHED_OAI SCHED_RR
+#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI)
+#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_max(SCHED_OAI))/2)
+#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_OAI)-2
void thread_top_init(char *thread_name,
int affinity,
diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c
index 03f7af99bc..734126721a 100644
--- a/common/utils/telnetsrv/telnetsrv.c
+++ b/common/utils/telnetsrv/telnetsrv.c
@@ -461,12 +461,12 @@ int process_command(char *buf) {
int i,j,k;
char modulename[TELNET_CMD_MAXSIZE];
char cmd[TELNET_CMD_MAXSIZE];
- char cmdb[TELNET_MAX_MSGLENGTH];
+ char *cmdb=NULL;
char *bufbck;
int rt;
memset(modulename,0,sizeof(modulename));
memset(cmd,0,sizeof(cmd));
- memset(cmdb,0,sizeof(cmdb));
+
if (strncasecmp(buf,"ex",2) == 0)
return CMDSTATUS_EXIT;
@@ -490,12 +490,10 @@ int process_command(char *buf) {
return CMDSTATUS_FOUND;
}
- memset(modulename,0,sizeof(modulename));
- memset(cmd,0,sizeof(cmd));
- memset(cmdb,0,sizeof(cmdb));
+
bufbck=strdup(buf);
rt=CMDSTATUS_NOTFOUND;
- j = sscanf(buf,"%19s %19s %19[^\t\n]",modulename,cmd,cmdb);
+ j = sscanf(buf,"%19s %19s %m[^\t\n]",modulename,cmd,&cmdb);
if (telnetparams.telnetdbg > 0)
printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb);
@@ -562,7 +560,7 @@ int process_command(char *buf) {
rt= CMDSTATUS_FOUND;
} /* loop */
} /* for i */
-
+ free(cmdb);
free(bufbck);
return rt;
}
@@ -702,7 +700,7 @@ void poll_telnetcmdq(void *qid, void *arg) {
*/
void exec_moduleinit(char *modname) {
void (*fptr)(void);
- char initfunc[TELNET_CMD_MAXSIZE+9];
+ char initfunc[TELNET_CMD_MAXSIZE+10];
if (strlen(modname) > TELNET_CMD_MAXSIZE) {
fprintf(stderr,"[TELNETSRV] module %s not loaded, name exceeds the %i size limit\n",
diff --git a/common/utils/telnetsrv/telnetsrv.h b/common/utils/telnetsrv/telnetsrv.h
index b66641d5c8..59655501d3 100644
--- a/common/utils/telnetsrv/telnetsrv.h
+++ b/common/utils/telnetsrv/telnetsrv.h
@@ -31,6 +31,7 @@
#ifndef TELNETSRV_H
#define TELNETSRV_H
+#include
#define TELNETSRV_MODNAME "telnetsrv"
#define TELNET_PORT 9090
diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h
index 5db1a5e34e..a32b7c3859 100644
--- a/common/utils/threadPool/thread-pool.h
+++ b/common/utils/threadPool/thread-pool.h
@@ -37,14 +37,21 @@
#else
#define THREADINIT PTHREAD_MUTEX_INITIALIZER
#endif
-#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,"");
-#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,"");
-#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,"");
+#define mutexinit(mutex) {int ret=pthread_mutex_init(&mutex,NULL); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define condinit(signal) {int ret=pthread_cond_init(&signal,NULL); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define mutexlock(mutex) {int ret=pthread_mutex_lock(&mutex); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
#define mutextrylock(mutex) pthread_mutex_trylock(&mutex)
-#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,"");
-#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,"");
-#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
-#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
+#define mutexunlock(mutex) {int ret=pthread_mutex_unlock(&mutex); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define condwait(condition, mutex) {int ret=pthread_cond_wait(&condition, &mutex); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define condbroadcast(signal) {int ret=pthread_cond_broadcast(&signal); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define condsignal(signal) {int ret=pthread_cond_broadcast(&signal); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
#define tpool_nbthreads(tpool) (tpool.nbThreads)
typedef struct notifiedFIFO_elt_s {
struct notifiedFIFO_elt_s *next;
@@ -78,7 +85,7 @@ static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size,
ret->reponseFifo=reponseFifo;
ret->processingFunc=processingFunc;
// We set user data piece aligend 32 bytes to be able to process it with SIMD
- ret->msgData=(void *)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32;
+ ret->msgData=(void *)((uint8_t*)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32);
ret->malloced=true;
return ret;
}
diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md
index a087b989fa..f2422d9822 100644
--- a/common/utils/threadPool/thread-pool.md
+++ b/common/utils/threadPool/thread-pool.md
@@ -210,8 +210,8 @@ time the worker finished the job
time the client reads the result
if you set the environement variable:
-thread-pool-measurements to a valid file name
+threadPoolMeasurements to a valid file name
These measurements will be wrote to this Linux pipe.
-A tool to read the linux fifo and display it in ascii is provided:
-see the local directory Makefile for this tool and to compile the thread pool unitary tests.
+A tool to read the linux fifo and display it in ascii is provided; compute the binay:
+in cmake building directory: make/ninja measurement_display
diff --git a/doc/SW_archi.md b/doc/SW_archi.md
index d92f802148..e5856d63bc 100644
--- a/doc/SW_archi.md
+++ b/doc/SW_archi.md
@@ -171,24 +171,31 @@ NR_sched_pusch_t (for values changing every TTI, e.g., frequency domain
allocation) and NR_sched_pusch_save_t (for values changing less frequently, at
least in FR1 [to my understanding], e.g., DMRS fields when the time domain
allocation stays between TTIs) structures. Furthermore, the preprocessor is an
-exchangeable module that might schedule differently, e.g., one user for
-phytest, multiple users in FR1, or maybe FR2: phytest is in
-nr_ul_preprocessor_phytest(), for FR1 is nr_simple_ulsch_preprocessor() [under
-development], for FR2 does not exist yet.
+exchangeable module that schedules differently based on a particular
+use-case/deployment type, e.g., one user for phytest [in
+nr_ul_preprocessor_phytest()], multiple users in FR1
+[nr_fr1_ulsch_preprocessor()], or maybe FR2 [does not exist yet]:
* calls preprocessor via pre_processor_ul(): the preprocessor is responsible
- for allocating CCEs (using allocate_nr_CCEs()). Note that we do not yet have
- scheduling requests or buffer status reports, and only one UE. E.g.,
- nr_simple_ulsch_preprocessor():
+ for allocating CCEs (using allocate_nr_CCEs()) and deciding on resource
+ allocation for the UEs including TB size. Note that we do not yet have
+ scheduling requests. What it typically does:
1) check whether the current frame/slot plus K2 is an UL slot, and return if
not.
2) Find first free start RB in vrb_map_UL, and as many free consecutive RBs
as possible.
- 3) allocate a CCE for the UE (and return if it is not possible)
- 4) Calculate DMRS stuff (nr_save_pusch_fields()) and the TBS.
- 5) Mark used resources in vrb_map_UL.
-* loop through all users: get a free HARQ PID and
- update statistics. Fill nFAPI structures directly for PUSCH, and call
- config_uldci() and fill_dci_pdu_rel15() for DCI filling and PDCCH messages.
+ 3) Either set up resource allocation directly (e.g., for a single UE,
+ phytest), or call into a function to perform actual resource allocation.
+ Currently, this is done using pf_ul() which implements a basic
+ proportional fair scheduler:
+ * for every UE, check for retransmission and allocate as necessary
+ * Calculate DMRS stuff (nr_set_pusch_semi_static())
+ * Calculate the PF coefficient and put eligible UEs into a list
+ * Allocate resources to the UE(s) with the highest coefficient
+ 4) Mark used resources in vrb_map_UL.
+* loop through all users: get a HARQ process as indicated through the
+ preprocessor, update statistics, fill nFAPI structures directly for PUSCH,
+ and call config_uldci() and fill_dci_pdu_rel15() for DCI filling and PDCCH
+ messages.
Calls nr_schedule_ue_spec(). It is divided into the "preprocessor" and the
"postprocessor": the first makes the scheduling decisions, the second fills
@@ -196,29 +203,28 @@ nFAPI structures to indicate to the PHY what it is supposed to do. To signal
which users have how many resources, the preprocessor populates the
NR_UE_sched_ctrl_t structure of affected users. In particular, the field rbSize
decides whether a user is to be allocated. Furthermore, the preprocessor is an
-exchangeable module that might schedule differently, e.g., one user for
-phytest, multiple users in FR1, or maybe FR2: phytest is in
-nr_preprocessor_phytest(), for FR1 is nr_simple_dlsch_preprocessor() [under
-development], for FR2 does not exist yet.
+exchangeable module that schedules differently based on a particular
+use-case/deployment type, e.g., one user for phytest [in
+nr_preprocessor_phytest()], multiple users in FR1
+[nr_fr1_dlsch_preprocessor()], or maybe FR2 [does not exist yet].
* calls preprocessor via pre_processor_dl(): the preprocessor is responsible
for allocating CCEs and PUCCH (using allocate_nr_CCEs() and
nr_acknack_scheduling()) and deciding on the frequency/time domain
- allocation. E.g., nr_simple_dlsch_preprocessor():
- 1) mac_rlc_status_ind() locks and checks directly inside rlc data the
- quantity of waiting data.
- 2) return from the preprocessor if there is no data and no timing advance to
- send,
- 3) otherwise, allocate a CCE for the UE (and return if it is not possible)
- 4) find a PUCCH occasion for HARQ
- 5a) check if there is a retransmission: if yes, find free resources to
- transmit using the same resources, else
- 5b) calculate the necessary RBs needed to get a TBS large enough to hold all
- data, or until no more resources are available
- 6) Mark taken resources in the vrb_map
+ allocation including the TB size. What it typically does:
+ 1) Check available resources in the vrb_map
+ 2) Checks the quantity of waiting data in RLC
+ 3) Either set up resource allocation directly (e.g., for a single UE,
+ phytest), or call into a function to perform actual resource allocation.
+ Currently, this is done using pf_dl() which implements a basic
+ proportional fair scheduler:
+ * for every UE, check for retransmission and allocate as necessary
+ * Calculate the PF coefficient and put eligible UEs into a list
+ * Allocate resources to the UE(s) with the highest coefficient
+ 4) Mark taken resources in the vrb_map
* loop through all users: check if a new TA is necessary. Then, if a user has
- allocated resources, compute its TBS, and fill nFAPI structures
- (nr_fill_nfapi_dl_pdu() to populate what should be done by the lower layers
- to make the Tx subframe). Update statistics (round, sent bytes).
+ allocated resources, update statistics (round, sent bytes), update HARQ
+ process information, and fill nFAPI structures (allocate a DCI and PDCCH
+ messages, TX_req, ...)
# RRC
RRC is a regular thread with itti loop on queue: TASK_RRC_GNB
@@ -296,6 +302,28 @@ gtp thread calls directly pdcp_data_req(), so it runs inside it's context intern
## inside other threads
gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the other threads, without mutex.
+# New GTP
+## initialization
+Coexistance until full merge with legacy GTP
+cmake new option: NEW_GTPU to use the new implementation (it changes for the entire executable)
+It is possible to use both old and new GTP in same executable because the itti task and all functions names are different
+Current status of new implementation: not tested, X2 not developped, 5G new GTP option not developped, remain issues on data coming from void: muid, enb_flag, ...
+
+ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything
+gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address
+
+newGtpuCreateTunnel() this function will replace the xxx_create_tunnel_xxx() for various cases
+This creates a outgoing context for a teid (in input), it computes and return the incoming teid that will be used for incoming packets
+These teids and in a "instance", so in a Linux socket: same teid can co-exist for different sockets
+ Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback
+stuff like enb_flag, but also mui and more important data are not given explicitly by any legacy function (gtpv1u_create_s1u_tunnel), but the legacy and the new interface to lower layer (like pdcp) require this data.
+The datamodel is still not fully understood, so this data source remain unknown
+A new parameter is the callback function: will be pdpcp_data_req() and gtpv_data_req() (x2 case) for existing implementation and later other call backs like the F1-U implementation.
+
+incoming packets
+the gtp layer retrieves the data, the teid, find out the related data: rnti, bearer and quite a lot of other parameters (not clear why, because it looks like all is statefull, so the lower layer should have the context)
+if lower layers can be stateless, it is a good idea to keep the context in the gtp layer and pass it to the callback, but the design remain obfuscated.
+
# NGAP
NGAP would be a itti thread as is S1AP (+twin thread SCTP that is almost void processing)?
About all messages are exchanged with RRC thread
diff --git a/doc/TESTING_GNB_W_COTS_UE.md b/doc/TESTING_GNB_W_COTS_UE.md
index 73ae18351f..5f9299f0ef 100644
--- a/doc/TESTING_GNB_W_COTS_UE.md
+++ b/doc/TESTING_GNB_W_COTS_UE.md
@@ -44,10 +44,11 @@ Our code might not work with all 5G phones yet, but we are constantly improving
* Oppo Reno 5G
* Samsung A90 5G
-* Google Pixel 5G
+* Google Pixel 5G (note1)
* Simcom SIMCOM8200EA
* Quectel RM500Q-GL
+Note1: In the version we have at Eurecom, you need to set the PLMN to 50501, and you also need to change the firmware to "11.0.0 (RD1A.201105.003.B1, Nov 2020, EU carriers)" (see https://developers.google.com/android/images)
## Repository
diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2
index aa8b9aa228..cf012502e0 100644
--- a/docker/Dockerfile.eNB.rhel8.2
+++ b/docker/Dockerfile.eNB.rhel8.2
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM localhost/ran-build:latest AS enb-build
+FROM ran-build:latest AS enb-build
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
@@ -37,10 +37,9 @@ RUN /bin/sh oaienv && \
mkdir -p log && \
./build_oai --eNB --ninja -w USRP --verbose-ci
-# debug
-#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15
-#RUN ls -ls /oai-ran/targets/bin
-#RUN ls -ls /oai-ran/cmake_targets/ran_build/build/*.so
+RUN yum install -y python3-pip && \
+ pip3 install --ignore-installed pyyaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml
#start from scratch for target executable
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-enb
@@ -59,6 +58,7 @@ RUN yum update -y && \
WORKDIR /opt/oai-enb/bin
COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 .
+COPY --from=enb-build /oai-ran/docker/scripts/enb_entrypoint.sh entrypoint.sh
WORKDIR /usr/local/lib/
COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
@@ -93,34 +93,16 @@ COPY --from=enb-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64
RUN ldconfig
-#debug
-#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15
-#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15
-#RUN ldd /usr/local/lib/librfsimulator.so.Rel15
-#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15
-#RUN ldd /usr/local/lib/libcoding.so
-#RUN ldd /usr/local/lib/libparams_libconfig.so
-#RUN ldd /usr/local/lib/libdfts.so
-#RUN ldd /usr/local/lib/liboai_iqplayer.so
-#RUN ldd /opt/oai-enb/bin/lte-softmodem.Rel15
-
# Copy the relevant configuration files for eNB
WORKDIR /opt/oai-enb/etc
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/enb.* .
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rcc.* .
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/cu.* .
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/du.* .
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rru.* .
+COPY --from=enb-build /oai-ran/docker/etc .
WORKDIR /opt/oai-enb
-#EXPOSE 2152/udp # S1U, GTP/UDP
-#EXPOSE 22100/tcp # ?
-#EXPOSE 36412/udp # S1C, SCTP/UDP
-#EXPOSE 36422/udp # X2C, SCTP/UDP
-#EXPOSE 50000/udp # IF5 / ORI (control)
-#EXPOSE 50001/udp # IF5 / ECPRI (data)
+# 2152 --> S1U, GTP/UDP
+# 36412 --> S1C, SCTP/UDP
+# 36422 --> X2C, SCTP/UDP
+EXPOSE 2152/udp 36412/udp 36422/udp
-#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"]
-#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
-CMD ["sleep", "infinity"]
+ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
+CMD ["/opt/oai-enb/bin/lte-softmodem.Rel15", "-O", "/opt/oai-enb/etc/enb.conf"]
diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18
index 95d7194c31..1f276094d5 100644
--- a/docker/Dockerfile.eNB.ubuntu18
+++ b/docker/Dockerfile.eNB.ubuntu18
@@ -41,11 +41,6 @@ RUN apt-get install -y python3-pip && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml
-# debug
-#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15
-#RUN ls -ls /oai-ran/targets/bin
-#RUN ls -ls /oai-ran/cmake_targets/ran_build/build/*.so
-
#start from scratch for target executable
FROM ubuntu:bionic as oai-enb
ENV DEBIAN_FRONTEND=noninteractive
@@ -98,17 +93,6 @@ COPY --from=enb-build /usr/local/lib/libprotobuf-c.so.1 .
RUN ldconfig
-#debug
-#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15
-#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15
-#RUN ldd /usr/local/lib/librfsimulator.so.Rel15
-#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15
-#RUN ldd /usr/local/lib/libcoding.so
-#RUN ldd /usr/local/lib/libparams_libconfig.so
-#RUN ldd /usr/local/lib/libdfts.so
-#RUN ldd /usr/local/lib/liboai_iqplayer.so
-#RUN ldd /opt/oai-enb/bin/lte-softmodem.Rel15
-
# Copy the relevant configuration files for eNB
WORKDIR /opt/oai-enb/etc
COPY --from=enb-build /oai-ran/docker/etc .
diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2
index e22343d63c..731abed1a8 100644
--- a/docker/Dockerfile.lteUE.rhel8.2
+++ b/docker/Dockerfile.lteUE.rhel8.2
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM localhost/ran-build:latest AS lte-ue-build
+FROM ran-build:latest AS lte-ue-build
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
@@ -37,10 +37,10 @@ RUN /bin/sh oaienv && \
mkdir -p log && \
./build_oai --UE --ninja -w USRP --verbose-ci
-# debug
-#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15
-#RUN ls -lst /oai-ran/targets/bin
-#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so
+RUN yum install -y python3-pip && \
+ pip3 install --ignore-installed pyyaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml
#start from scratch for target executable
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-lte-ue
@@ -59,12 +59,10 @@ RUN yum update -y && \
WORKDIR /opt/oai-lte-ue/bin
COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 .
+COPY --from=lte-ue-build /oai-ran/docker/scripts/lte_ue_entrypoint.sh entrypoint.sh
COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata .
COPY --from=lte-ue-build /oai-ran/targets/bin/nvram .
COPY --from=lte-ue-build /oai-ran/targets/bin/usim .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.ue_emm.nvram0 .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.ue.nvram0 .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 .
WORKDIR /usr/local/lib/
COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
@@ -99,26 +97,10 @@ COPY --from=lte-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64
RUN ldconfig
-#debug
-#RUN ldd /opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15
-#RUN ldd /opt/oai-lte-ue/bin/conf2uedata
-#RUN ldd /opt/oai-lte-ue/bin/nvram
-#RUN ldd /opt/oai-lte-ue/bin/usim
-#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15
-#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15
-#RUN ldd /usr/local/lib/librfsimulator.so.Rel15
-#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15
-#RUN ldd /usr/local/lib/libcoding.so
-#RUN ldd /usr/local/lib/libparams_libconfig.so
-#RUN ldd /usr/local/lib/libSIMU.so
-#RUN ldd /usr/local/lib/libdfts.so
-
-# Copy the relevant configuration files for eNB
+# Copy the relevant configuration files for UE
WORKDIR /opt/oai-lte-ue/etc
-COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* .
-COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
+COPY --from=lte-ue-build /oai-ran/docker/etc .
WORKDIR /opt/oai-lte-ue
-#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"]
-#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
-CMD ["sleep", "infinity"]
+CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15"]
+ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18
index 6af2e61991..6575a81899 100644
--- a/docker/Dockerfile.lteUE.ubuntu18
+++ b/docker/Dockerfile.lteUE.ubuntu18
@@ -37,11 +37,10 @@ RUN /bin/sh oaienv && \
mkdir -p log && \
./build_oai --UE --ninja -w USRP --verbose-ci
-# debug
-#RUN ldconfig -v
-#RUN ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15
-#RUN ls -lst /oai-ran/targets/bin
-#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so
+RUN apt-get install -y python3-pip && \
+ pip3 install --ignore-installed pyyaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml
#start from scratch for target executable
FROM ubuntu:bionic as oai-lte-ue
@@ -76,12 +75,10 @@ RUN apt-get update && \
WORKDIR /opt/oai-lte-ue/bin
COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 .
+COPY --from=lte-ue-build /oai-ran/docker/scripts/lte_ue_entrypoint.sh entrypoint.sh
COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata .
COPY --from=lte-ue-build /oai-ran/targets/bin/nvram .
COPY --from=lte-ue-build /oai-ran/targets/bin/usim .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.ue_emm.nvram0 .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.ue.nvram0 .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 .
WORKDIR /usr/local/lib/
COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
@@ -100,26 +97,10 @@ COPY --from=lte-ue-build /usr/local/lib/libprotobuf-c.so.1 .
RUN ldconfig
-#debug
-#RUN ldd /opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15
-#RUN ldd /opt/oai-lte-ue/bin/conf2uedata
-#RUN ldd /opt/oai-lte-ue/bin/nvram
-#RUN ldd /opt/oai-lte-ue/bin/usim
-#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15
-#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15
-#RUN ldd /usr/local/lib/librfsimulator.so.Rel15
-#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15
-#RUN ldd /usr/local/lib/libcoding.so
-#RUN ldd /usr/local/lib/libparams_libconfig.so
-#RUN ldd /usr/local/lib/libSIMU.so
-#RUN ldd /usr/local/lib/libdfts.so
-
-# Copy the relevant configuration files for eNB
+# Copy the relevant configuration files for UE
WORKDIR /opt/oai-lte-ue/etc
-COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* ./
-COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
+COPY --from=lte-ue-build /oai-ran/docker/etc .
WORKDIR /opt/oai-lte-ue
-#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"]
-#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
-CMD ["sleep", "infinity"]
+CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15"]
+ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2
new file mode 100644
index 0000000000..4472ece363
--- /dev/null
+++ b/docker/Dockerfile.phySim.rhel8.2
@@ -0,0 +1,123 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+#
+# Dockerfile for the Open-Air-Interface BUILD service
+# Valid for RHEL8
+#
+#---------------------------------------------------------------------
+
+FROM localhost/ran-build:develop AS phy-sim-build
+
+RUN rm -Rf /oai-ran
+WORKDIR /oai-ran
+COPY . .
+
+#run build_oai to build the target image
+RUN /bin/sh oaienv && \
+ cd cmake_targets && \
+ mkdir -p log && \
+ ./build_oai --phy_simulators --ninja --verbose-ci
+
+
+#start from scratch for target executable
+FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim
+
+RUN yum update -y && \
+ yum install -y --enablerepo="ubi-8-codeready-builder" \
+ lksctp-tools \
+ nettle \
+ atlas \
+ hostname \
+ sudo \
+ procps-ng \
+ net-tools \
+ iputils \
+ bc \
+ iproute \
+ libyaml && \
+ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
+ echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
+
+WORKDIR /opt/oai-physim/targets/bin
+COPY --from=phy-sim-build /oai-ran/targets/bin/dlsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_dlsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_prachsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_ulschsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/polartest.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/ulsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/ldpctest.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_dlschsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_pbchsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_pucchsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_ulsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/smallblocktest.Rel15 .
+
+WORKDIR /usr/local/lib/
+COPY --from=phy-sim-build /oai-ran/targets/bin/libcoding.so .
+COPY --from=phy-sim-build /lib64/liblapacke.so.3 .
+COPY --from=phy-sim-build /lib64/libX11.so.6 .
+COPY --from=phy-sim-build /lib64/libXpm.so.4 .
+COPY --from=phy-sim-build /lib64/libxcb.so.1 .
+COPY --from=phy-sim-build /lib64/libXau.so.6 .
+COPY --from=phy-sim-build /lib64/libforms.so.2 .
+COPY --from=phy-sim-build /lib64/libblas.so.3 .
+COPY --from=phy-sim-build /lib64/liblapack.so.3 .
+COPY --from=phy-sim-build /lib64/libexslt.so.0 .
+COPY --from=phy-sim-build /lib64/libxslt.so.1 .
+COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libdfts.so .
+COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libSIMU.so .
+COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libldpc.so .
+COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libldpc_orig.so .
+
+RUN ldconfig
+
+#debug
+#RUN ldd /opt/oai-physim/targets/bin/dlsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_dlsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_prachsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_ulschsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/polartest.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/ulsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/ldpctest.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_dlschsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_pbchsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_pucchsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_ulsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/smallblocktest.Rel15
+
+# Copy some executables
+WORKDIR /usr/bin/
+
+COPY --from=phy-sim-build /usr/bin/killall .
+COPY --from=phy-sim-build /usr/bin/xmlstarlet .
+COPY --from=phy-sim-build /usr/bin/svn .
+
+# Copy the relevant configuration files for phySim
+WORKDIR /opt/oai-physim/
+
+COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/run_exec_autotests.bash /opt/oai-physim/cmake_targets/autotests/
+COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/test_case_list.xml /opt/oai-physim/cmake_targets/autotests/
+COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/tools/free_mem.bash /opt/oai-physim/cmake_targets/autotests/tools/
+COPY --from=phy-sim-build /oai-ran/cmake_targets/tools/build_helper /opt/oai-physim/cmake_targets/tools/
+COPY --from=phy-sim-build /oai-ran/cmake_targets/tools/test_helper /opt/oai-physim/cmake_targets/tools/
+
+#CMD ["sleep", "infinity"]
diff --git a/docker/scripts/enb_entrypoint.sh b/docker/scripts/enb_entrypoint.sh
index 31d99b2a67..dbe97360f6 100755
--- a/docker/scripts/enb_entrypoint.sh
+++ b/docker/scripts/enb_entrypoint.sh
@@ -2,17 +2,20 @@
set -euo pipefail
+PREFIX=/opt/oai-enb
+RRC_INACTIVITY_THRESHOLD=${RRC_INACTIVITY_THRESHOLD:-0}
+
# Based another env var, pick one template to use
-if [[ -v USE_FDD_CU ]]; then ln -s /opt/oai-enb/etc/cu.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_FDD_DU ]]; then ln -s /opt/oai-enb/etc/du.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_FDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_TDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.tdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_FDD_RCC ]]; then ln -s /opt/oai-enb/etc/rcc.if4p5.enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_FDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_TDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.tdd.conf /opt/oai-enb/etc/enb.conf; fi
+if [[ -v USE_FDD_CU ]]; then ln -s $PREFIX/etc/cu.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_DU ]]; then ln -s $PREFIX/etc/du.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_MONO ]]; then ln -s $PREFIX/etc/enb.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_TDD_MONO ]]; then ln -s $PREFIX/etc/enb.tdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_FAPI_RCC ]]; then ln -s $PREFIX/etc/rcc.nfapi.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_RRU ]]; then ln -s $PREFIX/etc/rru.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_TDD_RRU ]]; then ln -s $PREFIX/etc/rru.tdd.conf $PREFIX/etc/enb.conf; fi
# Only this template will be manipulated
-CONFIG_FILES=`ls /opt/oai-enb/etc/enb.conf`
+CONFIG_FILES=`ls $PREFIX/etc/enb.conf || true`
for c in ${CONFIG_FILES}; do
# grep variable names (format: ${VAR}) from template to be rendered
diff --git a/docker/scripts/enb_parameters.yaml b/docker/scripts/enb_parameters.yaml
index a60fc20e29..d115d177ab 100644
--- a/docker/scripts/enb_parameters.yaml
+++ b/docker/scripts/enb_parameters.yaml
@@ -159,6 +159,8 @@
env: "@ENB_S1U_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@ENB_X2_IP_ADDRESS@"
+ - key: rrc_inactivity_threshold
+ env: "@RRC_INACTIVITY_THRESHOLD@"
- key: FLEXRAN_ENABLED
env: "@FLEXRAN_ENABLED@"
- key: FLEXRAN_INTERFACE_NAME
@@ -204,7 +206,7 @@
env: "@F1_CU_IP_ADDRESS@"
- filePrefix: "rcc.band7.tm1.nfapi"
- outputfilename: "rcc.if4p5.enb.fdd.conf"
+ outputfilename: "rcc.nfapi.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
diff --git a/docker/scripts/generateTemplate.py b/docker/scripts/generateTemplate.py
index 4949e9cf21..418476d395 100644
--- a/docker/scripts/generateTemplate.py
+++ b/docker/scripts/generateTemplate.py
@@ -35,11 +35,12 @@ def main():
data = yaml.full_load(f)
dir = os.listdir(f'{data[0]["paths"]["source_dir"]}')
-
#identify configs, read and replace corresponding values
for config in data[1]["configurations"]:
filePrefix = config["filePrefix"]
outputfilename = config["outputfilename"]
+ print('filePrefix = ' + filePrefix)
+ print('outputfilename = ' + outputfilename)
for inputfile in dir:
if inputfile.find(filePrefix) >=0:
prefix_outputfile = {"cu": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
@@ -48,7 +49,9 @@ def main():
"rru.tdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band7.tm1.25PRB.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band40.tm1.25PRB.FairScheduler.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
- "rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}'
+ "rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
+ "ue.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
+ "ue_sim_ci": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}'
}
if filePrefix in prefix_outputfile:
outputfile1 = prefix_outputfile[filePrefix]
@@ -61,6 +64,9 @@ def main():
open(outputfile1, mode='w') as outputfile:
for line in inputfile:
count = 0
+ if re.search(r'EHPLMN_LIST', line):
+ outputfile.write(line)
+ continue
for key in config["config"]:
if line.find(key["key"]) >= 0:
count += 1
diff --git a/docker/scripts/lte_ue_entrypoint.sh b/docker/scripts/lte_ue_entrypoint.sh
new file mode 100755
index 0000000000..235128f738
--- /dev/null
+++ b/docker/scripts/lte_ue_entrypoint.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+set -euo pipefail
+
+PREFIX=/opt/oai-lte-ue
+
+# Based another env var, pick one template to use
+if [[ -v USE_NFAPI ]]; then ln -s $PREFIX/etc/ue.nfapi.conf $PREFIX/etc/ue.conf; fi
+
+# Only this template will be manipulated and the USIM one!
+CONFIG_FILES=`ls $PREFIX/etc/ue.conf $PREFIX/etc/ue_usim.conf || true`
+
+for c in ${CONFIG_FILES}; do
+ # grep variable names (format: ${VAR}) from template to be rendered
+ VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
+
+ # create sed expressions for substituting each occurrence of ${VAR}
+ # with the value of the environment variable "VAR"
+ EXPRESSIONS=""
+ for v in ${VARS}; do
+ NEW_VAR=`echo $v | sed -e "s#@##g"`
+ if [[ "${!NEW_VAR}x" == "x" ]]; then
+ echo "Error: Environment variable '${NEW_VAR}' is not set." \
+ "Config file '$(basename $c)' requires all of $VARS."
+ exit 1
+ fi
+ EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
+ done
+ EXPRESSIONS="${EXPRESSIONS#';'}"
+
+ # render template and inline replace config file
+ sed -i "${EXPRESSIONS}" ${c}
+done
+
+#now generate USIM files
+# At this point all operations will be run from $PREFIX!
+cd $PREFIX
+$PREFIX/bin/conf2uedata -c $PREFIX/etc/ue_usim.conf -o $PREFIX
+
+# Load the USRP binaries
+if [[ -v USE_B2XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t b2xx
+elif [[ -v USE_X3XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t x3xx
+elif [[ -v USE_N3XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t n3xx
+fi
+
+# in case we have conf file, append
+new_args=()
+while [[ $# -gt 0 ]]; do
+ new_args+=("$1")
+ shift
+done
+if [[ -v USE_NFAPI ]]; then
+ new_args+=("-O")
+ new_args+=("$PREFIX/etc/ue.conf")
+fi
+
+echo "=================================="
+echo "== Starting LTE UE soft modem"
+if [[ -v USE_ADDITIONAL_OPTIONS ]]; then
+ echo "Additional option(s): ${USE_ADDITIONAL_OPTIONS}"
+ for word in ${USE_ADDITIONAL_OPTIONS}; do
+ new_args+=("$word")
+ done
+ echo "${new_args[@]}"
+ exec "${new_args[@]}"
+else
+ echo "${new_args[@]}"
+ exec "${new_args[@]}"
+fi
diff --git a/docker/scripts/lte_ue_parameters.yaml b/docker/scripts/lte_ue_parameters.yaml
new file mode 100644
index 0000000000..977659bb54
--- /dev/null
+++ b/docker/scripts/lte_ue_parameters.yaml
@@ -0,0 +1,37 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+
+---
+- paths:
+ source_dir: "ci-scripts/conf_files/"
+ dest_dir: docker/etc
+
+- configurations:
+ - filePrefix: ue.nfapi
+ outputfilename: "ue.nfapi.conf"
+ config:
+ - key: remote_n_address
+ env: "@ENB_IP_ADDRESS@"
+ - key: local_n_address
+ env: "@LTE_UE_IP_ADDRESS@"
+ - key: local_n_if_name
+ env: "@UE_NFAPI_IF_NAME@"
+
diff --git a/docker/scripts/lte_ue_sim_parameters.yaml b/docker/scripts/lte_ue_sim_parameters.yaml
new file mode 100644
index 0000000000..a339ed7504
--- /dev/null
+++ b/docker/scripts/lte_ue_sim_parameters.yaml
@@ -0,0 +1,47 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+
+---
+- paths:
+ source_dir: "openair3/NAS/TOOLS/"
+ dest_dir: docker/etc
+
+- configurations:
+ - filePrefix: ue_sim_ci
+ outputfilename: "ue_usim.conf"
+ config:
+ - key: MNC
+ env: "@MNC@"
+ - key: MCC
+ env: "@MCC@"
+ - key: MSIN
+ env: "@SHORT_IMSI@"
+ - key: USIM_API_K
+ env: "@LTE_KEY@"
+ - key: OPC
+ env: "@OPC@"
+ - key: MSISDN
+ env: "@MSISDN@"
+ - key: HPLMN
+ env: "@HPLMN@"
+ - key: OPLMN_LIST
+ env: "@HPLMN@"
+
diff --git a/executables/main-fs6.c b/executables/main-fs6.c
index 5283ce5eaa..438edb4044 100644
--- a/executables/main-fs6.c
+++ b/executables/main-fs6.c
@@ -750,7 +750,7 @@ void phy_procedures_eNB_uespec_RX_fromsplit(uint8_t *bufferZone, int nbBlocks,PH
recvFs6Ul(bufferZone, nbBlocks, eNB, ul_propa);
// dirty memory allocation in OAI...
- for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++)
+ for (int i = 0; i < NUMBER_OF_UCI_MAX; i++)
if ( eNB->uci_vars[i].frame == proc->frame_rx &&
eNB->uci_vars[i].subframe == proc->subframe_rx )
eNB->uci_vars[i].active=0;
@@ -1145,7 +1145,7 @@ void appendFs6DLUEcch(uint8_t *bufferZone, PHY_VARS_eNB *eNB, int frame, int sub
commonUDP_t *newUDPheader=(commonUDP_t *) firstFreeByte;
bool first_UE=true;
- for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) {
+ for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) {
LTE_eNB_UCI *uci = &(eNB->uci_vars[i]);
if ((uci->active == 1) && (uci->frame == frame) && (uci->subframe == subframe)) {
diff --git a/executables/main-ocp.c b/executables/main-ocp.c
index ae1db7195b..b0f0b05315 100644
--- a/executables/main-ocp.c
+++ b/executables/main-ocp.c
@@ -73,13 +73,15 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex.
int config_sync_var=-1;
volatile int oai_exit = 0;
double cpuf;
+msc_interface_t msc_interface;
+THREAD_STRUCT thread_struct;
+
uint16_t sf_ahead=4;
//uint16_t slot_ahead=6;
int otg_enabled;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int split73;
-int usrp_tx_thread = 0;
char * split73_config;
int split73;
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0};
@@ -202,7 +204,6 @@ void init_eNB_afterRU(void) {
for (int inst=0; instframe_parms.nb_antennas_rx = 0;
eNB->frame_parms.nb_antennas_tx = 0;
eNB->prach_vars.rxsigF[0] = (int16_t **)malloc16(64*sizeof(int16_t *));
@@ -228,12 +229,26 @@ void init_eNB_afterRU(void) {
for (int ce_level=0; ce_level<4; ce_level++)
eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i];
- eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i];
}
}
- AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 4, "");
- AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 4, "");
+
+ AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 5, "");
+ AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 5, "");
+
+ phy_init_lte_eNB(eNB,0,0);
+
+ // need to copy rxdataF after L1 variables are allocated
+ for (int inst=0; instnum_RU; ru_id++) {
+ for (int i=0; iRU_list[ru_id]->nb_rx; aa++,i++)
+ eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i];
+ }
+ }
+ }
+
LOG_I(PHY,"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx);
init_transport(eNB);
//init_precoding_weights(RC.eNB[inst][CC_id]);
@@ -800,7 +815,7 @@ int init_rf(RU_t *ru) {
pthread_setname_np(pthread_self(),name);
return ret;
}
-
+
void ocp_init_RU(RU_t *ru, char *rf_config_file, int send_dmrssync) {
PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
int i;
@@ -1318,7 +1333,7 @@ int main ( int argc, char **argv ) {
// end of CI modifications
//getchar();
- if(IS_SOFTMODEM_DOFORMS)
+ if(IS_SOFTMODEM_DOSCOPE)
load_softscope("enb", NULL);
itti_wait_tasks_end();
@@ -1327,7 +1342,7 @@ int main ( int argc, char **argv ) {
// stop threads
if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) {
- if(IS_SOFTMODEM_DOFORMS)
+ if(IS_SOFTMODEM_DOSCOPE)
end_forms();
LOG_I(ENB_APP,"stopping MODEM threads\n");
diff --git a/executables/main_ru.c b/executables/main_ru.c
new file mode 100644
index 0000000000..93a580560e
--- /dev/null
+++ b/executables/main_ru.c
@@ -0,0 +1,382 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file oairu.c
+ * \brief Top-level threads for radio-unit
+ * \author R. Knopp
+ * \date 2020
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+
+#define _GNU_SOURCE /* See feature_test_macros(7) */
+#include
+
+
+
+
+#include "assertions.h"
+#include "PHY/types.h"
+
+#include "PHY/defs_RU.h"
+#include "common/config/config_userapi.h"
+#include "common/utils/load_module_shlib.h"
+
+
+#include "../../ARCH/COMMON/common_lib.h"
+#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
+
+
+#include "PHY/phy_vars.h"
+#include "SCHED/sched_common_vars.h"
+#include "PHY/TOOLS/phy_scope_interface.h"
+#include "common/utils/LOG/log.h"
+#include "common/utils/LOG/vcd_signal_dumper.h"
+#include "PHY/INIT/phy_init.h"
+#include "openair2/ENB_APP/enb_paramdef.h"
+#include "system.h"
+
+#include
+#include
+#include
+
+static int DEFBANDS[] = {7};
+static int DEFENBS[] = {0};
+static int DEFBFW[] = {0x00007fff};
+
+THREAD_STRUCT thread_struct;
+
+pthread_cond_t sync_cond;
+pthread_mutex_t sync_mutex;
+int sync_var=-1; //!< protected by mutex \ref sync_mutex.
+int config_sync_var=-1;
+
+volatile int oai_exit = 0;
+uint16_t sf_ahead = 4;
+RU_t ru_m;
+
+
+extern void init_RU0(RU_t *ru,int ru_id,char *rf_config_file, int send_dmrssync);
+extern void init_RU_proc(RU_t *ru);
+extern void kill_RU_proc(RU_t *ru);
+extern void set_function_spec_param(RU_t *ru);
+
+int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
+
+
+void nfapi_setmode(nfapi_mode_t nfapi_mode) { return; }
+void exit_function(const char *file, const char *function, const int line, const char *s) {
+
+ if (s != NULL) {
+ printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
+ }
+ close_log_mem();
+ oai_exit = 1;
+
+ if (ru_m.rfdevice.trx_end_func) {
+ ru_m.rfdevice.trx_end_func(&ru_m.rfdevice);
+ ru_m.rfdevice.trx_end_func = NULL;
+ }
+
+ if (ru_m.ifdevice.trx_end_func) {
+ ru_m.ifdevice.trx_end_func(&ru_m.ifdevice);
+ ru_m.ifdevice.trx_end_func = NULL;
+ }
+
+ pthread_mutex_destroy(ru_m.ru_mutex);
+ pthread_cond_destroy(ru_m.ru_cond);
+ sleep(1); //allow lte-softmodem threads to exit first
+ exit(1);
+}
+
+
+static void get_options(void) {
+ CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
+ get_common_options(SOFTMODEM_ENB_BIT );
+ CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
+
+ //RCConfig();
+
+}
+
+
+
+
+
+extern void phy_free_RU(RU_t *);
+
+nfapi_mode_t nfapi_getmode(void) {
+ return(NFAPI_MODE_PNF);
+}
+
+void oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
+
+ AssertFatal(1==0,"This is bad ... please check why we get here\n");
+}
+
+void wait_eNBs(void){ return; }
+
+uint64_t downlink_frequency[MAX_NUM_CCs][4];
+
+
+int main ( int argc, char **argv )
+{
+
+ if ( load_configmodule(argc,argv,0) == NULL) {
+ exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
+ }
+
+ logInit();
+ printf("Reading in command-line options\n");
+ get_options ();
+
+ if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
+ fprintf(stderr,"Getting configuration failed\n");
+ exit(-1);
+ }
+
+#if T_TRACER
+ T_Config_Init();
+#endif
+ printf("configuring for RRU\n");
+
+#ifndef PACKAGE_VERSION
+# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
+#endif
+ LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
+
+ /* Read configuration */
+
+ printf("About to Init RU threads\n");
+
+
+ RU_t *ru=&ru_m;
+
+ paramdef_t RUParams[] = RUPARAMS_DESC;
+ paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
+ config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
+
+ int j=0;
+ uint64_t ru_mask=1;
+ pthread_mutex_t ru_mutex; pthread_mutex_init(&ru_mutex,NULL);
+ pthread_cond_t ru_cond; pthread_cond_init(&ru_cond,NULL);
+
+ ru->ru_mask= &ru_mask;
+ ru->ru_mutex = &ru_mutex;
+ ru->ru_cond = &ru_cond;
+
+ ru->if_timing = synch_to_ext_device;
+ ru->num_eNB = 0;
+ ru->has_ctrl_prt = 1;
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_ADDRS)) {
+ ru->openair0_cfg.sdr_addrs = strdup(*(RUParamList.paramarray[j][RU_SDR_ADDRS].strptr));
+ }
+
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) {
+ if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) {
+ ru->openair0_cfg.clock_source = internal;
+ LOG_D(PHY, "RU clock source set as internal\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) {
+ ru->openair0_cfg.clock_source = external;
+ LOG_D(PHY, "RU clock source set as external\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) {
+ ru->openair0_cfg.clock_source = gpsdo;
+ LOG_D(PHY, "RU clock source set as gpsdo\n");
+ } else {
+ LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
+ }
+ }
+ else {
+ ru->openair0_cfg.clock_source = unset;
+ }
+
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) {
+ if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) {
+ ru->openair0_cfg.time_source = internal;
+ LOG_D(PHY, "RU time source set as internal\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) {
+ ru->openair0_cfg.time_source = external;
+ LOG_D(PHY, "RU time source set as external\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) {
+ ru->openair0_cfg.time_source = gpsdo;
+ LOG_D(PHY, "RU time source set as gpsdo\n");
+ } else {
+ LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
+ }
+ }
+ else {
+ ru->openair0_cfg.time_source = unset;
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
+ if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
+ AssertFatal(1==0,"IF_NAME is required\n");
+ } else {
+ ru->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
+ ru->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
+ ru->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
+ ru->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
+ ru->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
+
+ // Check if control port set
+ if (!(config_isparamset(RUParamList.paramarray[j],RU_REMOTE_PORTC_IDX)) ) {
+ printf("Removing control port for RU %d\n",j);
+ ru->has_ctrl_prt = 0;
+ } else {
+ ru->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
+ ru->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
+ printf(" Control port %u \n",ru->eth_params.my_portc);
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF5;
+ ru->eth_params.transp_preference = ETH_UDP_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF5;
+ ru->eth_params.transp_preference = ETH_RAW_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF4p5;
+ ru->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF4p5;
+ ru->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j);
+ }
+
+ printf("RU %d is_slave=%s\n",j,*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr));
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru->is_slave=1;
+ else ru->is_slave=0;
+
+ printf("RU %d ota_sync_enabled=%s\n",j,*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr));
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr), "yes") == 0) ru->ota_sync_enable=1;
+ else ru->ota_sync_enable=0;
+ }
+
+ ru->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
+ ru->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
+ ru->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
+ /* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */
+ ru->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr);
+
+ for (int i=0; inum_bands; i++) ru->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
+ } //strcmp(local_rf, "yes") == 0
+ else {
+ printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr));
+ ru->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
+ ru->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
+ ru->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
+ ru->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
+ ru->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
+ ru->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
+ ru->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
+ ru->if_south = REMOTE_IF5;
+ ru->function = NGFI_RAU_IF5;
+ ru->eth_params.transp_preference = ETH_UDP_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
+ ru->if_south = REMOTE_IF5;
+ ru->function = NGFI_RAU_IF5;
+ ru->eth_params.transp_preference = ETH_RAW_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
+ ru->if_south = REMOTE_IF4p5;
+ ru->function = NGFI_RAU_IF4p5;
+ ru->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
+ ru->if_south = REMOTE_IF4p5;
+ ru->function = NGFI_RAU_IF4p5;
+ ru->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru->is_slave=1;
+ else ru->is_slave=0;
+ } /* strcmp(local_rf, "yes") != 0 */
+
+ ru->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
+ ru->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
+ ru->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
+ ru->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
+
+
+ set_worker_conf("WORKER_ENABLE");
+
+ mlockall(MCL_CURRENT | MCL_FUTURE);
+ pthread_cond_init(&sync_cond,NULL);
+ pthread_mutex_init(&sync_mutex, NULL);
+
+ init_RU0(ru,0,get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync);
+ ru->rf_map.card=0;
+ ru->rf_map.chain=(get_softmodem_params()->chain_offset);
+
+ LOG_I(PHY, "Initializing RRU descriptor : (%s,%s,%d)\n", ru_if_types[ru->if_south], NB_timing[ru->if_timing], ru->function);
+ set_function_spec_param(ru);
+ LOG_I(PHY, "Starting ru_thread , is_slave %d, send_dmrs %d\n", ru->is_slave, ru->generate_dmrs_sync);
+ init_RU_proc(ru);
+
+ pthread_mutex_lock(&ru_mutex);
+ while (ru_mask>0)
+ pthread_cond_wait(&ru_cond,&ru_mutex);
+ pthread_mutex_unlock(&ru_mutex);
+ LOG_I(PHY,"RU configured, unlocking threads\n");
+ config_sync_var=0;
+ pthread_mutex_lock(&sync_mutex);
+ sync_var=0;
+ pthread_cond_broadcast(&sync_cond);
+ pthread_mutex_unlock(&sync_mutex);
+
+ while (oai_exit==0) sleep(1);
+ // stop threads
+
+ kill_RU_proc(ru);
+ phy_free_RU(ru);
+
+ free_lte_top();
+ end_configmodule();
+
+ if (ru->rfdevice.trx_end_func) {
+ ru->rfdevice.trx_end_func(&ru->rfdevice);
+ ru->rfdevice.trx_end_func = NULL;
+ }
+
+ if (ru->ifdevice.trx_end_func) {
+ ru->ifdevice.trx_end_func(&ru->ifdevice);
+ ru->ifdevice.trx_end_func = NULL;
+ }
+
+
+
+ logClean();
+ printf("Bye.\n");
+ return 0;
+}
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index 410c41d9b1..5e46f0b6f8 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -131,7 +131,7 @@ void tx_func(void *param) {
}
void rx_func(void *param) {
- //printf("inside rx func. \n");
+
processingData_L1_t *info = (processingData_L1_t *) param;
PHY_VARS_gNB *gNB = info->gNB;
int frame_rx = info->frame_rx;
@@ -228,18 +228,6 @@ void rx_func(void *param) {
rnti_to_remove_count = 0;
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
- // Call the scheduler
-
- if(NFAPI_MODE == NFAPI_MONOLITHIC)
- {
- pthread_mutex_lock(&gNB->UL_INFO_mutex);
- gNB->UL_INFO.frame = frame_rx;
- gNB->UL_INFO.slot = slot_rx;
- gNB->UL_INFO.module_id = gNB->Mod_id;
- gNB->UL_INFO.CC_id = gNB->CC_id;
- gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
- pthread_mutex_unlock(&gNB->UL_INFO_mutex);
- }
// RX processing
int tx_slot_type; int rx_slot_type;
if(NFAPI_MODE != NFAPI_MONOLITHIC) { //slot selection routines not working properly in nfapi, so temporarily hardcoding
@@ -277,19 +265,32 @@ void rx_func(void *param) {
L1_nr_prach_procedures(gNB,frame_rx,slot_rx);
//apply the rx signal rotation here
- apply_nr_rotation_ul(&gNB->frame_parms,
- gNB->common_vars.rxdataF[0],
- slot_rx,
- 0,
- gNB->frame_parms.Ncp==EXTENDED?12:14,
- gNB->frame_parms.ofdm_symbol_size);
-
+ for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
+ apply_nr_rotation_ul(&gNB->frame_parms,
+ gNB->common_vars.rxdataF[aa],
+ slot_rx,
+ 0,
+ gNB->frame_parms.Ncp==EXTENDED?12:14,
+ gNB->frame_parms.ofdm_symbol_size);
+ }
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
}
stop_meas( &softmodem_stats_rxtx_sf );
LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx);
+ // Call the scheduler
+
+ start_meas(&gNB->ul_indication_stats);
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+ gNB->UL_INFO.frame = frame_rx;
+ gNB->UL_INFO.slot = slot_rx;
+ gNB->UL_INFO.module_id = gNB->Mod_id;
+ gNB->UL_INFO.CC_id = gNB->CC_id;
+ gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
+ pthread_mutex_unlock(&gNB->UL_INFO_mutex);
+ stop_meas(&gNB->ul_indication_stats);
+
notifiedFIFO_elt_t *res;
if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) {
@@ -349,18 +350,24 @@ static void *process_stats_thread(void *param) {
PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
+ reset_meas(&gNB->phy_proc_tx);
reset_meas(&gNB->dlsch_encoding_stats);
- reset_meas(&gNB->dlsch_scrambling_stats);
- reset_meas(&gNB->dlsch_modulation_stats);
+ reset_meas(&gNB->phy_proc_rx);
+ reset_meas(&gNB->ul_indication_stats);
+ reset_meas(&gNB->rx_pusch_stats);
+ reset_meas(&gNB->ulsch_decoding_stats);
wait_sync("process_stats_thread");
while(!oai_exit)
{
sleep(1);
- print_meas(&gNB->dlsch_encoding_stats, "pdsch_encoding", NULL, NULL);
- print_meas(&gNB->dlsch_scrambling_stats, "pdsch_scrambling", NULL, NULL);
- print_meas(&gNB->dlsch_modulation_stats, "pdsch_modulation", NULL, NULL);
+ print_meas(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL);
+ print_meas(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL);
+ print_meas(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL);
+ print_meas(&gNB->ul_indication_stats, "UL Indication", NULL, NULL);
+ print_meas(&gNB->rx_pusch_stats, "PUSCH inner-receiver", NULL, NULL);
+ print_meas(&gNB->ulsch_decoding_stats, "PUSCH decoding", NULL, NULL);
}
return(NULL);
}
@@ -373,7 +380,9 @@ void init_gNB_Tpool(int inst) {
// ULSCH decoding threadpool
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
int numCPU = sysconf(_SC_NPROCESSORS_ONLN);
+ LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->pusch_proc_threads,numCPU);
int threadCnt = min(numCPU, gNB->pusch_proc_threads);
+ if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt);
char ul_pool[80];
sprintf(ul_pool,"-1");
int s_offset = 0;
@@ -446,6 +455,8 @@ void init_eNB_afterRU(void) {
PHY_VARS_gNB *gNB;
LOG_I(PHY,"%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst);
+ if(NFAPI_MODE == NFAPI_MODE_PNF)
+ RC.nb_nr_inst = 1;
for (inst=0; instabstraction_flag = 0;
gNB->single_thread_flag = single_thread_flag;
@@ -535,7 +544,7 @@ void init_gNB(int single_thread_flag,int wait_for_sync) {
}
- LOG_I(PHY,"[nr-softmodem.c] gNB structure allocated\n");
+ LOG_I(PHY,"[nr-gnb.c] gNB structure allocated\n");
}
diff --git a/executables/nr-ru.c b/executables/nr-ru.c
index 1e8cae3adc..5eff0f35b8 100644
--- a/executables/nr-ru.c
+++ b/executables/nr-ru.c
@@ -89,7 +89,7 @@ static int DEFBFW[] = {0x00007fff};
#include "s1ap_eNB.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
-
+#include
#include "T.h"
@@ -113,6 +113,7 @@ void configure_ru(int idx, void *arg);
void configure_rru(int idx, void *arg);
int attach_rru(RU_t *ru);
int connect_rau(RU_t *ru);
+static void NRRCconfig_RU(void);
uint16_t sf_ahead;
uint16_t slot_ahead;
@@ -120,7 +121,6 @@ uint16_t sl_ahead;
extern int emulate_rf;
extern int numerology;
-extern int usrp_tx_thread;
/*************************************************************/
/* Functions to attach and configure RRU */
@@ -757,17 +757,25 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
if (fp->freq_range==nr_FR2) {
// the beam index is written in bits 8-10 of the flags
// bit 11 enables the gpio programming
+ // currently we switch beams every 10 slots (should = 1 TDD period in FR2) and we take the beam index of the first symbol of the first slot of this period
int beam=0;
- //if (slot==0) beam = 11; //3 for boresight & 8 to enable
+ if (slot%10==0) {
+ if (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8) {
+ beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8;
+ }
+ }
/*
- if (slot==0 || slot==40) beam=0&8;
- if (slot==10 || slot==50) beam=1&8;
- if (slot==20 || slot==60) beam=2&8;
- if (slot==30 || slot==70) beam=3&8;
+ if (slot==0 || slot==40) beam=0|8;
+ if (slot==10 || slot==50) beam=1|8;
+ if (slot==20 || slot==60) beam=2|8;
+ if (slot==30 || slot==70) beam=3|8;
*/
flags |= beam<<8;
- }
+ LOG_D(HW,"slot %d, beam %d\n",slot,ru->common.beam_id[0][slot*fp->symbols_per_slot]);
+
+ }
+
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS, flags );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, slot );
@@ -1370,12 +1378,17 @@ void *ru_thread( void *param ) {
for (aa=0;aanb_rx;aa++)
memcpy((void*)RC.gNB[0]->common_vars.rxdataF[aa],
(void*)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t));
-
+ if (IS_SOFTMODEM_DOSCOPE && RC.gNB[0]->scopeData)
+ ((scopeData_t*)RC.gNB[0]->scopeData)->slotFunc(ru->common.rxdataF[0],proc->tti_rx, RC.gNB[0]->scopeData);
// Do PRACH RU processing
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
uint8_t prachStartSymbol,N_dur;
if (prach_id>=0) {
+
+ T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0),
+ T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2));
+
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
/*
get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value,
@@ -1755,11 +1768,9 @@ void set_function_spec_param(RU_t *ru) {
ru->nr_start_if = NULL; // no if interface
ru->rfdevice.host_type = RAU_HOST;
- // FK this here looks messed up. The following lines should be part of the if (ru->function == gNodeB_3GPP), shouldn't they?
-
- ru->fh_south_in = rx_rf; // local synchronous RF RX
- ru->fh_south_out = tx_rf; // local synchronous RF TX
- ru->start_rf = start_rf; // need to start the local RF interface
+ ru->fh_south_in = rx_rf; // local synchronous RF RX
+ ru->fh_south_out = tx_rf; // local synchronous RF TX
+ ru->start_rf = start_rf; // need to start the local RF interface
ru->stop_rf = stop_rf;
ru->start_write_thread = start_write_thread; // starting RF TX in different thread
printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf);
@@ -1861,7 +1872,7 @@ void init_NR_RU(char *rf_config_file)
pthread_cond_init(&RC.ru_cond,NULL);
// read in configuration file)
printf("configuring RU from file\n");
- RCconfig_RU();
+ NRRCconfig_RU();
LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_nr_L1_inst,RC.nb_RU,get_nprocs());
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
@@ -1936,7 +1947,7 @@ void stop_RU(int nb_ru)
/* --------------------------------------------------------*/
/* from here function to use configuration module */
-void RCconfig_RU(void)
+static void NRRCconfig_RU(void)
{
int i = 0, j = 0;
paramdef_t RUParams[] = RUPARAMS_DESC;
diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h
index 500819e684..813ffcf8fa 100644
--- a/executables/nr-softmodem-common.h
+++ b/executables/nr-softmodem-common.h
@@ -68,11 +68,15 @@
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
#define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
#define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
-#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
+#define CONFIG_HLP_DLMCS_PHYTEST "Set the downlink MCS for PHYTEST mode\n"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
-#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
+#define CONFIG_HLP_ULMCS_PHYTEST "Set the uplink MCS for PHYTEST mode\n"
+#define CONFIG_HLP_DLBW_PHYTEST "Set the number of PRBs used for DLSCH in PHYTEST mode\n"
+#define CONFIG_HLP_ULBW_PHYTEST "Set the number of PRBs used for ULSCH in PHYTEST mode\n"
+#define CONFIG_HLP_DLBM_PHYTEST "Bitmap for DLSCH slots (slot 0 starts at LSB)\n"
+#define CONFIG_HLP_ULBM_PHYTEST "Bitmap for ULSCH slots (slot 0 starts at LSB)\n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index 69fc3c554d..353751a66a 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -85,6 +85,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "x2ap_eNB.h"
#include "ngap_gNB.h"
#include "gnb_paramdef.h"
+#include
#include "nfapi/oai_integration/vendor_ext.h"
pthread_cond_t nfapi_sync_cond;
@@ -92,11 +93,12 @@ pthread_mutex_t nfapi_sync_mutex;
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
extern uint8_t nfapi_mode; // Default to monolithic mode
-
+THREAD_STRUCT thread_struct;
pthread_cond_t sync_cond;
pthread_mutex_t sync_mutex;
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
int config_sync_var=-1;
+msc_interface_t msc_interface;
volatile int start_gNB = 0;
volatile int oai_exit = 0;
@@ -114,7 +116,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
//Temp fix for inexistent NR upper layer
unsigned char NB_gNB_INST = 1;
-static char *itti_dump_file = NULL;
int UE_scan = 1;
int UE_scan_carrier = 0;
@@ -160,15 +161,18 @@ int otg_enabled;
//static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
//static nfapi_nr_config_request_t *config[MAX_NUM_CCs];
-uint32_t target_dl_mcs = 28; //maximum allowed mcs
-uint32_t target_ul_mcs = 20;
uint32_t timing_advance = 0;
uint64_t num_missed_slots=0; // counter for the number of missed slots
+#include
int split73=0;
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
AssertFatal(false, "Must not be called in this context\n");
}
+void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask, uint16_t rnti, int32_t stat) {
+ AssertFatal(false, "Must not be called in this context\n");
+}
+
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
@@ -179,7 +183,6 @@ extern void *udp_eNB_task(void *args_p);
int transmission_mode=1;
int emulate_rf = 0;
int numerology = 0;
-int usrp_tx_thread = 0;
static char *parallel_config = NULL;
@@ -717,12 +720,11 @@ if(!IS_SOFTMODEM_NOS1)
if(IS_SOFTMODEM_NOS1)
init_pdcp();
+ if (RC.nb_nr_L1_inst > 0)
+ RCconfig_NR_L1();
if (RC.nb_nr_inst > 0) {
// don't create if node doesn't connect to RRC/S1/GTP
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
- } else {
- printf("No ITTI, Initializing L1\n");
- RCconfig_NR_L1();
}
/* Start the agent. If it is turned off in the configuration, it won't start */
@@ -810,7 +812,7 @@ if(!IS_SOFTMODEM_NOS1)
printf("RC.nb_RU:%d\n", RC.nb_RU);
// once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
printf("ALL RUs ready - init gNBs\n");
- if(IS_SOFTMODEM_DOFORMS) {
+ if(IS_SOFTMODEM_DOSCOPE) {
sleep(1);
scopeParms_t p;
p.argc=&argc;
diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h
index d6cfe6b906..928558013c 100644
--- a/executables/nr-softmodem.h
+++ b/executables/nr-softmodem.h
@@ -18,19 +18,27 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_PARAMS_DESC_GNB { \
- {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
- {"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
- {"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
- {"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
+ {"m" , CONFIG_HLP_DLMCS_PHYTEST,0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
+ {"t" , CONFIG_HLP_ULMCS_PHYTEST,0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
+ {"M" , CONFIG_HLP_DLBW_PHYTEST,0, uptr:&target_dl_bw, defintval:0, TYPE_UINT, 0}, \
+ {"T" , CONFIG_HLP_ULBW_PHYTEST,0, uptr:&target_ul_bw, defintval:0, TYPE_UINT, 0}, \
+ {"D" , CONFIG_HLP_DLBM_PHYTEST,0, u64ptr:&dlsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \
+ {"U" , CONFIG_HLP_ULBM_PHYTEST,0, u64ptr:&ulsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
}
#include "threads_t.h"
extern threads_t threads;
+extern uint32_t target_dl_mcs;
+extern uint32_t target_ul_mcs;
+extern uint32_t target_dl_bw;
+extern uint32_t target_ul_bw;
+extern uint64_t dlsch_slot_bitmap;
+extern uint64_t ulsch_slot_bitmap;
// In nr-gnb.c
extern void init_gNB(int single_thread_flag,int wait_for_sync);
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index f175ab4980..a35a11a033 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -27,6 +27,8 @@
#include "SCHED_NR_UE/phy_frame_config_nr.h"
#include "SCHED_NR_UE/defs.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
+#include "executables/softmodem-common.h"
+#include "SCHED_NR_UE/pucch_uci_ue_nr.h"
/*
* NR SLOT PROCESSING SEQUENCE
@@ -90,6 +92,8 @@
#else
#define DURATION_RX_TO_TX (6) /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */
#endif
+#define RX_JOB_ID 0x1010
+#define TX_JOB_ID 100
typedef enum {
pss = 0,
@@ -107,6 +111,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
ue->Mod_id = UE_id;
ue->mac_enabled = 1;
ue->if_inst = nr_ue_if_module_init(0);
+ ue->dci_thres = 0;
// Setting UE mode to NOT_SYNCHED by default
for (gNB_id = 0; gNB_id < nb_connected_gNB; gNB_id++){
@@ -129,10 +134,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
* \param arg is a pointer to a \ref PHY_VARS_NR_UE structure.
*/
-typedef struct syncData_s {
- UE_nr_rxtx_proc_t proc;
- PHY_VARS_NR_UE *UE;
-} syncData_t;
+typedef nr_rxtx_thread_data_t syncData_t;
static void UE_synch(void *arg) {
syncData_t *syncD=(syncData_t *) arg;
@@ -279,7 +281,11 @@ static void UE_synch(void *arg) {
}
}
-void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
+void processSlotTX(void *arg) {
+
+ nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
+ UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
+ PHY_VARS_NR_UE *UE = rxtxD->UE;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
@@ -310,10 +316,14 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
}
}
-void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
+void processSlotRX(void *arg) {
+ nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
+ UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
+ PHY_VARS_NR_UE *UE = rxtxD->UE;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_slot_rx);
+ int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){
@@ -329,7 +339,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL );
#else
uint64_t a=rdtsc();
- phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel);
+ phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel, &rxtxD->txFifo);
LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500);
#endif
@@ -338,35 +348,47 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0);
pdcp_run(&ctxt);
+
+ /* send tick to RLC and PDCP every ms */
+ if (proc->nr_slot_rx % UE->frame_parms.slots_per_subframe == 0) {
+ void nr_rlc_tick(int frame, int subframe);
+ void nr_pdcp_tick(int frame, int subframe);
+ nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe);
+ nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe);
+ }
}
+
+ // Wait for PUSCH processing to finish
+ notifiedFIFO_elt_t *res;
+ res = pullTpool(&rxtxD->txFifo,&(get_nrUE_params()->Tpool));
+ delNotifiedFIFO_elt(res);
+
+ } else {
+ processSlotTX(rxtxD);
}
-}
+ if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){
+ if (UE->UE_mode[gNB_id] <= PUSCH) {
+ if (get_softmodem_params()->usim_test==0) {
+ pucch_procedures_ue_nr(UE,
+ gNB_id,
+ proc,
+ FALSE);
+ }
-/*!
- * \brief This is the UE thread for RX subframe n and TX subframe n+4.
- * This thread performs the phy_procedures_UE_RX() on every received slot.
- * then, if TX is enabled it performs TX for n+4.
- * \param arg is a pointer to a \ref PHY_VARS_NR_UE structure.
- * \returns a pointer to an int. The storage is not on the heap and must not be freed.
- */
+ LOG_D(PHY, "Sending Uplink data \n");
+ nr_ue_pusch_common_procedures(UE,
+ proc->nr_slot_tx,
+ &UE->frame_parms,1);
+ }
-typedef struct processingData_s {
- UE_nr_rxtx_proc_t proc;
- PHY_VARS_NR_UE *UE;
-} processingData_t;
-
-void UE_processing(void *arg) {
- processingData_t *rxtxD = (processingData_t *) arg;
- UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
- PHY_VARS_NR_UE *UE = rxtxD->UE;
- int slot_tx = proc->nr_slot_tx;
- int frame_tx = proc->frame_tx;
-
- processSlotRX(UE, proc);
- processSlotTX(UE, proc);
- ue_ta_procedures(UE, slot_tx, frame_tx);
+ if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) {
+ nr_ue_prach_procedures(UE, proc, gNB_id);
+ }
+ LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx);
+ }
+ ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx);
}
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
@@ -483,25 +505,44 @@ void *UE_thread(void *arg) {
int start_rx_stream = 0;
AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), "");
UE->rfdevice.host_type = RAU_HOST;
+ UE->lost_sync = 0;
+ UE->is_synchronized = 0;
AssertFatal(UE->rfdevice.trx_start_func(&UE->rfdevice) == 0, "Could not start the device\n");
+
notifiedFIFO_t nf;
initNotifiedFIFO(&nf);
- int nbSlotProcessing=0;
- int thread_idx=0;
+
notifiedFIFO_t freeBlocks;
initNotifiedFIFO_nothreadSafe(&freeBlocks);
+
+ int nbSlotProcessing=0;
+ int thread_idx=0;
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
int timing_advance = UE->timing_advance;
- for (int i=0; iframe_parms.slots_per_frame;
int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0;
+ for (int i=0; itxFifo);
+ pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt);
+ }
+
while (!oai_exit) {
+ if (UE->lost_sync) {
+ int nb = abortTpool(&(get_nrUE_params()->Tpool),RX_JOB_ID);
+ nb += abortNotifiedFIFO(&nf, RX_JOB_ID);
+ LOG_I(PHY,"Number of aborted slots %d\n",nb);
+ for (int i=0; iis_synchronized = 0;
+ UE->lost_sync = 0;
+ }
+
if (syncRunning) {
notifiedFIFO_elt_t *res=tryPullTpool(&nf,&(get_nrUE_params()->Tpool));
@@ -511,9 +552,10 @@ void *UE_thread(void *arg) {
if (UE->is_synchronized) {
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
// shift the frame index with all the frames we trashed meanwhile we perform the synch search
- decoded_frame_rx=(decoded_frame_rx + (!UE->init_sync_frame) + trashed_frames) % MAX_FRAME_NUMBER;
+ decoded_frame_rx=(decoded_frame_rx + UE->init_sync_frame + trashed_frames) % MAX_FRAME_NUMBER;
}
delNotifiedFIFO_elt(res);
+ start_rx_stream=0;
} else {
readFrame(UE, ×tamp, true);
trashed_frames+=2;
@@ -560,13 +602,13 @@ void *UE_thread(void *arg) {
// whatever means thread_idx
// Fix me: will be wrong when slot 1 is slow, as slot 2 finishes
- // Slot 3 will overlap if RX_NB_TH is 2
+ // Slot 3 will overlap if NR_RX_NB_TH is 2
// this is general failure in UE !!!
- thread_idx = absolute_slot % RX_NB_TH;
+ thread_idx = absolute_slot % NR_RX_NB_TH;
int slot_nr = absolute_slot % nb_slot_frame;
notifiedFIFO_elt_t *msgToPush;
- AssertFatal((msgToPush=pullNotifiedFIFO_nothreadSafe(&freeBlocks)) != NULL,"chained list failure");
- processingData_t *curMsg=(processingData_t *)NotifiedFifoData(msgToPush);
+ AssertFatal((msgToPush=pullTpool(&freeBlocks,&(get_nrUE_params()->Tpool))) != NULL,"chained list failure");
+ nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(msgToPush);
curMsg->UE=UE;
// update thread index for received subframe
curMsg->proc.thread_id = thread_idx;
@@ -594,18 +636,18 @@ void *UE_thread(void *arg) {
for (int i=0; iframe_parms.nb_antennas_tx; i++)
txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp(
- ((slot_nr + DURATION_RX_TO_TX - RX_NB_TH)%nb_slot_frame),&UE->frame_parms,0)];
+ ((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH)%nb_slot_frame),&UE->frame_parms,0)];
int readBlockSize, writeBlockSize;
if (slot_nr<(nb_slot_frame - 1)) {
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms);
- writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms);
+ writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH) % nb_slot_frame, &UE->frame_parms);
} else {
UE->rx_offset_diff = computeSamplesShift(UE);
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) -
UE->rx_offset_diff;
- writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms)- UE->rx_offset_diff;
+ writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH) % nb_slot_frame, &UE->frame_parms)- UE->rx_offset_diff;
}
AssertFatal(readBlockSize ==
@@ -632,31 +674,33 @@ void *UE_thread(void *arg) {
}
curMsg->proc.timestamp_tx = timestamp+
- UE->frame_parms.get_samples_slot_timestamp(slot_nr,
- &UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp;
+ UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX)
+ - firstSymSamp;
notifiedFIFO_elt_t *res;
- while (nbSlotProcessing >= RX_NB_TH) {
+ while (nbSlotProcessing >= NR_RX_NB_TH) {
res=pullTpool(&nf, &(get_nrUE_params()->Tpool));
nbSlotProcessing--;
- processingData_t *tmp=(processingData_t *)res->msgData;
+ nr_rxtx_thread_data_t *tmp=(nr_rxtx_thread_data_t *)res->msgData;
if (tmp->proc.decoded_frame_rx != -1)
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
- else
+ else
decoded_frame_rx=-1;
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
}
- if ( decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx)
+ if (decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx)
LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
- decoded_frame_rx, curMsg->proc.frame_rx );
+ decoded_frame_rx, curMsg->proc.frame_rx);
// use previous timing_advance value to compute writeTimestamp
- writeTimestamp = timestamp + UE->frame_parms.get_samples_slot_timestamp(slot_nr, &UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) -
- firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance;
+ writeTimestamp = timestamp+
+ UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX
+ - NR_RX_NB_TH) - firstSymSamp - openair0_cfg[0].tx_sample_advance -
+ UE->N_TA_offset - timing_advance;
// but use current UE->timing_advance value to compute writeBlockSize
if (UE->timing_advance != timing_advance) {
@@ -665,7 +709,7 @@ void *UE_thread(void *arg) {
}
int flags = 0;
- int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH;
+ int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH;
if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) {
@@ -685,38 +729,21 @@ void *UE_thread(void *arg) {
}
if (flags || IS_SOFTMODEM_RFSIM)
- AssertFatal( writeBlockSize ==
- UE->rfdevice.trx_write_func(&UE->rfdevice,
- writeTimestamp,
- txp,
- writeBlockSize,
- UE->frame_parms.nb_antennas_tx,
- flags),"");
+ AssertFatal(writeBlockSize ==
+ UE->rfdevice.trx_write_func(&UE->rfdevice,
+ writeTimestamp,
+ txp,
+ writeBlockSize,
+ UE->frame_parms.nb_antennas_tx,
+ flags),"");
for (int i=0; iframe_parms.nb_antennas_tx; i++)
memset(txp[i], 0, writeBlockSize);
nbSlotProcessing++;
- msgToPush->key=slot_nr;
+ LOG_D(PHY,"Number of slots being processed at the moment: %d\n",nbSlotProcessing);
pushTpool(&(get_nrUE_params()->Tpool), msgToPush);
- if (IS_SOFTMODEM_RFSIM) { //getenv("RFSIMULATOR")
- // FixMe: Wait previous thread is done, because race conditions seems too bad
- // in case of actual RF board, the overlap between threads mitigate the issue
- // We must receive one message, that proves the slot processing is done
- res=pullTpool(&nf, &(get_nrUE_params()->Tpool));
- nbSlotProcessing--;
- processingData_t *tmp=(processingData_t *)res->msgData;
-
- if (tmp->proc.decoded_frame_rx != -1)
- decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
- else
- decoded_frame_rx=-1;
- //decoded_frame_rx=tmp->proc.decoded_frame_rx;
-
- pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
- }
-
} // while !oai_exit
return NULL;
@@ -731,23 +758,6 @@ void init_NR_UE(int nb_inst, char* rrc_config_path) {
AssertFatal((rrc_inst = nr_l3_init_ue(rrc_config_path)) != NULL, "can not initialize RRC module\n");
AssertFatal((mac_inst = nr_l2_init_ue(rrc_inst)) != NULL, "can not initialize L2 module\n");
AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initialize IF module\n");
-
- NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
- if (mac_inst->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) {
- pusch_TimeDomainAllocationList = mac_inst->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup;
- }
- else if (mac_inst->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
- pusch_TimeDomainAllocationList = mac_inst->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
- }
-
- if (pusch_TimeDomainAllocationList) {
- for(int i = 0; i < pusch_TimeDomainAllocationList->list.count; i++) {
- AssertFatal(*pusch_TimeDomainAllocationList->list.array[i]->k2 >= DURATION_RX_TO_TX,
- "Slot offset K2 (%ld) cannot be less than DURATION_RX_TO_TX (%d)\n",
- *pusch_TimeDomainAllocationList->list.array[i]->k2,
- DURATION_RX_TO_TX);
- }
- }
}
}
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 2854457eee..83b3d433aa 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -82,12 +82,14 @@ unsigned short config_frames[4] = {2,9,11,13};
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
#include "PHY/TOOLS/phy_scope_interface.h"
#include "PHY/TOOLS/nr_phy_scope.h"
-#define NRUE_MAIN
#include
#include "executables/softmodem-common.h"
#include "executables/thread-common.h"
extern const char *duplex_mode[];
+msc_interface_t msc_interface;
+THREAD_STRUCT thread_struct;
+nrUE_params_t nrUE_params;
// Thread variables
pthread_cond_t nfapi_sync_cond;
@@ -145,7 +147,7 @@ int chain_offset = 0;
int card_offset = 0;
uint64_t num_missed_slots = 0; // counter for the number of missed slots
int transmission_mode = 1;
-int usrp_tx_thread = 0;
+int numerology = 0;
int oaisim_flag = 0;
int emulate_rf = 0;
@@ -179,6 +181,23 @@ void print_difftimes(void) {
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
}
+int create_tasks_nrue(uint32_t ue_nb) {
+ LOG_D(NR_RRC, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb);
+ itti_wait_ready(1);
+
+ if (ue_nb > 0) {
+ LOG_I(NR_RRC,"create TASK_RRC_NRUE \n");
+ if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
+ LOG_E(NR_RRC, "Create task for RRC UE failed\n");
+ return -1;
+ }
+
+ }
+
+ itti_wait_ready(0);
+ return 0;
+}
+
void exit_function(const char *file, const char *function, const int line, const char *s) {
int CC_id;
@@ -213,9 +232,16 @@ nrUE_params_t *get_nrUE_params(void) {
}
/* initialie thread pools used for NRUE processing paralleliation */
void init_tpools(uint8_t nun_dlsch_threads) {
- char *params=calloc(1,(RX_NB_TH*3)+1);
- for (int i=0; i TO TERMINATE\n");
+
+ if (create_tasks_nrue(1) < 0) {
+ printf("cannot create ITTI tasks\n");
+ exit(-1); // need a softer mode
+ }
+
// Sleep a while before checking all parameters have been used
// Some are used directly in external threads, asynchronously
sleep(20);
diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h
index 5902c8cca8..5c082b7bbb 100644
--- a/executables/nr-uesoftmodem.h
+++ b/executables/nr-uesoftmodem.h
@@ -72,9 +72,6 @@ extern uint64_t get_nrUE_optmask(void);
extern uint64_t set_nrUE_optmask(uint64_t bitmask);
extern nrUE_params_t *get_nrUE_params(void);
-#ifdef NRUE_MAIN
-nrUE_params_t nrUE_params;
-#endif
// In nr-ue.c
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c
index 4ddc7870d9..326f7d277f 100644
--- a/executables/ocp-gnb.c
+++ b/executables/ocp-gnb.c
@@ -61,8 +61,6 @@ uint32_t do_forms=0;
unsigned int mmapped_dma=0;
int8_t threequarter_fs=0;
-uint32_t target_dl_mcs = 28; //maximum allowed mcs
-uint32_t target_ul_mcs = 20;
int chain_offset=0;
uint16_t sl_ahead=6;
uint16_t sf_ahead=6;
@@ -70,16 +68,15 @@ uint32_t timing_advance = 0;
int transmission_mode=1;
int emulate_rf = 0;
int numerology = 0;
-int usrp_tx_thread = 0;
int config_sync_var=-1;
pthread_mutex_t nfapi_sync_mutex;
pthread_cond_t nfapi_sync_cond;
int nfapi_sync_var=-1;
-uint8_t nfapi_mode = NFAPI_MONOLITHIC; // Default to monolithic mode
double cpuf;
+THREAD_STRUCT thread_struct;
pthread_cond_t sync_cond;
pthread_mutex_t sync_mutex;
@@ -95,7 +92,8 @@ time_stats_t nfapi_meas; // total tx time
time_stats_t softmodem_stats_rx_sf; // total rx time
// not used but needed for link
openair0_config_t openair0_cfg[MAX_CARDS];
-
+uint16_t slot_ahead=6;
+msc_interface_t msc_interface;
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
int flexran_agent_start(mid_t mod_id) {
@@ -122,7 +120,6 @@ int restart_L1L2(module_id_t gnb_id) {
}
static int wait_for_sync = 0;
-static char *itti_dump_file = NULL;
static double snr_dB=20;
static int DEFBANDS[] = {7};
static int DEFENBS[] = {0};
@@ -996,7 +993,7 @@ int main( int argc, char **argv ) {
(void *)NULL, "time_meas", -1, OAI_PRIORITY_RT_LOW);
}
- if(IS_SOFTMODEM_DOFORMS) {
+ if(IS_SOFTMODEM_DOSCOPE) {
scopeParms_t tmp= {&argc, argv, &ru, RC.gNB[0]};
load_softscope("nr",&tmp);
}
diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c
index 1077c0e1ac..fa6b674765 100644
--- a/executables/softmodem-common.c
+++ b/executables/softmodem-common.c
@@ -45,6 +45,8 @@
static softmodem_params_t softmodem_params;
char *parallel_config=NULL;
char *worker_config=NULL;
+msc_interface_t msc_interface;
+int usrp_tx_thread = 0;
uint8_t nfapi_mode=0;
@@ -86,7 +88,7 @@ char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) {
void get_common_options(uint32_t execmask) {
uint32_t online_log_messages=0;
uint32_t glog_level=0 ;
- uint32_t start_telnetsrv = 0;
+ uint32_t start_telnetsrv = 0, start_telnetclt = 0;
uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0;
uint32_t rfsim = 0, basicsim = 0, do_forms = 0;
char *logmem_filename = NULL;
@@ -95,21 +97,26 @@ void get_common_options(uint32_t execmask) {
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
check_execmask(execmask);
config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
- config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
- sizeof(cmdline_logparams)/sizeof(paramdef_t));
- config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
-
- if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
+
+ int numparams=sizeof(cmdline_logparams)/sizeof(paramdef_t);
+ config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,numparams);
+ config_get( cmdline_logparams,numparams,NULL);
+
+ if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) {
set_glog_onlinelog(online_log_messages);
}
- if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
+ if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_LOGL_OPT))) {
set_glog(glog_level);
}
if (start_telnetsrv) {
load_module_shlib("telnetsrv",NULL,0,NULL);
}
+
+ if (start_telnetclt) {
+ set_softmodem_optmask(SOFTMODEM_TELNETCLT_BIT);
+ }
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
log_mem_filename = &logmem_filename[0];
@@ -140,7 +147,7 @@ void get_common_options(uint32_t execmask) {
}
if (do_forms) {
- set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT);
+ set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT);
}
if(parallel_config != NULL) set_parallel_conf(parallel_config);
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index 7a7be1de96..ad349d4d01 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -73,6 +73,7 @@ extern "C"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
#define CONFIG_HLP_256QAM "Use the 256 QAM mcs table for PDSCH\n"
+#define CONFIG_HLP_NONSTOP "Go back to frame sync mode after 100 consecutive PBCH failures\n"
//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
@@ -87,10 +88,13 @@ extern "C"
#define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n"
#define CONFIG_HLP_PARALLEL_CMD "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n"
#define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n"
+#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n"
+
#define CONFIG_HLP_NOS1 "Disable s1 interface\n"
#define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n"
#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
+#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n"
#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n"
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -114,9 +118,11 @@ extern "C"
#define USIM_TEST softmodem_params.usim_test
#define USE_256QAM_TABLE softmodem_params.use_256qam_table
#define NFAPI softmodem_params.nfapi
+#define NON_STOP softmodem_params.non_stop
#define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat";
+extern int usrp_tx_thread;
#define CMDLINE_PARAMS_DESC { \
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\
{"split73", CONFIG_HLP_SPLIT73, 0, strptr:(char **)&SPLIT73, defstrval:NULL, TYPE_STRING, sizeof(SPLIT73)},\
@@ -144,7 +150,9 @@ extern "C"
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
{"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \
+ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
+ {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \
}
@@ -153,23 +161,22 @@ extern "C"
#define CONFIG_HLP_LOGV "Set the global log verbosity \n"
#define CONFIG_HLP_TELN "Start embedded telnet server \n"
#define CONFIG_HLP_MSC "Enable the MSC tracing utility \n"
-/*----------------------------------------------------------------------------------------------------------------------------*/
-/* command line parameters for LOG utility */
-/* optname helpstr paramflags XXXptr defXXXval type numelt */
-/*----------------------------------------------------------------------------------------------------------------------------*/
+#define CONFIG_FLOG_OPT "R"
+#define CONFIG_LOGL_OPT "g"
+/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
+/* command line parameters for LOG utility */
+/* optname helpstr paramflags XXXptr defXXXval type numelt */
+/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
#define START_MSC softmodem_params.start_msc
#define CMDLINE_LOGPARAMS_DESC { \
- {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
- {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
- {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
- {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
- {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
+ {CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
+ {CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
+ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
+ {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
+ {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
+ {"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \
}
-#define CMDLINE_ONLINELOG_IDX 0
-#define CMDLINE_GLOGLEVEL_IDX 1
-#define CMDLINE_GLOGVERBO_IDX 2
-#define CMDLINE_STARTTELN_IDX 3
/* check function for global log level */
#define CMDLINE_LOGPARAMS_CHECK_DESC { \
@@ -178,6 +185,7 @@ extern "C"
{ .s5= {NULL} } , \
{ .s5= {NULL} } , \
{ .s5= {NULL} } , \
+ { .s5= {NULL} } , \
}
/***************************************************************************************************************************************/
@@ -188,8 +196,9 @@ extern "C"
#define SOFTMODEM_RFSIM_BIT (1<<10)
#define SOFTMODEM_BASICSIM_BIT (1<<11)
#define SOFTMODEM_SIML1_BIT (1<<12)
-#define SOFTMODEM_DOFORMS_BIT (1<<15)
+#define SOFTMODEM_DOSCOPE_BIT (1<<15)
#define SOFTMODEM_RECPLAY_BIT (1<<16)
+#define SOFTMODEM_TELNETCLT_BIT (1<<17)
#define SOFTMODEM_ENB_BIT (1<<20)
#define SOFTMODEM_GNB_BIT (1<<21)
#define SOFTMODEM_4GUE_BIT (1<<22)
@@ -204,8 +213,9 @@ extern "C"
#define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT)
#define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT)
#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
-#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT)
+#define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT)
#define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT)
+#define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT)
#define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT)
#define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT)
#define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT)
@@ -233,6 +243,7 @@ typedef struct {
uint32_t send_dmrs_sync;
int use_256qam_table;
uint8_t nfapi;
+ int non_stop;
} softmodem_params_t;
extern uint64_t get_softmodem_optmask(void);
@@ -244,6 +255,7 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
extern void set_softmodem_sighandler(void);
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
+extern int usrp_tx_thread;
extern uint16_t sl_ahead;
extern uint16_t sf_ahead;
extern volatile int oai_exit;
diff --git a/executables/thread-common.h b/executables/thread-common.h
index 6f3af3cfc0..0aaeb3c30e 100644
--- a/executables/thread-common.h
+++ b/executables/thread-common.h
@@ -3,7 +3,7 @@
#include "PHY/defs_common.h"
-THREAD_STRUCT thread_struct;
+extern THREAD_STRUCT thread_struct;
static inline void set_parallel_conf(char *parallel_conf) {
mapping config[]= {
diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c
index e744fcbb24..a2d2a2863e 100644
--- a/nfapi/oai_integration/nfapi_pnf.c
+++ b/nfapi/oai_integration/nfapi_pnf.c
@@ -73,7 +73,6 @@ extern pthread_mutex_t nfapi_sync_mutex;
extern int nfapi_sync_var;
extern int sync_var;
-char uecap_xer_in;
extern void init_eNB_afterRU(void);
extern void init_UE_stub(int nb_inst,int,int);
@@ -2202,7 +2201,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
- printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
+ printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n",
__FUNCTION__,config->vnf_ip_addr, config->vnf_p5_port,
pnf.phys[0].local_addr,
pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
@@ -2253,7 +2252,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
- printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
+ printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n",
__FUNCTION__,
config->vnf_ip_addr, config->vnf_p5_port,
pnf.phys[0].local_addr,
diff --git a/nfapi/oai_integration/nfapi_pnf.h b/nfapi/oai_integration/nfapi_pnf.h
index b3ab7cbdbc..61d4847eba 100644
--- a/nfapi/oai_integration/nfapi_pnf.h
+++ b/nfapi/oai_integration/nfapi_pnf.h
@@ -21,6 +21,7 @@
#if !defined(NFAPI_PNF_H__)
#define NFAPI_PNF_H__
+extern nfapi_ue_release_request_body_t release_rntis;
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c
index 485f17922f..7bbe51f3f0 100644
--- a/nfapi/oai_integration/nfapi_vnf.c
+++ b/nfapi/oai_integration/nfapi_vnf.c
@@ -239,6 +239,18 @@ void oai_enb_init(void) {
void oai_create_gnb(void) {
int bodge_counter=0;
+
+ if (RC.gNB == NULL) {
+ RC.gNB = (PHY_VARS_gNB **) calloc(1, sizeof(PHY_VARS_gNB *));
+ LOG_I(PHY,"gNB L1 structure RC.gNB allocated @ %p\n",RC.gNB);
+ }
+
+
+ if (RC.gNB[0] == NULL) {
+ RC.gNB[0] = (PHY_VARS_gNB *) calloc(1, sizeof(PHY_VARS_gNB));
+ LOG_I(PHY,"[nr-gnb.c] gNB structure RC.gNB[%d] allocated @ %p\n",0,RC.gNB[0]);
+ }
+
PHY_VARS_gNB *gNB = RC.gNB[0];
RC.nb_nr_CC = (int *)malloc(sizeof(int)); // TODO: find a better function to place this in
diff --git a/nfapi/open-nFAPI/common/src/debug.c b/nfapi/open-nFAPI/common/src/debug.c
index a45d41d7d7..f53be43223 100644
--- a/nfapi/open-nFAPI/common/src/debug.c
+++ b/nfapi/open-nFAPI/common/src/debug.c
@@ -1,76 +1,76 @@
-/*
- * Copyright 2017 Cisco Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#define MAX_MSG_LENGTH 2096
-#define TRACE_HEADER_LENGTH 44
-
-void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
-
-// initialize the trace function to 0
-void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
-
-nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
-//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
-
-void nfapi_set_trace_level(nfapi_trace_level_t new_level)
-{
- nfapi_trace_level_g = new_level;
-}
-
-void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
-{
- char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
- uint32_t num_chars;
- va_list p_args;
- struct timeval tv;
- pthread_t tid = pthread_self();
-
- (void)gettimeofday(&tv, NULL);
-
- num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
-
- if (num_chars > TRACE_HEADER_LENGTH)
- {
- printf("trace_dbg: Error, num_chars is too large: %d", num_chars);
- return;
- }
-
- va_start(p_args, format);
- if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
- {
- if (level <= NFAPI_TRACE_WARN)
- {
- printf("%s", trace_buff);
- }
- printf("%s", trace_buff);
- }
- va_end(p_args);
-}
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#define MAX_MSG_LENGTH 2096
+#define TRACE_HEADER_LENGTH 44
+
+void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
+
+// initialize the trace function to 0
+void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
+
+nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
+//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
+
+void nfapi_set_trace_level(nfapi_trace_level_t new_level)
+{
+ nfapi_trace_level_g = new_level;
+}
+
+void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
+{
+ char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
+ uint32_t num_chars;
+ va_list p_args;
+ struct timeval tv;
+ pthread_t tid = pthread_self();
+
+ (void)gettimeofday(&tv, NULL);
+
+ num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
+
+ if (num_chars > TRACE_HEADER_LENGTH)
+ {
+ printf("trace_dbg: Error, num_chars is too large: %u", num_chars);
+ return;
+ }
+
+ va_start(p_args, format);
+ if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
+ {
+ if (level <= NFAPI_TRACE_WARN)
+ {
+ printf("%s", trace_buff);
+ }
+ printf("%s", trace_buff);
+ }
+ va_end(p_args);
+}
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
index 9df9be4cbd..0436f92a8d 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
@@ -972,7 +972,7 @@ typedef struct
typedef struct
{
- uint32_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
+ int ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
uint8_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload
uint8_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3
@@ -1058,12 +1058,6 @@ typedef struct {
fapi_nr_tdd_table_t tdd_table;
fapi_nr_prach_config_t prach_config;
- fapi_nr_dl_bwp_common_config_t dl_bwp_common;
- fapi_nr_dl_bwp_dedicated_config_t dl_bwp_dedicated;
-
- fapi_nr_ul_bwp_common_config_t ul_bwp_common;
- fapi_nr_ul_bwp_dedicated_config_t ul_bwp_dedicated;
-
} fapi_nr_config_request_t;
#endif
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
index bc5e7af45f..bcb0a94ca8 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
@@ -357,7 +357,7 @@ typedef struct
//table 3-23
typedef struct
{
- nfapi_uint32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
+ nfapi_int32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
nfapi_uint8_tlv_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload
nfapi_uint8_tlv_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3
@@ -398,13 +398,13 @@ typedef struct
{
nfapi_uint32_tlv_t ssb_mask;//Bitmap for actually transmitted SSB. MSB->LSB of first 32 bit number corresponds to SSB 0 to SSB 31 MSB->LSB of second 32 bit number corresponds to SSB 32 to SSB 63 Value for each bit: 0: not transmitted 1: transmitted
-} nfapi_nr_ssb_mask_size_2_t;
+} nfapi_nr_ssb_mask_list_t;
typedef struct
{
- nfapi_uint8_tlv_t beam_id[64];//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63
+ nfapi_uint8_tlv_t beam_id;//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63
-} nfapi_nr_ssb_mask_size_64_t;
+} nfapi_nr_ssb_beam_id_list_t;
typedef struct
{
@@ -413,8 +413,8 @@ typedef struct
nfapi_uint8_tlv_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160
nfapi_uint8_tlv_t ssb_subcarrier_offset;//ssbSubcarrierOffset or 𝑘𝑆𝑆𝐵 (38.211, section 7.4.3.1) Value: 0->31
nfapi_uint32_tlv_t MIB;//MIB payload, where the 24 MSB are used and represent the MIB in [38.331 MIB IE] and represent 0 1 2 3 1 , , , ,..., A− a a a a a [38.212, sec 7.1.1]
- nfapi_nr_ssb_mask_size_2_t ssb_mask_list[2];
- nfapi_nr_ssb_mask_size_64_t* ssb_beam_id_list;//64
+ nfapi_nr_ssb_mask_list_t ssb_mask_list[2];
+ nfapi_nr_ssb_beam_id_list_t ssb_beam_id_list[64];
nfapi_uint8_tlv_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled
nfapi_uint8_tlv_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled
@@ -678,7 +678,7 @@ typedef struct {
} nfapi_nr_slot_indication_scf_t;
-// 3.4.2
+// 3.4.2
//for pdcch_pdu:
@@ -691,11 +691,10 @@ typedef struct
typedef struct
{
uint16_t pm_idx;//Index to precoding matrix (PM) pre-stored at cell configuration. Note: If precoding is not used this parameter should be set to 0. Value: 0->65535.
- nfapi_nr_dig_bf_interface_t* dig_bf_interface_list;
+ nfapi_nr_dig_bf_interface_t dig_bf_interface_list[1];//max dig_bf_interfaces
}nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t;
-/*
//table 3-43
typedef struct
{
@@ -703,23 +702,10 @@ typedef struct
uint16_t prg_size;//Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275
//watchout: dig_bf_interfaces here, in table 3-53 it's dig_bf_interface
uint8_t dig_bf_interfaces;//Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
- nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t* prgs_list;//
+ nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t prgs_list[1];//max prg_size
}nfapi_nr_tx_precoding_and_beamforming_t;
-*/
-typedef struct {
- /// Number of PRGs spanning this allocation. Value : 1->275
- uint16_t numPRGs;
- /// Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275
- uint16_t prgSize;
- /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
- uint8_t digBFInterfaces;
- // Depends on numPRGs
- uint16_t PMIdx[275];
- // Depends on digBFInterfaces
- uint16_t beamIdx[256];
-} nfapi_nr_tx_precoding_and_beamforming_t;
//table 3-37
@@ -755,16 +741,6 @@ typedef struct {
} nfapi_nr_dl_dci_pdu_t;
-typedef struct {
- /// Number of PRGs spanning this allocation. Value : 1->275
- uint16_t numPRGs;
- /// Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275
- uint16_t prgSize;
- /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
- uint8_t digBFInterfaces;
- uint16_t PMIdx[275];
- uint16_t *beamIdx[275];
-} nr_beamforming_t;
typedef struct {
///Bandwidth part size [TS38.213 sec12]. Number of contiguous PRBs allocated to the BWP,Value: 1->275
@@ -1028,7 +1004,7 @@ typedef struct {
typedef struct {
uint16_t PDUType;
- uint16_t PDUSize;
+ uint32_t PDUSize;
union {
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu;
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
index 5f8e6b52b4..8f6a736a14 100755
--- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
@@ -1,8271 +1,8271 @@
-/*
- * Copyright 2017 Cisco Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include "nfapi_nr_interface_scf.h"
-
-extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
-extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
-
-uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len)
-{
- uint32_t chksum = 0;
- // calcaulte upto the checksum
- chksum = crc32(chksum, buffer, 8);
-
- // skip the checksum
- uint8_t zeros[4] = {0, 0, 0, 0};
- chksum = crc32(chksum, zeros, 4);
-
- // continu with the rest of the mesage
- chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH);
-
- // return the inverse
- return ~(chksum);
-}
-
-int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len)
-{
- uint32_t checksum = nfapi_calculate_checksum(buffer, len);
-
- uint8_t* p_write = &buffer[8];
- return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1);
-}
-
-int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp)
-{
- uint8_t* p_write = &buffer[12];
- return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1);
-}
-
-uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len)
-{
- return nfapi_calculate_checksum(buffer, len);
-}
-
-void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
-{
- if(size == 0)
- return 0;
-
- void* buffer_p = NULL;
- if(config && config->allocate)
- {
- buffer_p = (config->allocate)(size);
- if(buffer_p != NULL){
- memset(buffer_p,0,size);
- }
- return buffer_p;
- }
- else
- {
- buffer_p = calloc(1, size);
- return buffer_p;
- }
-}
-
-void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config)
-{
- if(ptr == NULL)
- return;
-
- if(config && config->deallocate)
- {
- return (config->deallocate)(ptr);
- }
- else
- {
- return free(ptr);
- }
-}
-// Pack routines
-
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
-
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format);
-
- return ( push8(value->dci_format, ppWritePackedMsg, end) &&
- push8(value->cce_idx, ppWritePackedMsg, end) &&
- push8(value->aggregation_level, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
- push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
- push32(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->mcs_1, ppWritePackedMsg, end) &&
- push8(value->redundancy_version_1, ppWritePackedMsg, end) &&
- push8(value->new_data_indicator_1, ppWritePackedMsg, end) &&
- push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
- push8(value->mcs_2, ppWritePackedMsg, end) &&
- push8(value->redundancy_version_2, ppWritePackedMsg, end) &&
- push8(value->new_data_indicator_2, ppWritePackedMsg, end) &&
- push8(value->harq_process, ppWritePackedMsg, end) &&
- push8(value->tpmi, ppWritePackedMsg, end) &&
- push8(value->pmi, ppWritePackedMsg, end) &&
- push8(value->precoding_information, ppWritePackedMsg, end) &&
- push8(value->tpc, ppWritePackedMsg, end) &&
- push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
- push8(value->ngap, ppWritePackedMsg, end) &&
- push8(value->transport_block_size_index, ppWritePackedMsg, end) &&
- push8(value->downlink_power_offset, ppWritePackedMsg, end) &&
- push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
- push8(value->preamble_index, ppWritePackedMsg, end) &&
- push8(value->prach_mask_index, ppWritePackedMsg, end) &&
- push8(value->rnti_type, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
-
- return( push8(value->mcch_flag, ppWritePackedMsg, end) &&
- push8(value->mcch_change_notification, ppWritePackedMsg, end) &&
- push8(value->scrambling_identity, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
-
- return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
- push8(value->carrier_indicator, ppWritePackedMsg, end) &&
- push8(value->srs_flag, ppWritePackedMsg, end) &&
- push8(value->srs_request, ppWritePackedMsg, end) &&
- push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) &&
- push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
- push8(value->n_dl_rb, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
-
- return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) &&
- push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
-
- return ( push8(value->primary_cell_type, ppWritePackedMsg, end) &&
- push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) &&
- push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) &&
- pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
- push8(value->number_of_subbands, ppWritePackedMsg, end) &&
- push8(value->num_antennas, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_subbands; ++idx)
- {
- nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
-
- if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) &&
- push8(subband_info->scheduled_ues, ppWritePackedMsg, end)))
- return 0;
-
-
- uint8_t antenna_idx = 0;
- uint8_t scheduled_ue_idx = 0;
-
- for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
- {
- for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
- {
- if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end))
- return 0;
- }
- }
-
- }
-
-
- return 1;
-
-}
-
-
-static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv;
-
- return(
- push16(value->bwp_size, ppWritePackedMsg, end) &&
- push16(value->bwp_start, ppWritePackedMsg, end) &&
-
- push8(value->subcarrier_spacing, ppWritePackedMsg, end) &&
- push8(value->cyclic_prefix, ppWritePackedMsg, end) &&
-
- push16(value->start_rb, ppWritePackedMsg, end) &&
- push16(value->nr_of_rbs, ppWritePackedMsg, end) &&
-
- push8(value->csi_type, ppWritePackedMsg, end) &&
- push8(value->row, ppWritePackedMsg, end) &&
-
- push16(value->freq_domain, ppWritePackedMsg, end) &&
- push8(value->symb_l0, ppWritePackedMsg, end) &&
-
- push8(value->symb_l1, ppWritePackedMsg, end) &&
- push8(value->cdm_type, ppWritePackedMsg, end) &&
-
- push8(value->freq_density, ppWritePackedMsg, end) &&
- push16(value->scramb_id, ppWritePackedMsg, end) &&
-
- push8(value->power_control_offset, ppWritePackedMsg, end) &&
- push8(value->power_control_offset_ss, ppWritePackedMsg, end)
- );
-
-}
-
-
-static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
-
- for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
- {
- if(!(push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
- push16(value->dci_pdu[i].ScramblingId, ppWritePackedMsg, end) &&
-
- push16(value->dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) &&
- push8(value->dci_pdu[i].CceIndex, ppWritePackedMsg, end) &&
- push8(value->dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) &&
- push8(value->dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) &&
-
- push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
- push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
- pusharray8(value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
- return 0;
-
- }
-
- // TODO: resolve the packaging of array (currently sending a single element)
- return(
- push16(value->BWPSize, ppWritePackedMsg, end) &&
- push16(value->BWPStart, ppWritePackedMsg, end) &&
- push8(value->SubcarrierSpacing, ppWritePackedMsg, end) &&
- push8(value->CyclicPrefix, ppWritePackedMsg, end) &&
-
- push8(value->StartSymbolIndex, ppWritePackedMsg, end) &&
- push8(value->DurationSymbols, ppWritePackedMsg, end) &&
- pusharray8(value->FreqDomainResource, 6, 6, ppWritePackedMsg, end) &&
- push8(value->CceRegMappingType, ppWritePackedMsg, end) &&
-
- push8(value->RegBundleSize, ppWritePackedMsg, end) &&
- push8(value->InterleaverSize, ppWritePackedMsg, end) &&
- push8(value->CoreSetType, ppWritePackedMsg, end) &&
- push16(value->ShiftIndex, ppWritePackedMsg, end) &&
-
- push8(value->precoderGranularity, ppWritePackedMsg, end) &&
- push16(value->numDlDci, ppWritePackedMsg, end));
-
-}
-
-
-static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
-
- // TODO: resolve the packaging of array (currently sending a single element)
- return(
- push16(value->pduBitmap, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push16(value->pduIndex, ppWritePackedMsg, end) &&
- push16(value->BWPSize, ppWritePackedMsg, end) &&
-
- push16(value->BWPStart, ppWritePackedMsg, end) &&
- push8(value->SubcarrierSpacing, ppWritePackedMsg, end) &&
- push8(value->CyclicPrefix, ppWritePackedMsg, end) &&
- push8(value->NrOfCodewords, ppWritePackedMsg, end) &&
-
- pusharray16(value->targetCodeRate, 2, 1, ppWritePackedMsg, end) &&
- pusharray8(value->qamModOrder, 2, 1, ppWritePackedMsg, end) &&
- pusharray8(value->mcsIndex, 2, 1, ppWritePackedMsg, end) &&
- pusharray8(value->mcsTable, 2, 1, ppWritePackedMsg, end) &&
-
- pusharray8(value->rvIndex, 2, 1, ppWritePackedMsg, end) &&
- pusharray32(value->TBSize, 2, 1, ppWritePackedMsg, end) &&
- push16(value->dataScramblingId, ppWritePackedMsg, end) &&
- push8(value->nrOfLayers, ppWritePackedMsg, end) &&
-
- push8(value->transmissionScheme, ppWritePackedMsg, end) &&
- push8(value->refPoint, ppWritePackedMsg, end) &&
- push16(value->dlDmrsSymbPos, ppWritePackedMsg, end) &&
- push8(value->dmrsConfigType, ppWritePackedMsg, end) &&
-
- push16(value->dlDmrsScramblingId, ppWritePackedMsg, end) &&
- push8(value->SCID, ppWritePackedMsg, end) &&
- push8(value->numDmrsCdmGrpsNoData, ppWritePackedMsg, end) &&
- push16(value->dmrsPorts, ppWritePackedMsg, end) &&
-
- push8(value->resourceAlloc, ppWritePackedMsg, end) &&
- push16(value->rbStart, ppWritePackedMsg, end) &&
- push16(value->rbSize, ppWritePackedMsg, end) &&
-
- push8(value->VRBtoPRBMapping, ppWritePackedMsg, end) &&
- push8(value->StartSymbolIndex, ppWritePackedMsg, end) &&
- push8(value->NrOfSymbols, ppWritePackedMsg, end) &&
- push8(value->PTRSPortIndex, ppWritePackedMsg, end) &&
-
- push8(value->PTRSTimeDensity, ppWritePackedMsg, end) &&
- push8(value->PTRSFreqDensity, ppWritePackedMsg, end) &&
- push8(value->PTRSReOffset, ppWritePackedMsg, end)
- );
-
-}
-
-
-static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- printf("Packing ssb. \n");
- nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
-
- return(
- push16(value->PhysCellId, ppWritePackedMsg, end) &&
- push8(value->BetaPss, ppWritePackedMsg, end) &&
- push8(value->SsbBlockIndex, ppWritePackedMsg, end) &&
- push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) &&
- push16(value->ssbOffsetPointA, ppWritePackedMsg, end) &&
- push8(value->bchPayloadFlag, ppWritePackedMsg, end) &&
- push32(value->bchPayload, ppWritePackedMsg, end)
- // TODO: pack precoding_and_beamforming too
- );
-
-}
-
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
-
- return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) &&
- push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) &&
- push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
- push8(value->codebook_size_determination, ppWritePackedMsg, end) &&
- push8(value->drms_table_flag, ppWritePackedMsg, end) &&
- push8(value->tpm_struct_flag, ppWritePackedMsg, end) &&
- (value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1));
-}
-
-static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
-
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__);
-
- return( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
-
- return ( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
- push32(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->modulation, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push16(value->mbsfn_area_id, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem;
-
- return ( push8(bf->subband_index, ppWritePackedMsg, end) &&
- push8(bf->num_antennas, ppWritePackedMsg, end) &&
- pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end));
-
-
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
-
- return ( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
- push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
- push32(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->modulation, ppWritePackedMsg, end) &&
- push8(value->redundancy_version, ppWritePackedMsg, end) &&
- push8(value->transport_blocks, ppWritePackedMsg, end) &&
- push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
- push8(value->transmission_scheme, ppWritePackedMsg, end) &&
- push8(value->number_of_layers, ppWritePackedMsg, end) &&
- push8(value->number_of_subbands, ppWritePackedMsg, end) &&
- pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) &&
- push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
- push8(value->pa, ppWritePackedMsg, end) &&
- push8(value->delta_power_offset_index, ppWritePackedMsg, end) &&
- push8(value->ngap, ppWritePackedMsg, end) &&
- push8(value->nprb, ppWritePackedMsg, end) &&
- push8(value->transmission_mode, ppWritePackedMsg, end) &&
- push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) &&
- push8(value->num_bf_vector, ppWritePackedMsg, end) &&
- packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info));
-
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
- return ( push8(value->nscid, ppWritePackedMsg, end) );
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
-
- return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) &&
- push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
- push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
- push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
- pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
- push8(value->pdsch_start, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
-
- return( push8(value->drms_config_flag, ppWritePackedMsg, end) &&
- push16(value->drms_scrambling, ppWritePackedMsg, end) &&
- push8(value->csi_config_flag, ppWritePackedMsg, end) &&
- push16(value->csi_scrambling, ppWritePackedMsg, end) &&
- push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) &&
- push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) &&
- push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
-
- return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) &&
- push8(value->maxlayers, ppWritePackedMsg, end) &&
- push8(value->n_dl_harq, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
-
- return( push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
- push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
- push8(value->ue_type, ppWritePackedMsg, end) &&
- push8(value->pdsch_payload_type, ppWritePackedMsg, end) &&
- push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
- push8(value->drms_table_flag, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
-
- return( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->p_rnti, ppWritePackedMsg, end) &&
- push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
- push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
- push32(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->mcs, ppWritePackedMsg, end) &&
- push8(value->redundancy_version, ppWritePackedMsg, end) &&
- push8(value->number_of_transport_blocks, ppWritePackedMsg, end) &&
- push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
- push8(value->transmission_scheme, ppWritePackedMsg, end) &&
- push8(value->number_of_layers, ppWritePackedMsg, end) &&
- push8(value->codebook_index, ppWritePackedMsg, end) &&
- push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
- push8(value->pa, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push8(value->nprb, ppWritePackedMsg, end) &&
- push8(value->ngap, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
-
- return ( push8(value->ue_mode, ppWritePackedMsg, end) &&
- push16(value->initial_transmission_sf_io, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
-
- return( push16(value->transmission_power, ppWritePackedMsg, end) &&
- push8(value->prs_bandwidth, ppWritePackedMsg, end) &&
- push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) &&
- push8(value->prs_muting, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
-
- return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) &&
- push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
- push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) &&
- pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
-
- if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) &&
- push8(value->cdm_type, ppWritePackedMsg, end) &&
- push8(value->num_bf_vector, ppWritePackedMsg, end)))
- {
- return 0;
- }
-
- uint16_t i;
- for(i = 0; i < value->num_bf_vector; ++i)
- {
- if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) &&
- pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end)))
- return 0;
- }
-
- return 1;
-}
-static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(vector->subband_index, ppWritePackedMsg, end) &&
- push8(vector->num_antennas, ppWritePackedMsg, end) &&
- pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
-
- return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) &&
- push16(value->epdcch_id, ppWritePackedMsg, end) &&
- push8(value->epdcch_start_symbol, ppWritePackedMsg, end) &&
- push8(value->epdcch_num_prb, ppWritePackedMsg, end) &&
- pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) &&
- pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
-
- return (push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
- push8(value->initial_lbt_sf, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
-
- return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) &&
- push8(value->number_of_prb_pairs, ppWritePackedMsg, end) &&
- push8(value->resource_block_assignment, ppWritePackedMsg, end) &&
- push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) &&
- push8(value->start_symbol, ppWritePackedMsg, end) &&
- push8(value->ecce_index, ppWritePackedMsg, end) &&
- push8(value->aggregation_level, ppWritePackedMsg, end) &&
- push8(value->rnti_type, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->ce_mode, ppWritePackedMsg, end) &&
- push16(value->drms_scrambling_init, ppWritePackedMsg, end) &&
- push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push8(value->dci_format, ppWritePackedMsg, end) &&
- push16(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->mcs, ppWritePackedMsg, end) &&
- push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) &&
- push8(value->redundancy_version, ppWritePackedMsg, end) &&
- push8(value->new_data_indicator, ppWritePackedMsg, end) &&
- push8(value->harq_process, ppWritePackedMsg, end) &&
- push8(value->tpmi_length, ppWritePackedMsg, end) &&
- push8(value->tpmi, ppWritePackedMsg, end) &&
- push8(value->pmi_flag, ppWritePackedMsg, end) &&
- push8(value->pmi, ppWritePackedMsg, end) &&
- push8(value->harq_resource_offset, ppWritePackedMsg, end) &&
- push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
- push8(value->tpc, ppWritePackedMsg, end) &&
- push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) &&
- push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
- push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
- push8(value->preamble_index, ppWritePackedMsg, end) &&
- push8(value->prach_mask_index, ppWritePackedMsg, end) &&
- push8(value->starting_ce_level, ppWritePackedMsg, end) &&
- push8(value->srs_request, ppWritePackedMsg, end) &&
- push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) &&
- push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) &&
- push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
- push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) &&
- push8(value->direct_indication, ppWritePackedMsg, end) &&
- push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
- push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
- pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
-
- return (push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
-
- return (push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push8(value->ncce_index, ppWritePackedMsg, end) &&
- push8(value->aggregation_level, ppWritePackedMsg, end) &&
- push8(value->start_symbol, ppWritePackedMsg, end) &&
- push8(value->rnti_type, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
- push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
- push8(value->dci_format, ppWritePackedMsg, end) &&
- push8(value->scheduling_delay, ppWritePackedMsg, end) &&
- push8(value->resource_assignment, ppWritePackedMsg, end) &&
- push8(value->repetition_number, ppWritePackedMsg, end) &&
- push8(value->mcs, ppWritePackedMsg, end) &&
- push8(value->new_data_indicator, ppWritePackedMsg, end) &&
- push8(value->harq_ack_resource, ppWritePackedMsg, end) &&
- push8(value->npdcch_order_indication, ppWritePackedMsg, end) &&
- push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) &&
- push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) &&
- push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) &&
- push8(value->direct_indication, ppWritePackedMsg, end) &&
- push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
- push8(value->total_dci_length_including_padding, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
-
- return (push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push8(value->start_symbol, ppWritePackedMsg, end) &&
- push8(value->rnti_type, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push16(value->resource_assignment, ppWritePackedMsg, end) &&
- push16(value->repetition_number, ppWritePackedMsg, end) &&
- push8(value->modulation, ppWritePackedMsg, end) &&
- push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) &&
- push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
- push16(value->sf_idx, ppWritePackedMsg, end) &&
- push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_dl_tti_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)tlv;
-
- if(!(push16(value->PDUSize, ppWritePackedMsg, end) &&
- push16(value->PDUType, ppWritePackedMsg, end) ))
- return 0;
-
-
- // first match the pdu type, then call the respective function
- switch(value->PDUType)
- {
- case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
- {
- if(!(pack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppWritePackedMsg,end)))
- return 0;
- }
- break;
-
- case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
- {
- if(!(pack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppWritePackedMsg,end)))
- return 0;
- }
- break;
- case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
- {
- if(!(pack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppWritePackedMsg,end)))
- return 0;
- }
- break;
- case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
- {
- if(!(pack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppWritePackedMsg,end)))
- return 0;
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType );
- }
- break;
- }
-
- return 1;
-}
-
-static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
-
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich);
-
- if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) &&
- push8(value->number_dci, ppWritePackedMsg, end) &&
- push16(value->number_pdu, ppWritePackedMsg, end) &&
- push8(value->number_pdsch_rnti, ppWritePackedMsg, end) &&
- push16(value->transmission_power_pcfich, ppWritePackedMsg, end)))
- {
- return 0;
- }
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_pdu;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
-
- if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
- if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
- {
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__);
-
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value)))
- {
- return 0;
- }
- }
- break;
- case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
- {
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__);
-
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel10_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) &
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value)))
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
- }
-
- return 1;
-}
-
-
-static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
-
- if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) &&
- pusharray8(pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end)
- //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
- ))
- return 0;
-
- int arr[12];
- for(int i=0;idl_tti_request_body.nGroup;i++)
- {
- for(int j=0;jdl_tti_request_body.nUe[i];j++)
- {
- arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
- }
- if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end)))
- return 0;
- }
-
- for(int i=0;idl_tti_request_body.nPDUs;i++)
- {
- if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end))
- return 0;
- }
-
-return 1;
-}
-
-
-static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
-
- //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
- //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
- {
- uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
- uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value);
- uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
-
- if (!x || !y || !z)
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z);
- }
-
- return x && y && z;
- }
-}
-
-
-
-
-static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end)
-{
- nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
-
- return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
-
- return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
- push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
-
- return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
-
- return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end));
-}
-
-//Pack fns for ul_tti PDUS
-
-
-static uint8_t pack_ul_tti_request_prach_pdu(nfapi_nr_prach_pdu_t* prach_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return(
- push16(prach_pdu->phys_cell_id, ppWritePackedMsg, end) &&
- push8(prach_pdu->num_prach_ocas, ppWritePackedMsg, end) &&
- push8(prach_pdu->prach_format, ppWritePackedMsg, end) &&
- push8(prach_pdu->num_ra, ppWritePackedMsg, end) &&
- push8(prach_pdu->prach_start_symbol, ppWritePackedMsg, end) &&
- push16(prach_pdu->num_cs, ppWritePackedMsg, end)
- // TODO: ignoring beamforming tlv for now
- );
-
-}
-
-static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t* pucch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return(
- push16(pucch_pdu->rnti, ppWritePackedMsg, end) &&
- push32(pucch_pdu->handle, ppWritePackedMsg, end) &&
- push16(pucch_pdu->bwp_size, ppWritePackedMsg, end) &&
- push16(pucch_pdu->bwp_start, ppWritePackedMsg, end) &&
- push8(pucch_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
- push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
- push8(pucch_pdu->format_type, ppWritePackedMsg, end) &&
- push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) &&
- push16(pucch_pdu->prb_start, ppWritePackedMsg, end) &&
- push16(pucch_pdu->prb_size, ppWritePackedMsg, end) &&
- push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
- push8(pucch_pdu->nr_of_symbols, ppWritePackedMsg, end) &&
- push8(pucch_pdu->freq_hop_flag, ppWritePackedMsg, end) &&
- push16(pucch_pdu->second_hop_prb, ppWritePackedMsg, end) &&
- push8(pucch_pdu->group_hop_flag, ppWritePackedMsg, end) &&
- push8(pucch_pdu->sequence_hop_flag, ppWritePackedMsg, end) &&
- push16(pucch_pdu->hopping_id, ppWritePackedMsg, end) &&
- push16(pucch_pdu->initial_cyclic_shift, ppWritePackedMsg, end) &&
- push16(pucch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
- push8(pucch_pdu->time_domain_occ_idx, ppWritePackedMsg, end) &&
- push8(pucch_pdu->pre_dft_occ_idx, ppWritePackedMsg, end) &&
- push8(pucch_pdu->pre_dft_occ_len, ppWritePackedMsg, end) &&
- push8(pucch_pdu->add_dmrs_flag, ppWritePackedMsg, end) &&
- push16(pucch_pdu->dmrs_scrambling_id, ppWritePackedMsg, end) &&
- push8(pucch_pdu->dmrs_cyclic_shift, ppWritePackedMsg, end) &&
- push8(pucch_pdu->sr_flag, ppWritePackedMsg, end) &&
- push8(pucch_pdu->bit_len_harq, ppWritePackedMsg, end) &&
- push16(pucch_pdu->bit_len_csi_part1, ppWritePackedMsg, end) &&
- push16(pucch_pdu->bit_len_csi_part2, ppWritePackedMsg, end)
- // TODO: ignoring beamforming tlv for now
- );
-
-}
-
-
-static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t* pusch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
-
- if (!(
- push16(pusch_pdu->pdu_bit_map, ppWritePackedMsg, end) &&
- push16(pusch_pdu->rnti, ppWritePackedMsg, end) &&
- push32(pusch_pdu->handle, ppWritePackedMsg, end) &&
- push16(pusch_pdu->bwp_size, ppWritePackedMsg, end) &&
- push16(pusch_pdu->bwp_start, ppWritePackedMsg, end) &&
- push8(pusch_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
- push8(pusch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
- push16(pusch_pdu->target_code_rate, ppWritePackedMsg, end) &&
- push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) &&
- push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) &&
- push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) &&
- push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) &&
- push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
- push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) &&
- push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) &&
- push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) &&
- push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) &&
- push8(pusch_pdu->scid, ppWritePackedMsg, end) &&
- push8(pusch_pdu->num_dmrs_cdm_grps_no_data, ppWritePackedMsg, end) &&
- push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) &&
- push8(pusch_pdu->resource_alloc, ppWritePackedMsg, end) &&
- push8(pusch_pdu->resource_alloc,ppWritePackedMsg, end) &&
- push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) &&
- push16(pusch_pdu->rb_start, ppWritePackedMsg, end) &&
- push16(pusch_pdu->rb_size, ppWritePackedMsg, end) &&
- push8(pusch_pdu->vrb_to_prb_mapping, ppWritePackedMsg, end) &&
- push8(pusch_pdu->frequency_hopping, ppWritePackedMsg, end) &&
- push16(pusch_pdu->tx_direct_current_location, ppWritePackedMsg, end) &&
- push8(pusch_pdu->uplink_frequency_shift_7p5khz, ppWritePackedMsg, end) &&
- push8(pusch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
- push8(pusch_pdu->nr_of_symbols, ppWritePackedMsg, end)
- // TODO: ignoring beamforming tlv for now
- ))
- return 0;
-
-
- //Pack Optional Data only included if indicated in pduBitmap
- switch(pusch_pdu->pdu_bit_map){
- case PUSCH_PDU_BITMAP_PUSCH_DATA:
- {
- // pack optional TLVs
- return(
- push8(pusch_pdu->pusch_data.rv_index, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_data.harq_process_id, ppWritePackedMsg, end) &&
- push32(pusch_pdu->pusch_data.tb_size, ppWritePackedMsg, end) &&
- push16(pusch_pdu->pusch_data.num_cb, ppWritePackedMsg, end) &&
- pusharray8(pusch_pdu->pusch_data.cb_present_and_position,1,1,ppWritePackedMsg, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_PUSCH_UCI:
- {
- return(
- push16(pusch_pdu->pusch_uci.harq_ack_bit_length, ppWritePackedMsg, end) &&
- push16(pusch_pdu->pusch_uci.csi_part1_bit_length, ppWritePackedMsg, end) &&
- push16(pusch_pdu->pusch_uci.csi_part2_bit_length, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_uci.alpha_scaling, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_uci.beta_offset_harq_ack, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_uci.beta_offset_csi1, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_uci.beta_offset_csi2, ppWritePackedMsg, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_PUSCH_PTRS:
- {
- return(
- push8(pusch_pdu->pusch_ptrs.num_ptrs_ports, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, ppWritePackedMsg, end) &&
- push16(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ptrs_time_density, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ptrs_freq_density, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ul_ptrs_power, ppWritePackedMsg, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_DFTS_OFDM:
- {
- return(
- push8(pusch_pdu->dfts_ofdm.low_papr_group_number, ppWritePackedMsg, end) &&
- push16(pusch_pdu->dfts_ofdm.low_papr_sequence_number, ppWritePackedMsg, end) &&
- push8(pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, ppWritePackedMsg, end) &&
- push8(pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, ppWritePackedMsg, end)
- );
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map );
- }
- }
-
- return 1;
-}
-
-static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t* srs_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return(
- push16(srs_pdu->rnti, ppWritePackedMsg, end) &&
- push32(srs_pdu->handle, ppWritePackedMsg, end) &&
- push16(srs_pdu->bwp_size, ppWritePackedMsg, end) &&
- push16(srs_pdu->bwp_start, ppWritePackedMsg, end) &&
- push8(srs_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
- push8(srs_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
- push8(srs_pdu->num_ant_ports, ppWritePackedMsg, end) &&
- push8(srs_pdu->num_symbols, ppWritePackedMsg, end) &&
- push8(srs_pdu->num_repetitions, ppWritePackedMsg, end) &&
- push8(srs_pdu->time_start_position, ppWritePackedMsg, end) &&
- push8(srs_pdu->config_index, ppWritePackedMsg, end) &&
- push16(srs_pdu->sequence_id, ppWritePackedMsg, end) &&
- push8(srs_pdu->bandwidth_index, ppWritePackedMsg, end) &&
- push8(srs_pdu->comb_size, ppWritePackedMsg, end) &&
- push8(srs_pdu->comb_offset, ppWritePackedMsg, end) &&
- push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) &&
- push8(srs_pdu->frequency_position, ppWritePackedMsg, end) &&
- push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) &&
- push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) &&
- push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) &&
- push8(srs_pdu->resource_type, ppWritePackedMsg, end) &&
- push16(srs_pdu->t_srs, ppWritePackedMsg, end) &&
- push16(srs_pdu->t_offset, ppWritePackedMsg, end)
-
- // TODO: ignoring beamforming tlv for now
- );
-
-}
-
-static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value));
-}
-
-static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
-
- return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
-
- if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end)))
- {
- return 0;
- }
-
- switch(cqi_ri_info_rel9->report_type)
- {
- case NFAPI_CSI_REPORT_TYPE_PERIODIC:
- {
- if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end)))
- {
- return 0;
- }
- }
- break;
- case NFAPI_CSI_REPORT_TYPE_APERIODIC:
- {
- if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint8_t i;
- for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
- {
- if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint8_t j;
- for(j = 0; j < 8; ++j)
- {
- if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0)
- return 0;
- }
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
- }
- break;
- };
-
- return 1;
-}
-
-static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
-
- switch(cqi_ri_info_rel13->report_type)
- {
- case NFAPI_CSI_REPORT_TYPE_PERIODIC:
- {
- if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0)
- return 0;
- }
- break;
- case NFAPI_CSI_REPORT_TYPE_APERIODIC:
- {
- // No parameters
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type );
- }
- break;
- };
-
- return 1;
-}
-
-static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value));
-
-}
-
-static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
-
- return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) &&
- push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value);
-}
-
-static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
-
- return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) &&
- push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) &&
- push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
-
- return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value));
-}
-
-static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
-
- return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) &&
- push16(ue_info_rel8->rnti, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
-
- return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
- push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
-
- return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) &&
- push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) &&
- push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
- push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value));
-}
-
-static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
-
- return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) &&
- push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) &&
- push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
- push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) &&
- push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) &&
- push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) &&
- push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
-
- return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
- push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
-
- return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) &&
- push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) &&
- push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
- push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
- push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) &&
- push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) &&
- push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
-
- return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) &&
- push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) &&
- push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) &&
- push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) &&
- push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
-
- return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->n_srs, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value));
-
-}
-
-static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
-
- return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) &&
- push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
-
- return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) &&
- push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
-
- return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) &&
- push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) &&
- push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) &&
- push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) &&
- push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) &&
- push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value));
-
-}
-
-static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
- return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end);
-}
-static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
-
- return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) &&
- push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value));
-}
-
-static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
-
- return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) &&
- push16(srs_pdu_rel8->size, ppWritePackedMsg, end) &&
- push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) &&
- push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
- return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end);
-}
-
-static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
-
- return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
-
- return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
-
- return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) &&
- push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) &&
- push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) &&
- push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) &&
- push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
- push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) &&
- pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value));
-}
-static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
-
- return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) &&
- push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) &&
- push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end));
-
-}
-
-
-
-static uint8_t pack_ul_tti_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_ul_tti_request_number_of_pdus_t* value = (nfapi_nr_ul_tti_request_number_of_pdus_t*)tlv;
-
- if(!(push16(value->pdu_size, ppWritePackedMsg, end) &&
- push16(value->pdu_type, ppWritePackedMsg, end) ))
- return 0;
-
-
- // first match the pdu type, then call the respective function
- switch(value->pdu_type)
- {
- case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
- {
- if(!pack_ul_tti_request_prach_pdu(&value->prach_pdu, ppWritePackedMsg, end))
- return 0;
- }
- break;
-
- case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
- {
- if(!pack_ul_tti_request_pucch_pdu(&value->pucch_pdu, ppWritePackedMsg, end))
- return 0;
- }
- break;
- case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
- {
- if(!pack_ul_tti_request_pusch_pdu(&value->pusch_pdu, ppWritePackedMsg, end))
- return 0;
- }
- break;
- case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
- {
- if(!pack_ul_tti_request_srs_pdu(&value->srs_pdu, ppWritePackedMsg, end))
- return 0;
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", value->pdu_type );
- }
- break;
- }
-
- return 1;
-}
-
-static uint8_t pack_ul_tti_groups_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_ul_tti_request_number_of_groups_t* value = (nfapi_nr_ul_tti_request_number_of_groups_t*)tlv;
-
- if(!push8(value->n_ue, ppWritePackedMsg, end))
- return 0;
- for(int i=0; in_ue;i++)
- {
- if(!push8(value->ue_list[i].pdu_idx, ppWritePackedMsg, end))
- return 0;
- }
- return 1;
-}
-
-static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
-
- if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) &&
- push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) &&
- push8(value->srs_present, ppWritePackedMsg, end)))
- return 0;
-
- uint16_t i = 0;
- for(i = 0; i < value->number_of_pdus; ++i)
- {
- nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
-
- if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
- if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
- {
- if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value)))
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
-
- }
- return 1;
-}
-
-
-static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg;
-
- if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->n_pdus , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->n_group, ppWritePackedMsg, end) ))
- return 0;
-
- for(int i=0; in_pdus; i++)
- {
- if(!pack_ul_tti_pdu_list_value(&pNfapiMsg->pdus_list[i], ppWritePackedMsg, end))
- return 0;
- }
-
- for(int i=0; in_group; i++)
- {
- if(!pack_ul_tti_groups_list_value(&pNfapiMsg->groups_list[i], ppWritePackedMsg, end))
- return 0;
-
- }
-
- return 1;
-}
-
-
-static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ;
-}
-
-static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
-
- return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
- push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
- push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) &&
- push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) &&
- push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
-
- return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) &&
- push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
-
- return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) &&
- push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) &&
- push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) &&
- push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
-
- return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
- push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
-
- return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
-
- return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) &&
- push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) &&
- push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) &&
- push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
- push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
- push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
- pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end));
-
-}
-
-static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
-
- return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
- push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
-
- if(!(push16(value->sfnsf, ppWritePackedMsg, end) &&
- push8(value->number_of_dci, ppWritePackedMsg, end) &&
- push8(value->number_of_hi, ppWritePackedMsg, end)))
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
-
- if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
- if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_HI_DCI0_HI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value)))
- return 0;
- }
- break;
- case NFAPI_HI_DCI0_DCI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value)))
- return 0;
- }
- break;
- case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value)))
- return 0;
- }
- break;
- case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value)))
- return 0;
- }
- break;
- case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value)))
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
-
- }
-
- return 1;
-}
-
-static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv;
-
- for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
- {
- if(!(push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, ppWritePackedMsg, end) &&
-
- push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) &&
-
- push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
-
- pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
-
- return 0;
- }
-
- return (push16(value->PDUType, ppWritePackedMsg, end) &&
- push16(value->PDUSize, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, ppWritePackedMsg, end) &&
-
- push8(value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, ppWritePackedMsg, end) &&
- pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, ppWritePackedMsg, end) &&
-
- push8(value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, ppWritePackedMsg, end));
-
-}
-
-static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg;
-
- if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->numPdus, ppWritePackedMsg, end)
- ))
- return 0;
-
- for(int i=0; inumPdus; i++)
- {
- if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end))
- return 0;
- }
- return 1;
-
-
-}
-
-
-
-static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-//pack_tx_data_pdu_list_value
-static uint8_t pack_tx_data_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_pdu_t* value = (nfapi_nr_pdu_t*)tlv;
-
- if(!(push32(value->num_TLV, ppWritePackedMsg, end) &&
- push16(value->PDU_index, ppWritePackedMsg, end) &&
- push16(value->PDU_length, ppWritePackedMsg, end)
- ))
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_tlvs = value->num_TLV;
- for(; i < total_number_of_tlvs; ++i)
- {
-
- if (!(push16(value->TLVs[i].length, ppWritePackedMsg, end) &&
- push16(value->TLVs[i].tag, ppWritePackedMsg, end)))
- return 0;
-
- switch(value->TLVs[i].tag)
- {
- case 0:
- {
- if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end))
- return 0;
- break;
-
- }
-
- case 1:
- {
- if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length , value->TLVs[i].length, ppWritePackedMsg, end))
- return 0;
- break;
-
- }
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", value->TLVs[i].tag );
- break;
- }
-
- }
- }
- return 1;
-}
-
-static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv;
-
- if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]);
-
- if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) &&
- push16(pdu->pdu_index, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t j;
- for(j = 0; j < pdu->num_segments; ++j)
- {
- // Use -1 as it is unbounded
- // DJP - does not handle -1
- // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
- int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
-
- if (pdu->segments[j].segment_length == 3)
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
- pdu->segments[j].segment_data[0],
- pdu->segments[j].segment_data[1],
- pdu->segments[j].segment_data[2]
- );
- }
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret);
-
- if (push_ret == 0)
- {
- return 0;
- }
- }
- }
-
- return 1;
-}
-
-static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg;
-
- if (!(
- push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Number_of_PDUs, ppWritePackedMsg, end)
- ))
- return 0;
-
- for(int i=0; iNumber_of_PDUs; i++)
- {
- if(!pack_tx_data_pdu_list_value(&pNfapiMsg->pdu_list[i], ppWritePackedMsg, end))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
-
- int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
- int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value);
- int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
-
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z);
-
- return x && y && z;
-}
-
-static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
- if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
- return 0;
- }
-
- uint8_t j;
- uint16_t num = value->number_of_TLVs;
- for(j = 0; j < num; ++j){
- if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
- return 0;
- }
- }
- return 1;
-}
-
-static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
- int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
- int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
- int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
- return x && y && z;
-}
-
-static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
-
- nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
-
- int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
- int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
- return x && z;
-}
-
-static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) );
-}
-
-static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
-
- return ( pull32(ppReadPackedMsg, &value->handle, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end));
-}
-
-static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(data->value_0, ppWritePackedMsg, end) &&
- push8(data->value_1, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(data->value_0, ppWritePackedMsg, end) &&
- push8(data->value_1, ppWritePackedMsg, end) &&
- push8(data->value_2, ppWritePackedMsg, end) &&
- push8(data->value_3, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(data->value_0, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(data->value_0, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv;
-
- if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) &&
- push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t result = 0;
- switch(harq_indication_tdd_rel8->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = 1;
- break;
- default:
- // err....
- break;
- }
-
- return result;
-
-}
-
-static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv;
-
- if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) &&
- push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t idx;
- for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx)
- {
- uint8_t result = 0;
-
- switch(harq_indication_tdd_rel9->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end);
- break;
- default:
- // err....
- break;
- }
-
- if(result == 0)
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv;
-
- if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) &&
- push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t idx;
- for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx)
- {
- uint8_t result = 0;
- switch(harq_indication_tdd_rel13->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end);
- break;
- default:
- // err....
- break;
- }
-
- if(result == 0)
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv;
-
- return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) &&
- push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv;
-
- return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) &&
- push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) &&
- pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv;
-
- return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) &&
- push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) &&
- pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
-
- return ( push8(value->ul_cqi, ppWritePackedMsg, end) &&
- push8(value->channel, ppWritePackedMsg, end));
-
-}
-
-static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
-
- if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_harqs;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) &&
- pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
-
- return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
-
- if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_crcs;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
- return 1;
-}
-
-static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-
-}
-static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
-
- return ( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->offset, ppWritePackedMsg, end) &&
- push8(value->ul_cqi, ppWritePackedMsg, end) &&
- push16(value->timing_advance, ppWritePackedMsg, end));
-}
-static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
-
- return ( push16(value->timing_advance_r9, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
-
- //printf("RX ULSCH BODY\n");
-
- if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
- return 0;
-
- // need to calculate the data offset's.
- uint16_t i = 0;
- uint16_t offset = 2; // taking into account the number_of_pdus
- uint16_t total_number_of_pdus = value->number_of_pdus;
- //printf("ULSCH:pdus:%d\n", total_number_of_pdus);
-
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
- if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
- {
- //printf("NFAPI_RX_UE_INFORMATION_TAG\n");
- offset += 4 + 6;
- }
-
- if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
- {
- //printf("NFAPI_RX_INDICATION_REL8_TAG\n");
- offset += 4 + 7;
- }
-
- if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG)
- {
- //printf("NFAPI_RX_INDICATION_REL9_TAG\n");
- offset += 4 + 2;
- }
- }
-
- // Now update the structure to include the offset
- for(i =0; i < total_number_of_pdus; ++i)
- {
- nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
-
- if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
- {
- if(pdu->rx_indication_rel8.offset == 1)
- {
- pdu->rx_indication_rel8.offset = offset;
- offset += pdu->rx_indication_rel8.length;
- }
- }
- }
-
- // Write out the pdu
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) &&
- pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value)))
- return 0;
- }
-
- // Write out the pdu data
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- uint16_t length = 0;
- nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
-
- if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
- {
- length = pdu->rx_indication_rel8.length;
- }
-
- if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0)
- return 0;
- }
- return 1;
-}
-
-
-static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
-
- return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) &&
- push8(preamble_rel8->preamble, ppWritePackedMsg, end) &&
- push16(preamble_rel8->timing_advance, ppWritePackedMsg, end));
-}
-static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
-
- return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) );
-}
-static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
-
- return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
-
- if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_preambles;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) &&
- pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) &&
- pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
-
- return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) &&
- push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) &&
- pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
-
- return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
-
- return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) );
-
-}
-
-static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
-
- return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ;
-}
-
-static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
-
- if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
- push8(value->number_of_subbands, ppWritePackedMsg, end) &&
- push8(value->num_atennas, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_subbands; ++idx)
- {
- if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) &&
- pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end)))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv;
-
- if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_ues;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) &&
- pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) &&
- pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) &&
- pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) &&
- pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-
-}
-
-static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
-
- if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_srs;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
- return 1;
-}
-
-static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-
-}
-
-static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
-
- return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) &&
- push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) &&
- push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
-
- return ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) &&
- push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) &&
- push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
- pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
-
- if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0)
- return 0;
-
- // need to calculate the data offset's. This very bittle due the hardcoding
- // of the sizes. can not use the sizeof as we have an array for the Rel9
- // info
- uint16_t i = 0;
- uint16_t offset = 2; // taking into account the number_of_cqis
- uint16_t total_number_of_pdus = value->number_of_cqis;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
-
- offset += 2; // for the instance length
-
- if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
- {
- offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t)
- }
-
- if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
- {
- offset += 4 + 8;
- }
-
- if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
- {
- offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported;
- }
-
- if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG)
- {
- offset += 4 + 2;
- }
- }
-
- // Now update the structure to include the offset
- for(i =0; i < total_number_of_pdus; ++i)
- {
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
-
- if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
- {
- if(pdu->cqi_indication_rel8.data_offset == 1)
- {
- pdu->cqi_indication_rel8.data_offset = offset;
- offset += pdu->cqi_indication_rel8.length;
- }
- }
-
- if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
- {
- if(pdu->cqi_indication_rel9.data_offset == 1)
- {
- pdu->cqi_indication_rel9.data_offset = offset;
- offset += pdu->cqi_indication_rel9.length;
- }
- }
-
- }
-
- // Write out the cqi information
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) &&
- pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) &&
- pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
-
- }
-
- // Write out the cqi raw data
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- uint16_t length = 0;
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
-
- if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
- {
- length = pdu->cqi_indication_rel8.length;
- }
-
- if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
- {
- length = pdu->cqi_indication_rel9.length;
- }
-
- if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0)
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-
-}
-
-static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push32(value->mp_cca, ppWritePackedMsg, end) &&
- push32(value->n_cca, ppWritePackedMsg, end) &&
- push32(value->offset, ppWritePackedMsg, end) &&
- push32(value->lte_txop_sf, ppWritePackedMsg, end) &&
- push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) &&
- push32(value->lbt_mode, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push32(value->offset, ppWritePackedMsg, end) &&
- push16(value->sfn_sf_end, ppWritePackedMsg, end) &&
- push32(value->lbt_mode, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
-
- if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
-
- if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
- if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
- {
- if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0)
- return 0;
- }
- break;
- case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
- {
- if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0)
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push32(value->result, ppWritePackedMsg, end) &&
- push32(value->lte_txop_symbols, ppWritePackedMsg, end) &&
- push32(value->initial_partial_sf, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push32(value->result, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
-
- if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
-
- if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
-
- if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
- {
- if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0)
- return 0;
- }
- break;
- case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
- {
- if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0)
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
-
- return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
-
- if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_harqs = value->number_of_harqs;
- for(; i < total_number_of_harqs; ++i)
- {
- nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) &&
- pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-
-static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
-
- return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) &&
- push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) &&
- push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) &&
- push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
-
- if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected;
- for(; i < total_number_of_initial_scs_detected; ++i)
- {
- nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
-
- //uint8_t* instance_length_p = *ppWritePackedMsg;
- //if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- // return 0;
-
- if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- //uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- //push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg;
-
- return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
-
- return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg;
-
- return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
-
- return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
-
- return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg;
-
- return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-
-// Main pack function - public
-
-int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
-{
- nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
- uint8_t *pWritePackedMessage = pPackedBuf;
- uint8_t *pPackedLengthField = &pWritePackedMessage[4];
- uint8_t *end = pPackedBuf + packedBufLen;
-
- if (pMessageBuf == NULL || pPackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
- return -1;
- }
- /*
- printf("\n P7 MESSAGE SENT: \n");
- for(int i=0; i< packedBufLen; i++){
- printf("%d", *(uint8_t *)(pMessageBuf + i));
- }
- printf("\n");
- */
- // process the header
- if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
- push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
- push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
- push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
- push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
- push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
- return -1;
- }
-
- if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
- }
- // look for the specific message
- uint8_t result = 0;
- switch (pMessageHeader->message_id)
- {
- case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
- result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
- result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
- case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
- result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
- case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
- result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_HARQ_INDICATION:
- result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_CRC_INDICATION:
- result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- //printf("RX ULSCH\n");
- result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RACH_INDICATION:
- result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_SRS_INDICATION:
- result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_SR_INDICATION:
- result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NRACH_INDICATION:
- result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
- result = pack_nr_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
- result = pack_nr_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_TIMING_INFO:
- result = pack_nr_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- default:
- {
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
- {
- if(config && config->pack_p7_vendor_extension)
- {
- result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- break;
- }
-
- if(result == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
- return -1;
- }
-
- // check for a valid message length
- uintptr_t msgHead = (uintptr_t)pPackedBuf;
- uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
- uint32_t packedMsgLen = msgEnd - msgHead;
- uint16_t packedMsgLen16;
- if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
- return -1;
- }
- else
- {
- packedMsgLen16 = (uint16_t)packedMsgLen;
- }
-
- // Update the message length in the header
- pMessageHeader->message_length = packedMsgLen16;
-
- if(!push16(packedMsgLen16, &pPackedLengthField, end))
- return -1;
-
- if(1)
- {
- //quick test
- if(pMessageHeader->message_length != packedMsgLen)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
- }
- }
-
- return (packedMsgLen);
-}
-
-int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
-{
- nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
- uint8_t *pWritePackedMessage = pPackedBuf;
- uint8_t *pPackedLengthField = &pWritePackedMessage[4];
- uint8_t *end = pPackedBuf + packedBufLen;
-
- if (pMessageBuf == NULL || pPackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
- return -1;
- }
- /*
- printf("\n P7 MESSAGE SENT: \n");
- for(int i=0; i< packedBufLen; i++){
- printf("%d", *(uint8_t *)(pMessageBuf + i));
- }
- printf("\n");
- */
- // process the header
- if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
- push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
- push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
- push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
- push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
- push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
- return -1;
- }
-
- if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
- }
- // look for the specific message
- uint8_t result = 0;
- switch (pMessageHeader->message_id)
- {
- case NFAPI_DL_CONFIG_REQUEST:
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__);
- result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UL_CONFIG_REQUEST:
- result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
- case NFAPI_TX_REQUEST:
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
- result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
- case NFAPI_HI_DCI0_REQUEST:
- result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_HARQ_INDICATION:
- result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_CRC_INDICATION:
- result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- //printf("RX ULSCH\n");
- result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RACH_INDICATION:
- result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_SRS_INDICATION:
- result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_SR_INDICATION:
- result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NRACH_INDICATION:
- result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_DL_NODE_SYNC:
- result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UL_NODE_SYNC:
- result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_TIMING_INFO:
- result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- default:
- {
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
- {
- if(config && config->pack_p7_vendor_extension)
- {
- result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- break;
- }
-
- if(result == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
- return -1;
- }
-
- // check for a valid message length
- uintptr_t msgHead = (uintptr_t)pPackedBuf;
- uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
- uint32_t packedMsgLen = msgEnd - msgHead;
- uint16_t packedMsgLen16;
- if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
- return -1;
- }
- else
- {
- packedMsgLen16 = (uint16_t)packedMsgLen;
- }
-
- // Update the message length in the header
- pMessageHeader->message_length = packedMsgLen16;
-
- if(!push16(packedMsgLen16, &pPackedLengthField, end))
- return -1;
-
- if(1)
- {
- //quick test
- if(pMessageHeader->message_length != packedMsgLen)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
- }
- }
-
- return (packedMsgLen);
-}
-
-// Unpack routines
-// NR:
-static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &value->bwp_size, end) &&
- pull16(ppReadPackedMsg, &value->bwp_start, end) &&
-
- pull8(ppReadPackedMsg, &value->subcarrier_spacing, end) &&
- pull8(ppReadPackedMsg, &value->cyclic_prefix, end) &&
-
- pull16(ppReadPackedMsg, &value->start_rb, end) &&
- pull16(ppReadPackedMsg, &value->nr_of_rbs, end) &&
-
- pull8(ppReadPackedMsg, &value->csi_type, end) &&
- pull8(ppReadPackedMsg, &value->row, end) &&
-
- pull16(ppReadPackedMsg, &value->freq_domain, end) &&
- pull8(ppReadPackedMsg, &value->symb_l0, end) &&
-
- pull8(ppReadPackedMsg, &value->symb_l1, end) &&
- pull8(ppReadPackedMsg, &value->cdm_type, end) &&
-
- pull8(ppReadPackedMsg, &value->freq_density, end) &&
- pull16(ppReadPackedMsg, &value->scramb_id, end) &&
-
- pull8(ppReadPackedMsg, &value->power_control_offset, end) &&
- pull8(ppReadPackedMsg, &value->power_control_offset_ss, end)
- );
-
-}
-
-
-static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
-
- for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
- {
- if(!(pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) &&
- pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingId, end) &&
-
- pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingRNTI, end) &&
- pull8(ppReadPackedMsg, &value->dci_pdu[i].CceIndex, end) &&
- pull8(ppReadPackedMsg, &value->dci_pdu[i].AggregationLevel, end) &&
- pull8(ppReadPackedMsg, &value->dci_pdu[i].beta_PDCCH_1_0, end) &&
-
- pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) &&
- pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) &&
-
- pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, end)))
-
- return 0;
- }
-
- // TODO: resolve the packaging of array (currently sending a single element)
- return(
- pull16(ppReadPackedMsg, &value->BWPSize, end) &&
- pull16(ppReadPackedMsg, &value->BWPStart, end) &&
- pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) &&
- pull8(ppReadPackedMsg, &value->CyclicPrefix, end) &&
-
- pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) &&
- pull8(ppReadPackedMsg, &value->DurationSymbols, end) &&
- pullarray8(ppReadPackedMsg, value->FreqDomainResource, 6, 6, end) &&
- pull8(ppReadPackedMsg, &value->CceRegMappingType, end) &&
-
- pull8(ppReadPackedMsg, &value->RegBundleSize, end) &&
- pull8(ppReadPackedMsg, &value->InterleaverSize, end) &&
- pull8(ppReadPackedMsg, &value->CoreSetType, end) &&
- pull16(ppReadPackedMsg, &value->ShiftIndex, end) &&
-
- pull8(ppReadPackedMsg, &value->precoderGranularity, end) &&
- pull16(ppReadPackedMsg, &value->numDlDci, end));
-
-}
-
-
-static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
-
- // TODO: resolve the packaging of array (currently sending a single element)
- return(
- pull16(ppReadPackedMsg, &value->pduBitmap, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull16(ppReadPackedMsg, &value->pduIndex, end) &&
- pull16(ppReadPackedMsg, &value->BWPSize, end) &&
-
- pull16(ppReadPackedMsg, &value->BWPStart, end) &&
- pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) &&
- pull8(ppReadPackedMsg, &value->CyclicPrefix, end) &&
- pull8(ppReadPackedMsg, &value->NrOfCodewords, end) &&
-
- pullarray16(ppReadPackedMsg, value->targetCodeRate, 2, 1, end) &&
- pullarray8(ppReadPackedMsg, value->qamModOrder, 2, 1, end) &&
- pullarray8(ppReadPackedMsg, value->mcsIndex, 2, 1, end) &&
- pullarray8(ppReadPackedMsg, value->mcsTable, 2, 1, end) &&
-
- pullarray8(ppReadPackedMsg, value->rvIndex, 2, 1, end) &&
- pullarray32(ppReadPackedMsg, value->TBSize, 2, 1, end) &&
- pull16(ppReadPackedMsg, &value->dataScramblingId, end) &&
- pull8(ppReadPackedMsg, &value->nrOfLayers, end) &&
-
- pull8(ppReadPackedMsg, &value->transmissionScheme, end) &&
- pull8(ppReadPackedMsg, &value->refPoint, end) &&
- pull16(ppReadPackedMsg, &value->dlDmrsSymbPos, end) &&
- pull8(ppReadPackedMsg, &value->dmrsConfigType, end) &&
-
- pull16(ppReadPackedMsg, &value->dlDmrsScramblingId, end) &&
- pull8(ppReadPackedMsg, &value->SCID, end) &&
- pull8(ppReadPackedMsg, &value->numDmrsCdmGrpsNoData, end) &&
- pull16(ppReadPackedMsg, &value->dmrsPorts, end) &&
-
- pull8(ppReadPackedMsg, &value->resourceAlloc, end) &&
- pull16(ppReadPackedMsg, &value->rbStart, end) &&
- pull16(ppReadPackedMsg, &value->rbSize, end) &&
-
- pull8(ppReadPackedMsg, &value->VRBtoPRBMapping, end) &&
- pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) &&
- pull8(ppReadPackedMsg, &value->NrOfSymbols, end) &&
- pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) &&
-
- pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) &&
- pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) &&
- pull8(ppReadPackedMsg, &value->PTRSReOffset, end)
- );
-
-}
-
-
-static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- printf("ssb received and unpacked. \n");
- nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &value->PhysCellId, end) &&
- pull8(ppReadPackedMsg, &value->BetaPss, end) &&
- pull8(ppReadPackedMsg, &value->SsbBlockIndex, end) &&
- pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) &&
- pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) &&
- pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) &&
- pull32(ppReadPackedMsg, &value->bchPayload, end)
- // TODO: pack precoding_and_beamforming too
- );
-
-}
-
-
-// LTE:
-static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) &&
- pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
- pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) &&
- pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end));
-
-}
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end));
-}
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end));
-}
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end));
-}
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) &&
- pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end));
-}
-
-static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end)
-{
- if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
- pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
- pull8(ppReadPackedMsg, &value->num_antennas, end)))
- return 0;
-
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_subbands; ++idx)
- {
- nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
-
- if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) &&
- pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end)))
- return 0;
-
- uint8_t antenna_idx = 0;
- uint8_t scheduled_ue_idx = 0;
-
- for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
- {
- for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
- {
- if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end))
- return 0;
- }
- }
-
- }
-
-
- return 1;
-
-}
-
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
-
- // If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been
- // added
- uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5;
- dci_dl_pdu_rel13->tpm_struct_flag = 0;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) &&
- ( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) &&
- ( (tpm_struct_flag_present == 1 && dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1));
-
-}
-
-static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) &&
- pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end));
-}
-
-static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) &&
- pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) &&
- pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) &&
- pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) &&
- pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end));
-}
-
-static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
-
- if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
- pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) &&
- pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end)))
- return 0;
-
- uint16_t j = 0;
- for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j)
- {
- if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) &&
- pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end)))
- return 0;
- }
- return 1;
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) );
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
- pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ;
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end));
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end));
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end));
-}
-
-static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) &&
- pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
- pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) &&
- pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end));
-}
-static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) &&
- pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end));
-}
-
-static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) &&
- pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) &&
- pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) &&
- pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end));
-}
-
-static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) &&
- pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) &&
- pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) &&
- pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
- pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) &&
- pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end));
-}
-
-static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
-
- if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) &&
- pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) &&
- pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end)))
- return 0;
-
-
- uint16_t idx =0;
- for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx)
- {
- if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end)))
- return 0;
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n");
- //pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??);
- }
- return 1;
-}
-
-static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) &&
- pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) &&
- pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) &&
- pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end));
-}
-
-static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end));
-}
-
-static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
-
-
- return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) &&
- pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end));
-}
-
-
-static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) &&
- pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) &&
- pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end));
-}
-
-static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) &&
- pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end));
-}
-
-static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) &&
- pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) &&
- pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) &&
- pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) &&
- pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end));
-}
-
-
-static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)msg;
-
- if(!(pull16(ppReadPackedMsg, &value->PDUSize, end) &&
- pull16(ppReadPackedMsg, &value->PDUType, end) ))
- return 0;
-
-
- // first match the pdu type, then call the respective function
- switch(value->PDUType)
- {
- case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
- {
- if(!(unpack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppReadPackedMsg,end)))
- return 0;
- }
- break;
-
- case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
- {
- if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end)))
- return 0;
- }
- break;
- case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
- {
- if(!(unpack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppReadPackedMsg,end)))
- return 0;
- }
- break;
- case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
- {
- if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end)))
- return 0;
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType );
- }
- break;
- }
-
- return 1;
-}
-
-
-
-
-static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) &&
- pull8(ppReadPackedMsg, &value->number_dci, end) &&
- pull16(ppReadPackedMsg, &value->number_pdu, end) &&
- pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) &&
- pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end)))
- return 0;
-
- if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU);
- return 0;
- }
-
- if(value->number_pdu)
- {
- value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config);
- if(value->dl_config_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu);
- return 0;
- }
- }
- else
- {
- value->dl_config_pdu_list = 0;
- }
-
- uint16_t i;
- uint16_t total_number_of_pdus = value->number_pdu;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- {
- // pdu end of beyond buffer end
- return 0;
- }
-
- switch(pdu->pdu_type)
- {
- case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value},
- { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value},
- { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
-
- }
- break;
- case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
-
- }
- break;
- default:
- // Need to log an error
- break;
- }
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_dl_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
-
- if (!(pull16(ppReadPackedMsg,&pNfapiMsg->SFN, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nGroup, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nPDUs, end) &&
- pullarray8(ppReadPackedMsg,pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, end)
- //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
- ))
- return 0;
-
- int arr[12];
- for(int i=0;idl_tti_request_body.nGroup;i++)
- {
- for(int j=0;jdl_tti_request_body.nUe[i];j++)
- {
- arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
- }
- if(!(pullarrays32(ppReadPackedMsg,arr,12,pNfapiMsg->dl_tti_request_body.nUe[i], end)))
- return 0;
- }
-
- for(int i=0;idl_tti_request_body.nPDUs;i++)
- {
- if(!unpack_dl_tti_request_body_value(ppReadPackedMsg, end, &pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i]))
- return 0;
- }
-
-return 1;
-}
-
-
-static uint8_t unpack_ul_tti_request_prach_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_prach_pdu_t* prach_pdu = (nfapi_nr_prach_pdu_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &prach_pdu->phys_cell_id, end) &&
- pull8(ppReadPackedMsg, &prach_pdu->num_prach_ocas, end) &&
- pull8(ppReadPackedMsg, &prach_pdu->prach_format, end) &&
- pull8(ppReadPackedMsg, &prach_pdu->num_ra, end) &&
- pull8(ppReadPackedMsg, &prach_pdu->prach_start_symbol, end) &&
- pull16(ppReadPackedMsg, &prach_pdu->num_cs, end)
- // TODO: ignoring beamforming tlv for now
- );
-}
-
-
-static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_pucch_pdu_t* pucch_pdu = (nfapi_nr_pucch_pdu_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &pucch_pdu->rnti, end) &&
- pull32(ppReadPackedMsg, &pucch_pdu->handle, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->bwp_size, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->bwp_start, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->subcarrier_spacing, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->nr_of_symbols, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->freq_hop_flag, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->second_hop_prb, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->group_hop_flag, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->sequence_hop_flag, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->hopping_id, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->initial_cyclic_shift, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->data_scrambling_id, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->time_domain_occ_idx, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_idx, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_len, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->add_dmrs_flag, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->dmrs_scrambling_id, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->dmrs_cyclic_shift, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->sr_flag, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->bit_len_harq, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part1, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part2, end)
- // TODO: ignoring beamforming tlv for now
- );
-}
-
-
-static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_pusch_pdu_t* pusch_pdu = (nfapi_nr_pusch_pdu_t*)tlv;
-
- if (!(
- pull16(ppReadPackedMsg, &pusch_pdu->pdu_bit_map, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->rnti, end) &&
- pull32(ppReadPackedMsg, &pusch_pdu->handle, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->bwp_size, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->bwp_start, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->subcarrier_spacing, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->cyclic_prefix, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->target_code_rate, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->scid, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->num_dmrs_cdm_grps_no_data, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc,end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->rb_start, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->rb_size, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->vrb_to_prb_mapping, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->frequency_hopping, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->tx_direct_current_location, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->uplink_frequency_shift_7p5khz, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->start_symbol_index, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->nr_of_symbols, end)
- // TODO: ignoring beamforming tlv for now
- ))
- return 0;
-
-
- //Pack Optional Data only included if indicated in pduBitmap
- switch(pusch_pdu->pdu_bit_map){
- case PUSCH_PDU_BITMAP_PUSCH_DATA:
- {
- // pack optional TLVs
- return(
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.rv_index, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.harq_process_id, end) &&
- pull32(ppReadPackedMsg, &pusch_pdu->pusch_data.tb_size, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->pusch_data.num_cb, end) &&
- pullarray8(ppReadPackedMsg, pusch_pdu->pusch_data.cb_present_and_position,1,1,end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_PUSCH_UCI:
- {
- return(
- pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.harq_ack_bit_length, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part1_bit_length, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part2_bit_length, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.alpha_scaling, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_harq_ack, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi1, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi2, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_PUSCH_PTRS:
- {
- return(
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.num_ptrs_ports, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, end) &&
-+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, end) &&
-+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_time_density, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_freq_density, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ul_ptrs_power, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_DFTS_OFDM:
- {
- return(
- pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_group_number, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_sequence_number, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, end)
- );
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map );
- }
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_srs_pdu_t* srs_pdu = (nfapi_nr_srs_pdu_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &srs_pdu->rnti, end) &&
- pull32(ppReadPackedMsg, &srs_pdu->handle, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->bwp_size, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->bwp_start, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->subcarrier_spacing, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->cyclic_prefix, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->num_ant_ports, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->num_symbols, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->num_repetitions, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->time_start_position, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->config_index, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->sequence_id, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->bandwidth_index, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->comb_size, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->t_srs, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->t_offset, end)
- // TODO: ignoring beamforming tlv for now
- );
-}
-
-
-static uint8_t unpack_ul_tti_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_ul_tti_request_number_of_pdus_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_pdus_t*)msg;
-
- if(!(pull16(ppReadPackedMsg, &pNfapiMsg->pdu_size, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->pdu_type, end) ))
- return 0;
-
-
- // first natch the pdu type, then call the respective function
- switch(pNfapiMsg->pdu_type)
- {
-
- case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
- {
- if(!unpack_ul_tti_request_prach_pdu(&pNfapiMsg->prach_pdu, ppReadPackedMsg, end))
- return 0;
- }
- break;
-
- case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
- {
- if(!unpack_ul_tti_request_pucch_pdu(&pNfapiMsg->pucch_pdu, ppReadPackedMsg, end))
- return 0;
- }
- break;
-
- case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
- {
- if(!unpack_ul_tti_request_pusch_pdu(&pNfapiMsg->pusch_pdu, ppReadPackedMsg, end))
- return 0;
- }
- break;
-
- case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
- {
- if(!unpack_ul_tti_request_srs_pdu(&pNfapiMsg->srs_pdu, ppReadPackedMsg, end))
- return 0;
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", pNfapiMsg->pdu_type );
- }
- break;
-
-
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_ul_tti_request_number_of_groups_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_groups_t*)msg;
-
- if(!pull8(ppReadPackedMsg, &pNfapiMsg->n_ue, end))
- return 0;
- for (int i = 0; i < pNfapiMsg->n_ue; i++)
- {
- if(!pull8(ppReadPackedMsg, &pNfapiMsg->ue_list[i].pdu_idx ,end) )
- return 0;
- }
- return 1;
-}
-
-
-static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg;
-
- if (!(
- pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) ))
- return 0;
-
- for(int i=0; i< pNfapiMsg->n_pdus; i++)
- {
- if (!unpack_ul_tti_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdus_list[i]))
- return 0;
- }
-
- for(int i=0; i< pNfapiMsg->n_group; i++)
- {
- if (!unpack_ul_tti_groups_list_value(ppReadPackedMsg, end, &pNfapiMsg->groups_list[i]))
- return 0;
- }
-
- return 1;
-}
-
-
-
-static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value},
- };
-
- return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
-
-
-
- nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end ));
-}
-
-static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) &&
- pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) &
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end));
-}
-static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel11->dmrs_config_flag, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end));
-}
-static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &ulsch_pdu_rel13->ue_type, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end));
-}
-static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end));
-}
-
-static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end)))
- return 0;
-
- switch(cqi_ri_info_rel9->report_type)
- {
- case NFAPI_CSI_REPORT_TYPE_PERIODIC:
- {
- if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end)))
- return 0;
- }
- break;
- case NFAPI_CSI_REPORT_TYPE_APERIODIC:
- {
- if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0)
- return 0;
-
- uint8_t i;
- for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
- {
- if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0)
- return 0;
-
- uint8_t j;
- for(j = 0; j < 8; ++j)
- {
- if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0)
- return 0;
- }
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
- return 0;
- }
- break;
- };
- return 1;
-}
-
-// NOTE : This function is a little unconventional as we uese the side to
-// determine the report type
-static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
- if(cqi_ri_info_rel13->tl.length == 0)
- {
- cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC;
- }
- else
- {
- cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC;
- if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0)
- return 0;
- }
- return 1;
-}
-static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) &&
- pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end));
-}
-static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end));
-}
-
-static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end));
-}
-
-static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end));
-}
-static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) &&
- pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end));
-}
-static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) &&
- pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) &&
- pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) &&
- pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end));
-}
-
-static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end));
-}
-static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) &&
- pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end));
-}
-static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) &&
- pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end));
-}
-
-static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end));
-}
-
-static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) &&
- pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) &&
- pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) &&
- pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) &&
- pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) &&
- pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) &&
- pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) &&
- pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) &&
- pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) &&
- pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) &&
- pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) &&
- pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) &&
- pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) &&
- pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) &&
- pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) &&
- pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) &&
- pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) &&
- pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) &&
- pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end));
-}
-
-
-static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) &&
- pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) &&
- pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) &&
- pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end));
-}
-
-static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
- return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end);
-}
-
-static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end));
-}
-
-static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end));
-}
-
-static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) &&
- pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) &&
- pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) &&
- pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) &&
- pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) &&
- pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end)))
- return 0;
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value},
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value},
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
- { NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value},
- };
-
- return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0);
-}
-
-static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) &&
- pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) &&
- pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end));
-}
-
-
-static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- #define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value},
-
- #define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \
- { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value},
-
- #define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value},
-
- #define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value},
-
- #define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
-
- #define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \
- { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value},
-
- #define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value},
-
- #define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value},
-
- #define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \
- { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value},
-
- #define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value},
-
- #define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value},
-
-
- nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) &&
- pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) &&
- pull8(ppReadPackedMsg, &value->srs_present, end)))
- return 0;
-
- if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_pdus > 0)
- {
- value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config);
-
- if(value->ul_config_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
- return 0;
- }
- }
- else
- {
- value->ul_config_pdu_list = 0;
- }
-
-
- uint16_t i;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- {
- // pdu end is past buffer end
- return 0;
- }
-
- switch(pdu->pdu_type)
- {
- case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
-
- case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu)
- UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information)
- UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu)
- UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information)
- UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu)
- UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information)
- UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information)
- UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information)
- UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information)
- UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information)
- UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information)
- UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- }
- }
- return 1;
-}
-
-
-static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
-
- return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) &&
- pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) &&
- pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) &&
- pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) &&
- pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end));
-}
-
-static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) &&
- pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end));
-}
-
-static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) &&
- pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) &&
- pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) &&
- pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end));
-}
-
-static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) &&
- pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end));
-}
-
-static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end));
-}
-
-static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) &&
- pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) &&
- pull8(ppReadPackedMsg, &value->resource_block_assignment, end) &&
- pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) &&
- pull8(ppReadPackedMsg, &value->start_symbol, end) &&
- pull8(ppReadPackedMsg, &value->ecce_index, end) &&
- pull8(ppReadPackedMsg, &value->aggreagation_level, end) &&
- pull8(ppReadPackedMsg, &value->rnti_type, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->ce_mode, end) &&
- pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) &&
- pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) &&
- pull16(ppReadPackedMsg, &value->transmission_power, end) &&
- pull8(ppReadPackedMsg, &value->dci_format, end) &&
- pull8(ppReadPackedMsg, &value->resource_block_start, end) &&
- pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
- pull8(ppReadPackedMsg, &value->mcs, end) &&
- pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) &&
- pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) &&
- pull8(ppReadPackedMsg, &value->new_data_indication, end) &&
- pull8(ppReadPackedMsg, &value->harq_process, end) &&
- pull8(ppReadPackedMsg, &value->redudency_version, end) &&
- pull8(ppReadPackedMsg, &value->tpc, end) &&
- pull8(ppReadPackedMsg, &value->csi_request, end) &&
- pull8(ppReadPackedMsg, &value->ul_inex, end) &&
- pull8(ppReadPackedMsg, &value->dai_presence_flag, end) &&
- pull8(ppReadPackedMsg, &value->dl_assignment_index, end) &&
- pull8(ppReadPackedMsg, &value->srs_request, end) &&
- pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) &&
- pull32(ppReadPackedMsg, &value->tcp_bitmap, end) &&
- pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) &&
- pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) &&
- pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end));
-}
-
-static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->ncce_index, end) &&
- pull8(ppReadPackedMsg, &value->aggregation_level, end) &&
- pull8(ppReadPackedMsg, &value->start_symbol, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) &&
- pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) &&
- pull8(ppReadPackedMsg, &value->subcarrier_indication, end) &&
- pull8(ppReadPackedMsg, &value->resource_assignment, end) &&
- pull8(ppReadPackedMsg, &value->scheduling_delay, end) &&
- pull8(ppReadPackedMsg, &value->mcs, end) &&
- pull8(ppReadPackedMsg, &value->redudancy_version, end) &&
- pull8(ppReadPackedMsg, &value->repetition_number, end) &&
- pull8(ppReadPackedMsg, &value->new_data_indicator, end) &&
- pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end));
-}
-
-static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
-
- if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) &&
- pull8(ppReadPackedMsg, &value->number_of_dci, end) &&
- pull8(ppReadPackedMsg, &value->number_of_hi, end)))
- return 0;
-
- uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci;
-
- if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU);
- return 0;
- }
-
- if(totalNumPdus > 0)
- {
- value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config);
- if(value->hi_dci0_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus);
- return 0;
- }
- }
- else
- {
- value->hi_dci0_pdu_list = 0;
- }
-
- uint8_t i;
- for(i = 0; i < totalNumPdus; ++i)
- {
- nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- {
- // pdu end if past buffer end
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %d %d\n", __FUNCTION__, packedPduEnd, end);
- return 0;
- }
-
- switch(pdu->pdu_type)
- {
- case NFAPI_HI_DCI0_HI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value},
- { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_HI_DCI0_DCI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
- { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
- { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
- { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
- { NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
- }
-
- return 1;
-}
-//unpack_ul_dci_pdu_list_value
-
-static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)msg;
- for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
- {
- if(!(pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, end) &&
-
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, end) &&
-
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end) &&
-
- pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end)))
-
- return 0;
- }
-
- return (pull16(ppReadPackedMsg, &value->PDUType, end) &&
- pull16(ppReadPackedMsg, &value->PDUSize, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, end) &&
-
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, end) &&
- pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, end) &&
-
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end));
-
-}
-
-static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
-nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg;
-
- if (!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->numPdus, end)
- ))
- return 0;
- for(int i=0; i< pNfapiMsg->numPdus; i++)
- {
- if (!unpack_ul_dci_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->ul_dci_pdu_list[i]))
- return 0;
- }
-
- return 1;
-
-}
-
-static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-
-}
-static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_pdu_t* pNfapiMsg = (nfapi_nr_pdu_t*)msg;
-
- if(!(pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->PDU_length, end)
- ))
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV;
- for(; i < total_number_of_tlvs; ++i)
- {
-
- if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end)))
- return 0;
-
- switch(pNfapiMsg->TLVs[i].tag){
- case 0:
- {
- if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end))
- return 0;
- break;
-
- }
-
- case 1:
- {
- if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length , pNfapiMsg->TLVs[i].length, end))
- return 0;
- break;
-
- }
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", pNfapiMsg->TLVs[i].tag );
- break;
- }
-
- }
- }
-
-
- return 1;
-}
-
-static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg;
-
- if(!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Number_of_PDUs, end)))
- return 0;
-
- for(int i=0; i< pNfapiMsg->Number_of_PDUs; i++)
- {
- if (!unpack_tx_data_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdu_list[i]))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- uint8_t proceed = 1;
- nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
-
- if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
- return 0;
-
- while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
- {
- nfapi_tl_t generic_tl;
- if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- return 0;
-
- switch(generic_tl.tag)
- {
- case NFAPI_TX_REQUEST_BODY_TAG:
- {
- pNfapiMsg->tx_request_body.tl = generic_tl;
-
- if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0)
- return 0;
-
- if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU);
- return 0;
- }
-
- if(pNfapiMsg->tx_request_body.number_of_pdus > 0)
- {
- pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config);
- if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus);
- return 0;
- }
- }
- else
- {
- pNfapiMsg->tx_request_body.tx_pdu_list = 0;
- }
-
-
- uint16_t i;
- uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus;
- for(i = 0; i < totalNumPdus; ++i)
- {
- nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
- if (pdu) {
- uint16_t length = 0;
- uint16_t index = 0;
-
- if(!(pull16(ppReadPackedMsg, &length, end) &&
- pull16(ppReadPackedMsg, &index, end)))
- return 0;
-
- pdu->pdu_length = length;
- pdu->pdu_index = index;
-
-
- // TODO : May need to rethink this bit
- pdu->num_segments = 1;
- pdu->segments[0].segment_length = pdu->pdu_length;
- pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
-
- if(pdu->segments[0].segment_data)
- {
- if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
- return 0;
- if (pdu->segments[0].segment_length == 3)
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
- pdu->segments[0].segment_data[0],
- pdu->segments[0].segment_data[1],
- pdu->segments[0].segment_data[2]
- );
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
- }
- } else {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
- }
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag );
- }
- break;
- };
- }
-
- return 1;
-}
-
-static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- uint8_t proceed = 1;
- nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
-
- if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
- return 0;
-
- while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
- {
- nfapi_tl_t generic_tl;
- if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- return 0;
-
- switch(generic_tl.tag)
- {
- case NFAPI_UE_RELEASE_BODY_TAG:
- {
- pNfapiMsg->ue_release_request_body.tl = generic_tl;
- if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
- return 0;
-
- if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
- return 0;
- } else {
- uint8_t j;
- uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
- for(j = 0; j < num; ++j){
- if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
- return 0;
- }
- }
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
- }
- break;
- };
- }
-
- return 1;
-}
-
-static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->value_0, end) &&
- pull8(ppReadPackedMsg, &value->value_1, end));
-}
-
-static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->value_0, end) &&
- pull8(ppReadPackedMsg, &value->value_1, end) &&
- pull8(ppReadPackedMsg, &value->value_2, end) &&
- pull8(ppReadPackedMsg, &value->value_3, end));
-}
-static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv;
- return ( pull8(ppReadPackedMsg, &value->value_0, end));
-}
-static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv;
- return (pull8(ppReadPackedMsg, &value->value_0, end));
-}
-
-static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
- pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
- return 0;
-
- uint8_t result = 0;
- switch(value->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = 1;
- break;
- default:
- // TODO add error message
- return 0;
- break;
- }
- return result;
-}
-
-static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
- pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
- return 0;
-
- if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
- {
- // TODO : add error message
- return 0;
- }
-
- uint16_t idx = 0;
- for(idx = 0; idx < value->number_of_ack_nack; ++idx)
- {
- uint8_t result = 0;
- switch(value->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
- break;
- default:
- // TODO add error message
- return 0;
- break;
- }
-
- if(result == 0)
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
- pull16(ppReadPackedMsg, &value->number_of_ack_nack, end)))
- return 0;
-
- if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
- {
- // TODO : add error message
- return 0;
- }
-
- uint16_t idx = 0;
- for(idx = 0; idx < value->number_of_ack_nack; ++idx)
- {
- uint8_t result = 0;
- switch(value->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end);
- break;
- default:
- // TODO add error message
- return 0;
- break;
- }
-
- if(result == 0)
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv;
- return (pull8(ppReadPackedMsg, &value->harq_tb1, end) &&
- pull8(ppReadPackedMsg, &value->harq_tb2, end));
-}
-
-static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->mode, end) &&
- pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
- pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end));
-}
-
-static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->mode, end) &&
- pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
- pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end));
-}
-
-static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
- pull8(ppReadPackedMsg, &value->channel, end));
-}
-
-
-
-static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
- uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(harqBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
- return 0;
-
- if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
- return 0;
- }
-
- value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config);
- if(value->harq_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
- return 0;
- }
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_harqs; ++i)
- {
- nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value},
- { NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value},
- { NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value},
- { NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value},
- { NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value},
- { NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value},
- { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
- return 0;
-
- }
-
- return 1;
-}
-
-static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
- return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) );
-}
-
-static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
- uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(crcBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0)
- return 0;
-
- if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_crcs > 0)
- {
- value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config);
- if(value->crc_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs);
- return 0;
- }
- }
- else
- {
- value->crc_pdu_list = 0;
- }
-
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_crcs; ++i)
- {
- nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value },
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0)
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &value->length, end) &&
- pull16(ppReadPackedMsg, &value->offset, end) &&
- pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end));
-}
-static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
- return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
-}
-
-static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
-
- // the rxBodyEnd points to the end of the cqi PDU's
- uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length;
- uint8_t* rxPduEnd = rxBodyEnd;
-
- uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
-
- if(rxBodyEnd > end)
- {
- // pdu end is past buffer end
- return 0;
- }
-
- if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
- return 0;
-
- if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_pdus > 0)
- {
- value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
- if(value->rx_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
- return 0;
- }
- }
- else
- {
- value->rx_pdu_list = 0;
- }
-
- uint8_t i = 0;
- nfapi_rx_indication_pdu_t* pdu = 0;
- while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd)
- {
- nfapi_tl_t generic_tl;
- if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- return 0;
-
- switch(generic_tl.tag)
- {
- case NFAPI_RX_UE_INFORMATION_TAG:
- {
- pdu = &(value->rx_pdu_list[i++]);
- pdu->rx_ue_information.tl = generic_tl;
- if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
- return 0;
- }
- break;
- case NFAPI_RX_INDICATION_REL8_TAG:
- {
- if(pdu != 0)
- {
- pdu->rx_indication_rel8.tl = generic_tl;
- if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
- return 0;
-
- if(pdu->rx_indication_rel8.offset > 0)
- {
- // Need to check that the data is within the tlv
- if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd)
- {
- // If this the first pdu set the rxPduEnd
- if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd)
- {
- rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset;
-
- if(rxPduEnd > end)
- {
- // pdu end is past buffer end
- return 0;
- }
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n");
- }
- }
- }
- }
- break;
- case NFAPI_RX_INDICATION_REL9_TAG:
- {
- if(pdu != 0)
- {
- pdu->rx_indication_rel9.tl = generic_tl;
- if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
- return 0;
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag );
- }
- break;
- }
- }
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_pdus; ++idx)
- {
- if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
- {
- uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length;
- value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config);
- if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0)
- {
- return 0;
- }
- }
- }
-
- return 1;
-}
-
-static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) &&
- pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end));
-}
-
-static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
- return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end);
-}
-
-static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
- return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end);
-}
-
-static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
- uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(rachBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0)
- return 0;
-
- if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_preambles > 0)
- {
- value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config);
- if(value->preamble_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles);
- return 0;
- }
- }
- else
- {
- value->preamble_list = 0;
- }
-
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_preambles; ++i)
- {
- nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value },
- { NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value },
- { NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value },
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0)
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
-
- if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) &&
- pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) &&
- pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end)))
- return 0;
- return 1;
-}
-
-static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
- return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end));
-}
-
-static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
- return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end));
-}
-
-static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
- return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end));
-}
-
-static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
- pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
- pull8(ppReadPackedMsg, &value->num_atennas, end)))
- return 0;
-
- if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS)
- {
- // todo : add error
- return 0;
- }
-
- if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS)
- {
- // todo : add error
- return 0;
- }
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_subbands; ++idx)
- {
- if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) &&
- pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end)))
- return 0;
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv;
- uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(srsBodyEnd > end)
- return 0;
-
- if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0)
- return 0;
-
- if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_ues > 0)
- {
- value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config);
- if(value->srs_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues);
- return 0;
- }
- }
- else
- {
- value->srs_pdu_list = 0;
- }
-
-
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_ues; ++i)
- {
- nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
-
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value},
- { NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value},
- { NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value},
- { NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value},
- { NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value},
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0)
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
- uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(srBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0)
- return 0;
-
- if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_srs > 0)
- {
- value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * value->number_of_srs, config);
- if(value->sr_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs);
- return 0;
- }
- }
- else
- {
- value->sr_pdu_list = 0;
- }
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_srs; ++i)
- {
- nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value },
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0)
- return 0;
- }
-
- return 1;
-
-}
-
-static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) &&
- pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) &&
- pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end));
-
-}
-
-static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
-
- if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) &&
- pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) &&
- pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end)))
- return 0;
-
- if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n");
- return 0;
- }
-
- if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end)))
- return 0;
-
- return 1;
-}
-
-static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
-
- // the cqiBodyEnd points to the end of the cqi PDU's
- uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- //uint8_t* cqiPduEnd = cqiBodyEnd;
- //uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
-
- if(cqiBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0)
- return 0;
-
- if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU);
- return -1;
- }
-
- if(value->number_of_cqis > 0)
- {
- value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * value->number_of_cqis, config);
- if(value->cqi_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
- return 0;
- }
- }
- else
- {
- value->cqi_pdu_list = 0;
- }
-
- if(value->number_of_cqis > 0)
- {
- value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * value->number_of_cqis, config);
- if(value->cqi_raw_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
- return 0;
- }
- }
- else
- {
- value->cqi_raw_pdu_list = 0;
- }
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_cqis; ++i)
- {
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
- memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t));
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd)
- {
- nfapi_tl_t generic_tl;
- if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- return 0;
-
- switch(generic_tl.tag)
- {
- case NFAPI_RX_UE_INFORMATION_TAG:
- pdu->rx_ue_information.tl = generic_tl;
- if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
- return 0;
- break;
- case NFAPI_CQI_INDICATION_REL8_TAG:
- pdu->cqi_indication_rel8.tl = generic_tl;
- if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0)
- return 0;
-
- break;
- case NFAPI_CQI_INDICATION_REL9_TAG:
- pdu->cqi_indication_rel9.tl = generic_tl;
- if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0)
- return 0;
-
- break;
- case NFAPI_UL_CQI_INFORMATION_TAG:
- pdu->ul_cqi_information.tl = generic_tl;
- if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0)
- return 0;
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag );
- }
- break;
-
- };
- }
- }
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_cqis; ++idx)
- {
- if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
- {
- if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0)
- return 0;
- }
- else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
- {
- if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0)
- return 0;
- }
- }
-
-
- return 1;
-
-}
-
-static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &value->handle, end) &&
- pull32(ppReadPackedMsg, &value->mp_cca, end) &&
- pull32(ppReadPackedMsg, &value->n_cca, end) &&
- pull32(ppReadPackedMsg, &value->offset, end) &&
- pull32(ppReadPackedMsg, &value->lte_txop_sf, end) &&
- pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) &&
- pull32(ppReadPackedMsg, &value->lbt_mode, end));
-}
-
-static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &value->handle, end) &&
- pull32(ppReadPackedMsg, &value->offset, end) &&
- pull16(ppReadPackedMsg, &value->sfn_sf_end, end) &&
- pull32(ppReadPackedMsg, &value->lbt_mode, end));
-}
-
-
-static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
-
- if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
- return 0;
-
- if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_pdus)
- {
- value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config);
- if(value->lbt_dl_config_req_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
- return 0;
- }
- }
- else
- {
- value->lbt_dl_config_req_pdu_list = 0;
- }
-
-
- uint16_t i;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type);
- return 0;
- }
- }
-
- return 1;
-}
-static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &value->handle, end) &&
- pull32(ppReadPackedMsg, &value->result, end) &&
- pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) &&
- pull32(ppReadPackedMsg, &value->initial_partial_sf, end));
-
-}
-static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &value->handle, end) &&
- pull32(ppReadPackedMsg, &value->result, end));
-}
-
-static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
-
- if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
- return 0;
-
- if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_pdus > 0)
- {
- value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config);
- if(value->lbt_indication_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
- return 0;
- }
- }
- else
- {
- value->lbt_indication_pdu_list = 0;
- }
-
- uint16_t i;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type);
- return 0;
- }
- }
-
- return 1;
-}
-static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
- return (pull8(ppReadPackedMsg, &value->harq_tb1, end));
-}
-
-
-static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
- uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(nbharqBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
- return 0;
-
- if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
- return 0;
- }
-
- value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config);
- if(value->nb_harq_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
- return 0;
- }
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_harqs; ++i)
- {
- nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value},
- { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
- return 0;
-
- }
-
- return 1;
-}
-
-static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->initial_sc, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end) &&
- pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
-}
-
-static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
- if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
- return 0;
- }
- else{
- NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
- }
- return 1;
-}
-
-static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
- uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(nrachBodyEnd > end)
- return 0;
-
- if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0)
- return 0;
-
- if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU);
- return 0;
- }
-
- value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config);
- if(value->nrach_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected);
- return 0;
- }
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_initial_scs_detected; ++i)
- {
- nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
-
- uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6;
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value},
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0)
- return 0;
-
- }
-
- return 1;
-}
-
-static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_nr_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_nr_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-
-// unpack length check
-
-static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
-{
- int retLen = 0;
-
- switch (msgId)
- {
- case NFAPI_DL_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t))
- retLen = sizeof(nfapi_dl_config_request_t);
- break;
-
- case NFAPI_UL_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t))
- retLen = sizeof(nfapi_ul_config_request_t);
- break;
-
- case NFAPI_SUBFRAME_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
- retLen = sizeof(nfapi_subframe_indication_t);
- break;
-
- case NFAPI_HI_DCI0_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t))
- retLen = sizeof(nfapi_hi_dci0_request_t);
- break;
-
- case NFAPI_TX_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_tx_request_t))
- retLen = sizeof(nfapi_tx_request_t);
- break;
-
- case NFAPI_HARQ_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_harq_indication_t))
- retLen = sizeof(nfapi_harq_indication_t);
- break;
-
- case NFAPI_CRC_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_crc_indication_t))
- retLen = sizeof(nfapi_crc_indication_t);
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_rx_indication_t))
- retLen = sizeof(nfapi_rx_indication_t);
- break;
-
- case NFAPI_RACH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_rach_indication_t))
- retLen = sizeof(nfapi_rach_indication_t);
- break;
-
- case NFAPI_SRS_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_srs_indication_t))
- retLen = sizeof(nfapi_srs_indication_t);
- break;
-
- case NFAPI_RX_SR_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_sr_indication_t))
- retLen = sizeof(nfapi_sr_indication_t);
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t))
- retLen = sizeof(nfapi_cqi_indication_t);
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t))
- retLen = sizeof(nfapi_lbt_dl_config_request_t);
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t))
- retLen = sizeof(nfapi_lbt_dl_indication_t);
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t))
- retLen = sizeof(nfapi_nb_harq_indication_t);
- break;
-
- case NFAPI_NRACH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t))
- retLen = sizeof(nfapi_nrach_indication_t);
- break;
-
- case NFAPI_DL_NODE_SYNC:
- if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t))
- retLen = sizeof(nfapi_dl_node_sync_t);
- break;
-
- case NFAPI_UL_NODE_SYNC:
- if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t))
- retLen = sizeof(nfapi_ul_node_sync_t);
- break;
-
- case NFAPI_TIMING_INFO:
- if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
- retLen = sizeof(nfapi_timing_info_t);
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
- retLen = sizeof(nfapi_ue_release_request_t);
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
- retLen = sizeof(nfapi_ue_release_response_t);
- break;
-
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
- break;
- }
-
- return retLen;
-}
-
-static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
-{
- int retLen = 0;
-
- switch (msgId)
- {
- case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_dl_tti_request_t))
- retLen = sizeof(nfapi_nr_dl_tti_request_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_ul_tti_request_t))
- retLen = sizeof(nfapi_nr_ul_tti_request_t);
- break;
-
- case NFAPI_SUBFRAME_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
- retLen = sizeof(nfapi_subframe_indication_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_ul_dci_request_t))
- retLen = sizeof(nfapi_nr_ul_dci_request_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t))
- retLen = sizeof(nfapi_nr_tx_data_request_t);
- break;
-
- case NFAPI_HARQ_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_harq_indication_t))
- retLen = sizeof(nfapi_harq_indication_t);
- break;
-
- case NFAPI_CRC_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_crc_indication_t))
- retLen = sizeof(nfapi_crc_indication_t);
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_rx_indication_t))
- retLen = sizeof(nfapi_rx_indication_t);
- break;
-
- case NFAPI_RACH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_rach_indication_t))
- retLen = sizeof(nfapi_rach_indication_t);
- break;
-
- case NFAPI_SRS_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_srs_indication_t))
- retLen = sizeof(nfapi_srs_indication_t);
- break;
-
- case NFAPI_RX_SR_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_sr_indication_t))
- retLen = sizeof(nfapi_sr_indication_t);
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t))
- retLen = sizeof(nfapi_cqi_indication_t);
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t))
- retLen = sizeof(nfapi_lbt_dl_config_request_t);
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t))
- retLen = sizeof(nfapi_lbt_dl_indication_t);
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t))
- retLen = sizeof(nfapi_nb_harq_indication_t);
- break;
-
- case NFAPI_NRACH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t))
- retLen = sizeof(nfapi_nrach_indication_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
- if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t))
- retLen = sizeof(nfapi_nr_dl_node_sync_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
- if (unpackedBufLen >= sizeof(nfapi_nr_ul_node_sync_t))
- retLen = sizeof(nfapi_nr_ul_node_sync_t);
- break;
-
- case NFAPI_TIMING_INFO:
- if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
- retLen = sizeof(nfapi_timing_info_t);
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
- retLen = sizeof(nfapi_ue_release_request_t);
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
- retLen = sizeof(nfapi_ue_release_response_t);
- break;
-
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
- break;
- }
-
- return retLen;
-}
-
-
-
-// Main unpack functions - public
-
-int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
-{
- nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
-
- // process the header
- if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
- return -1;
-
- return 0;
-}
-
-int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
-{
- int result = 0;
- nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
- /*
- uint8_t *ptr = pMessageBuf;
- printf("\n Read P7 message unpack: ");
- while(ptr < end){
- printf(" %d ", *ptr);
- ptr++;
- }
- printf("\n");
-*/
- // clean the supplied buffer for - tag value blanking
- (void)memset(pUnpackedBuf, 0, unpackedBufLen);
-
- // process the header
- if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
- return -1;
- }
-
- if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
- return -1;
- }
-
- /*
- if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
- return -1;
- }
- */
-
- // look for the specific message
- switch (pMessageHeader->message_id)
- {
- case NFAPI_DL_CONFIG_REQUEST:
- if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen))
- result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UL_CONFIG_REQUEST:
- if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen))
- result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
- case NFAPI_TX_REQUEST:
- if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen))
- result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
- case NFAPI_HI_DCI0_REQUEST:
- if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen))
- result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
- result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_HARQ_INDICATION:
- if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
- result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_CRC_INDICATION:
- if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
- result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
- result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RACH_INDICATION:
- if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
- result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_SRS_INDICATION:
- if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen))
- result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_SR_INDICATION:
- if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen))
- result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen))
- result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen))
- result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
- result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
- result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NRACH_INDICATION:
- if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
- result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_DL_NODE_SYNC:
- if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen))
- result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UL_NODE_SYNC:
- if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen))
- result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_TIMING_INFO:
- if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
- result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
- result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- default:
-
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
- {
- if(config && config->unpack_p7_vendor_extension)
- {
- result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
- break;
- }
-
- if(result == 0)
- return -1;
- else
- return 0;
-}
-
-int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
-{
- int result = 0;
- nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
- /*
- uint8_t *ptr = pMessageBuf;
- printf("\n Read P7 message unpack: ");
- while(ptr < end){
- printf(" %d ", *ptr);
- ptr++;
- }
- printf("\n");
-*/
- // clean the supplied buffer for - tag value blanking
- (void)memset(pUnpackedBuf, 0, unpackedBufLen);
-
- // process the header
- if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
- return -1;
- }
-
- if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
- return -1;
- }
-
- /*
- if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
- return -1;
- }
- */
-
- // look for the specific message
- switch (pMessageHeader->message_id)
- {
- case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen))
- result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen))
- result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
- case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen))
- result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
- case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen))
- result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
- result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_HARQ_INDICATION:
- if (check_nr_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
- result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_CRC_INDICATION:
- if (check_nr_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
- result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- if (check_nr_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
- result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RACH_INDICATION:
- if (check_nr_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
- result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_SRS_INDICATION:
- if (check_nr_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen))
- result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_SR_INDICATION:
- if (check_nr_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen))
- result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- if (check_nr_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen))
- result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- if (check_nr_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen))
- result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- if (check_nr_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
- result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- if (check_nr_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
- result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NRACH_INDICATION:
- if (check_nr_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
- result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen))
- result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen))
- result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_TIMING_INFO:
- if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
- result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
- result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- default:
-
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
- {
- if(config && config->unpack_p7_vendor_extension)
- {
- result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
- break;
- }
-
- if(result == 0)
- return -1;
- else
- return 0;
-}
-
-
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include "nfapi_nr_interface_scf.h"
+
+extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
+extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
+
+uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len)
+{
+ uint32_t chksum = 0;
+ // calcaulte upto the checksum
+ chksum = crc32(chksum, buffer, 8);
+
+ // skip the checksum
+ uint8_t zeros[4] = {0, 0, 0, 0};
+ chksum = crc32(chksum, zeros, 4);
+
+ // continu with the rest of the mesage
+ chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH);
+
+ // return the inverse
+ return ~(chksum);
+}
+
+int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len)
+{
+ uint32_t checksum = nfapi_calculate_checksum(buffer, len);
+
+ uint8_t* p_write = &buffer[8];
+ return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1);
+}
+
+int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp)
+{
+ uint8_t* p_write = &buffer[12];
+ return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1);
+}
+
+uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len)
+{
+ return nfapi_calculate_checksum(buffer, len);
+}
+
+void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
+{
+ if(size == 0)
+ return 0;
+
+ void* buffer_p = NULL;
+ if(config && config->allocate)
+ {
+ buffer_p = (config->allocate)(size);
+ if(buffer_p != NULL){
+ memset(buffer_p,0,size);
+ }
+ return buffer_p;
+ }
+ else
+ {
+ buffer_p = calloc(1, size);
+ return buffer_p;
+ }
+}
+
+void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config)
+{
+ if(ptr == NULL)
+ return;
+
+ if(config && config->deallocate)
+ {
+ return (config->deallocate)(ptr);
+ }
+ else
+ {
+ return free(ptr);
+ }
+}
+// Pack routines
+
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
+
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format);
+
+ return ( push8(value->dci_format, ppWritePackedMsg, end) &&
+ push8(value->cce_idx, ppWritePackedMsg, end) &&
+ push8(value->aggregation_level, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+ push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+ push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->mcs_1, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version_1, ppWritePackedMsg, end) &&
+ push8(value->new_data_indicator_1, ppWritePackedMsg, end) &&
+ push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+ push8(value->mcs_2, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version_2, ppWritePackedMsg, end) &&
+ push8(value->new_data_indicator_2, ppWritePackedMsg, end) &&
+ push8(value->harq_process, ppWritePackedMsg, end) &&
+ push8(value->tpmi, ppWritePackedMsg, end) &&
+ push8(value->pmi, ppWritePackedMsg, end) &&
+ push8(value->precoding_information, ppWritePackedMsg, end) &&
+ push8(value->tpc, ppWritePackedMsg, end) &&
+ push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
+ push8(value->ngap, ppWritePackedMsg, end) &&
+ push8(value->transport_block_size_index, ppWritePackedMsg, end) &&
+ push8(value->downlink_power_offset, ppWritePackedMsg, end) &&
+ push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
+ push8(value->preamble_index, ppWritePackedMsg, end) &&
+ push8(value->prach_mask_index, ppWritePackedMsg, end) &&
+ push8(value->rnti_type, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
+
+ return( push8(value->mcch_flag, ppWritePackedMsg, end) &&
+ push8(value->mcch_change_notification, ppWritePackedMsg, end) &&
+ push8(value->scrambling_identity, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
+
+ return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
+ push8(value->carrier_indicator, ppWritePackedMsg, end) &&
+ push8(value->srs_flag, ppWritePackedMsg, end) &&
+ push8(value->srs_request, ppWritePackedMsg, end) &&
+ push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) &&
+ push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
+ push8(value->n_dl_rb, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
+
+ return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) &&
+ push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
+
+ return ( push8(value->primary_cell_type, ppWritePackedMsg, end) &&
+ push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) &&
+ push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) &&
+ pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
+ push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+ push8(value->num_antennas, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_subbands; ++idx)
+ {
+ nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
+
+ if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) &&
+ push8(subband_info->scheduled_ues, ppWritePackedMsg, end)))
+ return 0;
+
+
+ uint8_t antenna_idx = 0;
+ uint8_t scheduled_ue_idx = 0;
+
+ for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
+ {
+ for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
+ {
+ if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end))
+ return 0;
+ }
+ }
+
+ }
+
+
+ return 1;
+
+}
+
+
+static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv;
+
+ return(
+ push16(value->bwp_size, ppWritePackedMsg, end) &&
+ push16(value->bwp_start, ppWritePackedMsg, end) &&
+
+ push8(value->subcarrier_spacing, ppWritePackedMsg, end) &&
+ push8(value->cyclic_prefix, ppWritePackedMsg, end) &&
+
+ push16(value->start_rb, ppWritePackedMsg, end) &&
+ push16(value->nr_of_rbs, ppWritePackedMsg, end) &&
+
+ push8(value->csi_type, ppWritePackedMsg, end) &&
+ push8(value->row, ppWritePackedMsg, end) &&
+
+ push16(value->freq_domain, ppWritePackedMsg, end) &&
+ push8(value->symb_l0, ppWritePackedMsg, end) &&
+
+ push8(value->symb_l1, ppWritePackedMsg, end) &&
+ push8(value->cdm_type, ppWritePackedMsg, end) &&
+
+ push8(value->freq_density, ppWritePackedMsg, end) &&
+ push16(value->scramb_id, ppWritePackedMsg, end) &&
+
+ push8(value->power_control_offset, ppWritePackedMsg, end) &&
+ push8(value->power_control_offset_ss, ppWritePackedMsg, end)
+ );
+
+}
+
+
+static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
+
+ for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
+ {
+ if(!(push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
+ push16(value->dci_pdu[i].ScramblingId, ppWritePackedMsg, end) &&
+
+ push16(value->dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) &&
+ push8(value->dci_pdu[i].CceIndex, ppWritePackedMsg, end) &&
+ push8(value->dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) &&
+ push8(value->dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) &&
+
+ push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
+ push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
+ pusharray8(value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
+ return 0;
+
+ }
+
+ // TODO: resolve the packaging of array (currently sending a single element)
+ return(
+ push16(value->BWPSize, ppWritePackedMsg, end) &&
+ push16(value->BWPStart, ppWritePackedMsg, end) &&
+ push8(value->SubcarrierSpacing, ppWritePackedMsg, end) &&
+ push8(value->CyclicPrefix, ppWritePackedMsg, end) &&
+
+ push8(value->StartSymbolIndex, ppWritePackedMsg, end) &&
+ push8(value->DurationSymbols, ppWritePackedMsg, end) &&
+ pusharray8(value->FreqDomainResource, 6, 6, ppWritePackedMsg, end) &&
+ push8(value->CceRegMappingType, ppWritePackedMsg, end) &&
+
+ push8(value->RegBundleSize, ppWritePackedMsg, end) &&
+ push8(value->InterleaverSize, ppWritePackedMsg, end) &&
+ push8(value->CoreSetType, ppWritePackedMsg, end) &&
+ push16(value->ShiftIndex, ppWritePackedMsg, end) &&
+
+ push8(value->precoderGranularity, ppWritePackedMsg, end) &&
+ push16(value->numDlDci, ppWritePackedMsg, end));
+
+}
+
+
+static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
+
+ // TODO: resolve the packaging of array (currently sending a single element)
+ return(
+ push16(value->pduBitmap, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push16(value->pduIndex, ppWritePackedMsg, end) &&
+ push16(value->BWPSize, ppWritePackedMsg, end) &&
+
+ push16(value->BWPStart, ppWritePackedMsg, end) &&
+ push8(value->SubcarrierSpacing, ppWritePackedMsg, end) &&
+ push8(value->CyclicPrefix, ppWritePackedMsg, end) &&
+ push8(value->NrOfCodewords, ppWritePackedMsg, end) &&
+
+ pusharray16(value->targetCodeRate, 2, 1, ppWritePackedMsg, end) &&
+ pusharray8(value->qamModOrder, 2, 1, ppWritePackedMsg, end) &&
+ pusharray8(value->mcsIndex, 2, 1, ppWritePackedMsg, end) &&
+ pusharray8(value->mcsTable, 2, 1, ppWritePackedMsg, end) &&
+
+ pusharray8(value->rvIndex, 2, 1, ppWritePackedMsg, end) &&
+ pusharray32(value->TBSize, 2, 1, ppWritePackedMsg, end) &&
+ push16(value->dataScramblingId, ppWritePackedMsg, end) &&
+ push8(value->nrOfLayers, ppWritePackedMsg, end) &&
+
+ push8(value->transmissionScheme, ppWritePackedMsg, end) &&
+ push8(value->refPoint, ppWritePackedMsg, end) &&
+ push16(value->dlDmrsSymbPos, ppWritePackedMsg, end) &&
+ push8(value->dmrsConfigType, ppWritePackedMsg, end) &&
+
+ push16(value->dlDmrsScramblingId, ppWritePackedMsg, end) &&
+ push8(value->SCID, ppWritePackedMsg, end) &&
+ push8(value->numDmrsCdmGrpsNoData, ppWritePackedMsg, end) &&
+ push16(value->dmrsPorts, ppWritePackedMsg, end) &&
+
+ push8(value->resourceAlloc, ppWritePackedMsg, end) &&
+ push16(value->rbStart, ppWritePackedMsg, end) &&
+ push16(value->rbSize, ppWritePackedMsg, end) &&
+
+ push8(value->VRBtoPRBMapping, ppWritePackedMsg, end) &&
+ push8(value->StartSymbolIndex, ppWritePackedMsg, end) &&
+ push8(value->NrOfSymbols, ppWritePackedMsg, end) &&
+ push8(value->PTRSPortIndex, ppWritePackedMsg, end) &&
+
+ push8(value->PTRSTimeDensity, ppWritePackedMsg, end) &&
+ push8(value->PTRSFreqDensity, ppWritePackedMsg, end) &&
+ push8(value->PTRSReOffset, ppWritePackedMsg, end)
+ );
+
+}
+
+
+static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ printf("Packing ssb. \n");
+ nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
+
+ return(
+ push16(value->PhysCellId, ppWritePackedMsg, end) &&
+ push8(value->BetaPss, ppWritePackedMsg, end) &&
+ push8(value->SsbBlockIndex, ppWritePackedMsg, end) &&
+ push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) &&
+ push16(value->ssbOffsetPointA, ppWritePackedMsg, end) &&
+ push8(value->bchPayloadFlag, ppWritePackedMsg, end) &&
+ push32(value->bchPayload, ppWritePackedMsg, end)
+ // TODO: pack precoding_and_beamforming too
+ );
+
+}
+
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
+
+ return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) &&
+ push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) &&
+ push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
+ push8(value->codebook_size_determination, ppWritePackedMsg, end) &&
+ push8(value->drms_table_flag, ppWritePackedMsg, end) &&
+ push8(value->tpm_struct_flag, ppWritePackedMsg, end) &&
+ (value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1));
+}
+
+static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
+
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__);
+
+ return( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
+
+ return ( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+ push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->modulation, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push16(value->mbsfn_area_id, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem;
+
+ return ( push8(bf->subband_index, ppWritePackedMsg, end) &&
+ push8(bf->num_antennas, ppWritePackedMsg, end) &&
+ pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end));
+
+
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
+
+ return ( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+ push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+ push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->modulation, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version, ppWritePackedMsg, end) &&
+ push8(value->transport_blocks, ppWritePackedMsg, end) &&
+ push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+ push8(value->transmission_scheme, ppWritePackedMsg, end) &&
+ push8(value->number_of_layers, ppWritePackedMsg, end) &&
+ push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+ pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) &&
+ push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
+ push8(value->pa, ppWritePackedMsg, end) &&
+ push8(value->delta_power_offset_index, ppWritePackedMsg, end) &&
+ push8(value->ngap, ppWritePackedMsg, end) &&
+ push8(value->nprb, ppWritePackedMsg, end) &&
+ push8(value->transmission_mode, ppWritePackedMsg, end) &&
+ push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) &&
+ push8(value->num_bf_vector, ppWritePackedMsg, end) &&
+ packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info));
+
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
+ return ( push8(value->nscid, ppWritePackedMsg, end) );
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
+
+ return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) &&
+ push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
+ push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
+ push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
+ pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
+ push8(value->pdsch_start, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
+
+ return( push8(value->drms_config_flag, ppWritePackedMsg, end) &&
+ push16(value->drms_scrambling, ppWritePackedMsg, end) &&
+ push8(value->csi_config_flag, ppWritePackedMsg, end) &&
+ push16(value->csi_scrambling, ppWritePackedMsg, end) &&
+ push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) &&
+ push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) &&
+ push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
+
+ return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) &&
+ push8(value->maxlayers, ppWritePackedMsg, end) &&
+ push8(value->n_dl_harq, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
+
+ return( push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
+ push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
+ push8(value->ue_type, ppWritePackedMsg, end) &&
+ push8(value->pdsch_payload_type, ppWritePackedMsg, end) &&
+ push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+ push8(value->drms_table_flag, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
+
+ return( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->p_rnti, ppWritePackedMsg, end) &&
+ push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+ push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+ push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->mcs, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version, ppWritePackedMsg, end) &&
+ push8(value->number_of_transport_blocks, ppWritePackedMsg, end) &&
+ push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+ push8(value->transmission_scheme, ppWritePackedMsg, end) &&
+ push8(value->number_of_layers, ppWritePackedMsg, end) &&
+ push8(value->codebook_index, ppWritePackedMsg, end) &&
+ push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
+ push8(value->pa, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push8(value->nprb, ppWritePackedMsg, end) &&
+ push8(value->ngap, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
+
+ return ( push8(value->ue_mode, ppWritePackedMsg, end) &&
+ push16(value->initial_transmission_sf_io, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
+
+ return( push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push8(value->prs_bandwidth, ppWritePackedMsg, end) &&
+ push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) &&
+ push8(value->prs_muting, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
+
+ return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) &&
+ push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
+ push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) &&
+ pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
+
+ if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) &&
+ push8(value->cdm_type, ppWritePackedMsg, end) &&
+ push8(value->num_bf_vector, ppWritePackedMsg, end)))
+ {
+ return 0;
+ }
+
+ uint16_t i;
+ for(i = 0; i < value->num_bf_vector; ++i)
+ {
+ if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) &&
+ pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ return 1;
+}
+static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(vector->subband_index, ppWritePackedMsg, end) &&
+ push8(vector->num_antennas, ppWritePackedMsg, end) &&
+ pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
+
+ return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) &&
+ push16(value->epdcch_id, ppWritePackedMsg, end) &&
+ push8(value->epdcch_start_symbol, ppWritePackedMsg, end) &&
+ push8(value->epdcch_num_prb, ppWritePackedMsg, end) &&
+ pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) &&
+ pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
+
+ return (push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
+ push8(value->initial_lbt_sf, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
+
+ return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) &&
+ push8(value->number_of_prb_pairs, ppWritePackedMsg, end) &&
+ push8(value->resource_block_assignment, ppWritePackedMsg, end) &&
+ push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) &&
+ push8(value->start_symbol, ppWritePackedMsg, end) &&
+ push8(value->ecce_index, ppWritePackedMsg, end) &&
+ push8(value->aggregation_level, ppWritePackedMsg, end) &&
+ push8(value->rnti_type, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->ce_mode, ppWritePackedMsg, end) &&
+ push16(value->drms_scrambling_init, ppWritePackedMsg, end) &&
+ push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push8(value->dci_format, ppWritePackedMsg, end) &&
+ push16(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->mcs, ppWritePackedMsg, end) &&
+ push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version, ppWritePackedMsg, end) &&
+ push8(value->new_data_indicator, ppWritePackedMsg, end) &&
+ push8(value->harq_process, ppWritePackedMsg, end) &&
+ push8(value->tpmi_length, ppWritePackedMsg, end) &&
+ push8(value->tpmi, ppWritePackedMsg, end) &&
+ push8(value->pmi_flag, ppWritePackedMsg, end) &&
+ push8(value->pmi, ppWritePackedMsg, end) &&
+ push8(value->harq_resource_offset, ppWritePackedMsg, end) &&
+ push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+ push8(value->tpc, ppWritePackedMsg, end) &&
+ push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) &&
+ push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
+ push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
+ push8(value->preamble_index, ppWritePackedMsg, end) &&
+ push8(value->prach_mask_index, ppWritePackedMsg, end) &&
+ push8(value->starting_ce_level, ppWritePackedMsg, end) &&
+ push8(value->srs_request, ppWritePackedMsg, end) &&
+ push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) &&
+ push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) &&
+ push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+ push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) &&
+ push8(value->direct_indication, ppWritePackedMsg, end) &&
+ push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
+ push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
+ pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
+
+ return (push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
+
+ return (push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push8(value->ncce_index, ppWritePackedMsg, end) &&
+ push8(value->aggregation_level, ppWritePackedMsg, end) &&
+ push8(value->start_symbol, ppWritePackedMsg, end) &&
+ push8(value->rnti_type, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
+ push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
+ push8(value->dci_format, ppWritePackedMsg, end) &&
+ push8(value->scheduling_delay, ppWritePackedMsg, end) &&
+ push8(value->resource_assignment, ppWritePackedMsg, end) &&
+ push8(value->repetition_number, ppWritePackedMsg, end) &&
+ push8(value->mcs, ppWritePackedMsg, end) &&
+ push8(value->new_data_indicator, ppWritePackedMsg, end) &&
+ push8(value->harq_ack_resource, ppWritePackedMsg, end) &&
+ push8(value->npdcch_order_indication, ppWritePackedMsg, end) &&
+ push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) &&
+ push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) &&
+ push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) &&
+ push8(value->direct_indication, ppWritePackedMsg, end) &&
+ push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+ push8(value->total_dci_length_including_padding, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
+
+ return (push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push8(value->start_symbol, ppWritePackedMsg, end) &&
+ push8(value->rnti_type, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push16(value->resource_assignment, ppWritePackedMsg, end) &&
+ push16(value->repetition_number, ppWritePackedMsg, end) &&
+ push8(value->modulation, ppWritePackedMsg, end) &&
+ push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) &&
+ push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
+ push16(value->sf_idx, ppWritePackedMsg, end) &&
+ push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_dl_tti_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)tlv;
+
+ if(!(push16(value->PDUSize, ppWritePackedMsg, end) &&
+ push16(value->PDUType, ppWritePackedMsg, end) ))
+ return 0;
+
+
+ // first match the pdu type, then call the respective function
+ switch(value->PDUType)
+ {
+ case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
+ {
+ if(!(pack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppWritePackedMsg,end)))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
+ {
+ if(!(pack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppWritePackedMsg,end)))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
+ {
+ if(!(pack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppWritePackedMsg,end)))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
+ {
+ if(!(pack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppWritePackedMsg,end)))
+ return 0;
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType );
+ }
+ break;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
+
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich);
+
+ if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) &&
+ push8(value->number_dci, ppWritePackedMsg, end) &&
+ push16(value->number_pdu, ppWritePackedMsg, end) &&
+ push8(value->number_pdsch_rnti, ppWritePackedMsg, end) &&
+ push16(value->transmission_power_pcfich, ppWritePackedMsg, end)))
+ {
+ return 0;
+ }
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_pdu;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
+
+ if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+ if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__);
+
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value)))
+ {
+ return 0;
+ }
+ }
+ break;
+ case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__);
+
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel10_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) &
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+ }
+
+ return 1;
+}
+
+
+static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
+
+ if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) &&
+ pusharray8(pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end)
+ //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ int arr[12];
+ for(int i=0;idl_tti_request_body.nGroup;i++)
+ {
+ for(int j=0;jdl_tti_request_body.nUe[i];j++)
+ {
+ arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
+ }
+ if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ for(int i=0;idl_tti_request_body.nPDUs;i++)
+ {
+ if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+
+static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
+
+ //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
+ //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+ {
+ uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+ uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value);
+ uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+ if (!x || !y || !z)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z);
+ }
+
+ return x && y && z;
+ }
+}
+
+
+
+
+static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end)
+{
+ nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
+
+ return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
+
+ return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
+ push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
+
+ return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
+
+ return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end));
+}
+
+//Pack fns for ul_tti PDUS
+
+
+static uint8_t pack_ul_tti_request_prach_pdu(nfapi_nr_prach_pdu_t* prach_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return(
+ push16(prach_pdu->phys_cell_id, ppWritePackedMsg, end) &&
+ push8(prach_pdu->num_prach_ocas, ppWritePackedMsg, end) &&
+ push8(prach_pdu->prach_format, ppWritePackedMsg, end) &&
+ push8(prach_pdu->num_ra, ppWritePackedMsg, end) &&
+ push8(prach_pdu->prach_start_symbol, ppWritePackedMsg, end) &&
+ push16(prach_pdu->num_cs, ppWritePackedMsg, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+
+}
+
+static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t* pucch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return(
+ push16(pucch_pdu->rnti, ppWritePackedMsg, end) &&
+ push32(pucch_pdu->handle, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->bwp_size, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->bwp_start, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->format_type, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->prb_start, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->prb_size, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->nr_of_symbols, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->freq_hop_flag, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->second_hop_prb, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->group_hop_flag, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->sequence_hop_flag, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->hopping_id, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->initial_cyclic_shift, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->time_domain_occ_idx, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->pre_dft_occ_idx, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->pre_dft_occ_len, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->add_dmrs_flag, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->dmrs_scrambling_id, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->dmrs_cyclic_shift, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->sr_flag, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->bit_len_harq, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->bit_len_csi_part1, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->bit_len_csi_part2, ppWritePackedMsg, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+
+}
+
+
+static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t* pusch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+
+ if (!(
+ push16(pusch_pdu->pdu_bit_map, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->rnti, ppWritePackedMsg, end) &&
+ push32(pusch_pdu->handle, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->bwp_size, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->bwp_start, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->target_code_rate, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->scid, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->num_dmrs_cdm_grps_no_data, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->resource_alloc, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->resource_alloc,ppWritePackedMsg, end) &&
+ push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->rb_start, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->rb_size, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->vrb_to_prb_mapping, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->frequency_hopping, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->tx_direct_current_location, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->uplink_frequency_shift_7p5khz, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->nr_of_symbols, ppWritePackedMsg, end)
+ // TODO: ignoring beamforming tlv for now
+ ))
+ return 0;
+
+
+ //Pack Optional Data only included if indicated in pduBitmap
+ switch(pusch_pdu->pdu_bit_map){
+ case PUSCH_PDU_BITMAP_PUSCH_DATA:
+ {
+ // pack optional TLVs
+ return(
+ push8(pusch_pdu->pusch_data.rv_index, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_data.harq_process_id, ppWritePackedMsg, end) &&
+ push32(pusch_pdu->pusch_data.tb_size, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->pusch_data.num_cb, ppWritePackedMsg, end) &&
+ pusharray8(pusch_pdu->pusch_data.cb_present_and_position,1,1,ppWritePackedMsg, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_PUSCH_UCI:
+ {
+ return(
+ push16(pusch_pdu->pusch_uci.harq_ack_bit_length, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->pusch_uci.csi_part1_bit_length, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->pusch_uci.csi_part2_bit_length, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_uci.alpha_scaling, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_uci.beta_offset_harq_ack, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_uci.beta_offset_csi1, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_uci.beta_offset_csi2, ppWritePackedMsg, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_PUSCH_PTRS:
+ {
+ return(
+ push8(pusch_pdu->pusch_ptrs.num_ptrs_ports, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ptrs_time_density, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ptrs_freq_density, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ul_ptrs_power, ppWritePackedMsg, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_DFTS_OFDM:
+ {
+ return(
+ push8(pusch_pdu->dfts_ofdm.low_papr_group_number, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->dfts_ofdm.low_papr_sequence_number, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, ppWritePackedMsg, end)
+ );
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map );
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t* srs_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return(
+ push16(srs_pdu->rnti, ppWritePackedMsg, end) &&
+ push32(srs_pdu->handle, ppWritePackedMsg, end) &&
+ push16(srs_pdu->bwp_size, ppWritePackedMsg, end) &&
+ push16(srs_pdu->bwp_start, ppWritePackedMsg, end) &&
+ push8(srs_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
+ push8(srs_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
+ push8(srs_pdu->num_ant_ports, ppWritePackedMsg, end) &&
+ push8(srs_pdu->num_symbols, ppWritePackedMsg, end) &&
+ push8(srs_pdu->num_repetitions, ppWritePackedMsg, end) &&
+ push8(srs_pdu->time_start_position, ppWritePackedMsg, end) &&
+ push8(srs_pdu->config_index, ppWritePackedMsg, end) &&
+ push16(srs_pdu->sequence_id, ppWritePackedMsg, end) &&
+ push8(srs_pdu->bandwidth_index, ppWritePackedMsg, end) &&
+ push8(srs_pdu->comb_size, ppWritePackedMsg, end) &&
+ push8(srs_pdu->comb_offset, ppWritePackedMsg, end) &&
+ push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) &&
+ push8(srs_pdu->frequency_position, ppWritePackedMsg, end) &&
+ push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) &&
+ push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) &&
+ push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) &&
+ push8(srs_pdu->resource_type, ppWritePackedMsg, end) &&
+ push16(srs_pdu->t_srs, ppWritePackedMsg, end) &&
+ push16(srs_pdu->t_offset, ppWritePackedMsg, end)
+
+ // TODO: ignoring beamforming tlv for now
+ );
+
+}
+
+static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
+
+ return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
+
+ if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end)))
+ {
+ return 0;
+ }
+
+ switch(cqi_ri_info_rel9->report_type)
+ {
+ case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+ {
+ if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end)))
+ {
+ return 0;
+ }
+ }
+ break;
+ case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+ {
+ if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint8_t i;
+ for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
+ {
+ if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint8_t j;
+ for(j = 0; j < 8; ++j)
+ {
+ if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0)
+ return 0;
+ }
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
+ }
+ break;
+ };
+
+ return 1;
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
+
+ switch(cqi_ri_info_rel13->report_type)
+ {
+ case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+ {
+ if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0)
+ return 0;
+ }
+ break;
+ case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+ {
+ // No parameters
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type );
+ }
+ break;
+ };
+
+ return 1;
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
+
+ return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) &&
+ push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value);
+}
+
+static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
+
+ return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) &&
+ push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) &&
+ push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
+
+ return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
+
+ return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) &&
+ push16(ue_info_rel8->rnti, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
+
+ return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
+ push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
+
+ return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) &&
+ push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) &&
+ push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
+ push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
+
+ return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) &&
+ push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) &&
+ push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
+ push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+ push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) &&
+ push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) &&
+ push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
+
+ return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+ push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
+
+ return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) &&
+ push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) &&
+ push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
+ push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+ push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) &&
+ push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) &&
+ push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
+
+ return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) &&
+ push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) &&
+ push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) &&
+ push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) &&
+ push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
+
+ return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->n_srs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
+
+ return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
+
+ return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) &&
+ push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
+
+ return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) &&
+ push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
+ return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end);
+}
+static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
+
+ return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) &&
+ push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value));
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
+
+ return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) &&
+ push16(srs_pdu_rel8->size, ppWritePackedMsg, end) &&
+ push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) &&
+ push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
+ return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end);
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
+
+ return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
+
+ return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
+
+ return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) &&
+ push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) &&
+ push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) &&
+ push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) &&
+ push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
+ push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) &&
+ pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value));
+}
+static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
+
+ return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) &&
+ push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) &&
+ push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end));
+
+}
+
+
+
+static uint8_t pack_ul_tti_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_ul_tti_request_number_of_pdus_t* value = (nfapi_nr_ul_tti_request_number_of_pdus_t*)tlv;
+
+ if(!(push16(value->pdu_size, ppWritePackedMsg, end) &&
+ push16(value->pdu_type, ppWritePackedMsg, end) ))
+ return 0;
+
+
+ // first match the pdu type, then call the respective function
+ switch(value->pdu_type)
+ {
+ case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
+ {
+ if(!pack_ul_tti_request_prach_pdu(&value->prach_pdu, ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
+ {
+ if(!pack_ul_tti_request_pucch_pdu(&value->pucch_pdu, ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
+ {
+ if(!pack_ul_tti_request_pusch_pdu(&value->pusch_pdu, ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
+ {
+ if(!pack_ul_tti_request_srs_pdu(&value->srs_pdu, ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", value->pdu_type );
+ }
+ break;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_ul_tti_groups_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_ul_tti_request_number_of_groups_t* value = (nfapi_nr_ul_tti_request_number_of_groups_t*)tlv;
+
+ if(!push8(value->n_ue, ppWritePackedMsg, end))
+ return 0;
+ for(int i=0; in_ue;i++)
+ {
+ if(!push8(value->ue_list[i].pdu_idx, ppWritePackedMsg, end))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
+
+ if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) &&
+ push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) &&
+ push8(value->srs_present, ppWritePackedMsg, end)))
+ return 0;
+
+ uint16_t i = 0;
+ for(i = 0; i < value->number_of_pdus; ++i)
+ {
+ nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
+
+ if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+ if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
+ {
+ if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+
+ }
+ return 1;
+}
+
+
+static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg;
+
+ if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->n_pdus , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->n_group, ppWritePackedMsg, end) ))
+ return 0;
+
+ for(int i=0; in_pdus; i++)
+ {
+ if(!pack_ul_tti_pdu_list_value(&pNfapiMsg->pdus_list[i], ppWritePackedMsg, end))
+ return 0;
+ }
+
+ for(int i=0; in_group; i++)
+ {
+ if(!pack_ul_tti_groups_list_value(&pNfapiMsg->groups_list[i], ppWritePackedMsg, end))
+ return 0;
+
+ }
+
+ return 1;
+}
+
+
+static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ;
+}
+
+static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
+
+ return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+ push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+ push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) &&
+ push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) &&
+ push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
+
+ return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) &&
+ push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
+
+ return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) &&
+ push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) &&
+ push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) &&
+ push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
+
+ return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
+ push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
+
+ return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
+
+ return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) &&
+ push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) &&
+ push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) &&
+ push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+ push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+ push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
+ pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end));
+
+}
+
+static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
+
+ return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
+ push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
+
+ if(!(push16(value->sfnsf, ppWritePackedMsg, end) &&
+ push8(value->number_of_dci, ppWritePackedMsg, end) &&
+ push8(value->number_of_hi, ppWritePackedMsg, end)))
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
+
+ if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+ if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_HI_DCI0_HI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_HI_DCI0_DCI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value)))
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+
+ }
+
+ return 1;
+}
+
+static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv;
+
+ for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
+ {
+ if(!(push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, ppWritePackedMsg, end) &&
+
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) &&
+
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
+
+ pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
+
+ return 0;
+ }
+
+ return (push16(value->PDUType, ppWritePackedMsg, end) &&
+ push16(value->PDUSize, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, ppWritePackedMsg, end) &&
+
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, ppWritePackedMsg, end) &&
+ pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, ppWritePackedMsg, end) &&
+
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, ppWritePackedMsg, end));
+
+}
+
+static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg;
+
+ if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->numPdus, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; inumPdus; i++)
+ {
+ if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end))
+ return 0;
+ }
+ return 1;
+
+
+}
+
+
+
+static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+//pack_tx_data_pdu_list_value
+static uint8_t pack_tx_data_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_pdu_t* value = (nfapi_nr_pdu_t*)tlv;
+
+ if(!(push32(value->num_TLV, ppWritePackedMsg, end) &&
+ push16(value->PDU_index, ppWritePackedMsg, end) &&
+ push16(value->PDU_length, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_tlvs = value->num_TLV;
+ for(; i < total_number_of_tlvs; ++i)
+ {
+
+ if (!(push16(value->TLVs[i].length, ppWritePackedMsg, end) &&
+ push16(value->TLVs[i].tag, ppWritePackedMsg, end)))
+ return 0;
+
+ switch(value->TLVs[i].tag)
+ {
+ case 0:
+ {
+ if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end))
+ return 0;
+ break;
+
+ }
+
+ case 1:
+ {
+ if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length , value->TLVs[i].length, ppWritePackedMsg, end))
+ return 0;
+ break;
+
+ }
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", value->TLVs[i].tag );
+ break;
+ }
+
+ }
+ }
+ return 1;
+}
+
+static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv;
+
+ if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]);
+
+ if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) &&
+ push16(pdu->pdu_index, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t j;
+ for(j = 0; j < pdu->num_segments; ++j)
+ {
+ // Use -1 as it is unbounded
+ // DJP - does not handle -1
+ // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
+ int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
+
+ if (pdu->segments[j].segment_length == 3)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
+ pdu->segments[j].segment_data[0],
+ pdu->segments[j].segment_data[1],
+ pdu->segments[j].segment_data[2]
+ );
+ }
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret);
+
+ if (push_ret == 0)
+ {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg;
+
+ if (!(
+ push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Number_of_PDUs, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; iNumber_of_PDUs; i++)
+ {
+ if(!pack_tx_data_pdu_list_value(&pNfapiMsg->pdu_list[i], ppWritePackedMsg, end))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
+
+ int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+ int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value);
+ int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z);
+
+ return x && y && z;
+}
+
+static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
+ if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
+ return 0;
+ }
+
+ uint8_t j;
+ uint16_t num = value->number_of_TLVs;
+ for(j = 0; j < num; ++j){
+ if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
+ int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+ int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
+ int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+ return x && y && z;
+}
+
+static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+
+ nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
+
+ int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
+ int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+ return x && z;
+}
+
+static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) );
+}
+
+static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
+
+ return ( pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(data->value_0, ppWritePackedMsg, end) &&
+ push8(data->value_1, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(data->value_0, ppWritePackedMsg, end) &&
+ push8(data->value_1, ppWritePackedMsg, end) &&
+ push8(data->value_2, ppWritePackedMsg, end) &&
+ push8(data->value_3, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(data->value_0, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(data->value_0, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv;
+
+ if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) &&
+ push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t result = 0;
+ switch(harq_indication_tdd_rel8->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = 1;
+ break;
+ default:
+ // err....
+ break;
+ }
+
+ return result;
+
+}
+
+static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv;
+
+ if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) &&
+ push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t idx;
+ for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx)
+ {
+ uint8_t result = 0;
+
+ switch(harq_indication_tdd_rel9->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end);
+ break;
+ default:
+ // err....
+ break;
+ }
+
+ if(result == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv;
+
+ if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) &&
+ push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t idx;
+ for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx)
+ {
+ uint8_t result = 0;
+ switch(harq_indication_tdd_rel13->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end);
+ break;
+ default:
+ // err....
+ break;
+ }
+
+ if(result == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv;
+
+ return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) &&
+ push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv;
+
+ return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) &&
+ push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) &&
+ pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv;
+
+ return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) &&
+ push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) &&
+ pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
+
+ return ( push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push8(value->channel, ppWritePackedMsg, end));
+
+}
+
+static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
+
+ if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_harqs;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) &&
+ pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
+
+ return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
+
+ if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_crcs;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+ return 1;
+}
+
+static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
+
+ return ( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->offset, ppWritePackedMsg, end) &&
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end));
+}
+static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
+
+ return ( push16(value->timing_advance_r9, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
+
+ //printf("RX ULSCH BODY\n");
+
+ if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // need to calculate the data offset's.
+ uint16_t i = 0;
+ uint16_t offset = 2; // taking into account the number_of_pdus
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ //printf("ULSCH:pdus:%d\n", total_number_of_pdus);
+
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+ if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
+ {
+ //printf("NFAPI_RX_UE_INFORMATION_TAG\n");
+ offset += 4 + 6;
+ }
+
+ if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ //printf("NFAPI_RX_INDICATION_REL8_TAG\n");
+ offset += 4 + 7;
+ }
+
+ if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG)
+ {
+ //printf("NFAPI_RX_INDICATION_REL9_TAG\n");
+ offset += 4 + 2;
+ }
+ }
+
+ // Now update the structure to include the offset
+ for(i =0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+
+ if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ if(pdu->rx_indication_rel8.offset == 1)
+ {
+ pdu->rx_indication_rel8.offset = offset;
+ offset += pdu->rx_indication_rel8.length;
+ }
+ }
+ }
+
+ // Write out the pdu
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) &&
+ pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value)))
+ return 0;
+ }
+
+ // Write out the pdu data
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ uint16_t length = 0;
+ nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+
+ if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ length = pdu->rx_indication_rel8.length;
+ }
+
+ if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0)
+ return 0;
+ }
+ return 1;
+}
+
+
+static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
+
+ return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) &&
+ push8(preamble_rel8->preamble, ppWritePackedMsg, end) &&
+ push16(preamble_rel8->timing_advance, ppWritePackedMsg, end));
+}
+static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
+
+ return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) );
+}
+static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
+
+ return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
+
+ if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_preambles;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) &&
+ pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) &&
+ pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
+
+ return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) &&
+ push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) &&
+ pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
+
+ return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
+
+ return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) );
+
+}
+
+static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
+
+ return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ;
+}
+
+static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
+
+ if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
+ push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+ push8(value->num_atennas, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_subbands; ++idx)
+ {
+ if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) &&
+ pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv;
+
+ if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_ues;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) &&
+ pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) &&
+ pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) &&
+ pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) &&
+ pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
+
+ if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_srs;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+ return 1;
+}
+
+static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
+
+ return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) &&
+ push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) &&
+ push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
+
+ return ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) &&
+ push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) &&
+ push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
+ pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
+
+ if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // need to calculate the data offset's. This very bittle due the hardcoding
+ // of the sizes. can not use the sizeof as we have an array for the Rel9
+ // info
+ uint16_t i = 0;
+ uint16_t offset = 2; // taking into account the number_of_cqis
+ uint16_t total_number_of_pdus = value->number_of_cqis;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+ offset += 2; // for the instance length
+
+ if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
+ {
+ offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t)
+ }
+
+ if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+ {
+ offset += 4 + 8;
+ }
+
+ if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+ {
+ offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported;
+ }
+
+ if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG)
+ {
+ offset += 4 + 2;
+ }
+ }
+
+ // Now update the structure to include the offset
+ for(i =0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+ if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+ {
+ if(pdu->cqi_indication_rel8.data_offset == 1)
+ {
+ pdu->cqi_indication_rel8.data_offset = offset;
+ offset += pdu->cqi_indication_rel8.length;
+ }
+ }
+
+ if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+ {
+ if(pdu->cqi_indication_rel9.data_offset == 1)
+ {
+ pdu->cqi_indication_rel9.data_offset = offset;
+ offset += pdu->cqi_indication_rel9.length;
+ }
+ }
+
+ }
+
+ // Write out the cqi information
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) &&
+ pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) &&
+ pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+
+ }
+
+ // Write out the cqi raw data
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ uint16_t length = 0;
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+ if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+ {
+ length = pdu->cqi_indication_rel8.length;
+ }
+
+ if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+ {
+ length = pdu->cqi_indication_rel9.length;
+ }
+
+ if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push32(value->mp_cca, ppWritePackedMsg, end) &&
+ push32(value->n_cca, ppWritePackedMsg, end) &&
+ push32(value->offset, ppWritePackedMsg, end) &&
+ push32(value->lte_txop_sf, ppWritePackedMsg, end) &&
+ push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) &&
+ push32(value->lbt_mode, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push32(value->offset, ppWritePackedMsg, end) &&
+ push16(value->sfn_sf_end, ppWritePackedMsg, end) &&
+ push32(value->lbt_mode, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
+
+ if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
+
+ if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+ if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
+ {
+ if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0)
+ return 0;
+ }
+ break;
+ case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
+ {
+ if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0)
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push32(value->result, ppWritePackedMsg, end) &&
+ push32(value->lte_txop_symbols, ppWritePackedMsg, end) &&
+ push32(value->initial_partial_sf, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push32(value->result, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
+
+ if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
+
+ if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+
+ if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
+ {
+ if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0)
+ return 0;
+ }
+ break;
+ case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
+ {
+ if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0)
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
+
+ return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
+
+ if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_harqs = value->number_of_harqs;
+ for(; i < total_number_of_harqs; ++i)
+ {
+ nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) &&
+ pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+
+static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
+
+ return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) &&
+ push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) &&
+ push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) &&
+ push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
+
+ if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected;
+ for(; i < total_number_of_initial_scs_detected; ++i)
+ {
+ nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
+
+ //uint8_t* instance_length_p = *ppWritePackedMsg;
+ //if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ // return 0;
+
+ if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ //uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ //push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg;
+
+ return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
+
+ return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg;
+
+ return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
+
+ return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
+
+ return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg;
+
+ return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+
+// Main pack function - public
+
+int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
+{
+ nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
+ uint8_t *pWritePackedMessage = pPackedBuf;
+ uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+ uint8_t *end = pPackedBuf + packedBufLen;
+
+ if (pMessageBuf == NULL || pPackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
+ return -1;
+ }
+ /*
+ printf("\n P7 MESSAGE SENT: \n");
+ for(int i=0; i< packedBufLen; i++){
+ printf("%d", *(uint8_t *)(pMessageBuf + i));
+ }
+ printf("\n");
+ */
+ // process the header
+ if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
+ push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
+ push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
+ push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
+ push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
+ push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
+ return -1;
+ }
+
+ if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
+ }
+ // look for the specific message
+ uint8_t result = 0;
+ switch (pMessageHeader->message_id)
+ {
+ case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
+ result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
+ result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+ case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
+ result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+ case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
+ result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ //printf("RX ULSCH\n");
+ result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
+ result = pack_nr_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
+ result = pack_nr_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_TIMING_INFO:
+ result = pack_nr_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ default:
+ {
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+ {
+ if(config && config->pack_p7_vendor_extension)
+ {
+ result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ break;
+ }
+
+ if(result == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
+ return -1;
+ }
+
+ // check for a valid message length
+ uintptr_t msgHead = (uintptr_t)pPackedBuf;
+ uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
+ uint32_t packedMsgLen = msgEnd - msgHead;
+ uint16_t packedMsgLen16;
+ if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
+ return -1;
+ }
+ else
+ {
+ packedMsgLen16 = (uint16_t)packedMsgLen;
+ }
+
+ // Update the message length in the header
+ pMessageHeader->message_length = packedMsgLen16;
+
+ if(!push16(packedMsgLen16, &pPackedLengthField, end))
+ return -1;
+
+ if(1)
+ {
+ //quick test
+ if(pMessageHeader->message_length != packedMsgLen)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
+ }
+ }
+
+ return (packedMsgLen);
+}
+
+int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
+{
+ nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
+ uint8_t *pWritePackedMessage = pPackedBuf;
+ uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+ uint8_t *end = pPackedBuf + packedBufLen;
+
+ if (pMessageBuf == NULL || pPackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
+ return -1;
+ }
+ /*
+ printf("\n P7 MESSAGE SENT: \n");
+ for(int i=0; i< packedBufLen; i++){
+ printf("%d", *(uint8_t *)(pMessageBuf + i));
+ }
+ printf("\n");
+ */
+ // process the header
+ if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
+ push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
+ push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
+ push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
+ push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
+ push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
+ return -1;
+ }
+
+ if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
+ }
+ // look for the specific message
+ uint8_t result = 0;
+ switch (pMessageHeader->message_id)
+ {
+ case NFAPI_DL_CONFIG_REQUEST:
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__);
+ result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UL_CONFIG_REQUEST:
+ result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+ case NFAPI_TX_REQUEST:
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
+ result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+ case NFAPI_HI_DCI0_REQUEST:
+ result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ //printf("RX ULSCH\n");
+ result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_DL_NODE_SYNC:
+ result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UL_NODE_SYNC:
+ result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_TIMING_INFO:
+ result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ default:
+ {
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+ {
+ if(config && config->pack_p7_vendor_extension)
+ {
+ result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ break;
+ }
+
+ if(result == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
+ return -1;
+ }
+
+ // check for a valid message length
+ uintptr_t msgHead = (uintptr_t)pPackedBuf;
+ uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
+ uint32_t packedMsgLen = msgEnd - msgHead;
+ uint16_t packedMsgLen16;
+ if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
+ return -1;
+ }
+ else
+ {
+ packedMsgLen16 = (uint16_t)packedMsgLen;
+ }
+
+ // Update the message length in the header
+ pMessageHeader->message_length = packedMsgLen16;
+
+ if(!push16(packedMsgLen16, &pPackedLengthField, end))
+ return -1;
+
+ if(1)
+ {
+ //quick test
+ if(pMessageHeader->message_length != packedMsgLen)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
+ }
+ }
+
+ return (packedMsgLen);
+}
+
+// Unpack routines
+// NR:
+static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &value->bwp_size, end) &&
+ pull16(ppReadPackedMsg, &value->bwp_start, end) &&
+
+ pull8(ppReadPackedMsg, &value->subcarrier_spacing, end) &&
+ pull8(ppReadPackedMsg, &value->cyclic_prefix, end) &&
+
+ pull16(ppReadPackedMsg, &value->start_rb, end) &&
+ pull16(ppReadPackedMsg, &value->nr_of_rbs, end) &&
+
+ pull8(ppReadPackedMsg, &value->csi_type, end) &&
+ pull8(ppReadPackedMsg, &value->row, end) &&
+
+ pull16(ppReadPackedMsg, &value->freq_domain, end) &&
+ pull8(ppReadPackedMsg, &value->symb_l0, end) &&
+
+ pull8(ppReadPackedMsg, &value->symb_l1, end) &&
+ pull8(ppReadPackedMsg, &value->cdm_type, end) &&
+
+ pull8(ppReadPackedMsg, &value->freq_density, end) &&
+ pull16(ppReadPackedMsg, &value->scramb_id, end) &&
+
+ pull8(ppReadPackedMsg, &value->power_control_offset, end) &&
+ pull8(ppReadPackedMsg, &value->power_control_offset_ss, end)
+ );
+
+}
+
+
+static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
+
+ for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
+ {
+ if(!(pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) &&
+ pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingId, end) &&
+
+ pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingRNTI, end) &&
+ pull8(ppReadPackedMsg, &value->dci_pdu[i].CceIndex, end) &&
+ pull8(ppReadPackedMsg, &value->dci_pdu[i].AggregationLevel, end) &&
+ pull8(ppReadPackedMsg, &value->dci_pdu[i].beta_PDCCH_1_0, end) &&
+
+ pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) &&
+ pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) &&
+
+ pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, end)))
+
+ return 0;
+ }
+
+ // TODO: resolve the packaging of array (currently sending a single element)
+ return(
+ pull16(ppReadPackedMsg, &value->BWPSize, end) &&
+ pull16(ppReadPackedMsg, &value->BWPStart, end) &&
+ pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) &&
+ pull8(ppReadPackedMsg, &value->CyclicPrefix, end) &&
+
+ pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) &&
+ pull8(ppReadPackedMsg, &value->DurationSymbols, end) &&
+ pullarray8(ppReadPackedMsg, value->FreqDomainResource, 6, 6, end) &&
+ pull8(ppReadPackedMsg, &value->CceRegMappingType, end) &&
+
+ pull8(ppReadPackedMsg, &value->RegBundleSize, end) &&
+ pull8(ppReadPackedMsg, &value->InterleaverSize, end) &&
+ pull8(ppReadPackedMsg, &value->CoreSetType, end) &&
+ pull16(ppReadPackedMsg, &value->ShiftIndex, end) &&
+
+ pull8(ppReadPackedMsg, &value->precoderGranularity, end) &&
+ pull16(ppReadPackedMsg, &value->numDlDci, end));
+
+}
+
+
+static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
+
+ // TODO: resolve the packaging of array (currently sending a single element)
+ return(
+ pull16(ppReadPackedMsg, &value->pduBitmap, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull16(ppReadPackedMsg, &value->pduIndex, end) &&
+ pull16(ppReadPackedMsg, &value->BWPSize, end) &&
+
+ pull16(ppReadPackedMsg, &value->BWPStart, end) &&
+ pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) &&
+ pull8(ppReadPackedMsg, &value->CyclicPrefix, end) &&
+ pull8(ppReadPackedMsg, &value->NrOfCodewords, end) &&
+
+ pullarray16(ppReadPackedMsg, value->targetCodeRate, 2, 1, end) &&
+ pullarray8(ppReadPackedMsg, value->qamModOrder, 2, 1, end) &&
+ pullarray8(ppReadPackedMsg, value->mcsIndex, 2, 1, end) &&
+ pullarray8(ppReadPackedMsg, value->mcsTable, 2, 1, end) &&
+
+ pullarray8(ppReadPackedMsg, value->rvIndex, 2, 1, end) &&
+ pullarray32(ppReadPackedMsg, value->TBSize, 2, 1, end) &&
+ pull16(ppReadPackedMsg, &value->dataScramblingId, end) &&
+ pull8(ppReadPackedMsg, &value->nrOfLayers, end) &&
+
+ pull8(ppReadPackedMsg, &value->transmissionScheme, end) &&
+ pull8(ppReadPackedMsg, &value->refPoint, end) &&
+ pull16(ppReadPackedMsg, &value->dlDmrsSymbPos, end) &&
+ pull8(ppReadPackedMsg, &value->dmrsConfigType, end) &&
+
+ pull16(ppReadPackedMsg, &value->dlDmrsScramblingId, end) &&
+ pull8(ppReadPackedMsg, &value->SCID, end) &&
+ pull8(ppReadPackedMsg, &value->numDmrsCdmGrpsNoData, end) &&
+ pull16(ppReadPackedMsg, &value->dmrsPorts, end) &&
+
+ pull8(ppReadPackedMsg, &value->resourceAlloc, end) &&
+ pull16(ppReadPackedMsg, &value->rbStart, end) &&
+ pull16(ppReadPackedMsg, &value->rbSize, end) &&
+
+ pull8(ppReadPackedMsg, &value->VRBtoPRBMapping, end) &&
+ pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) &&
+ pull8(ppReadPackedMsg, &value->NrOfSymbols, end) &&
+ pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) &&
+
+ pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) &&
+ pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) &&
+ pull8(ppReadPackedMsg, &value->PTRSReOffset, end)
+ );
+
+}
+
+
+static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ printf("ssb received and unpacked. \n");
+ nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &value->PhysCellId, end) &&
+ pull8(ppReadPackedMsg, &value->BetaPss, end) &&
+ pull8(ppReadPackedMsg, &value->SsbBlockIndex, end) &&
+ pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) &&
+ pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) &&
+ pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) &&
+ pull32(ppReadPackedMsg, &value->bchPayload, end)
+ // TODO: pack precoding_and_beamforming too
+ );
+
+}
+
+
+// LTE:
+static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) &&
+ pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+ pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end));
+
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) &&
+ pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end));
+}
+
+static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end)
+{
+ if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
+ pull8(ppReadPackedMsg, &value->num_antennas, end)))
+ return 0;
+
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_subbands; ++idx)
+ {
+ nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
+
+ if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) &&
+ pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end)))
+ return 0;
+
+ uint8_t antenna_idx = 0;
+ uint8_t scheduled_ue_idx = 0;
+
+ for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
+ {
+ for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
+ {
+ if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end))
+ return 0;
+ }
+ }
+
+ }
+
+
+ return 1;
+
+}
+
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
+
+ // If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been
+ // added
+ uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5;
+ dci_dl_pdu_rel13->tpm_struct_flag = 0;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) &&
+ ( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) &&
+ ( (tpm_struct_flag_present == 1 && dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1));
+
+}
+
+static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) &&
+ pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) &&
+ pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) &&
+ pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end));
+}
+
+static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
+
+ if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+ pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) &&
+ pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end)))
+ return 0;
+
+ uint16_t j = 0;
+ for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j)
+ {
+ if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) &&
+ pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end)))
+ return 0;
+ }
+ return 1;
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) );
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
+ pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ;
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end));
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end));
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end));
+}
+
+static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+ pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) &&
+ pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end));
+}
+static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) &&
+ pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end));
+}
+
+static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) &&
+ pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) &&
+ pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) &&
+ pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end));
+}
+
+static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) &&
+ pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) &&
+ pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) &&
+ pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
+ pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) &&
+ pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end));
+}
+
+static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
+
+ if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) &&
+ pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) &&
+ pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end)))
+ return 0;
+
+
+ uint16_t idx =0;
+ for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx)
+ {
+ if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end)))
+ return 0;
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n");
+ //pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??);
+ }
+ return 1;
+}
+
+static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) &&
+ pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) &&
+ pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) &&
+ pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end));
+}
+
+static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end));
+}
+
+static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
+
+
+ return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) &&
+ pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end));
+}
+
+
+static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) &&
+ pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end));
+}
+
+static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end));
+}
+
+static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) &&
+ pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) &&
+ pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) &&
+ pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end));
+}
+
+
+static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)msg;
+
+ if(!(pull16(ppReadPackedMsg, &value->PDUSize, end) &&
+ pull16(ppReadPackedMsg, &value->PDUType, end) ))
+ return 0;
+
+
+ // first match the pdu type, then call the respective function
+ switch(value->PDUType)
+ {
+ case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
+ {
+ if(!(unpack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppReadPackedMsg,end)))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
+ {
+ if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end)))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
+ {
+ if(!(unpack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppReadPackedMsg,end)))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
+ {
+ if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end)))
+ return 0;
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType );
+ }
+ break;
+ }
+
+ return 1;
+}
+
+
+
+
+static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) &&
+ pull8(ppReadPackedMsg, &value->number_dci, end) &&
+ pull16(ppReadPackedMsg, &value->number_pdu, end) &&
+ pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) &&
+ pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end)))
+ return 0;
+
+ if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_pdu)
+ {
+ value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config);
+ if(value->dl_config_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu);
+ return 0;
+ }
+ }
+ else
+ {
+ value->dl_config_pdu_list = 0;
+ }
+
+ uint16_t i;
+ uint16_t total_number_of_pdus = value->number_pdu;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ {
+ // pdu end of beyond buffer end
+ return 0;
+ }
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value},
+ { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value},
+ { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+
+ }
+ break;
+ case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+
+ }
+ break;
+ default:
+ // Need to log an error
+ break;
+ }
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_dl_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg,&pNfapiMsg->SFN, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nGroup, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nPDUs, end) &&
+ pullarray8(ppReadPackedMsg,pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, end)
+ //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ int arr[12];
+ for(int i=0;idl_tti_request_body.nGroup;i++)
+ {
+ for(int j=0;jdl_tti_request_body.nUe[i];j++)
+ {
+ arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
+ }
+ if(!(pullarrays32(ppReadPackedMsg,arr,12,pNfapiMsg->dl_tti_request_body.nUe[i], end)))
+ return 0;
+ }
+
+ for(int i=0;idl_tti_request_body.nPDUs;i++)
+ {
+ if(!unpack_dl_tti_request_body_value(ppReadPackedMsg, end, &pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i]))
+ return 0;
+ }
+
+return 1;
+}
+
+
+static uint8_t unpack_ul_tti_request_prach_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_prach_pdu_t* prach_pdu = (nfapi_nr_prach_pdu_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &prach_pdu->phys_cell_id, end) &&
+ pull8(ppReadPackedMsg, &prach_pdu->num_prach_ocas, end) &&
+ pull8(ppReadPackedMsg, &prach_pdu->prach_format, end) &&
+ pull8(ppReadPackedMsg, &prach_pdu->num_ra, end) &&
+ pull8(ppReadPackedMsg, &prach_pdu->prach_start_symbol, end) &&
+ pull16(ppReadPackedMsg, &prach_pdu->num_cs, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+}
+
+
+static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_pucch_pdu_t* pucch_pdu = (nfapi_nr_pucch_pdu_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &pucch_pdu->rnti, end) &&
+ pull32(ppReadPackedMsg, &pucch_pdu->handle, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->bwp_size, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->bwp_start, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->subcarrier_spacing, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->nr_of_symbols, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->freq_hop_flag, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->second_hop_prb, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->group_hop_flag, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->sequence_hop_flag, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->hopping_id, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->initial_cyclic_shift, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->data_scrambling_id, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->time_domain_occ_idx, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_idx, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_len, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->add_dmrs_flag, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->dmrs_scrambling_id, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->dmrs_cyclic_shift, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->sr_flag, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->bit_len_harq, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part1, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part2, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+}
+
+
+static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_pusch_pdu_t* pusch_pdu = (nfapi_nr_pusch_pdu_t*)tlv;
+
+ if (!(
+ pull16(ppReadPackedMsg, &pusch_pdu->pdu_bit_map, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->rnti, end) &&
+ pull32(ppReadPackedMsg, &pusch_pdu->handle, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->bwp_size, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->bwp_start, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->subcarrier_spacing, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->cyclic_prefix, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->target_code_rate, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->scid, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->num_dmrs_cdm_grps_no_data, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc,end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->rb_start, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->rb_size, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->vrb_to_prb_mapping, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->frequency_hopping, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->tx_direct_current_location, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->uplink_frequency_shift_7p5khz, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->start_symbol_index, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->nr_of_symbols, end)
+ // TODO: ignoring beamforming tlv for now
+ ))
+ return 0;
+
+
+ //Pack Optional Data only included if indicated in pduBitmap
+ switch(pusch_pdu->pdu_bit_map){
+ case PUSCH_PDU_BITMAP_PUSCH_DATA:
+ {
+ // pack optional TLVs
+ return(
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.rv_index, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.harq_process_id, end) &&
+ pull32(ppReadPackedMsg, &pusch_pdu->pusch_data.tb_size, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_data.num_cb, end) &&
+ pullarray8(ppReadPackedMsg, pusch_pdu->pusch_data.cb_present_and_position,1,1,end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_PUSCH_UCI:
+ {
+ return(
+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.harq_ack_bit_length, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part1_bit_length, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part2_bit_length, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.alpha_scaling, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_harq_ack, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi1, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi2, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_PUSCH_PTRS:
+ {
+ return(
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.num_ptrs_ports, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, end) &&
++ pull16(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, end) &&
++ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_time_density, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_freq_density, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ul_ptrs_power, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_DFTS_OFDM:
+ {
+ return(
+ pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_group_number, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_sequence_number, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, end)
+ );
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map );
+ }
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_srs_pdu_t* srs_pdu = (nfapi_nr_srs_pdu_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &srs_pdu->rnti, end) &&
+ pull32(ppReadPackedMsg, &srs_pdu->handle, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->bwp_size, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->bwp_start, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->subcarrier_spacing, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->cyclic_prefix, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->num_ant_ports, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->num_symbols, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->num_repetitions, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->time_start_position, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->config_index, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->sequence_id, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->bandwidth_index, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->comb_size, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->t_srs, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->t_offset, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+}
+
+
+static uint8_t unpack_ul_tti_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_ul_tti_request_number_of_pdus_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_pdus_t*)msg;
+
+ if(!(pull16(ppReadPackedMsg, &pNfapiMsg->pdu_size, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->pdu_type, end) ))
+ return 0;
+
+
+ // first natch the pdu type, then call the respective function
+ switch(pNfapiMsg->pdu_type)
+ {
+
+ case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
+ {
+ if(!unpack_ul_tti_request_prach_pdu(&pNfapiMsg->prach_pdu, ppReadPackedMsg, end))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
+ {
+ if(!unpack_ul_tti_request_pucch_pdu(&pNfapiMsg->pucch_pdu, ppReadPackedMsg, end))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
+ {
+ if(!unpack_ul_tti_request_pusch_pdu(&pNfapiMsg->pusch_pdu, ppReadPackedMsg, end))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
+ {
+ if(!unpack_ul_tti_request_srs_pdu(&pNfapiMsg->srs_pdu, ppReadPackedMsg, end))
+ return 0;
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", pNfapiMsg->pdu_type );
+ }
+ break;
+
+
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_ul_tti_request_number_of_groups_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_groups_t*)msg;
+
+ if(!pull8(ppReadPackedMsg, &pNfapiMsg->n_ue, end))
+ return 0;
+ for (int i = 0; i < pNfapiMsg->n_ue; i++)
+ {
+ if(!pull8(ppReadPackedMsg, &pNfapiMsg->ue_list[i].pdu_idx ,end) )
+ return 0;
+ }
+ return 1;
+}
+
+
+static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg;
+
+ if (!(
+ pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) ))
+ return 0;
+
+ for(int i=0; i< pNfapiMsg->n_pdus; i++)
+ {
+ if (!unpack_ul_tti_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdus_list[i]))
+ return 0;
+ }
+
+ for(int i=0; i< pNfapiMsg->n_group; i++)
+ {
+ if (!unpack_ul_tti_groups_list_value(ppReadPackedMsg, end, &pNfapiMsg->groups_list[i]))
+ return 0;
+ }
+
+ return 1;
+}
+
+
+
+static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value},
+ };
+
+ return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+
+
+
+ nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end ));
+}
+
+static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) &&
+ pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) &
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end));
+}
+static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel11->dmrs_config_flag, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end));
+}
+static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &ulsch_pdu_rel13->ue_type, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end));
+}
+static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end));
+}
+
+static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end)))
+ return 0;
+
+ switch(cqi_ri_info_rel9->report_type)
+ {
+ case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+ {
+ if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+ {
+ if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0)
+ return 0;
+
+ uint8_t i;
+ for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
+ {
+ if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0)
+ return 0;
+
+ uint8_t j;
+ for(j = 0; j < 8; ++j)
+ {
+ if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0)
+ return 0;
+ }
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
+ return 0;
+ }
+ break;
+ };
+ return 1;
+}
+
+// NOTE : This function is a little unconventional as we uese the side to
+// determine the report type
+static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
+ if(cqi_ri_info_rel13->tl.length == 0)
+ {
+ cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC;
+ }
+ else
+ {
+ cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC;
+ if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0)
+ return 0;
+ }
+ return 1;
+}
+static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) &&
+ pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end));
+}
+static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end));
+}
+
+static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end));
+}
+
+static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end));
+}
+static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) &&
+ pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end));
+}
+static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) &&
+ pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) &&
+ pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) &&
+ pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end));
+}
+
+static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end));
+}
+static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) &&
+ pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end));
+}
+static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) &&
+ pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end));
+}
+
+static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end));
+}
+
+static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) &&
+ pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) &&
+ pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) &&
+ pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) &&
+ pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) &&
+ pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) &&
+ pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) &&
+ pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) &&
+ pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) &&
+ pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) &&
+ pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) &&
+ pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) &&
+ pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) &&
+ pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) &&
+ pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) &&
+ pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) &&
+ pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) &&
+ pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) &&
+ pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end));
+}
+
+
+static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end));
+}
+
+static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
+ return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end);
+}
+
+static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end));
+}
+
+static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end));
+}
+
+static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) &&
+ pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) &&
+ pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) &&
+ pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) &&
+ pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) &&
+ pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end)))
+ return 0;
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value},
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value},
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
+ { NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value},
+ };
+
+ return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0);
+}
+
+static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) &&
+ pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) &&
+ pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end));
+}
+
+
+static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ #define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value},
+
+ #define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value},
+
+ #define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value},
+
+ #define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value},
+
+ #define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
+
+ #define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value},
+
+ #define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value},
+
+ #define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value},
+
+ #define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value},
+
+ #define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value},
+
+ #define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value},
+
+
+ nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) &&
+ pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) &&
+ pull8(ppReadPackedMsg, &value->srs_present, end)))
+ return 0;
+
+ if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_pdus > 0)
+ {
+ value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config);
+
+ if(value->ul_config_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->ul_config_pdu_list = 0;
+ }
+
+
+ uint16_t i;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ {
+ // pdu end is past buffer end
+ return 0;
+ }
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+
+ case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu)
+ UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information)
+ UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu)
+ UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information)
+ UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu)
+ UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information)
+ UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information)
+ UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information)
+ UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information)
+ UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information)
+ UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information)
+ UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ }
+ }
+ return 1;
+}
+
+
+static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
+
+ return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) &&
+ pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+ pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) &&
+ pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) &&
+ pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) &&
+ pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) &&
+ pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) &&
+ pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) &&
+ pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) &&
+ pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end));
+}
+
+static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) &&
+ pull8(ppReadPackedMsg, &value->resource_block_assignment, end) &&
+ pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) &&
+ pull8(ppReadPackedMsg, &value->start_symbol, end) &&
+ pull8(ppReadPackedMsg, &value->ecce_index, end) &&
+ pull8(ppReadPackedMsg, &value->aggreagation_level, end) &&
+ pull8(ppReadPackedMsg, &value->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->ce_mode, end) &&
+ pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) &&
+ pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) &&
+ pull16(ppReadPackedMsg, &value->transmission_power, end) &&
+ pull8(ppReadPackedMsg, &value->dci_format, end) &&
+ pull8(ppReadPackedMsg, &value->resource_block_start, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
+ pull8(ppReadPackedMsg, &value->mcs, end) &&
+ pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) &&
+ pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) &&
+ pull8(ppReadPackedMsg, &value->new_data_indication, end) &&
+ pull8(ppReadPackedMsg, &value->harq_process, end) &&
+ pull8(ppReadPackedMsg, &value->redudency_version, end) &&
+ pull8(ppReadPackedMsg, &value->tpc, end) &&
+ pull8(ppReadPackedMsg, &value->csi_request, end) &&
+ pull8(ppReadPackedMsg, &value->ul_inex, end) &&
+ pull8(ppReadPackedMsg, &value->dai_presence_flag, end) &&
+ pull8(ppReadPackedMsg, &value->dl_assignment_index, end) &&
+ pull8(ppReadPackedMsg, &value->srs_request, end) &&
+ pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) &&
+ pull32(ppReadPackedMsg, &value->tcp_bitmap, end) &&
+ pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) &&
+ pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end));
+}
+
+static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->ncce_index, end) &&
+ pull8(ppReadPackedMsg, &value->aggregation_level, end) &&
+ pull8(ppReadPackedMsg, &value->start_symbol, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) &&
+ pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) &&
+ pull8(ppReadPackedMsg, &value->subcarrier_indication, end) &&
+ pull8(ppReadPackedMsg, &value->resource_assignment, end) &&
+ pull8(ppReadPackedMsg, &value->scheduling_delay, end) &&
+ pull8(ppReadPackedMsg, &value->mcs, end) &&
+ pull8(ppReadPackedMsg, &value->redudancy_version, end) &&
+ pull8(ppReadPackedMsg, &value->repetition_number, end) &&
+ pull8(ppReadPackedMsg, &value->new_data_indicator, end) &&
+ pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end));
+}
+
+static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
+
+ if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_dci, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_hi, end)))
+ return 0;
+
+ uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci;
+
+ if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU);
+ return 0;
+ }
+
+ if(totalNumPdus > 0)
+ {
+ value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config);
+ if(value->hi_dci0_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->hi_dci0_pdu_list = 0;
+ }
+
+ uint8_t i;
+ for(i = 0; i < totalNumPdus; ++i)
+ {
+ nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ {
+ // pdu end if past buffer end
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %d %d\n", __FUNCTION__, packedPduEnd, end);
+ return 0;
+ }
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_HI_DCI0_HI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value},
+ { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_HI_DCI0_DCI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
+ { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
+ { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
+ { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
+ { NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+ }
+
+ return 1;
+}
+//unpack_ul_dci_pdu_list_value
+
+static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)msg;
+ for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
+ {
+ if(!(pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, end) &&
+
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, end) &&
+
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end) &&
+
+ pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end)))
+
+ return 0;
+ }
+
+ return (pull16(ppReadPackedMsg, &value->PDUType, end) &&
+ pull16(ppReadPackedMsg, &value->PDUSize, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, end) &&
+
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, end) &&
+ pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, end) &&
+
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end));
+
+}
+
+static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->numPdus, end)
+ ))
+ return 0;
+ for(int i=0; i< pNfapiMsg->numPdus; i++)
+ {
+ if (!unpack_ul_dci_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->ul_dci_pdu_list[i]))
+ return 0;
+ }
+
+ return 1;
+
+}
+
+static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+}
+static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_pdu_t* pNfapiMsg = (nfapi_nr_pdu_t*)msg;
+
+ if(!(pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->PDU_length, end)
+ ))
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV;
+ for(; i < total_number_of_tlvs; ++i)
+ {
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end)))
+ return 0;
+
+ switch(pNfapiMsg->TLVs[i].tag){
+ case 0:
+ {
+ if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end))
+ return 0;
+ break;
+
+ }
+
+ case 1:
+ {
+ if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length , pNfapiMsg->TLVs[i].length, end))
+ return 0;
+ break;
+
+ }
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", pNfapiMsg->TLVs[i].tag );
+ break;
+ }
+
+ }
+ }
+
+
+ return 1;
+}
+
+static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg;
+
+ if(!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Number_of_PDUs, end)))
+ return 0;
+
+ for(int i=0; i< pNfapiMsg->Number_of_PDUs; i++)
+ {
+ if (!unpack_tx_data_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdu_list[i]))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ uint8_t proceed = 1;
+ nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
+
+ if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
+ return 0;
+
+ while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
+ {
+ nfapi_tl_t generic_tl;
+ if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ return 0;
+
+ switch(generic_tl.tag)
+ {
+ case NFAPI_TX_REQUEST_BODY_TAG:
+ {
+ pNfapiMsg->tx_request_body.tl = generic_tl;
+
+ if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0)
+ return 0;
+
+ if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU);
+ return 0;
+ }
+
+ if(pNfapiMsg->tx_request_body.number_of_pdus > 0)
+ {
+ pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config);
+ if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ pNfapiMsg->tx_request_body.tx_pdu_list = 0;
+ }
+
+
+ uint16_t i;
+ uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus;
+ for(i = 0; i < totalNumPdus; ++i)
+ {
+ nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
+ if (pdu) {
+ uint16_t length = 0;
+ uint16_t index = 0;
+
+ if(!(pull16(ppReadPackedMsg, &length, end) &&
+ pull16(ppReadPackedMsg, &index, end)))
+ return 0;
+
+ pdu->pdu_length = length;
+ pdu->pdu_index = index;
+
+
+ // TODO : May need to rethink this bit
+ pdu->num_segments = 1;
+ pdu->segments[0].segment_length = pdu->pdu_length;
+ pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
+
+ if(pdu->segments[0].segment_data)
+ {
+ if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
+ return 0;
+ if (pdu->segments[0].segment_length == 3)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
+ pdu->segments[0].segment_data[0],
+ pdu->segments[0].segment_data[1],
+ pdu->segments[0].segment_data[2]
+ );
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
+ }
+ } else {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
+ }
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag );
+ }
+ break;
+ };
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ uint8_t proceed = 1;
+ nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
+
+ if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
+ return 0;
+
+ while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
+ {
+ nfapi_tl_t generic_tl;
+ if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ return 0;
+
+ switch(generic_tl.tag)
+ {
+ case NFAPI_UE_RELEASE_BODY_TAG:
+ {
+ pNfapiMsg->ue_release_request_body.tl = generic_tl;
+ if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
+ return 0;
+
+ if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
+ return 0;
+ } else {
+ uint8_t j;
+ uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
+ for(j = 0; j < num; ++j){
+ if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
+ return 0;
+ }
+ }
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
+ }
+ break;
+ };
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->value_0, end) &&
+ pull8(ppReadPackedMsg, &value->value_1, end));
+}
+
+static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->value_0, end) &&
+ pull8(ppReadPackedMsg, &value->value_1, end) &&
+ pull8(ppReadPackedMsg, &value->value_2, end) &&
+ pull8(ppReadPackedMsg, &value->value_3, end));
+}
+static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv;
+ return ( pull8(ppReadPackedMsg, &value->value_0, end));
+}
+static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv;
+ return (pull8(ppReadPackedMsg, &value->value_0, end));
+}
+
+static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+ return 0;
+
+ uint8_t result = 0;
+ switch(value->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = 1;
+ break;
+ default:
+ // TODO add error message
+ return 0;
+ break;
+ }
+ return result;
+}
+
+static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+ return 0;
+
+ if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
+ {
+ // TODO : add error message
+ return 0;
+ }
+
+ uint16_t idx = 0;
+ for(idx = 0; idx < value->number_of_ack_nack; ++idx)
+ {
+ uint8_t result = 0;
+ switch(value->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
+ break;
+ default:
+ // TODO add error message
+ return 0;
+ break;
+ }
+
+ if(result == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull16(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+ return 0;
+
+ if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
+ {
+ // TODO : add error message
+ return 0;
+ }
+
+ uint16_t idx = 0;
+ for(idx = 0; idx < value->number_of_ack_nack; ++idx)
+ {
+ uint8_t result = 0;
+ switch(value->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end);
+ break;
+ default:
+ // TODO add error message
+ return 0;
+ break;
+ }
+
+ if(result == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv;
+ return (pull8(ppReadPackedMsg, &value->harq_tb1, end) &&
+ pull8(ppReadPackedMsg, &value->harq_tb2, end));
+}
+
+static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
+ pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end));
+}
+
+static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
+ pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end));
+}
+
+static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull8(ppReadPackedMsg, &value->channel, end));
+}
+
+
+
+static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
+ uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(harqBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
+ return 0;
+
+ if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
+ return 0;
+ }
+
+ value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config);
+ if(value->harq_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
+ return 0;
+ }
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_harqs; ++i)
+ {
+ nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value},
+ { NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value},
+ { NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value},
+ { NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value},
+ { NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value},
+ { NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value},
+ { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
+ return 0;
+
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
+ return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) );
+}
+
+static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
+ uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(crcBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0)
+ return 0;
+
+ if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_crcs > 0)
+ {
+ value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config);
+ if(value->crc_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs);
+ return 0;
+ }
+ }
+ else
+ {
+ value->crc_pdu_list = 0;
+ }
+
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_crcs; ++i)
+ {
+ nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value },
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &value->length, end) &&
+ pull16(ppReadPackedMsg, &value->offset, end) &&
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end));
+}
+static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
+ return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
+}
+
+static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
+
+ // the rxBodyEnd points to the end of the cqi PDU's
+ uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length;
+ uint8_t* rxPduEnd = rxBodyEnd;
+
+ uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
+
+ if(rxBodyEnd > end)
+ {
+ // pdu end is past buffer end
+ return 0;
+ }
+
+ if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+ return 0;
+
+ if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_pdus > 0)
+ {
+ value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
+ if(value->rx_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->rx_pdu_list = 0;
+ }
+
+ uint8_t i = 0;
+ nfapi_rx_indication_pdu_t* pdu = 0;
+ while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd)
+ {
+ nfapi_tl_t generic_tl;
+ if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ return 0;
+
+ switch(generic_tl.tag)
+ {
+ case NFAPI_RX_UE_INFORMATION_TAG:
+ {
+ pdu = &(value->rx_pdu_list[i++]);
+ pdu->rx_ue_information.tl = generic_tl;
+ if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
+ return 0;
+ }
+ break;
+ case NFAPI_RX_INDICATION_REL8_TAG:
+ {
+ if(pdu != 0)
+ {
+ pdu->rx_indication_rel8.tl = generic_tl;
+ if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
+ return 0;
+
+ if(pdu->rx_indication_rel8.offset > 0)
+ {
+ // Need to check that the data is within the tlv
+ if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd)
+ {
+ // If this the first pdu set the rxPduEnd
+ if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd)
+ {
+ rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset;
+
+ if(rxPduEnd > end)
+ {
+ // pdu end is past buffer end
+ return 0;
+ }
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n");
+ }
+ }
+ }
+ }
+ break;
+ case NFAPI_RX_INDICATION_REL9_TAG:
+ {
+ if(pdu != 0)
+ {
+ pdu->rx_indication_rel9.tl = generic_tl;
+ if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
+ return 0;
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag );
+ }
+ break;
+ }
+ }
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_pdus; ++idx)
+ {
+ if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length;
+ value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config);
+ if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0)
+ {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) &&
+ pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end));
+}
+
+static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
+ return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end);
+}
+
+static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
+ return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end);
+}
+
+static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
+ uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(rachBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0)
+ return 0;
+
+ if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_preambles > 0)
+ {
+ value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config);
+ if(value->preamble_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles);
+ return 0;
+ }
+ }
+ else
+ {
+ value->preamble_list = 0;
+ }
+
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_preambles; ++i)
+ {
+ nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value },
+ { NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value },
+ { NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value },
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
+
+ if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) &&
+ pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end)))
+ return 0;
+ return 1;
+}
+
+static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
+ return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end));
+}
+
+static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
+ return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end));
+}
+
+static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
+ return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end));
+}
+
+static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
+ pull8(ppReadPackedMsg, &value->num_atennas, end)))
+ return 0;
+
+ if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS)
+ {
+ // todo : add error
+ return 0;
+ }
+
+ if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS)
+ {
+ // todo : add error
+ return 0;
+ }
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_subbands; ++idx)
+ {
+ if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) &&
+ pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end)))
+ return 0;
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv;
+ uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(srsBodyEnd > end)
+ return 0;
+
+ if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0)
+ return 0;
+
+ if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_ues > 0)
+ {
+ value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config);
+ if(value->srs_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues);
+ return 0;
+ }
+ }
+ else
+ {
+ value->srs_pdu_list = 0;
+ }
+
+
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_ues; ++i)
+ {
+ nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
+
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value},
+ { NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value},
+ { NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value},
+ { NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value},
+ { NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value},
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
+ uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(srBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0)
+ return 0;
+
+ if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_srs > 0)
+ {
+ value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * value->number_of_srs, config);
+ if(value->sr_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs);
+ return 0;
+ }
+ }
+ else
+ {
+ value->sr_pdu_list = 0;
+ }
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_srs; ++i)
+ {
+ nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value },
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0)
+ return 0;
+ }
+
+ return 1;
+
+}
+
+static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) &&
+ pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) &&
+ pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end));
+
+}
+
+static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
+
+ if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) &&
+ pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) &&
+ pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end)))
+ return 0;
+
+ if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n");
+ return 0;
+ }
+
+ if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end)))
+ return 0;
+
+ return 1;
+}
+
+static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
+
+ // the cqiBodyEnd points to the end of the cqi PDU's
+ uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ //uint8_t* cqiPduEnd = cqiBodyEnd;
+ //uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
+
+ if(cqiBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0)
+ return 0;
+
+ if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU);
+ return -1;
+ }
+
+ if(value->number_of_cqis > 0)
+ {
+ value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * value->number_of_cqis, config);
+ if(value->cqi_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
+ return 0;
+ }
+ }
+ else
+ {
+ value->cqi_pdu_list = 0;
+ }
+
+ if(value->number_of_cqis > 0)
+ {
+ value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * value->number_of_cqis, config);
+ if(value->cqi_raw_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
+ return 0;
+ }
+ }
+ else
+ {
+ value->cqi_raw_pdu_list = 0;
+ }
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_cqis; ++i)
+ {
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+ memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t));
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd)
+ {
+ nfapi_tl_t generic_tl;
+ if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ return 0;
+
+ switch(generic_tl.tag)
+ {
+ case NFAPI_RX_UE_INFORMATION_TAG:
+ pdu->rx_ue_information.tl = generic_tl;
+ if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
+ return 0;
+ break;
+ case NFAPI_CQI_INDICATION_REL8_TAG:
+ pdu->cqi_indication_rel8.tl = generic_tl;
+ if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0)
+ return 0;
+
+ break;
+ case NFAPI_CQI_INDICATION_REL9_TAG:
+ pdu->cqi_indication_rel9.tl = generic_tl;
+ if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0)
+ return 0;
+
+ break;
+ case NFAPI_UL_CQI_INFORMATION_TAG:
+ pdu->ul_cqi_information.tl = generic_tl;
+ if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0)
+ return 0;
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag );
+ }
+ break;
+
+ };
+ }
+ }
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_cqis; ++idx)
+ {
+ if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+ {
+ if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0)
+ return 0;
+ }
+ else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+ {
+ if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0)
+ return 0;
+ }
+ }
+
+
+ return 1;
+
+}
+
+static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull32(ppReadPackedMsg, &value->mp_cca, end) &&
+ pull32(ppReadPackedMsg, &value->n_cca, end) &&
+ pull32(ppReadPackedMsg, &value->offset, end) &&
+ pull32(ppReadPackedMsg, &value->lte_txop_sf, end) &&
+ pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) &&
+ pull32(ppReadPackedMsg, &value->lbt_mode, end));
+}
+
+static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull32(ppReadPackedMsg, &value->offset, end) &&
+ pull16(ppReadPackedMsg, &value->sfn_sf_end, end) &&
+ pull32(ppReadPackedMsg, &value->lbt_mode, end));
+}
+
+
+static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+ return 0;
+
+ if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_pdus)
+ {
+ value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config);
+ if(value->lbt_dl_config_req_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->lbt_dl_config_req_pdu_list = 0;
+ }
+
+
+ uint16_t i;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type);
+ return 0;
+ }
+ }
+
+ return 1;
+}
+static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull32(ppReadPackedMsg, &value->result, end) &&
+ pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) &&
+ pull32(ppReadPackedMsg, &value->initial_partial_sf, end));
+
+}
+static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull32(ppReadPackedMsg, &value->result, end));
+}
+
+static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+ return 0;
+
+ if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_pdus > 0)
+ {
+ value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config);
+ if(value->lbt_indication_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->lbt_indication_pdu_list = 0;
+ }
+
+ uint16_t i;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type);
+ return 0;
+ }
+ }
+
+ return 1;
+}
+static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
+ return (pull8(ppReadPackedMsg, &value->harq_tb1, end));
+}
+
+
+static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
+ uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(nbharqBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
+ return 0;
+
+ if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
+ return 0;
+ }
+
+ value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config);
+ if(value->nb_harq_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
+ return 0;
+ }
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_harqs; ++i)
+ {
+ nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value},
+ { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
+ return 0;
+
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->initial_sc, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
+}
+
+static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
+ if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
+ return 0;
+ }
+ else{
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
+ }
+ return 1;
+}
+
+static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
+ uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(nrachBodyEnd > end)
+ return 0;
+
+ if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0)
+ return 0;
+
+ if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU);
+ return 0;
+ }
+
+ value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config);
+ if(value->nrach_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected);
+ return 0;
+ }
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_initial_scs_detected; ++i)
+ {
+ nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
+
+ uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6;
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value},
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0)
+ return 0;
+
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nr_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_nr_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+
+// unpack length check
+
+static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
+{
+ int retLen = 0;
+
+ switch (msgId)
+ {
+ case NFAPI_DL_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t))
+ retLen = sizeof(nfapi_dl_config_request_t);
+ break;
+
+ case NFAPI_UL_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t))
+ retLen = sizeof(nfapi_ul_config_request_t);
+ break;
+
+ case NFAPI_SUBFRAME_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
+ retLen = sizeof(nfapi_subframe_indication_t);
+ break;
+
+ case NFAPI_HI_DCI0_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t))
+ retLen = sizeof(nfapi_hi_dci0_request_t);
+ break;
+
+ case NFAPI_TX_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_tx_request_t))
+ retLen = sizeof(nfapi_tx_request_t);
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_harq_indication_t))
+ retLen = sizeof(nfapi_harq_indication_t);
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_crc_indication_t))
+ retLen = sizeof(nfapi_crc_indication_t);
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_rx_indication_t))
+ retLen = sizeof(nfapi_rx_indication_t);
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_rach_indication_t))
+ retLen = sizeof(nfapi_rach_indication_t);
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_srs_indication_t))
+ retLen = sizeof(nfapi_srs_indication_t);
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_sr_indication_t))
+ retLen = sizeof(nfapi_sr_indication_t);
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t))
+ retLen = sizeof(nfapi_cqi_indication_t);
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t))
+ retLen = sizeof(nfapi_lbt_dl_config_request_t);
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t))
+ retLen = sizeof(nfapi_lbt_dl_indication_t);
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t))
+ retLen = sizeof(nfapi_nb_harq_indication_t);
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t))
+ retLen = sizeof(nfapi_nrach_indication_t);
+ break;
+
+ case NFAPI_DL_NODE_SYNC:
+ if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t))
+ retLen = sizeof(nfapi_dl_node_sync_t);
+ break;
+
+ case NFAPI_UL_NODE_SYNC:
+ if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t))
+ retLen = sizeof(nfapi_ul_node_sync_t);
+ break;
+
+ case NFAPI_TIMING_INFO:
+ if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
+ retLen = sizeof(nfapi_timing_info_t);
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
+ retLen = sizeof(nfapi_ue_release_request_t);
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
+ retLen = sizeof(nfapi_ue_release_response_t);
+ break;
+
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
+ break;
+ }
+
+ return retLen;
+}
+
+static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
+{
+ int retLen = 0;
+
+ switch (msgId)
+ {
+ case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_dl_tti_request_t))
+ retLen = sizeof(nfapi_nr_dl_tti_request_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_ul_tti_request_t))
+ retLen = sizeof(nfapi_nr_ul_tti_request_t);
+ break;
+
+ case NFAPI_SUBFRAME_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
+ retLen = sizeof(nfapi_subframe_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_ul_dci_request_t))
+ retLen = sizeof(nfapi_nr_ul_dci_request_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t))
+ retLen = sizeof(nfapi_nr_tx_data_request_t);
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_harq_indication_t))
+ retLen = sizeof(nfapi_harq_indication_t);
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_crc_indication_t))
+ retLen = sizeof(nfapi_crc_indication_t);
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_rx_indication_t))
+ retLen = sizeof(nfapi_rx_indication_t);
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_rach_indication_t))
+ retLen = sizeof(nfapi_rach_indication_t);
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_srs_indication_t))
+ retLen = sizeof(nfapi_srs_indication_t);
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_sr_indication_t))
+ retLen = sizeof(nfapi_sr_indication_t);
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t))
+ retLen = sizeof(nfapi_cqi_indication_t);
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t))
+ retLen = sizeof(nfapi_lbt_dl_config_request_t);
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t))
+ retLen = sizeof(nfapi_lbt_dl_indication_t);
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t))
+ retLen = sizeof(nfapi_nb_harq_indication_t);
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t))
+ retLen = sizeof(nfapi_nrach_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
+ if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t))
+ retLen = sizeof(nfapi_nr_dl_node_sync_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
+ if (unpackedBufLen >= sizeof(nfapi_nr_ul_node_sync_t))
+ retLen = sizeof(nfapi_nr_ul_node_sync_t);
+ break;
+
+ case NFAPI_TIMING_INFO:
+ if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
+ retLen = sizeof(nfapi_timing_info_t);
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
+ retLen = sizeof(nfapi_ue_release_request_t);
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
+ retLen = sizeof(nfapi_ue_release_response_t);
+ break;
+
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
+ break;
+ }
+
+ return retLen;
+}
+
+
+
+// Main unpack functions - public
+
+int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
+{
+ nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+
+ // process the header
+ if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
+ return -1;
+
+ return 0;
+}
+
+int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
+{
+ int result = 0;
+ nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+ /*
+ uint8_t *ptr = pMessageBuf;
+ printf("\n Read P7 message unpack: ");
+ while(ptr < end){
+ printf(" %d ", *ptr);
+ ptr++;
+ }
+ printf("\n");
+*/
+ // clean the supplied buffer for - tag value blanking
+ (void)memset(pUnpackedBuf, 0, unpackedBufLen);
+
+ // process the header
+ if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
+ return -1;
+ }
+
+ if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
+ return -1;
+ }
+
+ /*
+ if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
+ return -1;
+ }
+ */
+
+ // look for the specific message
+ switch (pMessageHeader->message_id)
+ {
+ case NFAPI_DL_CONFIG_REQUEST:
+ if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen))
+ result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UL_CONFIG_REQUEST:
+ if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen))
+ result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+ case NFAPI_TX_REQUEST:
+ if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen))
+ result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+ case NFAPI_HI_DCI0_REQUEST:
+ if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen))
+ result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
+ result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
+ result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
+ result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
+ result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
+ result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen))
+ result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen))
+ result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen))
+ result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen))
+ result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
+ result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
+ result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
+ result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_DL_NODE_SYNC:
+ if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen))
+ result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UL_NODE_SYNC:
+ if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen))
+ result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_TIMING_INFO:
+ if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
+ result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
+ result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ default:
+
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+ {
+ if(config && config->unpack_p7_vendor_extension)
+ {
+ result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ break;
+ }
+
+ if(result == 0)
+ return -1;
+ else
+ return 0;
+}
+
+int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
+{
+ int result = 0;
+ nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+ /*
+ uint8_t *ptr = pMessageBuf;
+ printf("\n Read P7 message unpack: ");
+ while(ptr < end){
+ printf(" %d ", *ptr);
+ ptr++;
+ }
+ printf("\n");
+*/
+ // clean the supplied buffer for - tag value blanking
+ (void)memset(pUnpackedBuf, 0, unpackedBufLen);
+
+ // process the header
+ if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
+ return -1;
+ }
+
+ if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
+ return -1;
+ }
+
+ /*
+ if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
+ return -1;
+ }
+ */
+
+ // look for the specific message
+ switch (pMessageHeader->message_id)
+ {
+ case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen))
+ result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen))
+ result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+ case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen))
+ result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+ case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen))
+ result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
+ result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ if (check_nr_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
+ result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ if (check_nr_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
+ result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ if (check_nr_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
+ result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ if (check_nr_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
+ result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ if (check_nr_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen))
+ result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ if (check_nr_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen))
+ result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ if (check_nr_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen))
+ result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ if (check_nr_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen))
+ result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ if (check_nr_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
+ result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
+ result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
+ result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen))
+ result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen))
+ result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_TIMING_INFO:
+ if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
+ result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
+ result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ default:
+
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+ {
+ if(config && config->unpack_p7_vendor_extension)
+ {
+ result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ break;
+ }
+
+ if(result == 0)
+ return -1;
+ else
+ return 0;
+}
+
+
diff --git a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
index fc9cd66077..8520a5d162 100644
--- a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
+++ b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
@@ -27,7 +27,6 @@ extern "C" {
#include
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
-
#include
#include "openair1/PHY/defs_gNB.h"
diff --git a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
index 1c2f0bef80..4fe5065cea 100644
--- a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
+++ b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
@@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) {
if(instance->tick == 1000) {
if(instance->tx_byte_count > 0) {
- printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
+ printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count);
instance->tx_byte_count = 0;
}
@@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) {
millisec = now_ts.tv_nsec / 1e6;
if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) {
- printf("*** missing millisec %d %d\n", last_millisec, millisec);
+ printf("*** missing millisec %u %u\n", last_millisec, millisec);
catchup = millisec - last_millisec - 1;
}
diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c
index 2a7b789650..fffd04ea3c 100644
--- a/openair1/PHY/CODING/3gpplte_sse.c
+++ b/openair1/PHY/CODING/3gpplte_sse.c
@@ -44,8 +44,6 @@
//#define DEBUG_TURBO_ENCODER 1
//#define CALLGRIND 1
-unsigned short threegpplte_interleaver_output;
-unsigned long long threegpplte_interleaver_tmp;
#if defined(__x86_64__) || defined(__i386__)
struct treillis {
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
index e1ca906b55..bc1c0dac56 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
@@ -798,11 +798,11 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
n is the size in bits of the coded block, with the tail */
int n2;
llr_t y8[3*(n+16)] __attribute__((aligned(16)));
- llr_t systematic0[n+16] __attribute__ ((aligned(16)));
- llr_t systematic1[n+16] __attribute__ ((aligned(16)));
- llr_t systematic2[n+16] __attribute__ ((aligned(16)));
- llr_t yparity1[n+16] __attribute__ ((aligned(16)));
- llr_t yparity2[n+16] __attribute__ ((aligned(16)));
+ llr_t systematic0[n+32] __attribute__ ((aligned(16)));
+ llr_t systematic1[n+32] __attribute__ ((aligned(16)));
+ llr_t systematic2[n+32] __attribute__ ((aligned(16)));
+ llr_t yparity1[n+32] __attribute__ ((aligned(16)));
+ llr_t yparity2[n+32] __attribute__ ((aligned(16)));
llr_t ext[n+128] __attribute__((aligned(16)));
llr_t ext2[n+128] __attribute__((aligned(16)));
llr_t alpha[(n+16)*8] __attribute__ ((aligned(16)));
@@ -811,7 +811,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
llr_t m10[n+16] __attribute__ ((aligned(16)));
// int *pi2_p,*pi4_p,*pi5_p,*pi6_p;
int *pi4_p,*pi5_p,*pi6_p;
- llr_t *s,*s1,*s2,*yp1,*yp2,*yp;
+ llr_t *s1,*s2,*yp1,*yp2,*yp;
unsigned int i,j,iind;//,pi;
unsigned char iteration_cnt=0;
unsigned int crc,oldcrc,crc_len;
@@ -927,7 +927,6 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
yp128 = (int8x16_t *)y8;
#endif
- s = systematic0;
s1 = systematic1;
s2 = systematic2;
yp1 = yparity1;
@@ -938,7 +937,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
for (i=0; i<16 ; i++ )
for (j=0; jn) {
/*
- s[n]=0;s[n+1]=0;s[n+2]=0;s[n+3]=0;
- s[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0;
+ systematic0[n]=0;systematic0[n+1]=0;systematic0[n+2]=0;systematic0[n+3]=0;
+ systematic0[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0;
s1[n]=0;s1[n+1]=0;s1[n+2]=0;s1[n+3]=0;
s1[n+4]=0;s1[n+5]=0;s1[n+6]=0;s1[n+7]=0;
s2[n]=0;s2[n+1]=0;s2[n+2]=0;s2[n+3]=0;
@@ -961,26 +960,26 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
// Termination
for (i=n2; i= maxlev)
+ qxd = maxlev - 1;
+
+ return ((char) qxd);
+}
+
+
+#endif
+
diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
index b42ac6e4c8..91c5d59611 100644
--- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c
+++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
@@ -26,9 +26,11 @@
#include "assertions.h"
#include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrLDPC_extern.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
+//#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h"
-#define MAX_NUM_DLSCH_SEGMENTS 16
+#include "openair1/PHY/defs_nr_common.h"
+#include "coding_unitary_defs.h"
+
#define MAX_BLOCK_LENGTH 8448
#ifndef malloc16
@@ -81,9 +83,6 @@ typedef struct {
int n_iter_max;
} n_iter_stats_t;
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
nrLDPC_encoderfunc_t encoder_orig;
short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
@@ -116,9 +115,8 @@ int test_ldpc(short No_iteration,
double sigma;
sigma = 1.0/sqrt(2*SNR);
opp_enabled=1;
- cpu_freq_GHz = get_cpu_freq_GHz();
//short test_input[block_length];
- unsigned char *test_input[MAX_NUM_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
+ unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
//short *c; //padded codeword
unsigned char *estimated_output[MAX_NUM_DLSCH_SEGMENTS];
unsigned char *estimated_output_bit[MAX_NUM_DLSCH_SEGMENTS];
@@ -144,7 +142,7 @@ int test_ldpc(short No_iteration,
t_nrLDPC_procBuf nrLDPC_procBuf;
t_nrLDPC_procBuf* p_nrLDPC_procBuf = &nrLDPC_procBuf;
- t_nrLDPC_time_stats decoder_profiler;
+ t_nrLDPC_time_stats decoder_profiler = {0};
t_nrLDPC_time_stats* p_decoder_profiler =&decoder_profiler ;
int32_t n_iter = 0;
@@ -614,7 +612,6 @@ int main(int argc, char *argv[])
exit(1);
break;
}
- cpu_freq_GHz = get_cpu_freq_GHz();
//printf("the decoder supports BG2, Kb=10, Z=128 & 256\n");
//printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n");
printf("block length %d: \n", block_length);
@@ -704,25 +701,25 @@ int main(int argc, char *argv[])
printf("SNR %f, Std iterations: %f\n",SNR, dec_iter->n_iter_std);
printf("SNR %f, Max iterations: %d\n",SNR, dec_iter->n_iter_max);
printf("\n");
- printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz);
- printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2)));
- printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/cpu_freq_GHz);
+ printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz());
+ printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2)));
+ printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/get_cpu_freq_GHz());
printf("\n");
- printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz);
- printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2)));
- printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/cpu_freq_GHz);
+ printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz());
+ printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)));
+ printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/get_cpu_freq_GHz());
fprintf(fd,"%f %f %f %f %f %f %f %f %f %f %f %f %d \n",
SNR,
(double)decoded_errors[i]/(double)n_trials ,
(double)errors_bit/(double)n_trials/(double)block_length/(double)n_segments ,
errors_bit_uncoded/(double)n_trials/(double)n_segments ,
- (double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,
- sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2)),
- (double)time_optim->max/1000.0/cpu_freq_GHz,
- (double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,
- sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2)),
- (double)time_decoder->max/1000.0/cpu_freq_GHz,
+ (double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),
+ sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2)),
+ (double)time_optim->max/1000.0/get_cpu_freq_GHz(),
+ (double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),
+ sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)),
+ (double)time_decoder->max/1000.0/get_cpu_freq_GHz(),
dec_iter->n_iter_mean,
dec_iter->n_iter_std,
dec_iter->n_iter_max
diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c
index d9adf3e24f..8e7e377542 100644
--- a/openair1/PHY/CODING/TESTBENCH/polartest.c
+++ b/openair1/PHY/CODING/TESTBENCH/polartest.c
@@ -11,16 +11,12 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h"
#include "PHY/CODING/coding_defs.h"
#include "SIMULATION/TOOLS/sim.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
//#include "common/utils/LOG/log.h"
-
+#include "coding_unitary_defs.h"
//#define DEBUG_DCI_POLAR_PARAMS
//#define DEBUG_POLAR_TIMING
//#define DEBUG_POLARTEST
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
int main(int argc, char *argv[])
{
@@ -113,7 +109,6 @@ int main(int argc, char *argv[])
//Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.)
time_stats_t timeEncoder,timeDecoder;
opp_enabled=1;
- cpu_freq_GHz = get_cpu_freq_GHz();
reset_meas(&timeEncoder);
reset_meas(&timeDecoder);
randominit(0);
@@ -324,9 +319,9 @@ if (logFlag){
#endif
//Iteration times are in microseconds.
- timeEncoderCumulative+=(timeEncoder.diff/(cpu_freq_GHz*1000.0));
- timeDecoderCumulative+=(timeDecoder.diff/(cpu_freq_GHz*1000.0));
- if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(cpu_freq_GHz*1000.0)), (timeDecoder.diff/(cpu_freq_GHz*1000.0)));
+ timeEncoderCumulative+=(timeEncoder.diff/(get_cpu_freq_GHz()*1000.0));
+ timeDecoderCumulative+=(timeDecoder.diff/(get_cpu_freq_GHz()*1000.0));
+ if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)), (timeDecoder.diff/(get_cpu_freq_GHz()*1000.0)));
if (nBitError<0) {
blockErrorCumulative++;
@@ -348,7 +343,7 @@ if (logFlag){
printf("[ListSize=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n",
decoderListSize, SNR, ((double)blockErrorCumulative/iterations),
((double)bitErrorCumulative / (iterations*testLength)),
- (double)timeEncoder.diff/timeEncoder.trials/(cpu_freq_GHz*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(cpu_freq_GHz*1000.0));
+ (double)timeEncoder.diff/timeEncoder.trials/(get_cpu_freq_GHz()*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(get_cpu_freq_GHz()*1000.0));
//(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations);
if (blockErrorCumulative==0 && bitErrorCumulative==0) break;
diff --git a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
index 02d5dc64e0..c9ed678a8f 100644
--- a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
+++ b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
@@ -1,19 +1,15 @@
#include
#include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
+#include "coding_unitary_defs.h"
//#define DEBUG_SMALLBLOCKTEST
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
int main(int argc, char *argv[])
{
time_stats_t timeEncoder,timeDecoder;
opp_enabled=1;
- cpu_freq_GHz = get_cpu_freq_GHz();
reset_meas(&timeEncoder);
reset_meas(&timeDecoder);
randominit(0);
@@ -141,8 +137,8 @@ int main(int argc, char *argv[])
SNR,
((double)bitErrorCumulative / (iterations*messageLength)),
((double)blockErrorCumulative/iterations),
- ((double)timeEncoder.diff/timeEncoder.trials)/(cpu_freq_GHz),
- ((double)timeDecoder.diff/timeDecoder.trials)/(cpu_freq_GHz*1000.0));
+ ((double)timeEncoder.diff/timeEncoder.trials)/(get_cpu_freq_GHz()),
+ ((double)timeDecoder.diff/timeDecoder.trials)/(get_cpu_freq_GHz()*1000.0));
blockErrorCumulative=0;
bitErrorCumulative=0;
diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
index 785b588b9f..3226c97f87 100644
--- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
+++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
@@ -39,7 +39,7 @@
#include "nrLDPC_bnProc.h"
#define NR_LDPC_ENABLE_PARITY_CHECK
-#define NR_LDPC_PROFILER_DETAIL
+//#define NR_LDPC_PROFILER_DETAIL
#ifdef NR_LDPC_DEBUG_MODE
#include "nrLDPC_tools/nrLDPC_debug.h"
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
index 18db8a01fb..8fe115b23a 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
@@ -40,9 +40,9 @@
#include "assertions.h"
int8_t polar_decoder(double *input,
- uint32_t *out,
- t_nrPolar_params *polarParams,
- uint8_t listSize)
+ uint32_t *out,
+ const t_nrPolar_params *polarParams,
+ uint8_t listSize)
{
//Assumes no a priori knowledge.
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
@@ -299,7 +299,7 @@ int8_t polar_decoder(double *input,
int8_t polar_decoder_dci(double *input,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint8_t listSize,
uint16_t n_RNTI) {
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
index a44a08a701..c2e9fd9381 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
@@ -138,22 +138,22 @@ typedef struct nrPolar_params t_nrPolar_params;
void polar_encoder(uint32_t *input,
uint32_t *output,
- t_nrPolar_params *polarParams);
+ const t_nrPolar_params *polarParams);
void polar_encoder_dci(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint16_t n_RNTI);
void polar_encoder_fast(uint64_t *A,
void *out,
int32_t crcmask,
uint8_t ones_flag,
- t_nrPolar_params *polarParams);
+ const t_nrPolar_params *polarParams);
int8_t polar_decoder(double *input,
- uint32_t *output,
- t_nrPolar_params *polarParams,
+ uint32_t *output,
+ const t_nrPolar_params *polarParams,
uint8_t listSize);
uint32_t polar_decoder_int16(int16_t *input,
@@ -163,21 +163,21 @@ uint32_t polar_decoder_int16(int16_t *input,
int8_t polar_decoder_dci(double *input,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint8_t listSize,
uint16_t n_RNTI);
void generic_polar_decoder(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void applyFtoleft(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void applyGtoright(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void computeBeta(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void build_decoder_tree(t_nrPolar_params *pp);
void build_polar_tables(t_nrPolar_params *polarParams);
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
index 27c062c217..e61b3dff9b 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
@@ -43,7 +43,7 @@
void polar_encoder(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams) {
+ const t_nrPolar_params *polarParams) {
if (1) {//polarParams->idx == 0 || polarParams->idx == 1) { //PBCH or PDCCH
/*
uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<payloadBits);
@@ -154,7 +154,7 @@ void polar_encoder(uint32_t *in,
void polar_encoder_dci(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint16_t n_RNTI) {
#ifdef DEBUG_POLAR_ENCODER_DCI
printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]);
@@ -251,9 +251,9 @@ void polar_encoder_dci(uint32_t *in,
#endif
}
-static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
+static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
-static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,void *out) {
+static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) {
// handle rate matching with a single 128 bit word using bit shuffling
// can be done with SIMD intrisics if needed
@@ -411,7 +411,7 @@ void polar_encoder_fast(uint64_t *A,
void *out,
int32_t crcmask,
uint8_t ones_flag,
- t_nrPolar_params *polarParams) {
+ const t_nrPolar_params *polarParams) {
// AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c
index 0990a58266..81fb28cc98 100644
--- a/openair1/PHY/INIT/init_top.c
+++ b/openair1/PHY/INIT/init_top.c
@@ -73,7 +73,6 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) {
init_unscrambling_lut();
init_scrambling_lut();
//set_taus_seed(1328);
- init_sss();
}
void free_lte_top(void) {
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index 2c7e3e88eb..1daeb72187 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -35,7 +35,7 @@
#include "assertions.h"
#include
#include "nfapi/oai_integration/vendor_ext.h"
-
+#include
extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
extern int32_t get_uldl_offset(int eutra_bandP);
@@ -46,6 +46,17 @@ uint8_t dmrs1_tab[8] = { 0, 2, 3, 4, 6, 8, 9, 10 };
int N_RB_DL_array[6] = { 6, 15, 25, 50, 75, 100 };
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
+void pdsch_procedures(PHY_VARS_eNB *eNB,
+ L1_rxtx_proc_t *proc,
+ int harq_pid,
+ LTE_eNB_DLSCH_t *dlsch,
+ LTE_eNB_DLSCH_t *dlsch1);
+
+void init_sss(void);
+
int
l1_north_init_eNB () {
int i,j;
@@ -347,6 +358,33 @@ void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx,
lte_gold_mbsfn_khz_1dot25 (fp, RC.eNB[Mod_id][CC_id]->lte_gold_mbsfn_khz_1dot25_table, fp->Nid_cell_mbsfn);
}
+void fill_subframe_mask(PHY_VARS_eNB *eNB) {
+
+ AssertFatal(eNB->subframe_mask!=NULL,"Subframe mask is null\n");
+ int32_t **dummy_tx=eNB->common_vars.txdataF;
+ eNB->common_vars.txdataF = eNB->subframe_mask;
+
+ for (int sf=0;sf<10;sf++) {
+ if (subframe_select(&eNB->frame_parms,sf)==SF_DL) {
+ LTE_DL_eNB_HARQ_t *dlsch_harq=eNB->dlsch[0][0]->harq_processes[0];
+ L1_rxtx_proc_t proc;
+ proc.frame_tx=0;
+ proc.subframe_tx=sf;
+ eNB->dlsch[0][0]->harq_ids[0][sf]=0;
+ eNB->dlsch[0][0]->rnti=0x1234;
+ dlsch_harq->nb_rb=48;
+ dlsch_harq->rb_alloc[0]=(uint32_t)0xffffffff;
+ dlsch_harq->Qm=2;
+ dlsch_harq->Nl=1;
+ dlsch_harq->pdsch_start=1;
+ dlsch_harq->mimo_mode=(eNB->frame_parms.nb_antenna_ports_eNB>1) ? ALAMOUTI : SISO;
+ dlsch_harq->dl_power_off = 1;
+ computeRhoB_eNB(4,eNB->frame_parms.pdsch_config_common.p_b,eNB->frame_parms.nb_antenna_ports_eNB,eNB->dlsch[0][0],dlsch_harq->dl_power_off);
+ pdsch_procedures(eNB,&proc,0,eNB->dlsch[0][0],NULL);
+ }
+ }
+ eNB->common_vars.txdataF = dummy_tx;
+}
int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
unsigned char is_secondary_eNB,
@@ -385,7 +423,9 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
lte_gold (fp, eNB->lte_gold_table, fp->Nid_cell);
generate_pcfich_reg_mapping (fp);
generate_phich_reg_mapping (fp);
+ init_sss();
+ init_fde();
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
eNB->first_run_timing_advance[UE_id] =
1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
@@ -397,9 +437,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
eNB->first_run_I0_measurements =
1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
+ eNB->use_DTX=1;
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
common_vars->rxdata = (int32_t **)NULL;
common_vars->txdataF = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t *));
+ if (eNB->use_DTX==0) {
+ eNB->subframe_mask = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t *));
+ }
common_vars->rxdataF = (int32_t **)malloc16(64*sizeof(int32_t *));
LOG_I(PHY,"[INIT] NB_ANTENNA_PORTS_ENB:%d fp->nb_antenna_ports_eNB:%d\n", NB_ANTENNA_PORTS_ENB, fp->nb_antenna_ports_eNB);
@@ -409,17 +453,19 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LOG_I(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
i,common_vars->txdataF[i],
fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t));
+ if (eNB->use_DTX==0 && inb_antenna_ports_eNB) eNB->subframe_mask[i] = malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
}
}
+ LOG_I(PHY,"[INIT]SRS allocation\n");
// Channel estimates for SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
- srs_vars[UE_id].srs_ch_estimates = (int32_t **) malloc16 (64 * sizeof (int32_t *));
- srs_vars[UE_id].srs_ch_estimates_time = (int32_t **) malloc16 (64 * sizeof (int32_t *));
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
+ srs_vars[srs_id].srs_ch_estimates = (int32_t **) malloc16 (64 * sizeof (int32_t *));
+ srs_vars[srs_id].srs_ch_estimates_time = (int32_t **) malloc16 (64 * sizeof (int32_t *));
for (i = 0; i < 64; i++) {
- srs_vars[UE_id].srs_ch_estimates[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size);
- srs_vars[UE_id].srs_ch_estimates_time[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size * 2);
+ srs_vars[srs_id].srs_ch_estimates[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size);
+ srs_vars[srs_id].srs_ch_estimates_time[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size * 2);
}
} //UE_id
@@ -427,10 +473,11 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
init_ulsch_power_LUT ();
// SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
- srs_vars[UE_id].srs = (int32_t *) malloc16_clear (2 * fp->ofdm_symbol_size * sizeof (int32_t));
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
+ srs_vars[srs_id].srs = (int32_t *) malloc16_clear (2 * fp->ofdm_symbol_size * sizeof (int32_t));
}
+ LOG_I(PHY,"PRACH allocation\n");
// PRACH
prach_vars->prachF = (int16_t *) malloc16_clear (1024 * 2 * sizeof (int16_t));
// assume maximum of 64 RX antennas for PRACH receiver
@@ -461,34 +508,33 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]);
}*/
- for (UE_id=0; UE_idrxdataF_ext = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->rxdataF_ext2 = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->drs_ch_estimates = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->drs_ch_estimates_time = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->rxdataF_comp = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->ul_ch_mag = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->ul_ch_magb = (int32_t **) malloc16 (2 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id] = (LTE_eNB_PUSCH *) malloc16_clear (NUMBER_OF_ULSCH_MAX * sizeof (LTE_eNB_PUSCH));
+ pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->drs_ch_estimates = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->drs_ch_estimates_time = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->rxdataF_comp = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->ul_ch_mag = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->ul_ch_magb = (int32_t **) malloc16 (4 * sizeof (int32_t *));
AssertFatal (fp->ofdm_symbol_size > 127, "fp->ofdm_symbol_size %d<128\n", fp->ofdm_symbol_size);
AssertFatal (fp->symbols_per_tti > 11, "fp->symbols_per_tti %d < 12\n", fp->symbols_per_tti);
AssertFatal (fp->N_RB_UL > 5, "fp->N_RB_UL %d < 6\n", fp->N_RB_UL);
-
- for (i = 0; i < 2; i++) {
- // RK 2 times because of output format of FFT!
+ AssertFatal (fp->nb_antennas_rx > 0,"fp->nb_antennas_rx = %d\n",fp->nb_antennas_rx);
+ for (i = 0; i < fp->nb_antennas_rx; i++) {
// FIXME We should get rid of this
- pusch_vars[UE_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
- pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
- pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
+ pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 4*sizeof(int32_t)*fp->ofdm_symbol_size );
+ pusch_vars[ULSCH_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
+ pusch_vars[ULSCH_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
}
- pusch_vars[UE_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
- } //UE_id
+ pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+ } //ULSCH_id
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++)
eNB->UE_stats_ptr[UE_id] = &eNB->UE_stats[UE_id];
@@ -518,19 +564,19 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) {
free_and_zero(common_vars->rxdataF);
// Channel estimates for SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
for (i=0; i<64; i++) {
- free_and_zero(srs_vars[UE_id].srs_ch_estimates[i]);
- free_and_zero(srs_vars[UE_id].srs_ch_estimates_time[i]);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates[i]);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates_time[i]);
}
- free_and_zero(srs_vars[UE_id].srs_ch_estimates);
- free_and_zero(srs_vars[UE_id].srs_ch_estimates_time);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates_time);
} //UE_id
free_ul_ref_sigs();
- for (UE_id=0; UE_idprachF);
@@ -548,26 +594,26 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) {
free_and_zero(prach_vars_br->prachF);
free_and_zero(prach_vars->rxsigF[0]);
- for (UE_id=0; UE_idrxdataF_ext[i]);
- free_and_zero(pusch_vars[UE_id]->rxdataF_ext2[i]);
- free_and_zero(pusch_vars[UE_id]->drs_ch_estimates[i]);
- free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time[i]);
- free_and_zero(pusch_vars[UE_id]->rxdataF_comp[i]);
- free_and_zero(pusch_vars[UE_id]->ul_ch_mag[i]);
- free_and_zero(pusch_vars[UE_id]->ul_ch_magb[i]);
+ for (int ULSCH_id=0; ULSCH_idnb_antennas_rx; i++) {
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates_time[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb[i]);
}
- free_and_zero(pusch_vars[UE_id]->rxdataF_ext);
- free_and_zero(pusch_vars[UE_id]->rxdataF_ext2);
- free_and_zero(pusch_vars[UE_id]->drs_ch_estimates);
- free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time);
- free_and_zero(pusch_vars[UE_id]->rxdataF_comp);
- free_and_zero(pusch_vars[UE_id]->ul_ch_mag);
- free_and_zero(pusch_vars[UE_id]->ul_ch_magb);
- free_and_zero(pusch_vars[UE_id]->llr);
- free_and_zero(pusch_vars[UE_id]);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates_time);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb);
+ free_and_zero(pusch_vars[ULSCH_id]->llr);
+ free_and_zero(pusch_vars[ULSCH_id]);
} //UE_id
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) eNB->UE_stats_ptr[UE_id] = NULL;
diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c
index 8ad928f8a0..a856c33999 100644
--- a/openair1/PHY/INIT/lte_init_ru.c
+++ b/openair1/PHY/INIT/lte_init_ru.c
@@ -21,9 +21,8 @@
#include "phy_init.h"
#include "SCHED/sched_eNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
-#include "SIMULATION/TOOLS/sim.h"
+//#include "SIMULATION/TOOLS/sim.h"
#include "LTE_RadioResourceConfigCommonSIB.h"
#include "LTE_RadioResourceConfigDedicated.h"
#include "LTE_TDD-Config.h"
@@ -34,6 +33,8 @@
void init_7_5KHz(void);
+extern const char ru_if_types[MAX_RU_IF_TYPES][20];
+
int phy_init_RU(RU_t *ru) {
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_CALIBRATION *calibration = &ru->calibration;
@@ -44,6 +45,7 @@ int phy_init_RU(RU_t *ru) {
if (ru->is_slave == 1) {
generate_ul_ref_sigs_rx();
}
+ else generate_ul_ref_sigs();
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals
// Time-domain signals
@@ -135,14 +137,14 @@ int phy_init_RU(RU_t *ru) {
}
}
- AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
- RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
- LOG_D(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
+ AssertFatal(ru->num_eNB <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
+ ru->num_eNB,NUMBER_OF_eNB_MAX);
+ LOG_D(PHY,"[INIT] %s() ru->num_eNB:%d \n", __FUNCTION__, ru->num_eNB);
int starting_antenna_index=0;
for (i=0; iidx; i++) starting_antenna_index+=ru->nb_tx;
- for (i=0; inum_eNB; i++) {
for (p=0; p<15; p++) {
LOG_D(PHY,"[INIT] %s() nb_antenna_ports_eNB:%d \n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB);
@@ -240,7 +242,7 @@ void phy_free_RU(RU_t *ru) {
free_and_zero(ru->prach_rxsigF[0]);
/* ru->prach_rxsigF_br is not allocated -> don't free */
- for (i = 0; i < RC.nb_L1_inst; i++) {
+ for (i = 0; i < ru->num_eNB; i++) {
for (p = 0; p < 15; p++) {
if (p < ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p == 5) {
for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c
index 64a5992a64..b756735816 100644
--- a/openair1/PHY/INIT/lte_init_ue.c
+++ b/openair1/PHY/INIT/lte_init_ue.c
@@ -39,6 +39,7 @@ void init_7_5KHz(void);
uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
+void init_sss(void);
void phy_config_sib1_ue(module_id_t Mod_id,int CC_id,
uint8_t eNB_id,
@@ -629,6 +630,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
init_frame_parms(&ue->frame_parms,1);
lte_sync_time_init(&ue->frame_parms);
init_lte_top(&ue->frame_parms);
+ init_sss();
init_7_5KHz();
init_ul_hopping(&ue->frame_parms);
// many memory allocation sizes are hard coded
diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c
index 1505ee018e..504c8fa80a 100644
--- a/openair1/PHY/INIT/lte_param_init.c
+++ b/openair1/PHY/INIT/lte_param_init.c
@@ -25,7 +25,6 @@
#include
#include
-#include "SIMULATION/TOOLS/sim.h"
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
@@ -33,7 +32,9 @@
#include "phy_init.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
-#include "targets/RT/USER/lte-softmodem.h"
+#include "executables/softmodem-common.h"
+#include "SIMULATION/TOOLS/sim.h"
+
extern PHY_VARS_eNB *eNB;
extern PHY_VARS_UE *UE;
extern RU_t *ru;
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index 0e6b253c2b..f9be627974 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -110,7 +110,7 @@ int l1_north_init_gNB() {
int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
unsigned char is_secondary_gNB,
- unsigned char abstraction_flag) {
+ unsigned char lowmem_flag) {
// shortcuts
NR_DL_FRAME_PARMS *const fp = &gNB->frame_parms;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
@@ -128,6 +128,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
while(gNB->configured == 0) usleep(10000);
+ if (lowmem_flag == 1) {
+ gNB->number_of_nr_dlsch_max = 2;
+ gNB->number_of_nr_ulsch_max = 2;
+ }
+ else {
+ gNB->number_of_nr_dlsch_max = NUMBER_OF_NR_DLSCH_MAX;
+ gNB->number_of_nr_ulsch_max = NUMBER_OF_NR_ULSCH_MAX;
+ }
+
load_dftslib();
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id);
@@ -142,6 +151,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n");
+ gNB->bad_pucch = 0;
+
for (int slot=0; slotslots_per_frame; slot++) {
pdcch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot);
@@ -231,13 +242,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
common_vars->rxdata = (int32_t **)malloc16(Prx*sizeof(int32_t*));
common_vars->txdataF = (int32_t **)malloc16(Ptx*sizeof(int32_t*));
common_vars->rxdataF = (int32_t **)malloc16(Prx*sizeof(int32_t*));
+ common_vars->beam_id = (uint8_t **)malloc16(Ptx*sizeof(uint8_t*));
for (i=0;itxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP
LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
i,common_vars->txdataF[i],
fp->samples_per_frame_wCP*sizeof(int32_t));
-
+ common_vars->beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
+ memset(common_vars->beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame);
}
for (i=0;irxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t));
@@ -283,7 +296,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
- for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) {
pusch_vars[ULSCH_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) );
pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
@@ -368,7 +381,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(prach_vars->prach_ifft[0]);
free_and_zero(prach_vars->rxsigF[0]);
*/
- for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) {
for (int i = 0; i < 2; i++) {
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
@@ -474,7 +487,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
fp->nr_band = 261;
// fp->threequarter_fs= 0;
}
-
+
+ fp->threequarter_fs = 0;
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
nr_init_frame_parms(gNB_config, fp);
@@ -558,9 +572,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i);
}
- for (i=0; inumber_of_nr_dlsch_max; i++) {
- LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,NUMBER_OF_NR_DLSCH_MAX);
+ LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max);
for (j=0; j<2; j++) {
gNB->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
@@ -568,9 +582,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
}
}
- for (i=0; inumber_of_nr_ulsch_max; i++) {
- LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
+ LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max);
for (j=0; j<2; j++) {
// ULSCH for data
diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c
index 648b820f07..5ab46ccda2 100644
--- a/openair1/PHY/INIT/nr_init_ru.c
+++ b/openair1/PHY/INIT/nr_init_ru.c
@@ -21,9 +21,6 @@
#include "phy_init.h"
#include "SCHED/sched_common.h"
-#include "PHY/phy_extern.h"
-#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
-#include "SIMULATION/TOOLS/sim.h"
/*#include "RadioResourceConfigCommonSIB.h"
#include "RadioResourceConfigDedicated.h"
#include "TDD-Config.h"
@@ -33,6 +30,10 @@
#include
#include "openair1/PHY/defs_RU.h"
+void init_prach_ru_list(RU_t *ru);
+
+extern const char ru_if_types[MAX_RU_IF_TYPES][20];
+
int nr_phy_init_RU(RU_t *ru) {
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
@@ -44,7 +45,7 @@ int nr_phy_init_RU(RU_t *ru) {
nfapi_nr_config_request_scf_t *cfg;
ru->nb_log_antennas=0;
- for (int n=0;nnum_gNB;n++) {
cfg = &ru->config;
if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value;
}
@@ -117,35 +118,41 @@ int nr_phy_init_RU(RU_t *ru) {
}
}
- AssertFatal(RC.nb_nr_L1_inst <= NUMBER_OF_eNB_MAX,"gNB instances %d > %d\n",
- RC.nb_nr_L1_inst,NUMBER_OF_gNB_MAX);
+ AssertFatal(ru->num_gNB <= NUMBER_OF_gNB_MAX,"gNB instances %d > %d\n",
+ ru->num_gNB,NUMBER_OF_gNB_MAX);
- LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst);
+ LOG_E(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB);
int beam_count = 0;
if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1
for (p=0;pnb_log_antennas;p++) {
- if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
+ //if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
beam_count++;
}
AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
int l_ind = 0;
- for (i=0; inum_gNB; i++) {
for (p=0;pnb_log_antennas;p++) {
- if ((fp->L_ssb >> (63-p)) & 0x01) {
+ //if ((fp->L_ssb >> (63-p)) & 0x01) {
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
for (j=0; jnb_tx; j++) {
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
for (re=0; reofdm_symbol_size; re++)
- ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind];
+ ru->beam_weights[i][p][j][re] = ru->bw_list[j][l_ind];
//printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j);
l_ind++;
} // for j
- } // for p
- }
+ //}
+ } // for p
} //for i
}
+
+ ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*));
+ for(i=0; i< ru->nb_tx; ++i) {
+ ru->common.beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
+ memset(ru->common.beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame);
+ }
} // !=IF5
ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP );
@@ -193,8 +200,7 @@ void nr_phy_free_RU(RU_t *ru)
free_and_zero(ru->prach_rxsigF[j][i]);
}
}
-
- for (i = 0; i < RC.nb_nr_L1_inst; i++) {
+ for (i = 0; i < ru->num_gNB; i++) {
for (p = 0; p < 15; p++) {
for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
free_and_zero(ru->beam_weights[i][p]);
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index 3132fb9960..a9c71d1582 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -28,6 +28,7 @@
#include "TDD-Config.h"
#include "MBSFN-SubframeConfigList.h"*/
#include "openair1/PHY/defs_RU.h"
+#include "openair1/PHY/impl_defs_nr.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "assertions.h"
#include
@@ -71,33 +72,39 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch,
pdsch->llr128 = (int16_t **)malloc16_clear( sizeof(int16_t *) );
// FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV
// FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there
- pdsch->rxdataF_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
- pdsch->dl_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
+ pdsch->rxdataF_ext = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->rho = (int32_t ***)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t **) );
+ pdsch->dl_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
//pdsch->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
//pdsch->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
- pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->ptrs_phase_per_slot = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->ptrs_re_per_slot = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_ch_ptrs_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
+ pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->ptrs_phase_per_slot = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->ptrs_re_per_slot = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_ch_ptrs_estimates_ext = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
// the allocated memory size is fixed:
- AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
+ AssertFatal( fp->nb_antennas_rx <= 4, "nb_antennas_rx > 4" );//Extend the max number of UE Rx antennas to 4
+ const size_t num = 7*2*fp->N_RB_DL*12;
for (int i=0; inb_antennas_rx; i++) {
- pdsch->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
+ pdsch->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
+ pdsch->rxdataF_uespec_pilots[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12);
+ pdsch->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14 );
+ pdsch->ptrs_re_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14);
+ pdsch->dl_ch_ptrs_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * num);
+ pdsch->rho[i] = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*NR_MAX_NB_LAYERS*sizeof(int32_t *) );
- for (int j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
- const int idx = (j<<1)+i;
- const size_t num = 7*2*fp->N_RB_DL*12;
- pdsch->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
- pdsch->rxdataF_uespec_pilots[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12);
+ for (int j=0; jnb_antennas_rx)+i;
+ for (int k=0; krho[i][j*NR_MAX_NB_LAYERS+k] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
+ }
pdsch->rxdataF_comp0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2);
pdsch->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
@@ -108,9 +115,6 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch,
pdsch->dl_ch_mag0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_magb0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_magr0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
- pdsch->ptrs_re_per_slot[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * 14);
- pdsch->ptrs_phase_per_slot[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14 );
- pdsch->dl_ch_ptrs_estimates_ext[idx]= (int32_t *)malloc16_clear( sizeof(int32_t) * num);
}
}
}
@@ -139,16 +143,14 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
int n_scid;
abstraction_flag = 0;
- fp->nb_antennas_tx = 1;
- fp->nb_antennas_rx=1;
// dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig;
// ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
LOG_I(PHY, "Initializing UE vars (abstraction %u) for gNB TXant %u, UE RXant %u\n", abstraction_flag, fp->nb_antennas_tx, fp->nb_antennas_rx);
- //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
+ //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_gNB_INST);
phy_init_nr_top(ue);
// many memory allocation sizes are hard coded
- AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
- AssertFatal(nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" );
+ AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
+ AssertFatal( nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" );
// init phy_vars_ue
for (i=0; i<4; i++) {
@@ -195,7 +197,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
for (i=0;iPDSCH_Config.pdsch_TimeDomainResourceAllocation[i] = (NR_PDSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
+ ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[i] = (PDSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(PDSCH_TimeDomainResourceAllocation_t));
ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[i]->mappingType = typeA;
}
@@ -276,7 +278,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
- //PDCCH DMRS init (eNB offset = 0)
+ //PDCCH DMRS init (gNB offset = 0)
ue->nr_gold_pdcch[0] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
uint32_t ***pdcch_dmrs = ue->nr_gold_pdcch[0];
AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n");
@@ -291,6 +293,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
+ ue->scramblingID_pdcch = fp->Nid_cell;
+ nr_gold_pdcch(ue,fp->Nid_cell);
+
//PDSCH DMRS init (eNB offset = 0)
ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0];
@@ -310,6 +315,12 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
+ // initializing the scrambling IDs for PDSCH DMRS
+ for (int i=0; i<2; i++)
+ ue->scramblingID[i]=fp->Nid_cell;
+
+ nr_gold_pdsch(ue,ue->scramblingID);
+
// DLSCH
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
- ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
- ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
- ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
- ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear(sizeof(int16_t *));
- ue->pdsch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16_clear(fp->nb_antennas_rx*sizeof(int32_t *));
+ ue->pdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
+ ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
+ ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
+ ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
+ ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
}
- for (int i=0; inb_antennas_rx; i++) {
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
- }
- }
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
}
for (i=0; inb_antennas_rx; i++)
for (j=0; j<4; j++) {
- const int idx = (j<<1)+i;
+ const int idx = (j*fp->nb_antennas_rx)+i;
const size_t num = 7*2*fp->N_RB_DL*12+4;
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
}
}
@@ -361,15 +366,15 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
for (k=0; k<8; k++) { //harq_pid
for (l=0; l<8; l++) { //round
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
+ ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
}
for (int i=0; inb_antennas_rx; i++)
for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
- const int idx = (j<<1)+i;
+ const int idx = (j*fp->nb_antennas_rx)+i;
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
@@ -383,26 +388,26 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
for (th_id=0; th_idpdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
- ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
- ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
- ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear(4*2*100*12 );
- ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
+ ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 );
+ ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
// Channel estimates
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
for (i=0; inb_antennas_rx; i++) {
ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4));
for (j=0; j<4; j++) {
- int idx = (j<<1) + i;
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->ofdm_symbol_size*2);
+ int idx = (j*fp->nb_antennas_rx)+i;
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
// size_t num = 7*2*fp->N_RB_DL*12;
size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
@@ -414,24 +419,24 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
// PBCH
- pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *));
- pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear(1920); //
- prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)));
- prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)));
+ pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
+ prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
+ prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
for (i=0; inb_antennas_rx; i++) {
pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
- int idx = (j<<1)+i;
- pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4);
- pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size));
- pbch_vars[gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size));
- pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4);
+ int idx = (j*fp->nb_antennas_rx)+i;
+ pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
+ pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
+ pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
+ pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
}
}
}
diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c
index bacc671adc..34938501e3 100644
--- a/openair1/PHY/INIT/nr_parms.c
+++ b/openair1/PHY/INIT/nr_parms.c
@@ -27,12 +27,9 @@
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16};
-int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
-{
+int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb) {
int mu = fp->numerology_index;
- uint8_t half_frame_index = fp->half_frame_bit;
- uint8_t i_ssb = fp->ssb_index;
int symbol = 0;
uint8_t n, n_temp;
nr_ssb_type_e type = fp->ssb_type;
@@ -69,9 +66,6 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu);
}
- if (half_frame_index)
- symbol += (5 * fp->symbols_per_slot * fp->slots_per_subframe);
-
return symbol;
}
@@ -204,9 +198,9 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
fp->slots_per_frame = 10* fp->slots_per_subframe;
- fp->nb_antenna_ports_gNB = cfg->carrier_config.num_tx_ant.value;// It corresponds to pdsch_AntennaPorts
+ fp->nb_antenna_ports_gNB = 1; // It corresponds to the number of common antenna ports
fp->nb_antennas_rx = cfg->carrier_config.num_rx_ant.value; // It denotes the number of rx antennas at gNB
- fp->nb_antennas_tx = 1; // It corresponds to the number of UE Tx antennas
+ fp->nb_antennas_tx = cfg->carrier_config.num_tx_ant.value; // It corresponds to pdsch_AntennaPorts
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe;
@@ -254,6 +248,11 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
uint8_t Nid_cell = 0;
int Ncp = NORMAL;
+ if(fp->nb_antennas_rx == 0)
+ fp->nb_antennas_rx = 1;
+ if(fp->nb_antennas_tx == 0)
+ fp->nb_antennas_tx = 1;
+
// default values until overwritten by RRCConnectionReconfiguration
fp->nb_antenna_ports_gNB = nb_ant_ports_gNB;
fp->tdd_config = tdd_cfg;
diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h
index 9c474264c8..2ab610739d 100644
--- a/openair1/PHY/INIT/phy_init.h
+++ b/openair1/PHY/INIT/phy_init.h
@@ -392,14 +392,14 @@ void phy_config_update_sib13_request(PHY_Config_t *phy_config);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
-int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp);
+int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb);
int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band);
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
void init_N_TA_offset(PHY_VARS_NR_UE *ue);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
-int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
+int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag);
void nr_phy_config_request(NR_PHY_Config_t *gNB);
void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst);
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
@@ -408,6 +408,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB);
void init_dfts(void);
+void fill_subframe_mask(PHY_VARS_eNB *eNB);
/** @} */
#endif
diff --git a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
index 3fd58a4989..6d382bdd63 100644
--- a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
+++ b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
@@ -20,11 +20,11 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/sse_intrin.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
-// This is 512/(1:256) in __m128i format
-int16_t inv_ch[256*8] = {512,512,512,512,512,512,512,512,
+// This is 4096/(1:4096) in __m128i format
+__m128i inv_ch[4096];/* = {512,512,512,512,512,512,512,512,
256,256,256,256,256,256,256,256,
170,170,170,170,170,170,170,170,
128,128,128,128,128,128,128,128,
@@ -280,7 +280,11 @@ int16_t inv_ch[256*8] = {512,512,512,512,512,512,512,512,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
- };
+ };*/
+
+void init_fde() {
+ for (int i=1;i<4096;i++) inv_ch[i] = _mm_set1_epi16(4096/i);
+}
void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
@@ -313,12 +317,12 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
amp=(*((int16_t*)&ul_ch_mag128[re]));
- if (amp>255)
- amp=255;
+ if (amp>4095)
+ amp=4095;
- // printf("freq_eq: symbol %d re %d => %d,%d,%d, (%d) (%d,%d) => ",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,inv_ch[8*amp],*((int16_t*)(&ul_ch_mag128[re]))*inv_ch[8*amp],*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
+ //printf("freq_eq: symbol %d re %d => mag %d,amp %d,inv %d, prod %d (%d,%d)\n",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,_mm_extract_epi16(inv_ch[amp],0),(*((int16_t*)(&ul_ch_mag128[re]))*_mm_extract_epi16(inv_ch[amp],0))>>3,*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
#if defined(__x86_64__) || defined(__i386__)
- rxdataF_comp128[re] = _mm_mullo_epi16(rxdataF_comp128[re],*((__m128i *)&inv_ch[8*amp]));
+ rxdataF_comp128[re] = _mm_srai_epi16(_mm_mullo_epi16(rxdataF_comp128[re],inv_ch[amp]),3);
if (Qm==4)
ul_ch_mag128[re] = _mm_set1_epi16(324); // this is 512*2/sqrt(10)
@@ -327,7 +331,7 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
ul_ch_magb128[re] = _mm_set1_epi16(158); // this is 512*2/sqrt(42)
}
#elif defined(__arm__)
- rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],*((int16x8_t *)&inv_ch[8*amp]));
+ rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],inv_ch[amp]);
if (Qm==4)
ul_ch_mag128[re] = vdupq_n_s16(324); // this is 512*2/sqrt(10)
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
index f85162e095..aac8e71828 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
@@ -21,7 +21,6 @@
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
@@ -118,12 +117,12 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
int temp, i, aa, max_pos=0, max_val=0;
short Re,Im;
- uint8_t cyclic_shift = 0;
- int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
+ // uint8_t cyclic_shift = 0;
+ int sync_pos = 0;//(frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size);
- AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n",
- frame_parms->nb_antennas_rx);
+ AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<=4,"frame_parms->nb_antennas_rx %d not in [1...%d]\n",
+ frame_parms->nb_antennas_rx,4);
for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
temp = 0;
@@ -142,9 +141,5 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
if (max_pos>frame_parms->ofdm_symbol_size/2)
max_pos = max_pos-frame_parms->ofdm_symbol_size;
- //#ifdef DEBUG_PHY
- LOG_D(PHY,"max_pos = %d, sync_pos=%d\n",max_pos,sync_pos);
- //#endif //DEBUG_PHY
-
return max_pos - sync_pos;
}
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
index 2d79158920..7eeeb998ba 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
@@ -32,6 +32,30 @@
int32_t rx_power_avg_eNB[3];
+void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB) {
+
+
+ int min_I0=1000,max_I0=0;
+ int amin=0,amax=0;
+ for (int i=0; iframe_parms.N_RB_UL; i++) {
+ if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
+
+ if (eNB->measurements.n0_subband_power_tot_dB[i]measurements.n0_subband_power_tot_dB[i]; amin=i;}
+
+ if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amax=i;}
+ }
+
+ for (int i=0; iframe_parms.N_RB_UL; i++) {
+ fprintf(fd,"%2d.",eNB->measurements.n0_subband_power_tot_dB[i]-eNB->measurements.n0_subband_power_avg_dB);
+ if (i%25 == 24) fprintf(fd,"\n");
+ }
+
+ fprintf(fd,"\nmax_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB);
+
+ fprintf(fd,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
+
+
+}
void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
int subframe,
module_id_t eNB_id,
@@ -87,46 +111,45 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
nb_rb++;
for (aarx=0; aarxnb_antennas_rx; aarx++) {
measurements->n0_subband_power[aarx][rb] = 0;
- for (int s=0;s<14-(frame_parms->Ncp<<1);s++) {
- // select the 7th symbol in an uplink subframe
- offset = offset0 + (s*frame_parms->ofdm_symbol_size);
- ul_ch = &common_vars->rxdataF[aarx][offset];
- len = 12;
+ for (int s=0;s<(14-(frame_parms->Ncp<<1));s++) {
+ offset = offset0 + (s*frame_parms->ofdm_symbol_size);
+ ul_ch = &common_vars->rxdataF[aarx][offset];
+ len = 12;
// just do first half of middle PRB for odd number of PRBs
- if (((frame_parms->N_RB_UL&1) == 1) &&
- (rb==(frame_parms->N_RB_UL>>1))) {
- len=6;
- }
+ if (((frame_parms->N_RB_UL&1) == 1) &&
+ (rb==(frame_parms->N_RB_UL>>1))) {
+ len=6;
+ }
- AssertFatal(ul_ch, "RX signal buffer (freq) problem");
+ AssertFatal(ul_ch, "RX signal buffer (freq) problem");
- measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
+ measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
- }
+ } // symbol
measurements->n0_subband_power[aarx][rb]/=(14-(frame_parms->Ncp<<1));
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
n0_power_tot += measurements->n0_subband_power[aarx][rb];
- }
+ } //antenna
n0_power_tot/=frame_parms->nb_antennas_rx;
n0_power_tot2 += n0_power_tot;
- measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot/frame_parms->nb_antennas_rx);
+ measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot);
measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - eNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL);
- }
- }
+ } //rb not used in subframe
+ } //rb
if (nb_rb>0) measurements->n0_subband_power_avg_dB = dB_fixed(n0_power_tot2/nb_rb);
}
void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
module_id_t eNB_id,
- module_id_t UE_id,
+ module_id_t srs_id,
unsigned char init_averaging)
{
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
PHY_MEASUREMENTS_eNB *measurements = &eNB->measurements;
- LTE_eNB_SRS *srs_vars = &eNB->srs_vars[UE_id];
+ LTE_eNB_SRS *srs_vars = &eNB->srs_vars[srs_id];
int32_t aarx,rx_power_correction;
int32_t rx_power;
@@ -136,7 +159,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
//printf("Running eNB_srs_measurements for eNB_id %d\n",eNB_id);
if (init_averaging == 1)
- rx_power_avg_eNB[UE_id] = 0;
+ rx_power_avg_eNB[srs_id] = 0;
rx_power = 0;
@@ -152,24 +175,24 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
for (aarx=0; aarxnb_antennas_rx; aarx++) {
- measurements->rx_spatial_power[UE_id][0][aarx] =
+ measurements->rx_spatial_power[srs_id][0][aarx] =
((signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][frame_parms->first_carrier_offset],
(frame_parms->N_RB_DL*6)) +
signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][1],
(frame_parms->N_RB_DL*6)))*rx_power_correction) -
measurements->n0_power[aarx];
- measurements->rx_spatial_power[UE_id][0][aarx]<<=1; // because of noise only in odd samples
+ measurements->rx_spatial_power[srs_id][0][aarx]<<=1; // because of noise only in odd samples
- measurements->rx_spatial_power_dB[UE_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[UE_id][0][aarx]);
+ measurements->rx_spatial_power_dB[srs_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[srs_id][0][aarx]);
- measurements->wideband_cqi[UE_id][aarx] = measurements->rx_spatial_power[UE_id][0][aarx];
+ measurements->wideband_cqi[srs_id][aarx] = measurements->rx_spatial_power[srs_id][0][aarx];
// measurements->rx_power[UE_id][aarx]/=frame_parms->nb_antennas_tx;
- measurements->wideband_cqi_dB[UE_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[UE_id][aarx]);
- rx_power += measurements->wideband_cqi[UE_id][aarx];
+ measurements->wideband_cqi_dB[srs_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[srs_id][aarx]);
+ rx_power += measurements->wideband_cqi[srs_id][aarx];
// measurements->rx_avg_power_dB[UE_id] += measurements->rx_power_dB[UE_id][aarx];
}
@@ -177,14 +200,14 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
// measurements->rx_avg_power_dB[UE_id]/=frame_parms->nb_antennas_rx;
if (init_averaging == 0)
- rx_power_avg_eNB[UE_id] = ((k1*rx_power_avg_eNB[UE_id]) + (k2*rx_power))>>10;
+ rx_power_avg_eNB[srs_id] = ((k1*rx_power_avg_eNB[srs_id]) + (k2*rx_power))>>10;
else
- rx_power_avg_eNB[UE_id] = rx_power;
+ rx_power_avg_eNB[srs_id] = rx_power;
- measurements->wideband_cqi_tot[UE_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot);
+ measurements->wideband_cqi_tot[srs_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot);
// times 2 since we have noise only in the odd carriers of the srs comb
- measurements->rx_rssi_dBm[UE_id] = (int32_t)dB_fixed(rx_power_avg_eNB[UE_id])-eNB->rx_total_gain_dB;
+ measurements->rx_rssi_dBm[srs_id] = (int32_t)dB_fixed(rx_power_avg_eNB[srs_id])-eNB->rx_total_gain_dB;
@@ -200,21 +223,21 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
else if (rb>12)
ul_ch = &srs_vars->srs_ch_estimates[aarx][6 + (rb-13)*12];
else {
- measurements->subband_cqi_dB[UE_id][aarx][rb] = 0;
+ measurements->subband_cqi_dB[srs_id][aarx][rb] = 0;
continue;
}
// cqi
if (aarx==0)
- measurements->subband_cqi_tot[UE_id][rb]=0;
+ measurements->subband_cqi_tot[srs_id][rb]=0;
- measurements->subband_cqi[UE_id][aarx][rb] = (signal_energy_nodc(ul_ch,12))*rx_power_correction - measurements->n0_power[aarx];
+ measurements->subband_cqi[srs_id][aarx][rb] = (signal_energy_nodc(ul_ch,12))*rx_power_correction - measurements->n0_power[aarx];
- if (measurements->subband_cqi[UE_id][aarx][rb] < 0)
- measurements->subband_cqi[UE_id][aarx][rb]=0;
+ if (measurements->subband_cqi[srs_id][aarx][rb] < 0)
+ measurements->subband_cqi[srs_id][aarx][rb]=0;
- measurements->subband_cqi_tot[UE_id][rb] += measurements->subband_cqi[UE_id][aarx][rb];
- measurements->subband_cqi_dB[UE_id][aarx][rb] = dB_fixed2(measurements->subband_cqi[UE_id][aarx][rb],
+ measurements->subband_cqi_tot[srs_id][rb] += measurements->subband_cqi[srs_id][aarx][rb];
+ measurements->subband_cqi_dB[srs_id][aarx][rb] = dB_fixed2(measurements->subband_cqi[srs_id][aarx][rb],
2*measurements->n0_power[aarx]);
// 2*n0_power since we have noise from the odd carriers in the comb of the srs
@@ -225,7 +248,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
for (rb=0; rbN_RB_DL; rb++) {
- measurements->subband_cqi_tot_dB[UE_id][rb] = dB_fixed2(measurements->subband_cqi_tot[UE_id][rb],
+ measurements->subband_cqi_tot_dB[srs_id][rb] = dB_fixed2(measurements->subband_cqi_tot[srs_id][rb],
measurements->n0_power_tot);
/*
if (measurements->subband_cqi_tot_dB[UE_id][rb] == 65)
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
index fc40280853..6ba901e29f 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
+++ b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
@@ -288,6 +288,8 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
unsigned short Msc_RS,
unsigned char Qm);
+void init_fde(void);
+void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB);
/** @} */
#endif
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index 0d765a18b3..1fbc8b7ef2 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -27,276 +27,89 @@
//#include
#include
-#include "LAYER2/MAC/mac.h"
#include "PHY/defs_UE.h"
#include "PHY/phy_extern_ue.h"
-#include "PHY_INTERFACE/phy_interface.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
-#include "RRC/LTE/rrc_extern.h"
// Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs)
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
-int* sync_corr_ue0 = NULL;
-int* sync_corr_ue1 = NULL;
-int* sync_corr_ue2 = NULL;
-int sync_tmp[2048*4] __attribute__((aligned(32)));
-short syncF_tmp[2048*2] __attribute__((aligned(32)));
+static struct complex16 *primary_synch0_time __attribute__((aligned(32)));
+static struct complex16 *primary_synch1_time __attribute__((aligned(32)));
+static struct complex16 *primary_synch2_time __attribute__((aligned(32)));
+static void doIdft(int size, short *in, short *out) {
+ switch (size) {
+ case 6:
+ idft(IDFT_128,in,out,1);
+ break;
-int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *common_vars
-{
- int i,k;
+ case 25:
+ idft(IDFT_512,in,out,1);
+ break;
- sync_corr_ue0 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
- sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
- sync_corr_ue2 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
+ case 50:
+ idft(IDFT_1024,in,out,1);
+ break;
+
+ case 75:
+ idft(IDFT_1536,in,out,1);
+ break;
- if (sync_corr_ue0) {
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue0);
-#endif
- //common_vars->sync_corr = sync_corr;
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue0 not allocated\n");
- return(-1);
+ case 100:
+ idft(IDFT_2048,in,out,1);
+ break;
+
+ default:
+ LOG_E(PHY,"Unsupported N_RB_DL %d\n",size);
+ abort();
+ break;
+ }
}
- if (sync_corr_ue1) {
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue1);
-#endif
- //common_vars->sync_corr = sync_corr;
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue1 not allocated\n");
- return(-1);
+static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) {
+ int k=ofdmSize-36;
+
+ for (int i=0; i<72; i++) {
+ out[k].r = in[i].r>>1; //we need to shift input to avoid overflow in fft
+ out[k].i = in[i].i>>1;
+ k++;
+
+ if (k >= ofdmSize) {
+ k++; // skip DC carrier
+ k-=ofdmSize;
+ }
+ }
}
- if (sync_corr_ue2) {
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue2);
-#endif
- //common_vars->sync_corr = sync_corr;
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue2 not allocated\n");
- return(-1);
- }
-
- // primary_synch0_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- primary_synch0_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-
- if (primary_synch0_time) {
- // bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time allocated at %p\n", primary_synch0_time);
-#endif
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time not allocated\n");
- return(-1);
- }
-
- // primary_synch1_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- primary_synch1_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-
- if (primary_synch1_time) {
- // bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time allocated at %p\n", primary_synch1_time);
-#endif
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time not allocated\n");
- return(-1);
- }
-
- // primary_synch2_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- primary_synch2_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-
- if (primary_synch2_time) {
- // bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time allocated at %p\n", primary_synch2_time);
-#endif
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time not allocated\n");
- return(-1);
- }
-
-
+int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars
+ struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {{0}};
+ int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time);
+ AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),"");
+ bzero(primary_synch0_time,sz);
+ AssertFatal( NULL != (primary_synch1_time = (struct complex16 *)malloc16(sz)),"");
+ bzero(primary_synch1_time,sz);
+ AssertFatal( NULL != (primary_synch2_time = (struct complex16 *)malloc16(sz)),"");
+ bzero(primary_synch2_time,sz);
// generate oversampled sync_time sequences
- k=frame_parms->ofdm_symbol_size-36;
-
- for (i=0; i<72; i++) {
- syncF_tmp[2*k] = primary_synch0[2*i]>>2; //we need to shift input to avoid overflow in fft
- syncF_tmp[2*k+1] = primary_synch0[2*i+1]>>2;
- k++;
-
- if (k >= frame_parms->ofdm_symbol_size) {
- k++; // skip DC carrier
- k-=frame_parms->ofdm_symbol_size;
- }
- }
-
- switch (frame_parms->N_RB_DL) {
- case 6:
- idft(IDFT_128,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 25:
- idft(IDFT_512,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 50:
- idft(IDFT_1024,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
-
- case 75:
- idft(IDFT_1536,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp,
- 1); /// complex output
- break;
- case 100:
- idft(IDFT_2048,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- default:
- LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
- break;
- }
-
- for (i=0; iofdm_symbol_size; i++)
- ((int32_t*)primary_synch0_time)[i] = sync_tmp[i];
-
- k=frame_parms->ofdm_symbol_size-36;
-
- for (i=0; i<72; i++) {
- syncF_tmp[2*k] = primary_synch1[2*i]>>2; //we need to shift input to avoid overflow in fft
- syncF_tmp[2*k+1] = primary_synch1[2*i+1]>>2;
- k++;
-
- if (k >= frame_parms->ofdm_symbol_size) {
- k++; // skip DC carrier
- k-=frame_parms->ofdm_symbol_size;
- }
- }
-
- switch (frame_parms->N_RB_DL) {
- case 6:
- idft(IDFT_128,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 25:
- idft(IDFT_512,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 50:
- idft(IDFT_1024,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
-
- case 75:
- idft(IDFT_1536,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 100:
- idft(IDFT_2048,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- default:
- LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
- break;
- }
-
- for (i=0; iofdm_symbol_size; i++)
- ((int32_t*)primary_synch1_time)[i] = sync_tmp[i];
-
- k=frame_parms->ofdm_symbol_size-36;
-
- for (i=0; i<72; i++) {
- syncF_tmp[2*k] = primary_synch2[2*i]>>2; //we need to shift input to avoid overflow in fft
- syncF_tmp[2*k+1] = primary_synch2[2*i+1]>>2;
- k++;
-
- if (k >= frame_parms->ofdm_symbol_size) {
- k++; // skip DC carrier
- k-=frame_parms->ofdm_symbol_size;
- }
- }
-
- switch (frame_parms->N_RB_DL) {
- case 6:
- idft(IDFT_128,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 25:
- idft(IDFT_512,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 50:
- idft(IDFT_1024,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
-
- case 75:
- idft(IDFT_1536,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 100:
- idft(IDFT_2048,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- default:
- LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
- break;
- }
-
- for (i=0; iofdm_symbol_size; i++)
- ((int32_t*)primary_synch2_time)[i] = sync_tmp[i];
-
+ copyPrimary( syncF_tmp, (struct complex16 *) primary_synch0, frame_parms->ofdm_symbol_size);
+ doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch0_time);
+ copyPrimary( syncF_tmp, (struct complex16 *) primary_synch1, frame_parms->ofdm_symbol_size);
+ doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch1_time);
+ copyPrimary( syncF_tmp, (struct complex16 *) primary_synch2, frame_parms->ofdm_symbol_size);
+ doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch2_time);
if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){
LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
}
+
return (1);
}
-void lte_sync_time_free(void)
-{
- if (sync_corr_ue0) {
- LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue0);
- free(sync_corr_ue0);
- }
-
- if (sync_corr_ue1) {
- LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue1);
- free(sync_corr_ue1);
- }
-
- if (sync_corr_ue2) {
- LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue2);
- free(sync_corr_ue2);
- }
-
+void lte_sync_time_free(void) {
if (primary_synch0_time) {
LOG_D(PHY,"Freeing primary_sync0_time ...\n");
free(primary_synch0_time);
@@ -312,126 +125,81 @@ void lte_sync_time_free(void)
free(primary_synch2_time);
}
- sync_corr_ue0 = NULL;
- sync_corr_ue1 = NULL;
- sync_corr_ue2 = NULL;
primary_synch0_time = NULL;
primary_synch1_time = NULL;
primary_synch2_time = NULL;
}
-static inline int abs32(int x)
-{
+static inline int abs32(int x) {
return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
}
+static inline double absF(struct complexd x) {
+ return x.r*x.r+x.i*x.i;
+}
+
+#define complexNull(c) bzero((void*) &(c), sizeof(c))
#define SHIFT 17
int lte_sync_time(int **rxdata, ///rx data in time domain
LTE_DL_FRAME_PARMS *frame_parms,
- int *eNB_id)
-{
+ int *eNB_id) {
// perform a time domain correlation using the oversampled sync sequence
-
unsigned int n, ar, s, peak_pos, peak_val, sync_source;
int result,result2;
- int sync_out[3] = {0,0,0},sync_out2[3] = {0,0,0};
- int tmp[3] = {0,0,0};
+ struct complexd sync_out[3]= {{0}}, sync_out2[3]= {{0}};
int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti>>1;
-
- //LOG_D(PHY,"[SYNC TIME] Calling sync_time.\n");
- AssertFatal(sync_corr_ue0 != NULL,
- "sync_corr_ue0 not yet allocated! Exiting.\n");
- AssertFatal(sync_corr_ue1 != NULL,
- "sync_corr_ue0 not yet allocated! Exiting.\n");
- AssertFatal(sync_corr_ue2 != NULL,
- "sync_corr_ue0 not yet allocated! Exiting.\n");
-
peak_val = 0;
peak_pos = 0;
sync_source = 0;
-
for (n=0; nofdm_symbol_size-frame_parms->nb_prefix_samples)) {
if (n<(length-frame_parms->ofdm_symbol_size)) {
-
//calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n];
for (ar=0; arnb_antennas_rx; ar++) {
-
- result = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
- result2 = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT);
-
- ((short*)sync_corr_ue0)[2*n] += ((short*) &result)[0];
- ((short*)sync_corr_ue0)[2*n+1] += ((short*) &result)[1];
- ((short*)sync_corr_ue0)[2*(length+n)] += ((short*) &result2)[0];
- ((short*)sync_corr_ue0)[(2*(length+n))+1] += ((short*) &result2)[1];
- ((short*)sync_out)[0] += ((short*) &result)[0];
- ((short*)sync_out)[1] += ((short*) &result)[1];
- ((short*)sync_out2)[0] += ((short*) &result2)[0];
- ((short*)sync_out2)[1] += ((short*) &result2)[1];
+ result = dot_product((short *)primary_synch0_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
+ result2 = dot_product((short *)primary_synch0_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT);
+ sync_out[0].r += ((short *) &result)[0];
+ sync_out[0].i += ((short *) &result)[1];
+ sync_out2[0].r += ((short *) &result2)[0];
+ sync_out2[0].i += ((short *) &result2)[1];
}
for (ar=0; arnb_antennas_rx; ar++) {
- result = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
- result2 = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT);
- ((short*)sync_corr_ue1)[2*n] += ((short*) &result)[0];
- ((short*)sync_corr_ue1)[2*n+1] += ((short*) &result)[1];
- ((short*)sync_corr_ue1)[2*(length+n)] += ((short*) &result2)[0];
- ((short*)sync_corr_ue1)[(2*(length+n))+1] += ((short*) &result2)[1];
-
- ((short*)sync_out)[2] += ((short*) &result)[0];
- ((short*)sync_out)[3] += ((short*) &result)[1];
- ((short*)sync_out2)[2] += ((short*) &result2)[0];
- ((short*)sync_out2)[3] += ((short*) &result2)[1];
+ result = dot_product((short *)primary_synch1_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
+ result2 = dot_product((short *)primary_synch1_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT);
+ sync_out[1].r += ((short *) &result)[0];
+ sync_out[1].i += ((short *) &result)[1];
+ sync_out2[1].r += ((short *) &result2)[0];
+ sync_out2[1].i += ((short *) &result2)[1];
}
for (ar=0; arnb_antennas_rx; ar++) {
-
- result = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
- result2 = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT);
- ((short*)sync_corr_ue2)[2*n] += ((short*) &result)[0];
- ((short*)sync_corr_ue2)[2*n+1] += ((short*) &result)[1];
- ((short*)sync_corr_ue2)[2*(length+n)] += ((short*) &result2)[0];
- ((short*)sync_corr_ue2)[(2*(length+n))+1] += ((short*) &result2)[1];
- ((short*)sync_out)[4] += ((short*) &result)[0];
- ((short*)sync_out)[5] += ((short*) &result)[1];
- ((short*)sync_out2)[4] += ((short*) &result2)[0];
- ((short*)sync_out2)[5] += ((short*) &result2)[1];
+ result = dot_product((short *)primary_synch2_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
+ result2 = dot_product((short *)primary_synch2_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT);
+ sync_out[2].r += ((short *) &result)[0];
+ sync_out[2].i += ((short *) &result)[1];
+ sync_out2[2].r += ((short *) &result2)[0];
+ sync_out2[2].i += ((short *) &result2)[1];
}
-
}
// calculate the absolute value of sync_corr[n]
- sync_corr_ue0[n] = abs32(sync_corr_ue0[n]);
- sync_corr_ue0[n+length] = abs32(sync_corr_ue0[n+length]);
- sync_corr_ue1[n] = abs32(sync_corr_ue1[n]);
- sync_corr_ue1[n+length] = abs32(sync_corr_ue1[n+length]);
- sync_corr_ue2[n] = abs32(sync_corr_ue2[n]);
- sync_corr_ue2[n+length] = abs32(sync_corr_ue2[n+length]);
-
for (s=0; s<3; s++) {
- tmp[s] = (abs32(sync_out[s])>>1) + (abs32(sync_out2[s])>>1);
+ double tmp = absF(sync_out[s]) + absF(sync_out2[s]);
- if (tmp[s]>peak_val) {
- peak_val = tmp[s];
+ if (tmp>peak_val) {
+ peak_val = tmp;
peak_pos = n;
sync_source = s;
/*
@@ -443,42 +211,22 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
}
*eNB_id = sync_source;
-
- LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
-
-
- if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){
- static int debug_cnt;
- if (debug_cnt == 0) {
- LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
- LOG_M("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
- LOG_M("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2);
- LOG_M("rxdata0.m","rxd0",rxdata[0],length<<1,1,1);
- // exit(-1);
- } else {
- debug_cnt++;
- }
-}
+ LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val/2,dB_fixed(peak_val/2)/2);
return(peak_pos);
}
-int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars
-{
+int ru_sync_time_init(RU_t *ru) { // LTE_UE_COMMON *common_vars
/*
int16_t dmrs[2048];
int16_t *dmrsp[2] = {dmrs,NULL};
*/
-
int32_t dmrs[ru->frame_parms->ofdm_symbol_size*14] __attribute__((aligned(32)));
//int32_t *dmrsp[2] = {&dmrs[(3-ru->frame_parms->Ncp)*ru->frame_parms->ofdm_symbol_size],NULL};
int32_t *dmrsp[2] = {&dmrs[0],NULL};
-
generate_ul_ref_sigs();
-
- ru->dmrssync = (int16_t*)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t));
- ru->dmrs_corr = (uint64_t*)malloc16_clear(ru->frame_parms->samples_per_tti*10*sizeof(uint64_t));
-
+ ru->dmrssync = (int16_t *)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t));
+ ru->dmrs_corr = (uint64_t *)malloc16_clear(ru->frame_parms->samples_per_tti*10*sizeof(uint64_t));
generate_drs_pusch(NULL,
NULL,
ru->frame_parms,
@@ -491,35 +239,39 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars
0);
switch (ru->frame_parms->N_RB_DL) {
- case 6:
- idft(IDFT_128,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
- ru->dmrssync, /// complex output
- 1);
- break;
- case 25:
- idft(IDFT_512,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
- ru->dmrssync, /// complex output
- 1);
- break;
- case 50:
- idft(IDFT_1024,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
- ru->dmrssync, /// complex output
- 1);
- break;
-
- case 75:
- idft(IDFT_1536,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
- ru->dmrssync,
- 1); /// complex output
- break;
- case 100:
- idft(IDFT_2048,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
- ru->dmrssync, /// complex output
- 1);
- break;
- default:
- AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL);
- break;
+ case 6:
+ idft(IDFT_128,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
+ ru->dmrssync, /// complex output
+ 1);
+ break;
+
+ case 25:
+ idft(IDFT_512,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
+ ru->dmrssync, /// complex output
+ 1);
+ break;
+
+ case 50:
+ idft(IDFT_1024,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
+ ru->dmrssync, /// complex output
+ 1);
+ break;
+
+ case 75:
+ idft(IDFT_1536,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
+ ru->dmrssync,
+ 1); /// complex output
+ break;
+
+ case 100:
+ idft(IDFT_2048,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]),
+ ru->dmrssync, /// complex output
+ 1);
+ break;
+
+ default:
+ AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL);
+ break;
}
return(0);
@@ -527,10 +279,11 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars
void ru_sync_time_free(RU_t *ru) {
-
AssertFatal(ru->dmrssync!=NULL,"ru->dmrssync is NULL\n");
free(ru->dmrssync);
- if (ru->dmrs_corr) free(ru->dmrs_corr);
+
+ if (ru->dmrs_corr)
+ free(ru->dmrs_corr);
}
//#define DEBUG_PHY
@@ -539,10 +292,8 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t length,
uint32_t *peak_val_out,
- uint32_t *sync_corr_eNB)
-{
+ uint32_t *sync_corr_eNB) {
// perform a time domain correlation using the oversampled sync sequence
-
unsigned int n, ar, peak_val, peak_pos;
uint64_t mean_val;
int result;
@@ -556,21 +307,21 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
}
switch (eNB_id) {
- case 0:
- primary_synch_time = (short*)primary_synch0_time;
- break;
+ case 0:
+ primary_synch_time = (short *)primary_synch0_time;
+ break;
- case 1:
- primary_synch_time = (short*)primary_synch1_time;
- break;
+ case 1:
+ primary_synch_time = (short *)primary_synch1_time;
+ break;
- case 2:
- primary_synch_time = (short*)primary_synch2_time;
- break;
+ case 2:
+ primary_synch_time = (short *)primary_synch2_time;
+ break;
- default:
- LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n");
- return (-1);
+ default:
+ LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n");
+ return (-1);
}
peak_val = 0;
@@ -578,21 +329,16 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
mean_val = 0;
for (n=0; nofdm_symbol_size-frame_parms->nb_prefix_samples)) {
-
//calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n];
for (ar=0; arnb_antennas_rx; ar++) {
-
- result = dot_product((short*)primary_synch_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
+ result = dot_product((short *)primary_synch_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT);
//((short*)sync_corr)[2*n] += ((short*) &result)[0];
//((short*)sync_corr)[2*n+1] += ((short*) &result)[1];
sync_corr_eNB[n] += abs32(result);
-
}
-
}
/*
@@ -610,7 +356,6 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
}
mean_val/=length;
-
*peak_val_out = peak_val;
if (peak_val <= (40*(uint32_t)mean_val)) {
@@ -620,88 +365,91 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
LOG_I(PHY,"[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %"PRIu64"\n",peak_pos,peak_val,mean_val);
return(peak_pos);
}
-
}
-static inline int64_t abs64(int64_t x)
-{
- return (((int64_t)((int32_t*)&x)[0])*((int64_t)((int32_t*)&x)[0]) + ((int64_t)
-((int32_t*)&x)[1])*((int64_t)((int32_t*)&x)[1]));
+static inline int64_t abs64(int64_t x) {
+ return (((int64_t)((int32_t *)&x)[0])*((int64_t)((int32_t *)&x)[0]) + ((int64_t)
+ ((int32_t *)&x)[1])*((int64_t)((int32_t *)&x)[1]));
}
int ru_sync_time(RU_t *ru,
int64_t *lev,
- int64_t *avg)
-{
+ int64_t *avg) {
LTE_DL_FRAME_PARMS *frame_parms = ru->frame_parms;
RU_CALIBRATION *calibration = &ru->calibration;
-
// perform a time domain correlation using the oversampled sync sequence
-
int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti;
-
// circular copy of beginning to end of rxdata buffer. Note: buffer should be big enough upon calling this function
- for (int ar=0;arnb_rx;ar++) memcpy((void*)&ru->common.rxdata[ar][2*length],
- (void*)&ru->common.rxdata[ar][0],
- frame_parms->ofdm_symbol_size);
-
+ for (int ar=0; arnb_rx; ar++)
+ memcpy((void *)&ru->common.rxdata[ar][2*length],
+ (void *)&ru->common.rxdata[ar][0],
+ frame_parms->ofdm_symbol_size);
+
int32_t maxlev0=0;
int maxpos0=0;
int64_t avg0=0;
int64_t result;
int64_t dmrs_corr;
-
int maxval=0;
- for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) {
+
+ for (int i=0; i<2*(frame_parms->ofdm_symbol_size); i++) {
maxval = max(maxval,ru->dmrssync[i]);
maxval = max(maxval,-ru->dmrssync[i]);
}
if (ru->state == RU_CHECK_SYNC) {
- for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) {
- maxval = max(maxval,calibration->drs_ch_estimates_time[0][i]);
- maxval = max(maxval,-calibration->drs_ch_estimates_time[0][i]);
- }
+ for (int i=0; i<2*(frame_parms->ofdm_symbol_size); i++) {
+ maxval = max(maxval,calibration->drs_ch_estimates_time[0][i]);
+ maxval = max(maxval,-calibration->drs_ch_estimates_time[0][i]);
+ }
}
int shift = log2_approx(maxval);
for (int n=0; nnb_rx; ar++) {
-
result = dot_product64(ru->dmrssync,
- (int16_t*) &ru->common.rxdata[ar][n],
- frame_parms->ofdm_symbol_size,
- shift);
-
- if (ru->state == RU_CHECK_SYNC) {
- result = dot_product64((int16_t*) &calibration->drs_ch_estimates_time[ar],
- (int16_t*) &ru->common.rxdata[ar][n],
+ (int16_t *) &ru->common.rxdata[ar][n],
frame_parms->ofdm_symbol_size,
shift);
+
+ if (ru->state == RU_CHECK_SYNC) {
+ result = dot_product64((int16_t *) &calibration->drs_ch_estimates_time[ar],
+ (int16_t *) &ru->common.rxdata[ar][n],
+ frame_parms->ofdm_symbol_size,
+ shift);
}
+
dmrs_corr += abs64(result);
}
- if (ru->dmrs_corr != NULL) ru->dmrs_corr[n] = dmrs_corr;
+
+ if (ru->dmrs_corr != NULL)
+ ru->dmrs_corr[n] = dmrs_corr;
// tmpi holds ++...+
+ if (dmrs_corr>maxlev0) {
+ maxlev0 = dmrs_corr;
+ maxpos0 = n;
+ }
- if (dmrs_corr>maxlev0) { maxlev0 = dmrs_corr; maxpos0 = n; }
avg0 += dmrs_corr;
}
- avg0/=(length/4);
+ avg0/=(length/4);
int dmrsoffset = frame_parms->samples_per_tti + (3*frame_parms->ofdm_symbol_size)+(3*frame_parms->nb_prefix_samples) + frame_parms->nb_prefix_samples0;
-
- if ((int64_t)maxlev0 > (10*avg0)) {*lev = maxlev0; *avg=avg0; return((length+maxpos0-dmrsoffset)%length);}
+
+ if ((int64_t)maxlev0 > (10*avg0)) {
+ *lev = maxlev0;
+ *avg=avg0;
+ return((length+maxpos0-dmrsoffset)%length);
+ }
return(-1);
}
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
index 1d1b16e036..eab9b3f321 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
@@ -20,7 +20,7 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
+//#include "PHY/phy_extern.h"
#include "PHY/sse_intrin.h"
//#define DEBUG_CH
#include "common/utils/LOG/log.h"
@@ -34,12 +34,18 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32
#define SCALE 0x3FFF
+static const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
+static const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
+
+extern unsigned short dftsizes[34];
+extern int16_t *ul_ref_sigs_rx[30][2][34];
+
int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
L1_rxtx_proc_t *proc,
- LTE_eNB_ULSCH_t * ulsch,
- int32_t **ul_ch_estimates,
- int32_t **ul_ch_estimates_time,
- int32_t **rxdataF_ext,
+ LTE_eNB_ULSCH_t * ulsch,
+ int32_t **ul_ch_estimates,
+ int32_t **ul_ch_estimates_time,
+ int32_t **rxdataF_ext,
module_id_t UE_id,
unsigned char l,
unsigned char Ns) {
diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c
index c5e48d8364..596760541b 100644
--- a/openair1/PHY/LTE_REFSIG/lte_gold.c
+++ b/openair1/PHY/LTE_REFSIG/lte_gold.c
@@ -56,7 +56,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
(((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
//n = 0
- x1 = 1+ (1<<31);
+ x1 = 1+ (1U<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
// skip first 50 double words (1600 bits)
@@ -103,7 +103,7 @@ void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
//n = 0
// printf("cinit (ns %d, l %d) => %d\n",ns,l,x2);
- x1 = 1+ (1<<31);
+ x1 = 1+ (1U<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
// skip first 50 double words (1600 bits)
@@ -143,7 +143,7 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
//n = 0
//printf("cinit (ns %d, l %d) => %d\n",ns,l,x2);
- x1 = 1+ (1<<31);
+ x1 = 1+ (1U<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
//skip first 50 double words (1600 bits)
diff --git a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c
index b057f6a403..78f0fd93fe 100644
--- a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c
+++ b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c
@@ -59,7 +59,7 @@ void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_tabl
//n = 0
// printf("cinit (sfn %d, l %d) => %d\n",sfn,l,x2);
// Initializing the Sequence
- x1 = 1+ (1<<31);
+ x1 = 1+ (1U<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
// skip first 50 double words (1600 bits)
// printf("n=0 : x1 %x, x2 %x\n",x1,x2);
@@ -90,7 +90,7 @@ void lte_gold_mbsfn_khz_1dot25(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold
for (sfn=0; sfn<10; sfn++) {
x2 = (Nid_mbsfn) + (((1+(Nid_mbsfn<<1))*(1 + (7*(1+sfn))))<<9); //cinit
- x1 = 1+ (1<<31);
+ x1 = 1+ (1U<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
for (n=1; n<50; n++) {
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
index 4b06f67bbe..f11a39e249 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
@@ -53,14 +53,12 @@
//#undef LOG_D
//#define LOG_D(A,B...) printf(B)
-int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
- uint16_t i;
- int16_t first_free_index=-1;
+int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
+ int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
- for (i=0; idlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i);
- AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i);
+ for (int i=0; idlsch[i][0] == NULL) continue;
LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
if ((eNB->dlsch[i][0]->harq_mask >0) &&
@@ -78,13 +76,12 @@ int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
}
-int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
- uint16_t i;
- int16_t first_free_index=-1;
+int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
+ int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
- for (i=0; iulsch[i]!=NULL,"eNB->ulsch[%d] is null\n",i);
+ for (int i=0; iulsch[i]==NULL) continue;
if ((eNB->ulsch[i]->harq_mask >0) &&
(eNB->ulsch[i]->rnti==rnti)) return i;
@@ -301,7 +298,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
- if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ) {
+ if( (UE_id<0) || (UE_id>=NUMBER_OF_DLSCH_MAX) ) {
LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id);
return;
}
@@ -476,7 +473,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process;
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index;
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->padding = 0;
- // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+ //LOG_D(PHY,"TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",rel8->mcs_1,rel8->resource_block_coding,rel8->redundancy_version_1,NPRB);
} else {
dci_alloc->dci_length = sizeof_DCI1A_20MHz_FDD_t;
((DCI1A_20MHz_FDD_t *)dci_pdu)->type = 1;
@@ -535,7 +532,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
dlsch0->harq_mask |= (1 << rel8->harq_process);
- if (rel8->rnti_type == 1) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,
+ if (rel8->rnti != SI_RNTI) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,
rel8->redundancy_version_1,rel8->rnti,rel8->harq_process);
break;
@@ -1550,7 +1547,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
dci_alloc->i0 = rel13->initial_transmission_sf_io;
UE_id = find_dlsch (rel13->rnti, eNB, SEARCH_EXIST_OR_FREE);
AssertFatal (UE_id != -1, "no free or exiting dlsch_context\n");
- AssertFatal (UE_id < NUMBER_OF_UE_MAX, "returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX);
+ AssertFatal (UE_id < NUMBER_OF_DLSCH_MAX, "returned UE_id %d >= %d(NUMBER_OF_DLSCH_MAX)\n", UE_id, NUMBER_OF_DLSCH_MAX);
dlsch0 = eNB->dlsch[UE_id][0];
dlsch0_harq = dlsch0->harq_processes[rel13->harq_process];
dci_alloc->ra_flag = 0;
@@ -1955,7 +1952,7 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
if(frame_parms->frame_type == TDD) {
UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE);
- if(UE_id != -1) {
+ if(UE_id >=0 -1 || UE_id < NUMBER_OF_ULSCH_MAX) {
eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1;
}
}
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
index 583d12eedb..64e74ebfbf 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
@@ -32,7 +32,6 @@
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
-#include "SCHED/sched_eNB.h"
#ifdef DEBUG_DCI_TOOLS
#include "PHY/phy_vars.h"
#endif
@@ -43,7 +42,6 @@
//#define DEBUG_HARQ
-#include "LAYER2/MAC/mac.h"
//#define DEBUG_DCI
@@ -100,7 +98,6 @@ uint16_t RIV2nb_rb_LUT100[6000];
uint16_t RIV2first_rb_LUT100[6000];
uint16_t RIV_max100=0;
-extern RAN_CONTEXT_t RC;
extern uint32_t current_dlsch_cqi;
@@ -273,15 +270,6 @@ uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint
-uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe)
-{
-
- // check for eNB only !
- return(get_nCCE(num_pdcch_symbols,
- &RC.eNB[Mod_id][CC_id]->frame_parms,
- get_mi(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe)));
-}
-
void conv_eMTC_rballoc (uint16_t resource_block_coding, uint32_t N_RB_DL, uint32_t * rb_alloc)
{
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
index 3eb44d98fa..b5bcb0848d 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
@@ -96,6 +96,7 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
}
+
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
unsigned char Mdlharq,
uint32_t Nsoft,
@@ -110,7 +111,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
switch (N_RB_DL) {
case 6:
- bw_scaling =16;
+ bw_scaling = 4;
break;
case 25:
@@ -160,7 +161,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
for (i=0; iharq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
- LOG_T(PHY, "Required mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n",
+ LOG_I(PHY, "Required DLSCH mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n",
MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling, i,dlsch->harq_processes[i]);
if (dlsch->harq_processes[i]) {
@@ -169,9 +170,9 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
dlsch->harq_processes[i]->b = (unsigned char *)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
if (dlsch->harq_processes[i]->b) {
- bzero(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
+ memset(dlsch->harq_processes[i]->b,0,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
} else {
- printf("Can't get b\n");
+ AssertFatal(1==0,"Can't get b\n");
exit_flag=1;
}
@@ -181,15 +182,15 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(((r==0)?8:0) + 3+ 768);
if (dlsch->harq_processes[i]->c[r]) {
- bzero(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+ 768);
+ memset(dlsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+ 768);
} else {
- printf("Can't get c\n");
+ AssertFatal(1==0,"Can't get c\n");
exit_flag=2;
}
}
}
} else {
- printf("Can't get harq_p %d\n",i);
+ AssertFatal(1==0,"Can't get harq_p %d\n",i);
exit_flag=3;
}
}
@@ -203,7 +204,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
}
}
- LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
+ LOG_I(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
exit_flag, sizeof(LTE_eNB_DLSCH_t));
free_eNB_dlsch(dlsch);
return(NULL);
@@ -360,6 +361,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
proc->nbEncode=0;
+
// if (hadlsch->Ndi == 1) { // this is a new packet
if (hadlsch->round == 0) { // this is a new packet
// Add 24-bit crc (polynomial A) to payload
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
index 347fbb026b..aba4a464f2 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
@@ -2375,16 +2375,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
for (l=num_pdcch_symbols; lmimo_mode,
pmi2hex_2Ar2(dlsch0_harq->pmi_alloc),
mod_order0,
mod_order1,
rb_alloc[0]
);
-#endif
}
if (frame_parms->Ncp==0) { // normal prefix
@@ -2980,7 +2978,7 @@ int allocate_REs_in_RB_MCH_khz_1dot25(int32_t **txdataF,
case 2: //QPSK
- LOG_D(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+ LOG_D(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
((int16_t*)&txdataF[0][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
*jj = *jj + 1;
@@ -3082,7 +3080,7 @@ int mch_modulation_khz_1dot25(int32_t **txdataF,
uint8_t skip_dc=0;
uint8_t mod_order = dlsch->harq_processes[0]->Qm;
int16_t qam16_table_a[4],qam64_table_a[8];//,qam16_table_b[4],qam64_table_b[8];
- int16_t *qam_table_s;
+ int16_t *qam_table_s=qam16_table_a;
nsymb_pmch = 1;
nsymb = (frame_parms->Ncp == NORMAL) ? 14 : 12;
@@ -3125,12 +3123,8 @@ int mch_modulation_khz_1dot25(int32_t **txdataF,
}
- if (mod_order == 4)
- qam_table_s = qam16_table_a;
- else if (mod_order == 6)
+ if (mod_order == 6)
qam_table_s = qam64_table_a;
- else
- qam_table_s = NULL;
//LOG_I(PHY,"Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
allocate_REs_in_RB_MCH_khz_1dot25(txdataF,
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
index d48164e07d..015a95a862 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
@@ -113,15 +113,12 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
x2 = ((Ns>>1)<<9) + frame_parms->Nid_cell_mbsfn; //this is c_init in 36.211 Sec 6.3.1 for PMCH
}
-#ifdef DEBUG_SCRAMBLING
- printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
-#endif
s = lte_gold_generic(&x1, &x2, 1);
for (n=0; n<(1+(G>>5)); n++) {
#ifdef DEBUG_SCRAMBLING
- for (int k=0; k<32; k++) printf("scrambling %d : %d xor %d = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1));
+ for (int k=0; k<32; k++) printf("scrambling %d : %x xor %x = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1));
#endif
e[0] = (e[0]) ^ (s&1);
diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
index 95ad420028..09c0b4ba0f 100644
--- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
@@ -30,10 +30,13 @@
* \warning
*/
-#include "PHY/defs_eNB.h"
+#include
+//#include "PHY/defs_eNB.h"
+#include "PHY/defs_RU.h"
#include "PHY/TOOLS/alaw_lut.h"
-#include "PHY/phy_extern.h"
-#include "SCHED/sched_eNB.h"
+//#include "PHY/phy_extern.h"
+//#include "SCHED/sched_eNB.h"
+lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_tools.c
index f39f3ef872..e2bec337aa 100644
--- a/openair1/PHY/LTE_TRANSPORT/if5_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.c
@@ -31,11 +31,11 @@
*/
#include
-#include "PHY/defs_eNB.h"
+#include
+#include "PHY/defs_RU.h"
#include "PHY/TOOLS/alaw_lut.h"
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
-#include
#include "common/utils/LOG/vcd_signal_dumper.h"
//#define DEBUG_DL_MOBIPASS
//#define DEBUG_UL_MOBIPASS
@@ -1469,7 +1469,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
// HYPOTHESIS: first packet per subframe has lowest timestamp of subframe
// should detect out of order and act accordingly ....
AssertFatal(aid==0 || aid==1,"aid %d != 0 or 1\n",aid);
- //LOG_I(PHY,"rxp[%d] %p, dest %p, offset %d (%lld,%lld)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(timestamp[packet_id]-timestamp[0]),timestamp[packet_id],timestamp[0]);
+ LOG_D(PHY,"rxp[%d] %p, dest %p, offset %d (%llu,%llu)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(int)(timestamp[packet_id]-timestamp[0]),(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[0]);
memcpy((void*)(rxp[aid]+(timestamp[packet_id]-timestamp[0])),
(void*)temp_rx,
spp_eth<<2);
diff --git a/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c b/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c
index b249052cbf..a23f8db4f2 100644
--- a/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c
+++ b/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c
@@ -41,7 +41,7 @@ extern inline uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t res
{
// Init value for x1: x1(0) = 1, x1(n) = 0, n=1,2,...,30
// x1(31) = [x1(3) + x1(0)]mod2 = 1
- *x1 = 1 + (1<<31);
+ *x1 = 1 + (1U<<31);
// Init value for x2: cinit = sum_{i=0}^30 x2*2^i
// x2(31) = [x2(3) + x2(2) + x2(1) + x2(0)]mod2
// = (*x2>>3) ^ (*x2>>2) + (*x2>>1) + *x2
diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c
index dfa990269e..8e9a968827 100644
--- a/openair1/PHY/LTE_TRANSPORT/pbch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pbch.c
@@ -72,6 +72,7 @@ int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
first_re=0;
last_re=12;
+
for (re=first_re; re
#include
+#include "common/utils/lte/prach_utils.h"
void rx_prach0(PHY_VARS_eNB *eNB,
RU_t *ru,
@@ -84,7 +85,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint8_t aa;
int32_t lev;
int16_t levdB;
- int fft_size,log2_ifft_size;
+ int fft_size=0,log2_ifft_size;
int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32)));
int32_t *prach_ifft=(int32_t *)NULL;
int32_t **prach_ifftp=(int32_t **)NULL;
@@ -112,7 +113,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prach_ConfigIndex = fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[ce_level];
Ncs_config = fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
restricted_set = fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag;
- n_ra_prb = get_prach_prb_offset(fp,prach_ConfigIndex,
+ n_ra_prb = get_prach_prb_offset(fp->frame_type,fp->tdd_config,fp->N_RB_UL,fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[ce_level],
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
tdd_mapindex,Nf);
// update pointers to results for ce_level
@@ -124,7 +125,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prach_ConfigIndex = fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
Ncs_config = fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
restricted_set = fp->prach_config_common.prach_ConfigInfo.highSpeedFlag;
- n_ra_prb = get_prach_prb_offset(fp,prach_ConfigIndex,
+ n_ra_prb = get_prach_prb_offset(fp->frame_type,fp->tdd_config,fp->N_RB_UL,fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
tdd_mapindex,Nf);
}
@@ -140,7 +141,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
if (LOG_DEBUGFLAG(PRACH)) {
- if (((frame_prach)&1023) < 20) LOG_I(PHY,
+ if (((frame_prach)&1023) < 20) LOG_D(PHY,
"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
br_flag,ce_level,frame_prach,subframe,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
@@ -153,24 +154,24 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prachF = eNB->prach_vars.prachF;
rxsigF = eNB->prach_vars.rxsigF[0];
- if (LOG_DEBUGFLAG(PRACH)) {
- if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,
+ //if (LOG_DEBUGFLAG(PRACH)) {
+ if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
- }
+ //}
}
} else {
if (br_flag == 1) {
rxsigF = ru->prach_rxsigF_br[ce_level];
if (LOG_DEBUGFLAG(PRACH)) {
- if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
+ if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
br_flag,ce_level,frame_prach,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex);
}
} else {
rxsigF = ru->prach_rxsigF[0];
if (LOG_DEBUGFLAG(PRACH)) {
- if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
+ if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex);
}
}
@@ -299,11 +300,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
case 6:
if (prach_fmt == 4) {
dft(DFT_256,prach2,rxsigF[aa],1);
+ fft_size=256;
} else {
dft(DFT_1536,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1);
+ fft_size=1536;
}
break;
@@ -311,13 +314,14 @@ void rx_prach0(PHY_VARS_eNB *eNB,
case 15:
if (prach_fmt == 4) {
dft(DFT_256,prach2,rxsigF[aa],1);
+ fft_size=256;
} else {
dft(DFT_3072,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1);
}
-
+ fft_size=3072;
break;
case 25:
@@ -339,11 +343,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
case 50:
if (prach_fmt == 4) {
dft(DFT_2048,prach2,rxsigF[aa],1);
+ fft_size=2048;
} else {
dft(DFT_12288,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_12288,prach2+24576,rxsigF[aa]+24576,1);
+ fft_size=12288;
}
break;
@@ -351,11 +357,13 @@ void rx_prach0(PHY_VARS_eNB *eNB,
case 75:
if (prach_fmt == 4) {
dft(DFT_3072,prach2,rxsigF[aa],1);
+ fft_size=3072;
} else {
dft(DFT_18432,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1);
+ fft_size=18432;
}
break;
@@ -364,20 +372,24 @@ void rx_prach0(PHY_VARS_eNB *eNB,
if (fp->threequarter_fs==0) {
if (prach_fmt == 4) {
dft(DFT_4096,prach2,rxsigF[aa],1);
+ fft_size=2048;
} else {
dft(DFT_24576,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_24576,prach2+49152,rxsigF[aa]+49152,1);
+ fft_size=24576;
}
} else {
if (prach_fmt == 4) {
dft(DFT_3072,prach2,rxsigF[aa],1);
+ fft_size=3072;
} else {
dft(DFT_18432,prach2,rxsigF[aa],1);
if (prach_fmt>1)
dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1);
+ fft_size=18432;
}
}
@@ -547,7 +559,6 @@ void rx_prach0(PHY_VARS_eNB *eNB,
}
log2_ifft_size = 10;
- fft_size = 6144;
if (new_dft == 1) {
new_dft = 0;
diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c
index 393d4ca3f8..e366e8edbc 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c
@@ -34,7 +34,7 @@
#include "PHY/phy_extern.h"
#include "PHY/phy_extern_ue.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
-
+#include "common/utils/lte/prach_utils.h"
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case
@@ -44,6 +44,9 @@ int16_t ru[2*839]; // quantized roots of unity
uint32_t ZC_inv[839]; // multiplicative inverse for roots u
uint16_t du[838];
+extern PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7];
+
+/*
// This is table 5.7.1-4 from 36.211
PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
// TDD Configuration Index 0
@@ -254,7 +257,7 @@ PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
}
};
-
+*/
uint16_t prach_root_sequence_map0_3[838] = { 129, 710, 140, 699, 120, 719, 210, 629, 168, 671, 84, 755, 105, 734, 93, 746, 70, 769, 60, 779,
2, 837, 1, 838,
@@ -378,192 +381,13 @@ uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index) {
return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].map[tdd_map_index].f_ra);
}
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type) {
- if (frame_type == FDD) // FDD
- return(prach_ConfigIndex>>4);
- else {
- if (prach_ConfigIndex < 20)
- return (0);
-
- if (prach_ConfigIndex < 30)
- return (1);
-
- if (prach_ConfigIndex < 40)
- return (2);
-
- if (prach_ConfigIndex < 48)
- return (3);
- else
- return (4);
- }
-}
-
-uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
- uint8_t prach_ConfigIndex,
- uint8_t n_ra_prboffset,
- uint8_t tdd_mapindex, uint16_t Nf) {
- lte_frame_type_t frame_type = frame_parms->frame_type;
- uint8_t tdd_config = frame_parms->tdd_config;
- uint8_t n_ra_prb;
- uint8_t f_ra,t1_ra;
- uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
- uint8_t Nsp=2;
-
- if (frame_type == TDD) { // TDD
- if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
- LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex);
- return(-1);
- }
-
- // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
- f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
-
- if (prach_fmt < 4) {
- if ((f_ra&1) == 0) {
- n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
- } else {
- n_ra_prb = frame_parms->N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
- }
- } else {
- if ((tdd_config >2) && (tdd_config<6))
- Nsp = 2;
-
- t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
-
- if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
- n_ra_prb = 6*f_ra;
- } else {
- n_ra_prb = frame_parms->N_RB_UL - 6*(f_ra+1);
- }
- }
- } else { //FDD
- n_ra_prb = n_ra_prboffset;
- }
-
- return(n_ra_prb);
-}
-
-int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) {
- // uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
- uint8_t tdd_config = frame_parms->tdd_config;
- uint8_t t0_ra;
- uint8_t t1_ra;
- uint8_t t2_ra;
- int prach_mask = 0;
-
- if (frame_parms->frame_type == FDD) { //FDD
- //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
- if ((((frame&1) == 1) && (subframe < 9)) ||
- (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
- if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
- ((prach_ConfigIndex&0x1f)==18) || // 18,50
- ((prach_ConfigIndex&0xf)==15)) // 15,47
- return(0);
-
- switch (prach_ConfigIndex&0x1f) {
- case 0:
- case 3:
- if (subframe==1) prach_mask = 1;
-
- break;
-
- case 1:
- case 4:
- if (subframe==4) prach_mask = 1;
-
- break;
-
- case 2:
- case 5:
- if (subframe==7) prach_mask = 1;
-
- break;
-
- case 6:
- if ((subframe==1) || (subframe==6)) prach_mask=1;
-
- break;
-
- case 7:
- if ((subframe==2) || (subframe==7)) prach_mask=1;
-
- break;
-
- case 8:
- if ((subframe==3) || (subframe==8)) prach_mask=1;
-
- break;
-
- case 9:
- if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
-
- break;
-
- case 10:
- if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
-
- break;
-
- case 11:
- if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
-
- break;
-
- case 12:
- if ((subframe&1)==0) prach_mask=1;
-
- break;
-
- case 13:
- if ((subframe&1)==1) prach_mask=1;
-
- break;
-
- case 14:
- prach_mask=1;
- break;
-
- case 15:
- if (subframe==9) prach_mask=1;
-
- break;
- }
- } else { // TDD
- AssertFatal(prach_ConfigIndex<64,
- "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
- AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
- "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
- t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
- t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
- t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
-#ifdef PRACH_DEBUG
- LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
- prach_ConfigIndex,
- subframe,
- t0_ra,t1_ra,t2_ra);
-#endif
-
- if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames
- ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames
- (t0_ra == 0)) && // PRACH is in all frames
- (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame
- (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame
- if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe
- (((subframe%5)-2)==t2_ra)) prach_mask=1;
- else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS
- }
- }
-
- return(prach_mask);
-}
-
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe) {
uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
- int prach_mask = is_prach_subframe0(frame_parms, prach_ConfigIndex, frame, subframe);
+ int prach_mask = is_prach_subframe0(frame_parms->tdd_config,frame_parms->frame_type, prach_ConfigIndex, frame, subframe);
for (int i=0; i<4; i++) {
if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1)
- prach_mask |= (is_prach_subframe0(frame_parms, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],
+ prach_mask |= (is_prach_subframe0(frame_parms->tdd_config,frame_parms->frame_type, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],
frame, subframe) << (i+1));
}
diff --git a/openair1/PHY/LTE_TRANSPORT/prach_extern.h b/openair1/PHY/LTE_TRANSPORT/prach_extern.h
index 47fbd93ad7..3404646923 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach_extern.h
+++ b/openair1/PHY/LTE_TRANSPORT/prach_extern.h
@@ -35,7 +35,7 @@
#include "PHY/sse_intrin.h"
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
+//#include "PHY/phy_extern.h"
//#define PRACH_DEBUG 1
//#define PRACH_WRITE_OUTPUT_DEBUG 1
@@ -74,17 +74,6 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index);
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
-
-
-uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
- uint8_t prach_ConfigIndex,
- uint8_t n_ra_prboffset,
- uint8_t tdd_mapindex, uint16_t Nf);
-
-
-int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe);
-
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe);
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c
index c72fa1b480..585a9d92a5 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch.c
@@ -65,10 +65,41 @@ int16_t cfo_pucch_ep[24*6] = {24278,-22005,29621,-14010,32412,-4808,32412,4807,2
+void dump_uci_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) {
+
+ int strpos=0;
+ char output[16384];
+
+ for (int i=0;iuci_stats[i].rnti>0) {
+ eNB_UCI_STATS_t *uci_stats = &eNB->uci_stats[i];
+ strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1_trials %d, pucch1_n0 %d dB, pucch1_thres %d dB, current pucch1_stat_pos %d dB, current pucch1_stat_neg %d dB, positive SR count %d\n",
+ i,uci_stats->rnti,uci_stats->pucch1_trials,eNB->measurements.n0_pucch_dB/*max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1])*/,uci_stats->pucch1_thres,dB_fixed(uci_stats->current_pucch1_stat_pos),dB_fixed(uci_stats->current_pucch1_stat_neg),uci_stats->pucch1_positive_SR);
+ strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1_low (%d,%d)dB pucch1_high (%d,%d)dB\n",
+ i,uci_stats->rnti,
+ dB_fixed(uci_stats->pucch1_low_stat[0]),
+ dB_fixed(uci_stats->pucch1_low_stat[1]),
+ dB_fixed(uci_stats->pucch1_high_stat[0]),
+ dB_fixed(uci_stats->pucch1_high_stat[1]));
+
+ strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1a_trials %d, pucch1a_stat (%d,%d), pucch1b_trials %d, pucch1b_stat (%d,%d) pucch1ab_DTX %d\n",
+ i,uci_stats->rnti,
+ uci_stats->pucch1a_trials,
+ uci_stats->current_pucch1a_stat_re,
+ uci_stats->current_pucch1a_stat_im,
+ uci_stats->pucch1b_trials,
+ uci_stats->current_pucch1b_stat_re,
+ uci_stats->current_pucch1b_stat_im,
+ uci_stats->pucch1ab_DTX);
+ }
+ }
+ if (fd) fprintf(fd,"%s",output);
+ else printf("%s",output);
+}
/* PUCCH format3 >> */
/* SubCarrier Demap */
uint16_t pucchfmt3_subCarrierDeMapping( PHY_VARS_eNB *eNB,
- int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2],
+ int16_t SubCarrierDeMapData[4][14][12][2],
uint16_t n3_pucch ) {
LTE_eNB_COMMON *eNB_common_vars = &eNB->common_vars;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
@@ -118,8 +149,8 @@ uint16_t pucchfmt3_subCarrierDeMapping( PHY_VARS_eNB *eNB,
}
/* cyclic shift hopping remove */
-uint16_t pucchfmt3_Baseseq_csh_remove( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2],
- int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2],
+uint16_t pucchfmt3_Baseseq_csh_remove( int16_t SubCarrierDeMapData[4][14][12][2],
+ int16_t CshData_fmt3[4][14][12][2],
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
uint8_t ncs_cell[20][7] ) {
@@ -169,9 +200,9 @@ const int16_t TBL_3_SF5_GEN_N_DASH_NS[MAXROW_TBL_SF5_OS_IDX] = {0,3,6,8,10};
const int16_t TBL_3_SF4_GEN_N_DASH_NS[MAXROW_TBL_SF4_OS_IDX] = {0,3,6,9};
/* Channel estimation */
-uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2],
- double delta_theta[NB_ANTENNAS_RX][12],
- int16_t ChestValue[NB_ANTENNAS_RX][2][12][2],
+uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[4][14][12][2],
+ double delta_theta[4][12],
+ int16_t ChestValue[4][2][12][2],
int16_t *Interpw,
uint8_t subframe,
uint8_t shortened_format,
@@ -183,12 +214,12 @@ uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX
int16_t np, np_n, ip_ind=-1;
//int16_t npucch_sf;
int16_t calctmp[2];
- int16_t BsCshData[NB_ANTENNAS_RX][D_NSYM1SF][D_NSC1RB][2];
- //int16_t delta_theta_calctmp[NB_ANTENNAS_RX][4][D_NSC1RB][2], delta_theta_comp[NB_ANTENNAS_RX][D_NSC1RB][2];
- int16_t delta_theta_comp[NB_ANTENNAS_RX][D_NSC1RB][2];
- int16_t CsData_allavg[NB_ANTENNAS_RX][14][2];
- int16_t CsData_temp[NB_ANTENNAS_RX][D_NSYM1SF][D_NSC1RB][2];
- int32_t IP_CsData_allsfavg[NB_ANTENNAS_RX][14][4][2];
+ int16_t BsCshData[4][D_NSYM1SF][D_NSC1RB][2];
+ //int16_t delta_theta_calctmp[4][4][D_NSC1RB][2], delta_theta_comp[4][D_NSC1RB][2];
+ int16_t delta_theta_comp[4][D_NSC1RB][2];
+ int16_t CsData_allavg[4][14][2];
+ int16_t CsData_temp[4][D_NSYM1SF][D_NSC1RB][2];
+ int32_t IP_CsData_allsfavg[4][14][4][2];
int32_t IP_allavg[D_NPUCCH_SF5];
//int16_t temp_ch[2];
int16_t m[NUMBER_OF_UE_MAX], m_self=0, same_m_number;
@@ -432,9 +463,9 @@ uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX
}
/* Channel Equalization */
-uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2],
- int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2],
- int16_t ChestValue[NB_ANTENNAS_RX][2][12][2],
+uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[4][14][12][2],
+ int16_t ChdetAfterValue_fmt3[4][14][12][2],
+ int16_t ChestValue[4][2][12][2],
LTE_DL_FRAME_PARMS *frame_parms) {
int16_t aa, sltNo, symNo, k;
@@ -457,9 +488,9 @@ uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2]
}
/* Frequency deviation remove AFC */
-uint16_t pucchfmt3_FrqDevRemove( int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2],
- double delta_theta[NB_ANTENNAS_RX][12],
- int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2],
+uint16_t pucchfmt3_FrqDevRemove( int16_t ChdetAfterValue_fmt3[4][14][12][2],
+ double delta_theta[4][12],
+ int16_t RemoveFrqDev_fmt3[4][2][5][12][2],
LTE_DL_FRAME_PARMS *frame_parms ) {
int16_t aa, sltNo, symNo1slt, k, n;
double calctmp[2];
@@ -509,8 +540,8 @@ const int16_t TBL_3_SF4[MAXROW_TBL_SF4_fmt3][MAXCLM_TBL_SF4][2] = {
};
/* orthogonal sequence remove */
-uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2],
- int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2],
+uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[4][2][5][12][2],
+ int16_t Fmt3xDataRmvOrth[4][2][5][12][2],
uint8_t shortened_format,
uint16_t n3_pucch,
LTE_DL_FRAME_PARMS *frame_parms ) {
@@ -556,7 +587,7 @@ uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5
}
/* averaging antenna */
-uint16_t pucchfmt3_AvgAnt( int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2],
+uint16_t pucchfmt3_AvgAnt( int16_t Fmt3xDataRmvOrth[4][2][5][12][2],
int16_t Fmt3xDataAvgAnt[2][5][12][2],
uint8_t shortened_format,
LTE_DL_FRAME_PARMS *frame_parms ) {
@@ -856,7 +887,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
uint32_t rx_pucch(PHY_VARS_eNB *eNB,
PUCCH_FMT_t fmt,
- uint8_t UE_id,
+ uint8_t UCI_id,
uint16_t n1_pucch,
uint16_t n2_pucch,
uint8_t shortened_format,
@@ -871,15 +902,15 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
static int first_call = 1;
LTE_eNB_COMMON *common_vars = &eNB->common_vars;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
- int8_t sigma2_dB = eNB->measurements.n0_pucch_dB;
+ int8_t sigma2_dB = /*max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1]); */eNB->measurements.n0_pucch_dB;
uint32_t u,v,n,aa;
uint32_t z[12*14];
int16_t *zptr;
- int16_t rxcomp[NB_ANTENNAS_RX][2*12*14];
+ int16_t rxcomp[4][2*12*14];
uint8_t ns,N_UL_symb,nsymb,n_oc,n_oc0,n_oc1;
uint8_t c = (frame_parms->Ncp==0) ? 3 : 2;
- uint16_t nprime,nprime0,nprime1;
+ int16_t nprime,nprime0,nprime1;
uint16_t i,j,re_offset,thres,h,off;
uint8_t Nprime_div_deltaPUCCH_Shift,Nprime,d;
uint8_t m,l,refs,phase,re,l2,phase_max=0;
@@ -887,12 +918,12 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
int16_t tmp_re,tmp_im,W_re=0,W_im=0;
int16_t *rxptr;
uint32_t symbol_offset;
- int16_t stat_ref_re,stat_ref_im,*cfo;
- int16_t chest0_re[NB_ANTENNAS_RX][12],chest0_im[NB_ANTENNAS_RX][12];
- int16_t chest1_re[NB_ANTENNAS_RX][12],chest1_im[NB_ANTENNAS_RX][12];
+ int16_t stat0_ref_re[4],stat0_ref_im[4],stat1_ref_re[4],stat1_ref_im[4],*cfo;
+ int16_t chest0_re[4][12],chest0_im[4][12];
+ int16_t chest1_re[4][12],chest1_im[4][12];
int32_t chest_mag;
- int32_t stat_re=0,stat_im=0;
- uint32_t stat,stat_max=0;
+ int32_t stat0_re[4],stat1_re[4],stat0_im[4],stat1_im[4];
+ uint32_t stat0[4],stat1[4],stat_max=0,stat0_max[4],stat1_max[4];
uint8_t log2_maxh;
uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift;
uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI;
@@ -905,13 +936,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
int chL;
/* PUCCH format3 >> */
uint16_t Ret = 0;
- int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
- int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
- double delta_theta[NB_ANTENNAS_RX][12]; //[Antenna][Subcarrier][Complex]
- int16_t ChestValue[NB_ANTENNAS_RX][2][12][2]; //[Antenna][Slot][Subcarrier][Complex]
- int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
- int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
- int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
+ int16_t SubCarrierDeMapData[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
+ int16_t CshData_fmt3[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
+ double delta_theta[4][12]; //[Antenna][Subcarrier][Complex]
+ int16_t ChestValue[4][2][12][2]; //[Antenna][Slot][Subcarrier][Complex]
+ int16_t ChdetAfterValue_fmt3[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
+ int16_t RemoveFrqDev_fmt3[4][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
+ int16_t Fmt3xDataRmvOrth[4][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
int16_t Fmt3xDataAvgAnt[2][5][12][2]; //[Slot][PUCCH_Symbol][Subcarrier][Complex]
int16_t Fmt3xDataAvgSym[2][12][2]; //[Slot][Subcarrier][Complex]
int16_t IFFTOutData_Fmt3[2][12][2]; //[Slot][Subcarrier][Complex]
@@ -941,9 +972,20 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
first_call=0;
}
-
+ eNB_UCI_STATS_t *uci_stats = NULL;
if(fmt!=pucch_format3) { /* PUCCH format3 */
+
+ eNB_UCI_STATS_t *first_uci_stats=NULL;
+ for (int i=0;iuci_stats[i].rnti == eNB->uci_vars[UCI_id].rnti) {
+ uci_stats = &eNB->uci_stats[i];
+ break;
+ } else if (first_uci_stats == NULL && eNB->uci_stats[i].rnti == 0) first_uci_stats = &eNB->uci_stats[i];
+ if (uci_stats == NULL) { uci_stats=first_uci_stats; uci_stats->rnti = eNB->uci_vars[UCI_id].rnti;}
+
+ AssertFatal(uci_stats!=NULL,"No stat index found\n");
+ uci_stats->frame = frame;
// TODO
// "SR+ACK/NACK" length is only 7 bits.
// This restriction will be lifted in the future.
@@ -1149,57 +1191,63 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
// Do cfo correction and MRC across symbols
if (fmt == pucch_format1) {
+ uci_stats->pucch1_trials++;
#ifdef DEBUG_PUCCH_RX
printf("Doing PUCCH detection for format 1\n");
#endif
stat_max = 0;
for (phase=0; phase<7; phase++) {
- stat=0;
-
+ int stat=0;
for (aa=0; aanb_antennas_rx; aa++) {
+ stat0[aa]=0;stat1[aa]=0;
for (re=0; re<12; re++) {
- stat_re=0;
- stat_im=0;
+ stat0_re[aa]=0;
+ stat0_im[aa]=0;
+ stat1_re[aa]=0;
+ stat1_im[aa]=0;
off=re<<1;
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase] : &cfo_pucch_ep[12*phase];
for (l=0; l<(nsymb>>1); l++) {
- stat_re += (((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15))/nsymb;
- stat_im += (((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15))/nsymb;
+ stat0_re[aa] += (((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15))/nsymb;
+ stat0_im[aa] += (((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15))/nsymb;
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) , stat %d\n",subframe,phase,l,re,
rxcomp[aa][off],rxcomp[aa][1+off],
cfo[l<<1],cfo[1+(l<<1)],
- stat_re,stat_im,stat);
+ stat0_re[aa],stat0_im[aa],stat);
#endif
}
for (l2=0,l=(nsymb>>1); l < nsymb; l++,l2++) {
- stat_re += (((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15))/nsymb;
- stat_im += (((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15))/nsymb;
+ stat1_re[aa] += (((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15))/nsymb;
+ stat1_im[aa] += (((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15))/nsymb;
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d), stat %d\n",subframe,phase,l2,re,
rxcomp[aa][off],rxcomp[aa][1+off],
cfo[l2<<1],cfo[1+(l2<<1)],
- stat_re,stat_im,stat);
+ stat1_re[aa],stat1_im[aa],stat);
#endif
}
-
- stat += ((stat_re*stat_re) + (stat_im*stat_im));
+
+ stat0[aa] += ((stat0_re[aa]*stat0_re[aa]) + (stat0_im[aa]*stat0_im[aa]));
+ stat1[aa] += ((stat1_re[aa]*stat1_re[aa]) + (stat1_im[aa]*stat1_im[aa]));
} //re
+ stat+=(stat0[aa]+stat1[aa]);
} // aa
-
if (stat>stat_max) {
stat_max = stat;
phase_max = phase;
+ for (aa=0;aanb_antennas_rx;aa++) {
+ stat0_max[aa] = stat0[aa];
+ stat1_max[aa] = stat1[aa];
+ }
}
} //phase
- // stat_max *= nsymb; // normalize to energy per symbol
- // stat_max /= (frame_parms->N_RB_UL*12); //
stat_max /= 12;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max);
@@ -1207,12 +1255,14 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PUCCH_RX
LOG_I(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (%d, %d), phase_max : %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements.n0_subband_power_tot_dBm[6],pucch1_thres,phase_max);
#endif
- eNB->pucch1_stats[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = stat_max;
- eNB->pucch1_stats_thres[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = sigma2_dB+pucch1_thres;
- eNB->pucch1_stats_cnt[UE_id][subframe] = (eNB->pucch1_stats_cnt[UE_id][subframe]+1)&1023;
- T(T_ENB_PHY_PUCCH_1_ENERGY, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UE_id].rnti), T_INT(frame), T_INT(subframe),
+ eNB->pucch1_stats[UCI_id][(subframe<<10)+eNB->pucch1_stats_cnt[UCI_id][subframe]] = stat_max;
+ eNB->pucch1_stats_thres[UCI_id][(subframe<<10)+eNB->pucch1_stats_cnt[UCI_id][subframe]] = sigma2_dB+pucch1_thres;
+ eNB->pucch1_stats_cnt[UCI_id][subframe] = (eNB->pucch1_stats_cnt[UCI_id][subframe]+1)&1023;
+ uci_stats->pucch1_thres = sigma2_dB+pucch1_thres;
+ T(T_ENB_PHY_PUCCH_1_ENERGY, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UCI_id].rnti), T_INT(frame), T_INT(subframe),
T_INT(stat_max), T_INT(sigma2_dB+pucch1_thres));
+
/*
if (eNB->pucch1_stats_cnt[UE_id][subframe] == 0) {
LOG_M("pucch_debug.m","pucch_energy",
@@ -1226,11 +1276,18 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
// This is a moving average of the PUCCH1 statistics conditioned on being above or below the threshold
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {
*payload = 1;
+ uci_stats->current_pucch1_stat_pos = stat_max;
+ for (int aa=0;aanb_antennas_rx;aa++) {
+ uci_stats->pucch1_low_stat[aa]=stat0_max[aa];
+ uci_stats->pucch1_high_stat[aa]=stat1_max[aa];
+ uci_stats->pucch1_positive_SR++;
+ }
} else {
+ uci_stats->current_pucch1_stat_neg = stat_max;
*payload = 0;
}
- if (UE_id==0) {
+ if (UCI_id==0) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_ENERGY,dB_fixed(stat_max));
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_THRES,sigma2_dB+pucch1_thres);
}
@@ -1239,29 +1296,30 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PUCCH_RX
LOG_D(PHY,"Doing PUCCH detection for format 1a/1b\n");
#endif
-
+ int stat_re=0,stat_im=0;
for (phase=0; phase<7; phase++) {
- stat=0;
-
+ int stat=0;
for (aa=0; aanb_antennas_rx; aa++) {
+ stat0[aa]=0;
+ stat1[aa]=0;
for (re=0; re<12; re++) {
// compute received energy first slot, seperately for data and reference
// by coherent combining across symbols but not resource elements
// Note: assumption is that channel is stationary over symbols in slot after CFO
- stat_re=0;
- stat_im=0;
- stat_ref_re=0;
- stat_ref_im=0;
+ stat0_re[aa]=0;
+ stat0_im[aa]=0;
+ stat0_ref_re[aa]=0;
+ stat0_ref_im[aa]=0;
off=re<<1;
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase] : &cfo_pucch_ep[12*phase];
for (l=0; l<(nsymb>>1); l++) {
if ((l<2)||(l>(nsymb>>1) - 3)) { //data symbols
- stat_re += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
- stat_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
+ stat0_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
+ stat0_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
} else { //reference symbols
- stat_ref_re += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
- stat_ref_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
+ stat0_ref_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
+ stat0_ref_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
}
off+=2;
@@ -1274,26 +1332,21 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
}
// this is total energy received, summed over data and reference
- if (fmt==pucch_format1a){
- stat += ((((stat_re*stat_re)) + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
- }else{
- stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) +
- ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
- }
-
+ stat0[aa] += ((((stat0_re[aa]*stat0_re[aa])) + ((stat0_im[aa]*stat0_im[aa])) +
+ ((stat0_ref_re[aa]*stat0_ref_re[aa])) + ((stat0_ref_im[aa]*stat0_ref_im[aa])))/nsymb);
// now second slot
- stat_re=0;
- stat_im=0;
- stat_ref_re=0;
- stat_ref_im=0;
+ stat1_re[aa]=0;
+ stat1_im[aa]=0;
+ stat1_ref_re[aa]=0;
+ stat1_ref_im[aa]=0;
for (l2=0,l=(nsymb>>1); l< nsymb; l++,l2++) {
if ((l2<2) || ((l2>(nsymb>>1) - 3)) ) { // data symbols
- stat_re += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
- stat_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
+ stat1_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
+ stat1_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
} else { //reference_symbols
- stat_ref_re += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
- stat_ref_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
+ stat1_ref_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15);
+ stat1_ref_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15);
}
off+=2;
@@ -1308,20 +1361,16 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PUCCH_RX
printf("aa%d re %d : phase %d : stat %d\n",aa,re,phase,stat);
#endif
- if (fmt==pucch_format1a){
- stat += ((((stat_re*stat_re)) + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
- }else{
- stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) +
- ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb);
- }
-
+ stat1[aa] += ((((stat1_re[aa]*stat1_re[aa])) + ((stat1_im[aa]*stat1_im[aa])) +
+ ((stat1_ref_re[aa]*stat1_ref_re[aa])) + ((stat1_ref_im[aa]*stat1_ref_im[aa])))/nsymb);
} //re
+ stat+=(stat0[aa]+stat1[aa]);
} // aa
#ifdef DEBUG_PUCCH_RX
LOG_D(PHY,"Format 1A: phase %d : stat %d\n",phase,stat);
#endif
-
+
if (stat>stat_max) {
stat_max = stat;
phase_max = phase;
@@ -1332,8 +1381,6 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
#ifdef DEBUG_PUCCH_RX
LOG_I(PHY,"[eNB] PUCCH fmt1a/b: stat_max : %d (%d : sigma2 %d), phase_max : %d\n",stat_max,dB_fixed(stat_max),sigma2_dB,phase_max);
#endif
- stat_re=0;
- stat_im=0;
// Do detection now
@@ -1341,13 +1388,12 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
// For instance i assume to skip pucch1_thres from the test below.
// Not 100% sure
- if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
+ if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
chL = (nsymb>>1)-4;
chest_mag=0;
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max];
for (aa=0; aanb_antennas_rx; aa++) {
- // channel estimates first
for (re=0; re<12; re++) {
// channel estimate for first slot
chest0_re[aa][re]=0;
@@ -1381,6 +1427,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
// now do channel matched filter
for (aa=0; aanb_antennas_rx; aa++) {
+ stat0_re[aa]=0;
+ stat0_im[aa]=0;
+ stat1_re[aa]=0;
+ stat1_im[aa]=0;
+
for (re=0; re<12; re++) {
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d chest0[%d][%d] => (%d,%d)\n",subframe,aa,re,
@@ -1392,8 +1443,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
off=(re<<1) + (24*l);
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
- stat_re += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
- stat_im += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
+ stat0_re[aa] += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
+ stat0_im[aa] += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
@@ -1409,8 +1460,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
off=(re<<1) + (24*l);
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
- stat_re += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
- stat_im += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
+ stat0_re[aa] += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh));
+ stat0_im[aa] += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh));
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
@@ -1431,8 +1482,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
off=(re<<1) + (24*l) + (nsymb>>1)*24;
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
- stat_re += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
- stat_im += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
+ stat1_re[aa] += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
+ stat1_im[aa] += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
@@ -1448,8 +1499,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
off=(re<<1) + (24*l) + (nsymb>>1)*24;
tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15);
tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15);
- stat_re += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
- stat_im += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
+ stat1_re[aa] += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh));
+ stat1_im[aa] += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh));
off+=2;
#ifdef DEBUG_PUCCH_RX
printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re,
@@ -1464,29 +1515,42 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
printf("aa%d re %d : stat %d,%d\n",aa,re,stat_re,stat_im);
#endif
} //re
+ stat_re+=stat0_re[aa]+stat1_re[aa];
+ stat_im+=stat0_im[aa]+stat1_im[aa];
} // aa
LOG_D(PHY,"PUCCH 1a/b: subframe %d : stat %d,%d (pos %d)\n",subframe,stat_re,stat_im,
- (subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe]));
+ (subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe]));
LOG_D(PHY,"In pucch.c PUCCH 1a/b: ACK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
- eNB->pucch1ab_stats[UE_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_re);
- eNB->pucch1ab_stats[UE_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_im);
- eNB->pucch1ab_stats_cnt[UE_id][subframe] = (eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023;
+ eNB->pucch1ab_stats[UCI_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UCI_id][subframe])] = (stat_re);
+ eNB->pucch1ab_stats[UCI_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UCI_id][subframe])] = (stat_im);
+ eNB->pucch1ab_stats_cnt[UCI_id][subframe] = (eNB->pucch1ab_stats_cnt[UCI_id][subframe]+1)&1023;
/* frame not available here - set to -1 for the moment */
- T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UE_id].rnti), T_INT(-1), T_INT(subframe), T_INT(stat_re), T_INT(stat_im));
+ T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UCI_id].rnti), T_INT(-1), T_INT(subframe), T_INT(stat_re), T_INT(stat_im));
*payload = (stat_re<0) ? 1 : 2; // 1 == ACK, 2 == NAK
- if (fmt==pucch_format1b)
+ if (fmt==pucch_format1b) {
+ uci_stats->pucch1b_trials++;
*(1+payload) = (stat_im<0) ? 1 : 2;
+ uci_stats->current_pucch1b_stat_re = stat_re;
+ uci_stats->current_pucch1b_stat_im = stat_im;
+ }
+ else {
+ uci_stats->pucch1a_trials++;
+ uci_stats->current_pucch1a_stat_re = stat_re;
+ uci_stats->current_pucch1a_stat_im = stat_im;
+ }
+
} else { // insufficient energy on PUCCH so NAK
LOG_D(PHY,"In pucch.c PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
*payload = 4; // DTX
- ((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
- ((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
- eNB->pucch1ab_stats_cnt[UE_id][subframe] = (eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023;
+ ((int16_t *)&eNB->pucch1ab_stats[UCI_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])])[0] = (int16_t)(stat_re);
+ ((int16_t *)&eNB->pucch1ab_stats[UCI_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])])[1] = (int16_t)(stat_im);
+ eNB->pucch1ab_stats_cnt[UCI_id][subframe] = (eNB->pucch1ab_stats_cnt[UCI_id][subframe]+1)&1023;
if (fmt==pucch_format1b)
*(1+payload) = 4;
+ uci_stats->pucch1ab_DTX++;
}
} else {
LOG_E(PHY,"[eNB] PUCCH fmt2/2a/2b not supported\n");
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch_common.c b/openair1/PHY/LTE_TRANSPORT/pucch_common.c
index 5b939b08d2..d7a500d5f7 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch_common.c
@@ -31,7 +31,6 @@
*/
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
-#include "LAYER2/MAC/mac.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/LOG/log.h"
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common.h b/openair1/PHY/LTE_TRANSPORT/transport_common.h
index ab2921c2b9..7c1065736d 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_common.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h
@@ -35,9 +35,9 @@
#include "dci.h"
#include "mdci.h"
//#include "uci.h"
-#ifndef STANDALONE_COMPILE
- #include "UTIL/LISTS/list.h"
-#endif
+//#ifndef STANDALONE_COMPILE
+// #include "UTIL/LISTS/list.h"
+//#endif
#define MOD_TABLE_QPSK_OFFSET 1
#define MOD_TABLE_16QAM_OFFSET 5
@@ -57,7 +57,7 @@
// maximum of 3 segments before each coding block if data length exceeds 6144 bits.
-#define MAX_NUM_DLSCH_SEGMENTS 16
+#define MAX_NUM_DLSCH_SEGMENTS 13
#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS
#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768)
#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768)
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
index 1944f06fab..622f37b3bc 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
@@ -223,7 +223,9 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
@param frame_type 0-FDD, 1-TDD
@returns 0-1 accordingly
*/
+/*
uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
+*/
/*!
\brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index
@@ -306,12 +308,12 @@ void init_scrambling_lut(void);
void init_unscrambling_lut(void);
-
+/*
uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t prach_ConfigIndex,
uint8_t n_ra_prboffset,
uint8_t tdd_mapindex, uint16_t Nf);
-
+*/
uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe);
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
@@ -319,6 +321,6 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL);
void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2);
-int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
+int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
index 5e446db5fd..b3985e973a 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
@@ -36,9 +36,9 @@
#include "dci.h"
#include "mdci.h"
#include "uci_common.h"
-#ifndef STANDALONE_COMPILE
- #include "UTIL/LISTS/list.h"
-#endif
+//#ifndef STANDALONE_COMPILE
+// #include "UTIL/LISTS/list.h"
+//#endif
// structures below implement 36-211 and 36-212
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
index 9e37821b05..19af50056c 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
@@ -520,6 +520,9 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB,
void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_id,int round);
+void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame);
+void dump_uci_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame);
+
@@ -691,13 +694,11 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding,
uint32_t N_RB_DL,
uint32_t *rb_alloc);
-int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
+int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
-int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
+int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
-int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
-
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
+int find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
diff --git a/openair1/PHY/LTE_TRANSPORT/uci_tools.c b/openair1/PHY/LTE_TRANSPORT/uci_tools.c
index f8ade9afc8..ae039bec2a 100644
--- a/openair1/PHY/LTE_TRANSPORT/uci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/uci_tools.c
@@ -37,12 +37,11 @@
//#define DEBUG_UCI 1
-int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
- uint16_t i;
- int16_t first_free_index=-1;
+int find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
+ int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
- for (i=0; iuci_vars[i].active >0) &&
(eNB->uci_vars[i].rnti==rnti) &&
(eNB->uci_vars[i].frame==frame) &&
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
index 92fe777201..ae8c666d18 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
@@ -374,7 +374,7 @@ static inline unsigned int lte_gold_unscram(unsigned int *x1, unsigned int *x2,
int n;
if (reset) {
- *x1 = 1+ (1<<31);
+ *x1 = 1+ (1U<<31);
*x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
// skip first 50 double words (1600 bits)
@@ -468,6 +468,35 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
ulsch_harq->Nsymb_pusch,
nb_rb);
//#endif
+
+ eNB_SCH_STATS_t *stats=NULL;
+ int first_free=-1;
+ for (int i=0;iulsch_stats[i].rnti == 0 && first_free == -1) {
+ first_free = i;
+ stats=&eNB->ulsch_stats[i];
+ }
+ if (eNB->ulsch_stats[i].rnti == ulsch->rnti) {
+ stats=&eNB->ulsch_stats[i];
+ break;
+ }
+ }
+ if (stats) {
+ stats->rnti = ulsch->rnti;
+ stats->round_trials[ulsch_harq->round]++;
+ stats->frame=proc->frame_rx;
+ }
+ if (ulsch_harq->round == 0) {
+ if (stats) {
+ stats->current_Qm = Q_m;
+ stats->current_RI = 1;
+ stats->total_bytes_tx += ulsch_harq->TBS;
+ stats->current_TBS = ulsch_harq->TBS;
+ stats->current_G = ulsch_harq->G;
+ }
+ }
+
+
//if (ulsch_harq->round == 0) { // delete for RB shortage pattern
// This is a new packet, so compute quantities regarding segmentation
ulsch_harq->B = A+24;
@@ -1086,3 +1115,44 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
ret = ulsch_decoding_data_all(eNB,proc, UE_id,harq_pid,llr8_flag);
return(ret);
}
+
+#define STATSTRLEN 16384
+void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) {
+
+ char output[16384];
+ int stroff=0;
+ for (int i=0;iulsch_stats[i].rnti>0 && eNB->ulsch_stats[i].round_trials[0]>100) {
+ for (int aa=0;aaframe_parms.nb_antennas_rx;aa++)
+ stroff+=sprintf(output+stroff,"ULSCH RNTI %x: ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n",
+ eNB->ulsch_stats[i].rnti, aa,eNB->ulsch_stats[i].ulsch_power[aa],aa,eNB->ulsch_stats[i].ulsch_noise_power[aa]);
+ AssertFatal(stroff<(STATSTRLEN-1000),"Increase STATSTRLEN\n");
+ stroff+=sprintf(output+stroff,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d\n",
+ eNB->ulsch_stats[i].rnti,
+ eNB->ulsch_stats[i].round_trials[0],
+ (double)eNB->ulsch_stats[i].round_trials[1]/eNB->ulsch_stats[i].round_trials[0],
+ eNB->ulsch_stats[i].round_trials[1],
+ (double)eNB->ulsch_stats[i].round_trials[2]/eNB->ulsch_stats[i].round_trials[0],
+ eNB->ulsch_stats[i].round_trials[2],
+ (double)eNB->ulsch_stats[i].round_trials[3]/eNB->ulsch_stats[i].round_trials[0],
+ eNB->ulsch_stats[i].round_trials[3]);
+ stroff+=sprintf(output+stroff,"ULSCH RNTI %x: current_Qm %d, current_G %d, current_TBS %d, current_rate %f,current_RI %d, timing_offset %d, total_bytes RX/SCHED %d/%d\n",
+ eNB->ulsch_stats[i].rnti,
+ eNB->ulsch_stats[i].current_Qm,
+ eNB->ulsch_stats[i].current_G,
+ eNB->ulsch_stats[i].current_TBS,
+ (double)eNB->ulsch_stats[i].current_G/eNB->ulsch_stats[i].current_TBS,
+ eNB->ulsch_stats[i].current_RI,
+ eNB->ulsch_stats[i].timing_offset,
+ eNB->ulsch_stats[i].total_bytes_rx,
+ eNB->ulsch_stats[i].total_bytes_tx);
+ }
+ fprintf(fd,"%s",output);
+}
+
+void clear_ulsch_stats(PHY_VARS_eNB *eNB) {
+
+ for (int i=0;iulsch_stats[i],0,sizeof(eNB->ulsch_stats[i]));
+}
+
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
index eeab616097..3529df8e44 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
@@ -31,12 +31,12 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
+//#include "PHY/phy_extern.h"
#include "transport_eNB.h"
#include "PHY/sse_intrin.h"
#include "transport_common_proto.h"
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
-#include "PHY/MODULATION/modulation_eNB.h"
+//#include "PHY/MODULATION/modulation_eNB.h"
#include "T.h"
@@ -45,8 +45,11 @@
//extern int **ulchmag_eren;
//eren
-static short jitter[8] __attribute__ ((aligned(16))) = {1,0,0,1,0,1,1,0};
-static short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1};
+static const short jitter[8] __attribute__ ((aligned(16))) = {1,0,0,1,0,1,1,0};
+static const short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1};
+static const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
+static const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
+
void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) {
#if defined(__x86_64__) || defined(__i386__)
@@ -511,7 +514,6 @@ void ulsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
for (i=0; i<(nb_rb*3); i++) {
#if defined(__x86_64__) || defined(__i386__)
mmtmpU0 = _mm_abs_epi16(rxF[i]);
- // print_shorts("tmp0",&tmp0);
mmtmpU0 = _mm_subs_epi16(ch_mag[i],mmtmpU0);
(*llrp128)[0] = _mm_unpacklo_epi32(rxF[i],mmtmpU0);
(*llrp128)[1] = _mm_unpackhi_epi32(rxF[i],mmtmpU0);
@@ -627,11 +629,15 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t symbol,
uint16_t nb_rb) {
#if defined(__x86_64__) || defined(__i386__)
- __m128i *rxdataF_comp128_0,*ul_ch_mag128_0,*ul_ch_mag128_0b;
- __m128i *rxdataF_comp128_1,*ul_ch_mag128_1,*ul_ch_mag128_1b;
+ __m128i *rxdataF_comp128_0=NULL,*ul_ch_mag128_0=NULL,*ul_ch_mag128_0b=NULL;
+ __m128i *rxdataF_comp128_1=NULL,*ul_ch_mag128_1=NULL,*ul_ch_mag128_1b=NULL;
+ __m128i *rxdataF_comp128_2=NULL,*ul_ch_mag128_2=NULL,*ul_ch_mag128_2b=NULL;
+ __m128i *rxdataF_comp128_3=NULL,*ul_ch_mag128_3=NULL,*ul_ch_mag128_3b=NULL;
#elif defined(__arm__)
int16x8_t *rxdataF_comp128_0,*ul_ch_mag128_0,*ul_ch_mag128_0b;
int16x8_t *rxdataF_comp128_1,*ul_ch_mag128_1,*ul_ch_mag128_1b;
+ int16x8_t *rxdataF_comp128_2,*ul_ch_mag128_2,*ul_ch_mag128_2b;
+ int16x8_t *rxdataF_comp128_3,*ul_ch_mag128_3,*ul_ch_mag128_3b;
#endif
int32_t i;
@@ -643,15 +649,39 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
ul_ch_mag128_1 = (__m128i *)&ul_ch_mag[1][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128_0b = (__m128i *)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
ul_ch_mag128_1b = (__m128i *)&ul_ch_magb[1][symbol*frame_parms->N_RB_DL*12];
-
- // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
- for (i=0; inb_antennas_rx>2) {
+ rxdataF_comp128_2 = (__m128i *)&rxdataF_comp[2][symbol*frame_parms->N_RB_DL*12];
+ ul_ch_mag128_2 = (__m128i *)&ul_ch_mag[2][symbol*frame_parms->N_RB_DL*12];
+ ul_ch_mag128_2b = (__m128i *)&ul_ch_magb[2][symbol*frame_parms->N_RB_DL*12];
+ }
+ if (frame_parms->nb_antennas_rx>3) {
+ rxdataF_comp128_3 = (__m128i *)&rxdataF_comp[3][symbol*frame_parms->N_RB_DL*12];
+ ul_ch_mag128_3 = (__m128i *)&ul_ch_mag[3][symbol*frame_parms->N_RB_DL*12];
+ ul_ch_mag128_3b = (__m128i *)&ul_ch_magb[3][symbol*frame_parms->N_RB_DL*12];
}
+ // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
+ if (frame_parms->nb_antennas_rx==2)
+ for (i=0; inb_antennas_rx==3)
+ for (i=0; inb_antennas_rx==4)
+ for (i=0; iN_RB_DL*12];
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12];
@@ -795,7 +825,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
mmtmpU0 = _mm_srai_epi32(mmtmpU0,output_shift);
mmtmpU1 = _mm_packs_epi32(mmtmpU0,mmtmpU0);
ul_ch_mag128[2] = _mm_unpacklo_epi16(mmtmpU1,mmtmpU1);
- LOG_D(PHY,"comp: symbol %d rb %d => %d,%d,%d (output_shift %d)\n",symbol,rb,*((int16_t *)&ul_ch_mag128[0]),*((int16_t *)&ul_ch_mag128[1]),*((int16_t *)&ul_ch_mag128[2]),output_shift);
+ //LOG_I(PHY,"comp: ant %d symbol %d rb %d => %d,%d,%d (output_shift %d)\n",aarx,symbol,rb,*((int16_t *)&ul_ch_mag128[0]),*((int16_t *)&ul_ch_mag128[1]),*((int16_t *)&ul_ch_mag128[2]),output_shift);
#elif defined(__arm__)
mmtmpU0 = vmull_s16(ul_ch128[0], ul_ch128[0]);
mmtmpU0 = vqshlq_s32(vqaddq_s32(mmtmpU0,vrev64q_s32(mmtmpU0)),-output_shift128);
@@ -834,6 +864,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
// print_ints("c1",&mmtmpU3);
rxdataF_comp128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
/*
+ LOG_I(PHY,"Antenna %d:",aarx);
print_shorts("rx:",&rxdataF128[0]);
print_shorts("ch:",&ul_ch128[0]);
print_shorts("pack:",&rxdataF_comp128[0]);
@@ -851,9 +882,12 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
rxdataF_comp128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
- // print_shorts("rx:",rxdataF128[1]);
- // print_shorts("ch:",ul_ch128[1]);
- // print_shorts("pack:",rxdataF_comp128[1]);
+ /*
+ LOG_I(PHY,"Antenna %d:",aarx);
+ print_shorts("rx:",&rxdataF128[1]);
+ print_shorts("ch:",&ul_ch128[1]);
+ print_shorts("pack:",&rxdataF_comp128[1]);
+ */
// multiply by conjugated channel
mmtmpU0 = _mm_madd_epi16(ul_ch128[2],rxdataF128[2]);
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
@@ -867,9 +901,12 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
rxdataF_comp128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
- // print_shorts("rx:",rxdataF128[2]);
- // print_shorts("ch:",ul_ch128[2]);
- // print_shorts("pack:",rxdataF_comp128[2]);
+ /*
+ LOG_I(PHY,"Antenna %d:",aarx);
+ print_shorts("rx:",&rxdataF128[2]);
+ print_shorts("ch:",&ul_ch128[2]);
+ print_shorts("pack:",&rxdataF_comp128[2]);
+ */
// Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT
rxdataF_comp128[0] = _mm_add_epi16(rxdataF_comp128[0],(*(__m128i *)&jitter[0]));
rxdataF_comp128[1] = _mm_add_epi16(rxdataF_comp128[1],(*(__m128i *)&jitter[0]));
@@ -1078,6 +1115,15 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
}
for (i=0; inb_antennas_rx; i++) {
+ pusch_vars->ulsch_power[i] = signal_energy_nodc(pusch_vars->drs_ch_estimates[i],
+ ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor;
+ LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid,
+ ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_x10(pusch_vars->ulsch_power[i]));
+ pusch_vars->ulsch_noise_power[i]=0;
+ for (int rb=0;rbharq_processes[harq_pid]->nb_rb;rb++)
+ pusch_vars->ulsch_noise_power[i]+=eNB->measurements.n0_subband_power[i][rb]/ulsch[UE_id]->harq_processes[harq_pid]->nb_rb;
+ LOG_D(PHY,"noise power[%d] %d\n",i,dB_fixed_x10(pusch_vars->ulsch_noise_power[i]));
+/* Check this modification w.r.t to new PUSCH modifications
//symbol 3
int symbol_offset = frame_parms->N_RB_UL*12*(3 - frame_parms->Ncp);
pusch_vars->ulsch_interference_power[i] = interference_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12);
@@ -1100,7 +1146,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
}
LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_x10(pusch_vars->ulsch_power[i]));
-
+ */
}
ulsch_channel_level(pusch_vars->drs_ch_estimates,
@@ -1113,8 +1159,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
for (aarx=0; aarxnb_antennas_rx; aarx++)
avgs = cmax(avgs,avgU[aarx]);
- // log2_maxh = 4+(log2_approx(avgs)/2);
- log2_maxh = (log2_approx(avgs)/2)+ log2_approx(frame_parms->nb_antennas_rx-1)+4;
+ log2_maxh = 4+(log2_approx(avgs)/2);
LOG_D(PHY,"[ULSCH] log2_maxh = %d (%d,%d)\n",log2_maxh,avgU[0],avgs);
for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) {
@@ -1221,67 +1266,56 @@ void dump_ulsch(PHY_VARS_eNB *eNB,int frame,int subframe,uint8_t UE_id,int round
uint8_t harq_pid;
char fname[100],vname[100];
harq_pid = subframe2harq_pid(&eNB->frame_parms,frame,subframe);
- LOG_UI(PHY,"Dumping ULSCH in subframe %d with harq_pid %d, round %d for NB_rb %d, TBS %d, Qm %d, N_symb %d\n",
+ LOG_UI(PHY,"Dumping ULSCH in subframe %d with harq_pid %d, round %d for NB_rb %d, first_rb %d, TBS %d, Qm %d, N_symb %d\n",
subframe,harq_pid,round,eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
+ eNB->ulsch[UE_id]->harq_processes[harq_pid]->first_rb,
eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS,eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm,
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
+ for (int aa=0;aaframe_parms.nb_antennas_rx;aa++)
+ LOG_UI(PHY,"ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n",aa,dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_power[aa]),aa,dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_noise_power[aa]));
sprintf(fname,"/tmp/ulsch_r%d_d",round);
sprintf(vname,"/tmp/ulsch_r%d_dseq",round);
LOG_UM(fname,vname,&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
if (eNB->common_vars.rxdata) {
- sprintf(fname,"/tmp/rxsig0_r%d.m",round);
- sprintf(vname,"rxs0_r%d",round);
- LOG_UM(fname,vname, &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
+ for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) {
+ sprintf(fname,"/tmp/rxsig%d_r%d.m",aarx,round);
+ sprintf(vname,"rxs%d_r%d",aarx,round);
+ LOG_UM(fname,vname, &eNB->common_vars.rxdata[aarx][0],eNB->frame_parms.samples_per_tti*10,1,1);
- if (eNB->frame_parms.nb_antennas_rx>1)
- if (eNB->common_vars.rxdata) {
- sprintf(fname,"/tmp/rxsig1_r%d.m",round);
- sprintf(vname,"rxs1_r%d",round);
- LOG_UM(fname,vname, &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
- }
+ }
}
-
- sprintf(fname,"/tmp/rxsigF0_r%d.m",round);
- sprintf(vname,"rxsF0_r%d",round);
- LOG_UM(fname,vname, (void *)&eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
-
- if (eNB->frame_parms.nb_antennas_rx>1) {
- sprintf(fname,"/tmp/rxsigF1_r%d.m",round);
- sprintf(vname,"rxsF1_r%d",round);
- LOG_UM(vname,fname, &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
+ if (eNB->common_vars.rxdataF) {
+ for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) {
+ sprintf(fname,"/tmp/rxsigF%d_r%d.m",aarx,round);
+ sprintf(vname,"rxsF%d_r%d",aarx,round);
+ LOG_UM(fname,vname, (void *)&eNB->common_vars.rxdataF[aarx][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
+ }
}
-
- sprintf(fname,"/tmp/rxsigF0_ext_r%d.m",round);
- sprintf(vname,"rxsF0_ext_r%d",round);
- LOG_UM(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
-
- if (eNB->frame_parms.nb_antennas_rx>1) {
- sprintf(fname,"/tmp/rxsigF1_ext_r%d.m",round);
- sprintf(vname,"rxsF1_ext_r%d",round);
- LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_ext[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+ if (eNB->pusch_vars[UE_id]->rxdataF_ext) {
+ for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) {
+ sprintf(fname,"/tmp/rxsigF%d_ext_r%d.m",aarx,round);
+ sprintf(vname,"rxsF%d_ext_r%d",aarx,round);
+ LOG_UM(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[aarx][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+ }
}
-
/*
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
if (eNB->frame_parms.nb_antennas_rx>1)
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
*/
- sprintf(fname,"/tmp/drs_est0_r%d.m",round);
- sprintf(vname,"drsest0_r%d",round);
- LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+ for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) {
+ sprintf(fname,"/tmp/drs_est%d_r%d.m",aarx,round);
+ sprintf(vname,"drsest%d_r%d",aarx,round);
+ LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[aarx],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
- if (eNB->frame_parms.nb_antennas_rx>1) {
- sprintf(fname,"/tmp/drs_est1_r%d.m",round);
- sprintf(vname,"drsest1_r%d",round);
- LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+ sprintf(fname,"/tmp/ulsch%d_rxF_comp0_r%d.m",aarx,round);
+ sprintf(vname,"ulsch_rxF%d_comp0_r%d",aarx,round);
+ LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[aarx][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
}
- sprintf(fname,"/tmp/ulsch0_rxF_comp0_r%d.m",round);
- sprintf(vname,"ulsch0_rxF_comp0_r%d",round);
- LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
// LOG_M("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
sprintf(fname,"/tmp/ulsch_rxF_llr_r%d.m",round);
sprintf(vname,"ulsch_llr_r%d",round);
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c
index 7442a0ae7e..39900113b7 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c
@@ -78,7 +78,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
switch (N_RB_DL) {
case 6:
- bw_scaling =16;
+ bw_scaling =4;
break;
case 25:
@@ -276,7 +276,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
switch (frame_parms->N_RB_DL) {
case 6:
- bw_scaling =16;
+ bw_scaling =4;
break;
case 25:
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
index ab7c2b9091..929f63e9fc 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
@@ -41,6 +41,7 @@
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "../LTE_TRANSPORT/prach_extern.h"
+#include "common/utils/lte/prach_utils.h"
//#define PRACH_DEBUG 1
@@ -115,7 +116,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
NCS = NCS_restricted[Ncs_config];
}
- n_ra_prb = get_prach_prb_offset(&(ue->frame_parms),
+ n_ra_prb = get_prach_prb_offset(ue->frame_parms.frame_type,
+ ue->frame_parms.tdd_config,
+ ue->frame_parms.N_RB_UL,
ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset,
tdd_mapindex, Nf);
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c
index e6960273c7..9c0edb467c 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c
@@ -170,6 +170,7 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms,
Msc_RS = msrsb * 6;
k0 = ( ( (int16_t)(frame_parms->N_RB_UL>>1) - (int16_t)(msrs0>>1) ) * 12 ) + kTC;
+ AssertFatal(msrsb,"divide by 0");
nb = (4*n_RRC/msrsb)%Nb;
for (b=0; b<=Bsrs; b++) {
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
index 3299401443..7ab795cae9 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
+++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
@@ -1740,10 +1740,5 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_UE_DLSCH_t *dlsch_ue);
*/
-uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
- uint8_t prach_ConfigIndex,
- uint8_t n_ra_prboffset,
- uint8_t tdd_mapindex, uint16_t Nf);
-
/**@}*/
#endif
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
index 4c433a5683..6b84a5f969 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
+++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
@@ -36,9 +36,11 @@
#include "../LTE_TRANSPORT/mdci.h"
#include "../LTE_TRANSPORT/uci_common.h"
#include "../LTE_TRANSPORT/transport_common.h"
+/*
#ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h"
#endif
+*/
#include "../LTE_TRANSPORT/transport_common.h"
diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c
index b1f419b172..d592aa466e 100644
--- a/openair1/PHY/MODULATION/beamforming.c
+++ b/openair1/PHY/MODULATION/beamforming.c
@@ -44,7 +44,6 @@
#include "PHY/defs_common.h"
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/CODING/coding_extern.h"
#include "PHY/CODING/lte_interleaver_inline.h"
@@ -145,7 +144,8 @@ int nr_beam_precoding(int32_t **txdataF,
int slot,
int symbol,
int aa,
- int nb_antenna_ports)
+ int nb_antenna_ports,
+ int offset)
{
@@ -155,14 +155,14 @@ int nr_beam_precoding(int32_t **txdataF,
memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size));
for (p=0; pL_ssb >> (63-p)) & 0x01) {
- multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size],
+ //if ((frame_parms->L_ssb >> (63-p)) & 0x01) {
+ multadd_cpx_vector((int16_t*)&txdataF[p][(symbol*frame_parms->ofdm_symbol_size)+offset],
(int16_t*)beam_weights[p][aa],
(int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],
0,
frame_parms->ofdm_symbol_size,
15);
- }
+ //}
}
return 0;
}
diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c
index f12dcfc01b..e32f6bf575 100644
--- a/openair1/PHY/MODULATION/nr_modulation.c
+++ b/openair1/PHY/MODULATION/nr_modulation.c
@@ -22,6 +22,101 @@
#include "nr_modulation.h"
#include "PHY/NR_REFSIG/nr_mod_table.h"
+//Table 6.3.1.5-1 Precoding Matrix W 1 layer 2 antenna ports 'n' = -1 and 'o' = -j
+char nr_W_1l_2p[6][2][1] = {
+ {{'1'}, {'0'}},//pmi 0
+ {{'0'}, {'1'}},
+ {{'1'}, {'1'}},
+ {{'1'}, {'n'}},
+ {{'1'}, {'j'}},
+ {{'1'}, {'o'}}//pmi 5
+};
+
+//Table 6.3.1.5-3 Precoding Matrix W 1 layer 4 antenna ports 'n' = -1 and 'o' = -j
+char nr_W_1l_4p[28][4][1] = {
+ {{'1'}, {'0'}, {'0'}, {'0'}},//pmi 0
+ {{'0'}, {'1'}, {'0'}, {'0'}},
+ {{'0'}, {'0'}, {'1'}, {'0'}},
+ {{'0'}, {'0'}, {'0'}, {'1'}},
+ {{'1'}, {'0'}, {'1'}, {'0'}},
+ {{'1'}, {'0'}, {'n'}, {'0'}},
+ {{'1'}, {'0'}, {'j'}, {'0'}},
+ {{'1'}, {'0'}, {'o'}, {'0'}},//pmi 7
+ {{'0'}, {'1'}, {'0'}, {'1'}},//pmi 8
+ {{'0'}, {'1'}, {'0'}, {'n'}},
+ {{'0'}, {'1'}, {'0'}, {'j'}},
+ {{'0'}, {'1'}, {'0'}, {'o'}},
+ {{'1'}, {'1'}, {'1'}, {'1'}},
+ {{'1'}, {'1'}, {'j'}, {'j'}},
+ {{'1'}, {'1'}, {'n'}, {'n'}},
+ {{'1'}, {'1'}, {'o'}, {'o'}},
+ {{'1'}, {'j'}, {'1'}, {'j'}},//pmi 16
+ {{'1'}, {'j'}, {'j'}, {'n'}},
+ {{'1'}, {'j'}, {'n'}, {'o'}},
+ {{'1'}, {'j'}, {'o'}, {'1'}},
+ {{'1'}, {'n'}, {'1'}, {'n'}},
+ {{'1'}, {'n'}, {'j'}, {'o'}},
+ {{'1'}, {'n'}, {'n'}, {'1'}},
+ {{'1'}, {'n'}, {'o'}, {'j'}},//pmi 23
+ {{'1'}, {'o'}, {'1'}, {'o'}},//pmi 24
+ {{'1'}, {'o'}, {'j'}, {'1'}},
+ {{'1'}, {'o'}, {'n'}, {'j'}},
+ {{'1'}, {'o'}, {'o'}, {'n'}}//pmi 27
+};
+
+//Table 6.3.1.5-4 Precoding Matrix W 2 antenna ports layers 2 'n' = -1 and 'o' = -j
+char nr_W_2l_2p[3][2][2] = {
+ {{'1', '0'}, {'0', '1'}},//pmi 0
+ {{'1', '1'}, {'1', 'n'}},
+ {{'1', '1'}, {'j', 'o'}} //pmi 2
+};
+
+//Table 6.3.1.5-5 Precoding Matrix W 2 layers 4 antenna ports 'n' = -1 and 'o' = -j
+char nr_W_2l_4p[22][4][2] = {
+ {{'1', '0'}, {'0', '1'}, {'0', '0'}, {'0', '0'}},//pmi 0
+ {{'1', '0'}, {'0', '0'}, {'0', '1'}, {'0', '0'}},
+ {{'1', '0'}, {'0', '0'}, {'0', '0'}, {'0', '1'}},
+ {{'0', '0'}, {'1', '0'}, {'0', '1'}, {'0', '0'}},//pmi 3
+ {{'0', '0'}, {'1', '0'}, {'0', '0'}, {'0', '1'}},//pmi 4
+ {{'0', '0'}, {'0', '0'}, {'1', '0'}, {'0', '1'}},
+ {{'1', '0'}, {'0', '1'}, {'1', '0'}, {'0', 'o'}},
+ {{'1', '0'}, {'0', '1'}, {'1', '0'}, {'0', 'j'}},
+ {{'1', '0'}, {'0', '1'}, {'o', '0'}, {'0', '1'}},//pmi 8
+ {{'1', '0'}, {'0', '1'}, {'o', '0'}, {'0', 'n'}},
+ {{'1', '0'}, {'0', '1'}, {'n', '0'}, {'0', 'o'}},
+ {{'1', '0'}, {'0', '1'}, {'n', '0'}, {'0', 'j'}},//pmi 11
+ {{'1', '0'}, {'0', '1'}, {'j', '0'}, {'0', '1'}},//pmi 12
+ {{'1', '0'}, {'0', '1'}, {'j', '0'}, {'0', 'n'}},
+ {{'1', '1'}, {'1', '1'}, {'1', 'n'}, {'1', 'n'}},
+ {{'1', '1'}, {'1', '1'}, {'j', 'o'}, {'j', 'o'}},//pmi 15
+ {{'1', '1'}, {'j', 'j'}, {'1', 'n'}, {'j', 'o'}},//pmi 16
+ {{'1', '1'}, {'j', 'j'}, {'j', 'o'}, {'n', '1'}},
+ {{'1', '1'}, {'n', 'n'}, {'1', 'n'}, {'n', '1'}},
+ {{'1', '1'}, {'n', 'n'}, {'j', 'o'}, {'o', 'j'}},//pmi 19
+ {{'1', '1'}, {'o', 'o'}, {'1', 'n'}, {'o', 'j'}},
+ {{'1', '1'}, {'o', 'o'}, {'j', 'o'}, {'1', 'n'}}//pmi 21
+};
+
+//Table 6.3.1.5-6 Precoding Matrix W 3 layers 4 antenna ports 'n' = -1 and 'o' = -j
+char nr_W_3l_4p[7][4][3] = {
+ {{'1', '0', '0'}, {'0', '1', '0'}, {'0', '0', '1'},{'0', '0', '0'}},//pmi 0
+ {{'1', '0', '0'}, {'0', '1', '0'}, {'1', '0', '0'},{'0', '0', '1'}},
+ {{'1', '0', '0'}, {'0', '1', '0'}, {'n', '0', '0'},{'0', '0', '1'}},
+ {{'1', '1', '1'}, {'1', 'n', '1'}, {'1', '1', 'n'},{'1', 'n', 'n'}},//pmi 3
+ {{'1', '1', '1'}, {'1', 'n', '1'}, {'j', 'j', 'o'},{'j', 'o', 'o'}},//pmi 4
+ {{'1', '1', '1'}, {'n', '1', 'n'}, {'1', '1', 'n'},{'n', '1', '1'}},
+ {{'1', '1', '1'}, {'n', '1', 'n'}, {'j', 'j', 'o'},{'o', 'j', 'j'}}
+};
+
+//Table 6.3.1.5-7 Precoding Matrix W 4 layers 4 antenna ports 'n' = -1 and 'o' = -j
+char nr_W_4l_4p[5][4][4] = {
+ {{'1', '0', '0', '0'}, {'0', '1', '0', '0'}, {'0', '0', '1', '0'}, {'0', '0', '0', '1'}},//pmi 0
+ {{'1', '1', '0', '0'}, {'0', '0', '1', '1'}, {'1', 'n', '0', '0'}, {'0', '0', '1', 'n'}},
+ {{'1', '1', '0', '0'}, {'0', '0', '1', '1'}, {'j', 'o', '0', '0'}, {'0', '0', 'j', 'o'}},
+ {{'1', '1', '1', '1'}, {'1', 'n', '1', 'n'}, {'1', '1', 'n', 'n'}, {'1', 'n', 'n', '1'}},//pmi 3
+ {{'1', '1', '1', '1'}, {'1', 'n', '1', 'n'}, {'j', 'j', 'o', 'o'}, {'j', 'o', 'o', 'j'}}//pmi 4
+};
+
void nr_modulation(uint32_t *in,
uint32_t length,
uint16_t mod_order,
@@ -37,7 +132,7 @@ void nr_modulation(uint32_t *in,
uint32_t i,j;
uint32_t bit_cnt;
uint64_t x,x1,x2;
-
+
#if defined(__SSE2__)
__m128i *nr_mod_table128;
__m128i *out128;
@@ -56,7 +151,7 @@ void nr_modulation(uint32_t *in,
// the bits that are left out
i = i*8/2;
nr_mod_table32 = (int32_t*) nr_qpsk_mod_table;
- while (i>((i*2)&0x7)) & mask);
out32[i] = nr_mod_table32[idx];
i++;
@@ -78,7 +173,7 @@ void nr_modulation(uint32_t *in,
out64[i] = nr_16qam_byte_mod_table[in_bytes[i]];
// the bits that are left out
i = i*8/4;
- while (i>((i*4)&0x7)) & mask);
out32[i] = nr_16qam_mod_table[idx];
i++;
@@ -88,7 +183,7 @@ void nr_modulation(uint32_t *in,
case 6:
j = 0;
for (i=0; i>12)&4095;
@@ -140,7 +235,7 @@ void nr_modulation(uint32_t *in,
bit_cnt += 24;
}
return;
-
+
case 8:
nr_mod_table32 = (int32_t*) nr_256qam_mod_table;
for (i=0; i>1; i++)
@@ -186,8 +281,8 @@ void nr_layer_mapping(int16_t **mod_symbs,
for (int l=2; l<5; l++) {
tx_layers[l][i<<1] = mod_symbs[1][(3*i+l)<<1];
tx_layers[l][(i<<1)+1] = mod_symbs[1][((3*i+l)<<1)+1];
- }
- break;
+ }
+ break;
case 6:
for (int q=0; q<2; q++)
@@ -196,7 +291,7 @@ void nr_layer_mapping(int16_t **mod_symbs,
tx_layers[l][i<<1] = mod_symbs[q][(3*i+l)<<1];
tx_layers[l][(i<<1)+1] = mod_symbs[q][((3*i+l)<<1)+1];
}
- break;
+ break;
case 7:
for (int i=0; id_mod;
- for (int i=0; i>15;
tx_layers[0][(i<<1)+1] = (mod_symbs[(i<<1)+1]*AMP)>>15;
}
- break;
+ break;
case 2:
case 3:
case 4:
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
- for (int i=0; i