diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf
index a4d9985dca..8d403cf4ce 100644
--- a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf
+++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf
@@ -236,9 +236,10 @@ MACRLCs = (
L1s = (
{
- num_cc = 1;
- tr_n_preference = "local_mac";
- pusch_proc_threads = 8;
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ pusch_proc_threads = 8;
+ ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0
}
);
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 1209a6f227..05c71c082e 100644
--- a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf
+++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf
@@ -219,6 +219,7 @@ L1s = (
num_cc = 1;
tr_n_preference = "local_mac";
pusch_proc_threads = 8;
+ ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0
}
);
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 33855f2c0e..df2fd874ca 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
@@ -231,10 +231,11 @@ MACRLCs = (
L1s = (
{
- num_cc = 1;
- tr_n_preference = "local_mac";
+ num_cc = 1;
+ tr_n_preference = "local_mac";
pusch_proc_threads = 6;
- }
+ ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0
+ }
);
RUs = (
diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml
index 7ec3a5f140..6c11a66d91 100644
--- a/ci-scripts/xml_files/fr1_nsa_quectel.xml
+++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml
@@ -97,7 +97,7 @@
Ping: 20pings in 20sec
idefix
-c 20
- 50
+ 1
@@ -105,7 +105,7 @@
Ping: 100pings in 20sec
idefix
-c 100 -i 0.2
- 50
+ 1
@@ -114,7 +114,7 @@
-u -b 20M -t 60
DL
idefix
- 50
+ 3
single-ue
@@ -124,7 +124,7 @@
-u -b 3M -t 60
UL
idefix
- 50
+ 1
single-ue
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 44678b4c91..9592334125 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -457,8 +457,8 @@ include_directories ("${RRC_FULL_DIR}")
#NR RRC
#######
set (NR_RRC_ASN1_VERSION "NR_Rel16" )
-make_version(NR_RRC_VERSION 16 1 0)
-set (NR_RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1c/ASN1_files/nr-rrc-16.1.0.asn1)
+make_version(NR_RRC_VERSION 16 4 1)
+set (NR_RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1c/ASN1_files/nr-rrc-16.4.1.asn1)
add_definitions(-DNR_RRC_VERSION=${NR_RRC_VERSION})
set (NR_RRC_FULL_DIR ${asn1_generated_dir}/RRC_${NR_RRC_ASN1_VERSION})
diff --git a/doc/NR_NFAPI_archi.md b/doc/NR_NFAPI_archi.md
new file mode 100644
index 0000000000..59c511fb52
--- /dev/null
+++ b/doc/NR_NFAPI_archi.md
@@ -0,0 +1,141 @@
+# global
+
+xnf is pnf or vnf
+
+The xnf starting functions are configure_nfapi_xnf()
+
+The OAI code that read the configuration parameters call these functions that will create autonomous thread for xnf control part
+
+These control threads create a SCTP socket by Linux API call (no use of OpenAir internal architecture with SCTP itti thread).
+
+The main() function of softmodem has to create and start the other threads+loop on event for appropriate work: RF Rx in pnf, NGAP, GTP-U, X2, RLC, PDCP for vnf
+
+NFAPI has it's own code directly on Linux+Posix, it doesn't reuse any piece of the OpenAir framework: SCTP thread, thread creation and management, ...
+
+## signaling (P5) xnf main loop
+
+nfapi_vnf_start() create the SCTP socket, then do event waiting in a infinite loop while(vnf->terminate == 0). It accepts the pnf connections, then process the messages on reception
+
+nfapi_pnf_start() initiate connection to vnf until it has a link. Then it enter a similar infinite loop in pnf_message_pump()
+
+After some checks, when a message is obtained, it calls pnf_handle_p5_message() or vnf_handle_p4_p5_message() that have a switch on each p5 message types: the enum nfapi_message_id_e
+
+Each message type has it's own processing function in the switch, like
+```
+case NFAPI_START_RESPONSE:
+ vnf_handle_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
+ break;
+```
+
+These loops are autonomous in their thread waiting incoming message.
+
+## P7 xnf main loop
+
+When the p5 interface receives appropriate message, it starts the p7 interface by launching a thread (see the calls to pthread_create() in nfapi/oai_integration/nfapi_xnf.c)
+
+The p7 main loops starting is a bit simpler, thanks to UDP non connected protocol. The xnf_dispatch_p7_message() do p7 fragments re-assembly, then
+calls xnf_dispatch_p7_message() that have the big switch on message type (as in p5 above description)
+
+So, we have the logic for UL reception in vnf, and DL reception in pnf
+
+## P7 UL transmission by PNF
+
+RF samples are received, and decoding is done by the PNF using control data transmitted by the VNF to the PNF through downlink p7 messages (UL_TTI_req and UL_DCI_req).
+
+After decoding, results are accumulated into the xNB->UL_INFO structure at the PNF.
+
+The data in the UL_INFO struct is transmitted through a socket in the form of 'uplink indication functions' from the PNF to the VNF. Each uplink indication message is transmitted from their respective handle functions in NR_UL_indication(). For example,
+
+```
+
+void handle_nr_rach(NR_UL_IND_t *UL_info) {
+ if(NFAPI_MODE == NFAPI_MODE_PNF) {
+ if (UL_info->rach_ind.number_of_pdus>0) {
+ oai_nfapi_nr_rach_indication(&UL_info->rach_ind); //This function calls the routines required for packing + transmission through socket
+ UL_info->rach_ind.number_of_pdus = 0;
+ }
+ }
+
+```
+
+## P7 UL reception at VNF
+
+Through the infinite loop [while(vnf_p7->terminate == 0)] running in nfapi_nr_vnf_p7_start(), the VNF receives and unpacks the uplink indication message received on its socket. Based on the unpacked messages, UL_INFO struct on the VNF side gets populated.
+
+```
+
+// have a p7 message
+ if(FD_ISSET(vnf_p7->socket, &rfds))
+ {
+ vnf_nr_p7_read_dispatch_message(vnf_p7);
+ }
+
+```
+
+vnf_nr_dispatch_p7_message() is the function that contains the switch on various message headers so that the appropriate unpack function is called.
+
+## P7 DL Transmission by VNF
+
+DL messages are scheduled at the VNF, through NR_UL_indication(). NR_UL_indication() is called when the SFN/slot in the UL_info structure changes (this acts as a trigger for next slot processing, instead of running a separate clock at the VNF). The SFN/slot at the VNF in UL_info is updated using the slot_indication uplink p7 message, which is sent at the beginning of every slot by the PNF. The slot_indication message contains SFN/slot of the TX_thread, so that the scheduler operates slot_ahead slots ahead of the RX thread. This ensures that UL_tti_req is received before RX slot processing at the PNF.
+
+The function NR_schedule_response calls oai_nfapi_[DL P7 msg]_req(), which contains the routines for packing + transmission of scheduled messages through the socket to the PNF. For example, to send the 'TX_data_req' p7 message
+
+```
+
+if (Sched_INFO->TX_req->Number_of_PDUs > 0)
+{
+ oai_nfapi_tx_data_req(Sched_INFO->TX_req);
+}
+
+```
+
+```mermaid
+
+graph TD
+ pselect[VNF socket pselect] -- timed out : end of slot --> call_sched[Call Scheduler NR_UL_indication] -- oai_nfapi_***_req sends the DL p7 msg--> slot_inc[Increment sfn/slot];
+ pselect[VNF socket pselect] -- UL p7 xyz msg recvd --> msg_recvd[Read message vnf_nr_p7_read_dispatch_message] --> header_unpack[Unpack Header] -- switch cases on header --> unpack_msg[Handle Message vnf_handle_nr_xyz] --> fill_ul_info[Fill UL info struct with fn pointer vnf_p7->_public.nr_rx_xyz];
+ fill_ul_info -- update pselect_timeout: next_slot_start - time_xyz_msg_recvd-->pselect;
+ slot_inc -- next slot --> pselect
+
+```
+Note that since DL P7 message reception and TX/RX processing are done on separate threads, there is the issue of the L1 processing threads trying to do their job before the required P7 message is received. In the case of RX processing, since the scheduler operates slot_ahead slots ahead of the RX thread, the required messages conveniently arrive earlier than they are required. However, in the case of TX processing, this cannot be ensured if the scheduler is exactly in sync with the TX thread.
+
+Therefore, we operate the VNF vnf_slot_ahead (which is currently 2) slots ahead of the PNF. This is to ensure that the DL fapi structures for a particular TX slot are all received before TX processing for that slot.
+
+## P7 DL Reception at PNF
+
+Through the infinite loop [while(pnf_p7->terminate == 0)] running in pnf_nr_p7_message_pump(), the PNF receives and unpacks the downlink P7 message received on its socket. Based on the unpacked message, the appropriate message structures are filled in the PNF, and these are used further down the pipeline for processing.
+
+While receiving the DL P7 message, we check whether the message was received within a timing window from which it was sent. The duration of the window can be set by the user (set as a parameter for xnf in the p5 messages). Note that the DL information must be received by the PNF within a timing window at least lesser than the duration of slot_ahead variable (timing_window <= slot_ahead * slot_duration).
+
+```mermaid
+
+graph TB
+ pselect[PNF socket pselect] -- timed out : end of slot --> slot_inc[Increment sfn/slot];
+ pselect[PNF socket pselect] -- DL p7 xyz msg recvd --> msg_recvd[Read message pnf_nr_nfapi_p7_read_dispatch_message] --> header_unpack[Unpack Header] -- switch cases on header --> unpack_msg[Unpack Message pnf_handle_nr_xyz] --> fill_pnf_p7[Fill pnf_p7 global structure pnf_handle_nr_xyz] --Data from pnf_p7 struct copied to fapi structures using pnf_phy_***_req. Called every slot from handle_nr_slot_ind-->pselect;
+
+ slot_inc -- next slot --> pselect
+```
+Once the messages are received, they are filled into slot buffers, and are stored until the processing of the slot that they were meant for.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/RUN_NR_NFAPI.md b/doc/RUN_NR_NFAPI.md
new file mode 100644
index 0000000000..ea7c2590c7
--- /dev/null
+++ b/doc/RUN_NR_NFAPI.md
@@ -0,0 +1,54 @@
+# Procedure to run nFAPI in 5G NR
+
+## Contributed by 5G Testbed IISc
+
+### Developers: Gokul S, Mahesh A, Aniq U R
+
+## Procedure to Build gNB and UE
+
+The regular commands to build gNB and UE can be used
+```
+sudo ./build_oai --gNB --nrUE
+
+```
+## Procedure to run NR nFAPI using RF-Simulator
+
+### Bring up another loopback interface
+
+If running for the first time on your computer, or you have restarted your computer, bring up another loopback interface with this command:
+
+sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up
+
+### VNF command
+```
+sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test
+
+```
+### PNF command
+```
+sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --rfsim --phy-test --rfsimulator.serveraddr server
+
+```
+### UE command
+```
+sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path . -d
+
+```
+## Procedure to run NR nFAPI using Hardware (tested with USRP x310)
+
+### VNF command
+```
+sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test
+
+```
+### PNF command
+```
+sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --phy-test
+
+```
+### UE command
+```
+sudo ./nr-uesoftmodem --usrp-args "addr=*USRP_ADDRESS*,clock_source=external,time_source=external" --phy-test --rrc_config_path ../../../ci-scripts/rrc-files
+
+```
+
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index fc8e13baaa..471704958e 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -85,6 +85,7 @@
#include "T.h"
#include "nfapi/oai_integration/vendor_ext.h"
+#include "executables/softmodem-common.h"
#include
#include
#include
@@ -146,15 +147,12 @@ void rx_func(void *param) {
start_meas(&softmodem_stats_rxtx_sf);
// *******************************************************************
- // NFAPI not yet supported for NR - this code has to be revised
+
if (NFAPI_MODE == NFAPI_MODE_PNF) {
// I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
- //add_subframe(&frame, &subframe, 4);
- //oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
- //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
+ //LOG_D(PHY, "oai_nfapi_slot_ind(frame:%u, slot:%d) ********\n", frame_rx, slot_rx);
start_meas(&nfapi_meas);
- // oai_subframe_ind(frame_rx, slot_rx);
- oai_slot_ind(frame_rx, slot_rx);
+ handle_nr_slot_ind(frame_rx, slot_rx);
stop_meas(&nfapi_meas);
/*if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus||
@@ -452,6 +450,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; instUL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list;*/
gNB->prach_energy_counter = 0;
+ gNB->prb_interpolation = get_softmodem_params()->prb_interpolation;
}
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 0fd9fcb6aa..0bfcdeceae 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -253,6 +253,7 @@ void init_tpools(uint8_t nun_dlsch_threads) {
}
static void get_options(void) {
+ nrUE_params.ofdm_offset_divisor = 8;
paramdef_t cmdline_params[] =CMDLINE_NRUEPARAMS_DESC ;
int numparams = sizeof(cmdline_params)/sizeof(paramdef_t);
config_process_cmdline( cmdline_params,numparams,NULL);
@@ -318,8 +319,9 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
UE->rf_map.card = card_offset;
UE->rf_map.chain = CC_id + chain_offset;
- LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n",
- UE->mode, UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction);
+
+ LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n, do_prb_interpolation %d\n",
+ UE->mode, UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->prb_interpolation);
// Set FP variables
@@ -330,6 +332,8 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d, ssb_start_subcarrier %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs, fp->ssb_start_subcarrier);
+ fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor;
+
}
void init_openair0(void) {
@@ -487,6 +491,7 @@ int main( int argc, char **argv ) {
}
init_symbol_rotation(&UE[CC_id]->frame_parms);
+ init_timeshift_rotation(&UE[CC_id]->frame_parms);
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
#ifdef FR2_TEST
diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h
index 6bbb75e559..3eba5731b0 100644
--- a/executables/nr-uesoftmodem.h
+++ b/executables/nr-uesoftmodem.h
@@ -8,7 +8,8 @@
-#define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization"
+#define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization\n"
+#define CONFIG_HLP_OFFSET_DIV "Divisor for computing OFDM symbol offset in Rx chain (num samples in CP/). Default value is 8. To set the sample offset to 0, set this value ~ 10e6\n"
/***************************************************************************************************************************************/
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
when calling config_get or config_getlist functions */
@@ -29,6 +30,7 @@
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, iptr:(int32_t *)&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \
+ {"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, uptr:(uint32_t *)&nrUE_params.ofdm_offset_divisor, defuintval:UINT_MAX, TYPE_UINT32, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \
@@ -40,32 +42,33 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_NRUE_PHYPARAMS_DESC { \
- { CALIBRX_OPT, CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
- { CALIBRXMED_OPT, CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
- { CALIBRXBYP_OPT, CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
- { DBGPRACH_OPT, CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
- { NOL2CONNECT_OPT, CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
- { CALIBPRACH_OPT, CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
- { DUMPFRAME_OPT, CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
- {"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE,0}, \
- {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE,0}, \
- {"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE,0}, \
- {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \
- {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \
- {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \
- {"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \
- {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
- {"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \
- {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \
- {"r" , CONFIG_HLP_PRB_SA, 0, iptr:&(fp->N_RB_DL), defintval:106, TYPE_UINT, 0}, \
- {"s" , CONFIG_HLP_SSC, 0, u16ptr:&(fp->ssb_start_subcarrier), defintval:516, TYPE_UINT16,0}, \
- {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
- {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \
+ { CALIBRX_OPT, CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
+ { CALIBRXMED_OPT, CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
+ { CALIBRXBYP_OPT, CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
+ { DBGPRACH_OPT, CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
+ { NOL2CONNECT_OPT, CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
+ {CALIBPRACH_OPT, CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
+ { DUMPFRAME_OPT, CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
+ {"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
+ {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
+ {"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
+ {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \
+ {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \
+ {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \
+ {"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \
+ {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
+ {"r" , CONFIG_HLP_PRB, 0, uptr:&(N_RB_DL), defuintval:160, TYPE_UINT, 0}, \
+ {"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \
+ {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \
+ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
+ {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \
+ {"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&(UE->prb_interpolation), defintval:0, TYPE_INT, 0}, \
}
typedef struct {
uint64_t optmask; //mask to store boolean config options
+ uint32_t ofdm_offset_divisor; // Divisor for sample offset computation for each OFDM symbol
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
tpool_t Tpool; // thread pool
} nrUE_params_t;
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index 61e7f32da4..3a7022a502 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -72,6 +72,7 @@ extern "C"
#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
#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_PRBINTER "Do PRB based averaging of channel estimates. Frequency domain linear interpolation by default\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"
@@ -119,6 +120,7 @@ extern "C"
#define SEND_DMRSSYNC softmodem_params.send_dmrs_sync
#define USIM_TEST softmodem_params.usim_test
#define USE_256QAM_TABLE softmodem_params.use_256qam_table
+#define PRB_INTERPOLATION softmodem_params.prb_interpolation
#define NFAPI softmodem_params.nfapi
#define NON_STOP softmodem_params.non_stop
@@ -153,9 +155,10 @@ extern int usrp_tx_thread;
{"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}, \
+ {"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, 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}, \
}
@@ -246,6 +249,7 @@ typedef struct {
int hw_timing_advance;
uint32_t send_dmrs_sync;
int use_256qam_table;
+ int prb_interpolation;
uint8_t nfapi;
int non_stop;
} softmodem_params_t;
diff --git a/nfapi/nrNFAPI.md b/nfapi/nrNFAPI.md
deleted file mode 100644
index 299a43fd93..0000000000
--- a/nfapi/nrNFAPI.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Procedure to run nFAPI in 5G NR
-
-## Conributed by 5G Testbed IISC
-### Developers: Sudhakar B,Mahesh K,Gokul S,Aniq U.R
-
-## Procedure to Build gNB and UE
-
-The regular commands to build gNB and UE can be used
-```
-sudo ./build_oai --gNB --UE
-
-```
-## Procedure to run NR nFAPI using RF-Simulator
-
-### VNF command
-```
-sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test
-
-```
-### PNF command
-```
-sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --rfsim --phy-test --rfsimulator.serveraddr server
-
-```
-### UE command
-```
-sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path . -d
-
-```
-## Procedure to run NR nFAPI using Hardware
-Will be updated as we have not yet currently tested on hardware
-
-## Notes
-* In order to acheive the synchronization between VNF and PNF and receive the P7 messages within the timing window the order in which we should run the modules on different terminals is UE->VNF->PNF
-* Currently only downlink is functional and working as we are still working on uplink functionality
diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c
index d9c5df199c..2b1900200a 100644
--- a/nfapi/oai_integration/nfapi_pnf.c
+++ b/nfapi/oai_integration/nfapi_pnf.c
@@ -37,8 +37,6 @@
#include "nfapi_pnf.h"
#include "common/ran_context.h"
#include "openair2/PHY_INTERFACE/phy_stub_UE.h"
-//#include "openair1/PHY/vars.h"
-extern RAN_CONTEXT_t RC;
#include
#include
@@ -50,7 +48,7 @@ extern RAN_CONTEXT_t RC;
#include
#include "fapi_stub.h"
-//#include "fapi_l1.h"
+
#include "common/utils/LOG/log.h"
#include "PHY/INIT/phy_init.h"
@@ -62,7 +60,7 @@ extern RAN_CONTEXT_t RC;
#include
#include
#include
-
+#include "nfapi/open-nFAPI/pnf/inc/pnf_p7.h"
#define NUM_P5_PHY 2
@@ -70,6 +68,7 @@ extern RAN_CONTEXT_t RC;
extern void phy_init_RU(RU_t *);
extern int config_sync_var;
+extern RAN_CONTEXT_t RC;
extern pthread_cond_t nfapi_sync_cond;
extern pthread_mutex_t nfapi_sync_mutex;
@@ -1110,18 +1109,14 @@ int pnf_phy_ul_dci_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
// LOG_D(PHY,"[PNF] HI_DCI0_REQUEST SFN/SF:%05d dci:%d hi:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), req->hi_dci0_request_body.number_of_dci, req->hi_dci0_request_body.number_of_hi);
- //phy_info* phy = (phy_info*)(pnf_p7->user_data);
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
if (proc ==NULL)
proc = &gNB->proc.L1_proc;
for (int i=0; inumPdus; i++) {
- //LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d]\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
if (req->ul_dci_pdu_list[i].PDUType == 0) {
- //LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_DCI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
- nfapi_nr_ul_dci_request_pdus_t *ul_dci_req_pdu = &req->ul_dci_pdu_list[i];
- int SFN=req->SFN+2;
- handle_nfapi_nr_ul_dci_pdu(gNB, SFN, req->Slot, ul_dci_req_pdu);
+ nfapi_nr_ul_dci_request_pdus_t *ul_dci_req_pdu = &req->ul_dci_pdu_list[i];
+ handle_nfapi_nr_ul_dci_pdu(gNB, req->SFN, req->Slot, ul_dci_req_pdu);
}
else {
LOG_E(PHY,"[PNF] UL_DCI_REQ sfn_slot:%d PDU[%d] - unknown pdu type:%d\n", NFAPI_SFNSLOT2DEC(req->SFN, req->Slot), i, req->ul_dci_pdu_list[i].PDUType);
@@ -1181,45 +1176,37 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
int sfn = req->SFN;
int slot = req->Slot;
-
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
if (proc==NULL)
proc = &gNB->proc.L1_proc;
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu_list = req->dl_tti_request_body.dl_tti_pdu_list;
- if (req->dl_tti_request_body.nPDUs)
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d; sfn:%d, slot:%d, nGroup:%u, nPDUs: %u, nUE: %u, PduIdx: %u,\n",
- __FUNCTION__, proc->frame_tx, proc->slot_tx, proc->frame_rx, proc->slot_rx, // TODO: change subframes to slot
- req->SFN,
- req->Slot,
- req->dl_tti_request_body.nGroup,
- req->dl_tti_request_body.nPDUs,
- req->dl_tti_request_body.nUe,
- req->dl_tti_request_body.PduIdx);
+ //if (req->dl_tti_request_body.nPDUs)
+ // NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d; sfn:%d, slot:%d, nGroup:%u, nPDUs: %u, nUE: %u, PduIdx: %u,\n",
+ // __FUNCTION__, proc->frame_tx, proc->slot_tx, proc->frame_rx, proc->slot_rx, // TODO: change subframes to slot
+ // req->SFN,
+ // req->Slot,
+ // req->dl_tti_request_body.nGroup,
+ // req->dl_tti_request_body.nPDUs,
+ // req->dl_tti_request_body.nUe,
+ // req->dl_tti_request_body.PduIdx);
for (int i=0; idl_tti_request_body.nPDUs; i++) {
- // TODO: enable after adding gNB PDCCH:
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d pdcch_vars->num_dci:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size,pdcch_vars->num_dci);
if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE) {
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu=&dl_tti_pdu_list[i];
- memcpy(dl_tti_pdu,&dl_tti_pdu_list[i],sizeof(nfapi_nr_dl_tti_request_pdu_t));
- int SFN=sfn+2;
- handle_nfapi_nr_pdcch_pdu(gNB, SFN, slot, &dl_tti_pdu->pdcch_pdu);
- //dl_tti_pdu_list[i].pdcch_pdu.pdcch_pdu_rel15.numDlDci++; // ?
- // NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() pdcch_vars->num_dci:%d\n", __FUNCTION__, pdcch_vars->num_dci);
- } else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_SSB_PDU_TYPE) {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU:%d BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, i, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]);
- handle_nr_nfapi_ssb_pdu(gNB, sfn, slot, &dl_tti_pdu_list[i]);
- gNB->pbch_configured=1;
- //} else {
- // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() BCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pdu_index);
- //}
- } else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE) {
+ handle_nfapi_nr_pdcch_pdu(gNB, sfn, slot, &dl_tti_pdu->pdcch_pdu);
+ }
+ else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_SSB_PDU_TYPE) {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU:%d BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, i, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]);
+ handle_nr_nfapi_ssb_pdu(gNB, sfn, slot, &dl_tti_pdu_list[i]);
+ gNB->pbch_configured=1;
+ }
+ else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE) {
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu = &dl_tti_pdu_list[i].pdsch_pdu;
- nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15_pdu = &pdsch_pdu->pdsch_pdu_rel15;
- //nfapi_nr_tx_data_request_t *tx_data = tx_data_request[sfn][slot][rel15_pdu->pduIndex];
- nfapi_nr_pdu_t *tx_data = tx_data_request[sfn][slot][0];
+ nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15_pdu = &pdsch_pdu->pdsch_pdu_rel15;
+ nfapi_nr_pdu_t *tx_data = tx_data_request[sfn][slot][rel15_pdu->pduIndex];
if (tx_data != NULL) {
int UE_id = find_nr_dlsch(rel15_pdu->rnti,gNB,SEARCH_EXIST_OR_FREE);
@@ -1232,14 +1219,21 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
LOG_E(PHY,"pnf_phy_dl_config_req illegal harq_pid %d\n", harq_pid);
return(-1);
}
- //uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct;
+
uint8_t *dlsch_sdu = nr_tx_pdus[UE_id][harq_pid];
- memcpy(dlsch_sdu, tx_data->TLVs[0].value.direct,tx_data->PDU_length);//TODO: Check if required
+ memcpy(dlsch_sdu, tx_data->TLVs[0].value.direct,tx_data->PDU_length);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols);
handle_nr_nfapi_pdsch_pdu(gNB, sfn, slot,pdsch_pdu, dlsch_sdu);
- } else {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() DLSCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSLOT2DEC(sfn,slot), rel15_pdu->pduIndex); }
- } else {
+ }
+ else {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() DLSCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSLOT2DEC(sfn,slot), rel15_pdu->pduIndex);
+ }
+ }
+ else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE) {
+ nfapi_nr_dl_tti_csi_rs_pdu *csi_rs_pdu = &dl_tti_pdu_list[i].csi_rs_pdu;
+ handle_nfapi_nr_csirs_pdu(gNB, sfn, slot, csi_rs_pdu);
+ }
+ else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_tti_pdu_list[i].PDUType);
}
}
@@ -1399,13 +1393,10 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) {
int pnf_phy_ul_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_nr_ul_tti_request_t *req) {
- // if (0)LOG_D(PHY,"[PNF] UL_CONFIG_REQ %s() sfn_sf:%d pdu:%d rach_prach_frequency_resources:%d srs_present:%u\n",
- // __FUNCTION__,
- // NFAPI_SFNSF2DEC(req->sfn_sf),
- // req->ul_config_request_body.number_of_pdus,
- // req->ul_config_request_body.rach_prach_frequency_resources,
- // req->ul_config_request_body.srs_present
- // );
+ LOG_D(PHY,"[PNF] UL_TTI_REQ recvd, writing into structs, SFN/slot:%d.%d pdu:%d \n",
+ req->SFN,req->Slot,
+ req->n_pdus
+ );
if (RC.ru == 0) {
return -1;
@@ -2162,7 +2153,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:%u rx:%u]\n",
+ printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\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,
@@ -2213,7 +2204,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:%u rx:%u]\n",
+ printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
__FUNCTION__,
config->vnf_ip_addr, config->vnf_p5_port,
pnf.phys[0].local_addr,
@@ -2272,50 +2263,24 @@ void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
}
}
+void handle_nr_slot_ind(uint16_t sfn, uint16_t slot) {
-long shift_ns,prev_ts_nsec,shift_us;
-void oai_slot_ind(uint16_t sfn, uint16_t slot) {
-
- //slow down PNF
-
- LOG_D(PHY,"%s(sfn:%d, slot:%d)\n", __FUNCTION__, sfn, slot);
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
-
- // if (!(sfn == 0 && slot == 0) && ts.tv_nsec > prev_ts_nsec){
- // shift_ns = ts.tv_nsec - prev_ts_nsec;
- // shift_us = shift_ns/1000;
- // printf("previous: %d, current: %d, shift: %d", prev_ts_nsec, ts.tv_nsec, shift_us);
- // if(500-shift_us > 0)
- // usleep(500-shift_us);
- // // usleep(50);
- // }
- prev_ts_nsec = ts.tv_nsec;
-
-
-//NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s %d.%d (sfn:%u slot:%u) SFN/SLOT(TX):%u\n", __FUNCTION__, ts.tv_sec, ts.tv_nsec, sfn, slot, NFAPI_SFNSLOT2DEC(sfn, slot));
- //TODO FIXME - HACK - DJP - using a global to bodge it in
- if (p7_config_g != NULL && sync_var==0) {
- // DONE: changed for NR x x x x x x x x x x x x x x - - - - - - : x (Frame), - (Slot) (max_numer =2)
- uint16_t sfn_slot_tx = sfn<<6 | slot;
- // if ((sfn % 100 == 0) && slot==0) { // DOUBT: Why 100?
- // struct timespec ts;
- // clock_gettime(CLOCK_MONOTONIC, &ts);
- // NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s %d.%d (sfn:%u slot:%u) SFN/SLOT(TX):%u\n", __FUNCTION__, ts.tv_sec, ts.tv_nsec, sfn, slot, NFAPI_SFNSLOT2DEC(sfn, slot));
- // }
-
- //TODO: send p7_config instead of p7_config_g
- int slot_ret = nfapi_pnf_p7_slot_ind(p7_config_g, p7_config_g->phy_id, sfn, slot);
+ //send VNF slot indication, which is aligned with TX thread, so that it can call the scheduler
+ nfapi_nr_slot_indication_scf_t *ind;
+ ind = (nfapi_nr_slot_indication_scf_t *) malloc(sizeof(nfapi_nr_slot_indication_scf_t));
+ uint8_t slot_ahead = 6;
+ uint32_t sfn_slot_tx = sfnslot_add_slot(sfn, slot, slot_ahead);
+ uint16_t sfn_tx = NFAPI_SFNSLOT2SFN(sfn_slot_tx);
+ uint8_t slot_tx = NFAPI_SFNSLOT2SLOT(sfn_slot_tx);
- // if (subframe_ret) {
- if (slot_ret) {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s(frame:%u slot:%u) SFN/SLOT(TX):%u - PROBLEM with pnf_p7_slot_ind()\n", __FUNCTION__, sfn, slot, sfn_slot_tx, NFAPI_SFNSLOT2DEC(sfn, slot));
- // printing anything causes error: probably because there isn't enough time to accomodate a print statement
- } else {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "***NFAPI subframe handler finished *** \n");
- }
- } else {
- }
+ ind->sfn = sfn_tx;
+ ind->slot = slot_tx;
+ oai_nfapi_nr_slot_indication(ind);
+
+ //copy data from appropriate p7 slot buffers into channel structures for PHY processing
+ nfapi_pnf_p7_slot_ind(p7_config_g, p7_config_g->phy_id, sfn, slot);
+
+ return;
}
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
@@ -2366,3 +2331,42 @@ int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind) {
//free(ind.rx_indication_body.rx_pdu_list);
return retval;
}
+
+//NR UPLINK INDICATION
+
+int oai_nfapi_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) {
+ ind->header.phy_id = 1;
+ ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION;
+ return nfapi_pnf_p7_nr_slot_ind(p7_config_g, ind);
+}
+
+int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) {
+ ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION;
+ return nfapi_pnf_p7_nr_rx_data_ind(p7_config_g, ind);
+}
+
+int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
+ ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION;
+ return nfapi_pnf_p7_nr_crc_ind(p7_config_g, ind);
+}
+
+int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) {
+ ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION;
+ return nfapi_pnf_p7_nr_srs_ind(p7_config_g, ind);
+}
+
+int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) {
+ ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION;
+ return nfapi_pnf_p7_nr_uci_ind(p7_config_g, ind);
+}
+
+int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) {
+ ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION;
+ return nfapi_pnf_p7_nr_rach_ind(p7_config_g, ind);
+}
+
diff --git a/nfapi/oai_integration/nfapi_pnf.h b/nfapi/oai_integration/nfapi_pnf.h
index 61d4847eba..b7ebdb36ea 100644
--- a/nfapi/oai_integration/nfapi_pnf.h
+++ b/nfapi/oai_integration/nfapi_pnf.h
@@ -19,13 +19,20 @@
* contact@openairinterface.org
*/
-#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);
void oai_subframe_ind(uint16_t sfn, uint16_t sf);
-void oai_slot_ind(uint16_t sfn, uint16_t slot);
-#endif
+void handle_nr_slot_ind(uint16_t sfn, uint16_t slot);
+uint32_t sfnslot_add_slot(uint16_t sfn, uint16_t slot, int offset);
+
+int oai_nfapi_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind);
+int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind);
+int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind);
+int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind);
+int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind);
+int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind);
+
diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c
index f4448e71df..d96829e127 100644
--- a/nfapi/oai_integration/nfapi_vnf.c
+++ b/nfapi/oai_integration/nfapi_vnf.c
@@ -33,10 +33,10 @@
#include "nfapi_nr_interface_scf.h"
#include "nfapi_vnf_interface.h"
+#include "nfapi_vnf.h"
#include "nfapi.h"
#include "vendor_ext.h"
-#include "nfapi_vnf.h"
#include "PHY/defs_eNB.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
@@ -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
@@ -584,7 +596,7 @@ extern pthread_mutex_t nfapi_sync_mutex;
extern int nfapi_sync_var;
int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) {
- printf("[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
+ //printf("[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
if (sync==1 && nfapi_sync_var!=0) {
@@ -1002,6 +1014,124 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
return 1;
}
+//NR phy indication
+
+int phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) {
+
+ uint8_t vnf_slot_ahead = 2;
+ uint32_t vnf_sfn_slot = sfnslot_add_slot(ind->sfn, ind->slot, vnf_slot_ahead);
+ uint16_t vnf_sfn = NFAPI_SFNSLOT2SFN(vnf_sfn_slot);
+ uint8_t vnf_slot = NFAPI_SFNSLOT2SLOT(vnf_sfn_slot); //offsetting the vnf from pnf by vnf_slot_head slots
+ struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+ gNB->UL_INFO.frame = vnf_sfn;
+ gNB->UL_INFO.slot = vnf_slot;
+ pthread_mutex_unlock(&gNB->UL_INFO_mutex);
+ LOG_D(MAC, "VNF SFN/Slot %d.%d \n", gNB->UL_INFO.frame, gNB->UL_INFO.slot);
+
+ return 1;
+}
+
+int phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
+ struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+
+ gNB->UL_INFO.crc_ind = *ind;
+
+ if (ind->number_crcs > 0)
+ gNB->UL_INFO.crc_ind.crc_list = malloc(sizeof(nfapi_nr_crc_t)*ind->number_crcs);
+
+ for (int i=0; inumber_crcs; i++)
+ memcpy(&gNB->UL_INFO.crc_ind.crc_list[i], &ind->crc_list[i], sizeof(ind->crc_list[0]));
+
+ pthread_mutex_unlock(&gNB->UL_INFO_mutex);
+
+ return 1;
+}
+
+int phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) {
+ struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+
+ gNB->UL_INFO.rx_ind = *ind;
+
+ if (ind->number_of_pdus > 0)
+ gNB->UL_INFO.rx_ind.pdu_list = malloc(sizeof(nfapi_nr_rx_data_pdu_t)*ind->number_of_pdus);
+
+ for (int i=0; inumber_of_pdus; i++)
+ memcpy(&gNB->UL_INFO.rx_ind.pdu_list[i], &ind->pdu_list[i], sizeof(ind->pdu_list[0]));
+
+
+ pthread_mutex_unlock(&gNB->UL_INFO_mutex);
+
+ return 1;
+}
+
+int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind) {
+ struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+
+ gNB->UL_INFO.uci_ind = *ind;
+
+ if (ind->num_ucis > 0)
+ gNB->UL_INFO.uci_ind.uci_list = malloc(sizeof(nfapi_nr_uci_t)*ind->num_ucis);
+
+ for (int i=0; inum_ucis; i++)
+ memcpy(&gNB->UL_INFO.uci_ind.uci_list[i], &ind->uci_list[i], sizeof(ind->uci_list[0]));
+ //printf("UCI ind written to UL_info: num_ucis: %d, PDU_type : %d. \n", ind->num_ucis, ind->uci_list[0].pdu_type);
+ pthread_mutex_unlock(&gNB->UL_INFO_mutex);
+
+ return 1;
+}
+
+int phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind) {
+ struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+
+ gNB->UL_INFO.srs_ind = *ind;
+
+ if (ind->number_of_pdus > 0)
+ gNB->UL_INFO.srs_ind.pdu_list = malloc(sizeof(nfapi_nr_srs_indication_pdu_t)*ind->number_of_pdus);
+
+ for (int i=0; inumber_of_pdus; i++) {
+ memcpy(&gNB->UL_INFO.srs_ind.pdu_list[i], &ind->pdu_list[i], sizeof(ind->pdu_list[0]));
+
+ LOG_D(MAC, "%s() NFAPI SFN/Slot:%d.%d SRS_IND:number_of_pdus:%d UL_INFO:pdus:%d\n",
+ __FUNCTION__,
+ ind->sfn,ind->slot, ind->number_of_pdus, gNB->UL_INFO.srs_ind.number_of_pdus
+ );
+ }
+
+ pthread_mutex_unlock(&gNB->UL_INFO_mutex);
+
+ return 1;
+}
+
+int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind) {
+ struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+
+ gNB->UL_INFO.rach_ind = *ind;
+
+ if (ind->number_of_pdus > 0)
+ gNB->UL_INFO.rach_ind.pdu_list = malloc(sizeof(nfapi_nr_prach_indication_pdu_t)*ind->number_of_pdus);
+
+ for (int i=0; inumber_of_pdus; i++) {
+ memcpy(&gNB->UL_INFO.rach_ind.pdu_list[i], &ind->pdu_list[i], sizeof(ind->pdu_list[0]));
+
+ LOG_D(MAC, "%s() NFAPI SFN/Slot:%d.%d RACH_IND:number_of_pdus:%d UL_INFO:pdus:%d\n",
+ __FUNCTION__,
+ ind->sfn,ind->slot, ind->number_of_pdus, gNB->UL_INFO.rach_ind.number_of_pdus
+ );
+ }
+
+ pthread_mutex_unlock(&gNB->UL_INFO_mutex);
+
+ return 1;
+}
+
+//end NR phy indication
+
int phy_lbt_dl_indication(struct nfapi_vnf_p7_config *config, nfapi_lbt_dl_indication_t *ind) {
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_lbt_dl_ind(p7_vnf->mac, ind);
@@ -1167,6 +1297,12 @@ void *vnf_nr_p7_thread_start(void *ptr) {
p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
p7_vnf->config->nrach_indication = &phy_nrach_indication;
+ p7_vnf->config->nr_crc_indication = &phy_nr_crc_indication;
+ p7_vnf->config->nr_slot_indication = &phy_nr_slot_indication;
+ p7_vnf->config->nr_rx_data_indication = &phy_nr_rx_data_indication;
+ p7_vnf->config->nr_uci_indication = &phy_nr_uci_indication;
+ p7_vnf->config->nr_rach_indication = &phy_nr_rach_indication;
+ p7_vnf->config->nr_srs_indication = &phy_nr_srs_indication;
p7_vnf->config->malloc = &vnf_allocate;
p7_vnf->config->free = &vnf_deallocate;
p7_vnf->config->trace = &vnf_trace;
@@ -1501,8 +1637,8 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
nfapi_setmode(NFAPI_MODE_VNF);
memset(&vnf, 0, sizeof(vnf));
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
- vnf.p7_vnfs[0].timing_window = 32;
- vnf.p7_vnfs[0].periodic_timing_enabled = 1;
+ vnf.p7_vnfs[0].timing_window = 30;
+ vnf.p7_vnfs[0].periodic_timing_enabled = 0;
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
vnf.p7_vnfs[0].periodic_timing_period = 10;
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
@@ -1620,7 +1756,7 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
//LOG_I(PHY, "sfn:%d,slot:%d\n",dl_config_req->SFN,dl_config_req->Slot);
//printf("\nEntering oai_nfapi_nr_dl_config_req sfn:%d,slot:%d\n",dl_config_req->SFN,dl_config_req->Slot);
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- dl_config_req->header.message_id= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
+ dl_config_req->header.message_id= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
int retval = nfapi_vnf_p7_nr_dl_config_req(p7_config, dl_config_req);
diff --git a/nfapi/oai_integration/nfapi_vnf.h b/nfapi/oai_integration/nfapi_vnf.h
index f4fd6a2bf9..478956f75c 100644
--- a/nfapi/oai_integration/nfapi_vnf.h
+++ b/nfapi/oai_integration/nfapi_vnf.h
@@ -19,9 +19,9 @@
* contact@openairinterface.org
*/
-#if !defined(NFAPI_VNF_H__)
-#define NFAPI_VNF_H__
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
-#endif
+
+uint32_t sfnslot_add_slot(uint16_t sfn, uint16_t slot, int offset);
+
diff --git a/nfapi/open-nFAPI/common/src/debug.c b/nfapi/open-nFAPI/common/src/debug.c
index f53be43223..a45d41d7d7 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: %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);
-}
+/*
+ * 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);
+}
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf
deleted file mode 100644
index 6ee4ec8404..0000000000
Binary files a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf and /dev/null differ
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 be6f92b2b9..9d245446c8 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
@@ -673,6 +673,7 @@ typedef struct {
#define NFAPI_NR_SLOT_INDICATION_PERIOD_NUMEROLOGY_3 125 //us
typedef struct {
+ nfapi_p7_message_header_t header;
uint16_t sfn; //0->1023
uint16_t slot;//0->319
@@ -1492,10 +1493,11 @@ typedef struct
typedef struct
{
+ nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint16_t number_of_pdus;
- nfapi_nr_rx_data_pdu_t* pdu_list;
+ nfapi_nr_rx_data_pdu_t *pdu_list;
} nfapi_nr_rx_data_indication_t;
@@ -1518,6 +1520,7 @@ typedef struct
typedef struct
{
+ nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint16_t number_crcs;
@@ -1653,6 +1656,7 @@ typedef struct
typedef struct
{
+ nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint16_t num_ucis;
@@ -1689,6 +1693,7 @@ typedef struct
typedef struct
{
+ nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint8_t number_of_pdus;
@@ -1721,6 +1726,7 @@ typedef struct{
typedef struct
{
+ nfapi_p7_message_header_t header;
uint16_t sfn;
uint16_t slot;
uint8_t number_of_pdus;
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c
index 0c0a8750bc..23d19482ea 100644
--- a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c
@@ -1,2368 +1,2389 @@
-/*
- * 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 "nfapi_nr_interface.h"
-#include "nfapi_nr_interface_scf.h"
-#include
-
-
-// Pack routines
-//TODO: Add pacl/unpack fns for uint32 and uint64
-static uint8_t pack_nr_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_param_request_t *request = (nfapi_nr_pnf_param_request_t *)msg;
- return pack_vendor_extension_tlv(request->vendor_extension, ppWritePackedMsg, end, config);
-}
-
-static uint8_t pack_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_param_request_t *request = (nfapi_pnf_param_request_t *)msg;
- return pack_vendor_extension_tlv(request->vendor_extension, ppWritePackedMsg, end, config);
-}
-
-static uint8_t pack_pnf_param_general_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_param_general_t *value = (nfapi_pnf_param_general_t *)tlv;
- return ( push8(value->nfapi_sync_mode, ppWritePackedMsg, end) &&
- push8(value->location_mode, ppWritePackedMsg, end) &&
- push16(value->location_coordinates_length, ppWritePackedMsg, end) &&
- pusharray8(value->location_coordinates, NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH, value->location_coordinates_length, ppWritePackedMsg, end) &&
- push32(value->dl_config_timing, ppWritePackedMsg, end) &&
- push32(value->tx_timing, ppWritePackedMsg, end) &&
- push32(value->ul_config_timing, ppWritePackedMsg, end) &&
- push32(value->hi_dci0_timing, ppWritePackedMsg, end) &&
- push16(value->maximum_number_phys, ppWritePackedMsg, end) &&
- push16(value->maximum_total_bandwidth, ppWritePackedMsg, end) &&
- push8(value->maximum_total_number_dl_layers, ppWritePackedMsg, end) &&
- push8(value->maximum_total_number_ul_layers, ppWritePackedMsg, end) &&
- push8(value->shared_bands, ppWritePackedMsg, end) &&
- push8(value->shared_pa, ppWritePackedMsg, end) &&
- pushs16(value->maximum_total_power, ppWritePackedMsg, end) &&
- pusharray8(value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_rf_config_info_t *rf = (nfapi_rf_config_info_t *)elem;
- return (push16(rf->rf_config_index, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_pnf_phy_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_info_t *phy = (nfapi_pnf_phy_info_t *)elem;
- return ( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
- push16(phy->number_of_rfs, ppWritePackedMsg, end) &&
- packarray(phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, ppWritePackedMsg, end, &pack_rf_config_info) &&
- push16(phy->number_of_rf_exclusions, ppWritePackedMsg, end) &&
- packarray(phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, ppWritePackedMsg, end, &pack_rf_config_info) &&
- push16(phy->downlink_channel_bandwidth_supported, ppWritePackedMsg, end) &&
- push16(phy->uplink_channel_bandwidth_supported, ppWritePackedMsg, end) &&
- push8(phy->number_of_dl_layers_supported, ppWritePackedMsg, end) &&
- push8(phy->number_of_ul_layers_supported, ppWritePackedMsg, end) &&
- push16(phy->maximum_3gpp_release_supported, ppWritePackedMsg, end) &&
- push8(phy->nmm_modes_supported, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_pnf_phy_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_t *value = (nfapi_pnf_phy_t *)tlv;
- return ( push16(value->number_of_phys, ppWritePackedMsg, end) &&
- packarray(value->phy, sizeof(nfapi_pnf_phy_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_info));
-}
-
-static uint8_t pack_pnf_rf_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_rf_t *value = (nfapi_pnf_rf_t *)tlv;
- uint16_t rf_index = 0;
-
- if(push16(value->number_of_rfs, ppWritePackedMsg, end) == 0)
- return 0;
-
- for(; rf_index < value->number_of_rfs; ++rf_index) {
- if( !(push16(value->rf[rf_index].rf_config_index, ppWritePackedMsg, end) &&
- push16(value->rf[rf_index].band, ppWritePackedMsg, end) &&
- pushs16(value->rf[rf_index].maximum_transmit_power, ppWritePackedMsg, end) &&
- pushs16(value->rf[rf_index].minimum_transmit_power, ppWritePackedMsg, end) &&
- push8(value->rf[rf_index].number_of_antennas_suppported, ppWritePackedMsg, end) &&
- push32(value->rf[rf_index].minimum_downlink_frequency, ppWritePackedMsg, end) &&
- push32(value->rf[rf_index].maximum_downlink_frequency, ppWritePackedMsg, end) &&
- push32(value->rf[rf_index].minimum_uplink_frequency, ppWritePackedMsg, end) &&
- push32(value->rf[rf_index].maximum_uplink_frequency, ppWritePackedMsg, end)))
- return 0;
- }
-
- return 1;
-}
-static uint8_t pack_pnf_phy_rel10_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel10_info_t *phy = (nfapi_pnf_phy_rel10_info_t *)elem;
- return(push16(phy->phy_config_index, ppWritePackedMsg, end) &&
- push16(phy->transmission_mode_7_supported, ppWritePackedMsg, end) &&
- push16(phy->transmission_mode_8_supported, ppWritePackedMsg, end) &&
- push16(phy->two_antenna_ports_for_pucch, ppWritePackedMsg, end) &&
- push16(phy->transmission_mode_9_supported, ppWritePackedMsg, end) &&
- push16(phy->simultaneous_pucch_pusch, ppWritePackedMsg, end) &&
- push16(phy->four_layer_tx_with_tm3_and_tm4, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_pnf_phy_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel10_t *value = (nfapi_pnf_phy_rel10_t *)tlv;
- return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
- packarray(value->phy, sizeof(nfapi_pnf_phy_rel10_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel10_info));
-}
-
-static uint8_t pack_pnf_phy_rel11_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel11_info_t *phy = (nfapi_pnf_phy_rel11_info_t *)elem;
- return (push16(phy->phy_config_index, ppWritePackedMsg, end) &&
- push16(phy->edpcch_supported, ppWritePackedMsg, end) &&
- push16(phy->multi_ack_csi_reporting, ppWritePackedMsg, end) &&
- push16(phy->pucch_tx_diversity, ppWritePackedMsg, end) &&
- push16(phy->ul_comp_supported, ppWritePackedMsg, end) &&
- push16(phy->transmission_mode_5_supported, ppWritePackedMsg, end ));
-}
-static uint8_t pack_pnf_phy_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel11_t *value = (nfapi_pnf_phy_rel11_t *)tlv;
- return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
- packarray(value->phy, sizeof(nfapi_pnf_phy_rel11_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel11_info));
-}
-static uint8_t pack_pnf_phy_rel12_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel12_info_t *phy = (nfapi_pnf_phy_rel12_info_t *)elem;
- return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
- push16(phy->csi_subframe_set, ppWritePackedMsg, end) &&
- push16(phy->enhanced_4tx_codebook, ppWritePackedMsg, end) &&
- push16(phy->drs_supported, ppWritePackedMsg, end) &&
- push16(phy->ul_64qam_supported, ppWritePackedMsg, end) &&
- push16(phy->transmission_mode_10_supported, ppWritePackedMsg, end) &&
- push16(phy->alternative_bts_indices, ppWritePackedMsg, end));
-}
-static uint8_t pack_pnf_phy_rel12_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel12_t *value = (nfapi_pnf_phy_rel12_t *)tlv;
- return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
- packarray(value->phy, sizeof(nfapi_pnf_phy_rel12_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel12_info));
-}
-
-static uint8_t pack_pnf_phy_rel13_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel13_info_t *phy = (nfapi_pnf_phy_rel13_info_t *)elem;
- return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
- push16(phy->pucch_format4_supported, ppWritePackedMsg, end) &&
- push16(phy->pucch_format5_supported, ppWritePackedMsg, end) &&
- push16(phy->more_than_5_ca_support, ppWritePackedMsg, end) &&
- push16(phy->laa_supported, ppWritePackedMsg, end) &&
- push16(phy->laa_ending_in_dwpts_supported, ppWritePackedMsg, end) &&
- push16(phy->laa_starting_in_second_slot_supported, ppWritePackedMsg, end) &&
- push16(phy->beamforming_supported, ppWritePackedMsg, end) &&
- push16(phy->csi_rs_enhancement_supported, ppWritePackedMsg, end) &&
- push16(phy->drms_enhancement_supported, ppWritePackedMsg, end) &&
- push16(phy->srs_enhancement_supported, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_pnf_phy_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel13_t *value = (nfapi_pnf_phy_rel13_t *)tlv;
- return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
- packarray(value->phy, sizeof(nfapi_pnf_phy_rel13_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel13_info));
-}
-
-static uint8_t pack_pnf_phy_rel13_nb_iot_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel13_nb_iot_info_t *phy = (nfapi_pnf_phy_rel13_nb_iot_info_t *)elem;
- return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
- push16(phy->number_of_rfs, ppWritePackedMsg, end) &&
- packarray(phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, ppWritePackedMsg, end, &pack_rf_config_info) &&
- push16(phy->number_of_rf_exclusions, ppWritePackedMsg, end) &&
- packarray(phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, ppWritePackedMsg, end, &pack_rf_config_info) &&
- push8(phy->number_of_dl_layers_supported, ppWritePackedMsg, end) &&
- push8(phy->number_of_ul_layers_supported, ppWritePackedMsg, end) &&
- push16(phy->maximum_3gpp_release_supported, ppWritePackedMsg, end) &&
- push8(phy->nmm_modes_supported, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_pnf_phy_rel13_nb_iot_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel13_nb_iot_t *value = (nfapi_pnf_phy_rel13_nb_iot_t *)tlv;
- return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
- packarray(value->phy, sizeof(nfapi_pnf_phy_rel13_nb_iot_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_info));
-}
-/*
-static uint8_t pack_nr_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
-{
- nfapi_nr_pnf_param_response_t *pNfapiMsg = (nfapi_nr_pnf_param_response_t*)msg;
-
- return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) &&
- pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-*/
-static uint8_t pack_nr_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_param_response_t *pNfapiMsg = (nfapi_nr_pnf_param_response_t *)msg;
- return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) &&
- pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-static uint8_t pack_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_param_response_t *pNfapiMsg = (nfapi_pnf_param_response_t *)msg;
- return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) &&
- pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) &&
- pack_tlv(NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, ppWritePackedMsg, end, &pack_pnf_rf_value) &&
- pack_tlv(NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, ppWritePackedMsg, end, &pack_pnf_phy_rel10_value) &&
- pack_tlv(NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, ppWritePackedMsg, end, &pack_pnf_phy_rel11_value) &&
- pack_tlv(NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, ppWritePackedMsg, end, &pack_pnf_phy_rel12_value) &&
- pack_tlv(NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, ppWritePackedMsg, end, &pack_pnf_phy_rel13_value) &&
- pack_tlv(NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-static uint8_t pack_phy_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_phy_rf_config_info_t *rf = (nfapi_phy_rf_config_info_t *)elem;
- return (push16(rf->phy_id, ppWritePackedMsg, end) &&
- push16(rf->phy_config_index, ppWritePackedMsg, end) &&
- push16(rf->rf_config_index, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t *)tlv;
- return(push16(value->number_phy_rf_config_info, ppWritePackedMsg, end) &&
- packarray(value->phy_rf_config, sizeof(nfapi_phy_rf_config_info_t), NFAPI_MAX_PHY_RF_INSTANCES, value->number_phy_rf_config_info, ppWritePackedMsg, end, &pack_phy_rf_config_info));
-}
-
-static uint8_t pack_nr_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_config_request_t *pNfapiMsg = (nfapi_nr_pnf_config_request_t *)msg;
- return (pack_tlv(NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, ppWritePackedMsg, end, &pack_pnf_phy_rf_config_value) &&
- //push8(pNfapiMsg->num_tlvs,ppWritePackedMsg,end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_config_request_t *pNfapiMsg = (nfapi_pnf_config_request_t *)msg;
- return (pack_tlv(NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, ppWritePackedMsg, end, &pack_pnf_phy_rf_config_value) &&
- push8(pNfapiMsg->num_tlvs,ppWritePackedMsg,end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-static uint8_t pack_nr_pnf_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_config_response_t *pNfapiMsg = (nfapi_nr_pnf_config_response_t *)msg;
- return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-static uint8_t pack_pnf_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_config_response_t *pNfapiMsg = (nfapi_pnf_config_response_t *)msg;
- return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_pnf_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_start_request_t *pNfapiMsg = (nfapi_nr_pnf_start_request_t *)msg;
- return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_pnf_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_start_request_t *pNfapiMsg = (nfapi_pnf_start_request_t *)msg;
- return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-static uint8_t pack_nr_pnf_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_start_response_t *pNfapiMsg = (nfapi_nr_pnf_start_response_t *)msg;
- return( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-static uint8_t pack_pnf_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_start_response_t *pNfapiMsg = (nfapi_pnf_start_response_t *)msg;
- return( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-static uint8_t pack_nr_pnf_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_stop_request_t *pNfapiMsg = (nfapi_nr_pnf_stop_request_t *)msg;
- return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-
-
-static uint8_t pack_pnf_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_stop_request_t *pNfapiMsg = (nfapi_pnf_stop_request_t *)msg;
- return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-
-static uint8_t pack_nr_pnf_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_stop_response_t *pNfapiMsg = (nfapi_nr_pnf_stop_response_t *)msg;
- return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-static uint8_t pack_pnf_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_stop_response_t *pNfapiMsg = (nfapi_pnf_stop_response_t *)msg;
- return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_param_request_scf_t *pNfapiMsg = (nfapi_nr_param_request_scf_t *)msg;
- return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_param_request_t *pNfapiMsg = (nfapi_param_request_t *)msg;
- return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_uint32_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_uint32_tlv_t *value = (nfapi_uint32_tlv_t *)tlv;
- return push32(value->value, ppWritePackedMsg, end);
-}
-
-static uint8_t unpack_uint32_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_uint32_tlv_t *value = (nfapi_uint32_tlv_t *)tlv;
- return pull32(ppReadPackedMsg, &value->value, end);
-}
-
-
-static uint8_t pack_uint16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_uint16_tlv_t *value = (nfapi_uint16_tlv_t *)tlv;
- return push16(value->value, ppWritePackedMsg, end);
-}
-
-static uint8_t unpack_uint16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_uint16_tlv_t *value = (nfapi_uint16_tlv_t *)tlv;
- return pull16(ppReadPackedMsg, &value->value, end);
-}
-
-static uint8_t pack_int16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_int16_tlv_t *value = (nfapi_int16_tlv_t *)tlv;
- return pushs16(value->value, ppWritePackedMsg, end);
-}
-
-static uint8_t unpack_int16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_int16_tlv_t *value = (nfapi_int16_tlv_t *)tlv;
- return pulls16(ppReadPackedMsg, &value->value, end);
-}
-
-static uint8_t pack_uint8_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_uint8_tlv_t *value = (nfapi_uint8_tlv_t *)tlv;
- return push8(value->value, ppWritePackedMsg, end);
-}
-static uint8_t unpack_uint8_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_uint8_tlv_t *value = (nfapi_uint8_tlv_t *)tlv;
- return pull8(ppReadPackedMsg, &value->value, end);
-}
-
-static uint8_t pack_ipv4_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
- return pusharray8(value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, ppWritePackedMsg, end);
-}
-static uint8_t unpack_ipv4_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
- return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, end);
-}
-static uint8_t pack_ipv6_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_ipv6_address_t *value = (nfapi_ipv6_address_t *)tlv;
- return pusharray8(value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, ppWritePackedMsg, end);
-}
-static uint8_t unpack_ipv6_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
- return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, end);
-}
-
-static uint8_t pack_rf_bands_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_rf_bands_t *value = (nfapi_rf_bands_t *)tlv;
- return ( push16(value->number_rf_bands, ppWritePackedMsg, end) &&
- pusharray16(value->rf_band, NFAPI_MAX_NUM_RF_BANDS, value->number_rf_bands, ppWritePackedMsg, end));
-}
-static uint8_t unpack_rf_bands_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_rf_bands_t *value = (nfapi_rf_bands_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_rf_bands, end) &&
- pullarray16(ppReadPackedMsg, value->rf_band, NFAPI_MAX_NUM_RF_BANDS, value->number_rf_bands, end));
-}
-
-static uint8_t pack_nmm_frequency_bands_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_nmm_frequency_bands_t *value = (nfapi_nmm_frequency_bands_t *)tlv;
- return( push16(value->number_of_rf_bands, ppWritePackedMsg, end) &&
- pusharray16(value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, ppWritePackedMsg, end));
-}
-static uint8_t unpack_nmm_frequency_bands_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_nmm_frequency_bands_t *value = (nfapi_nmm_frequency_bands_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_of_rf_bands, end) &&
- pullarray16(ppReadPackedMsg, value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, end));
-}
-static uint8_t pack_embms_mbsfn_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_embms_mbsfn_config_t *value = (nfapi_embms_mbsfn_config_t *)tlv;
- return ( push16(value->num_mbsfn_config, ppWritePackedMsg, end) &&
- pusharray16(value->radioframe_allocation_period, 8,value->num_mbsfn_config,ppWritePackedMsg, end) &&
- pusharray16(value->radioframe_allocation_offset, 8,value->num_mbsfn_config,ppWritePackedMsg, end) &&
- pusharray8(value->fourframes_flag, 8,value->num_mbsfn_config,ppWritePackedMsg, end) &&
- pusharrays32(value->mbsfn_subframeconfig, 8, value->num_mbsfn_config, ppWritePackedMsg, end));
-}
-// static uint8_t unpack_embms_mbsfn_config_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t* end)
-// {
-// nfapi_embms_mbsfn_config_t* value = (nfapi_embms_mbsfn_config_t*)tlv;
-
-// return ( pull16(ppReadPackedMsg, &value->num_mbsfn_config, end) &&
-// pull16(ppReadPackedMsg, &value->radioframe_allocation_period, end) &&
-// pull16(ppReadPackedMsg, &value->radioframe_allocation_offset, end) &&
-// pull8(ppReadPackedMsg, &value->fourframes_flag, end) &&
-// pullarrays32(ppReadPackedMsg, value->mbsfn_subframeconfig, 8, value->num_mbsfn_config, end));
-// }
-
-static uint8_t pack_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_param_response_t *pNfapiMsg = (nfapi_param_response_t *)msg;
- return( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_L1_STATUS_PHY_STATE_TAG, &pNfapiMsg->l1_status.phy_state, ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- // Do we check the phy state and then just fill those sepecified, however
- // we do not know the duplex mode, so just attempt to pack all and assumme
- // that the callee has set the right tlvs
- pack_tlv(NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.dl_bandwidth_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.ul_bandwidth_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.dl_modulation_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.ul_modulation_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.phy_antenna_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.release_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.mbsfn_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- // laa capability
- pack_tlv(NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &(pNfapiMsg->subframe_config.duplex_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &(pNfapiMsg->subframe_config.pcfich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value)&&
- pack_tlv(NFAPI_SUBFRAME_CONFIG_PB_TAG, &(pNfapiMsg->subframe_config.pb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.dl_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.ul_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.dl_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.ul_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &(pNfapiMsg->rf_config.reference_signal_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.tx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.rx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &(pNfapiMsg->phich_config.phich_resource), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &(pNfapiMsg->phich_config.phich_duration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &(pNfapiMsg->phich_config.phich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &(pNfapiMsg->sch_config.physical_cell_id), ppWritePackedMsg, end,&pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->prach_config.configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->prach_config.zero_correlation_zone_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &(pNfapiMsg->prach_config.high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->prach_config.frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &(pNfapiMsg->pusch_config.hopping_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &(pNfapiMsg->pusch_config.hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &(pNfapiMsg->pusch_config.number_of_subbands), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &(pNfapiMsg->pucch_config.delta_pucch_shift), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &(pNfapiMsg->pucch_config.n_cqi_rb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &(pNfapiMsg->pucch_config.n_an_cs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &(pNfapiMsg->pucch_config.n1_pucch_an), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMBMS_MBSFN_CONFIG_AREA_IDX_TAG, &(pNfapiMsg->embms_sib13_config.mbsfn_area_idx), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_EMBMS_MBSFN_CONFIG_AREA_IDR9_TAG, &(pNfapiMsg->embms_sib13_config.mbsfn_area_id_r9), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMBMS_MBSFN_CONFIG_TAG, &(pNfapiMsg->embms_mbsfn_config), ppWritePackedMsg, end, &pack_embms_mbsfn_config_value) &&
- pack_tlv(NFAPI_FEMBMS_CONFIG_RADIOFRAME_ALLOCATION_PERIOD_TAG, &(pNfapiMsg->fembms_config.radioframe_allocation_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_FEMBMS_CONFIG_RADIOFRAME_ALLOCATION_OFFSET_TAG, &(pNfapiMsg->fembms_config.radioframe_allocation_offset), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_FEMBMS_CONFIG_NON_MBSFN_FLAG_TAG, &(pNfapiMsg->fembms_config.non_mbsfn_config_flag), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_FEMBMS_CONFIG_NON_MBSFN_SUBFRAMECONFIG_TAG, &(pNfapiMsg->fembms_config.non_mbsfn_subframeconfig), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.bandwidth_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &(pNfapiMsg->srs_config.max_up_pts), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.srs_subframe_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &(pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &(pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &(pNfapiMsg->uplink_reference_signal_config.group_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &(pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &(pNfapiMsg->tdd_frame_structure_config.subframe_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &(pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &(pNfapiMsg->l23_config.data_report_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_L23_CONFIG_SFNSF_TAG, &(pNfapiMsg->l23_config.sfnsf), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
- pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
- pack_tlv(NFAPI_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
- pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
- pack_tlv(NFAPI_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) &&
- pack_tlv(NFAPI_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_EARFCN_TAG, &(pNfapiMsg->nfapi_config.earfcn), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
- pack_tlv(NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_umts_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
- pack_tlv(NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_lte_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
- pack_tlv(NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &(pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-static uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- printf("\nRUNNING pack_param_response\n");
- nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg;
- return (push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->cell_param.release_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, &(pNfapiMsg->cell_param.phy_state), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_dl_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_ul_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, &(pNfapiMsg->cell_param.num_config_tlvs_to_report ), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, &(pNfapiMsg->carrier_param.cyclic_prefix), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_dl), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_dl), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_ul), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_ul), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, &(pNfapiMsg->pdcch_param.cce_mapping_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, &(pNfapiMsg->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, &(pNfapiMsg->pdcch_param.coreset_precoder_granularity_coreset), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, &(pNfapiMsg->pdcch_param.pdcch_mu_mimo), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, &(pNfapiMsg->pdcch_param.pdcch_precoder_cycling), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, &(pNfapiMsg->pdcch_param.max_pdcch_per_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, &(pNfapiMsg->pucch_param.pucch_formats), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, &(pNfapiMsg->pucch_param.max_pucchs_per_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pdsch_param.pdsch_mapping_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_allocation_types), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, &(pNfapiMsg->pdsch_param.pdsch_vrb_to_prb_mapping), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, &(pNfapiMsg->pdsch_param.pdsch_cbg), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_config_types), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_max_length), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_additional_pos), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_YBS_PER_SLOT_TAG, &(pNfapiMsg->pdsch_param.max_pdsch_tbs_per_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, &(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, &(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.premption_support), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.pdsch_non_slot_support), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_mux_ulsch_in_pusch), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_only_pusch), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, &(pNfapiMsg->pusch_param.pusch_frequency_hopping), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_config_types), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_max_len), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_additional_pos), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, &(pNfapiMsg->pusch_param.pusch_cbg), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pusch_param.pusch_mapping_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_allocation_types), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, &(pNfapiMsg->pusch_param.pusch_vrb_to_prb_mapping), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, &(pNfapiMsg->pusch_param.pusch_max_ptrs_ports), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, &(pNfapiMsg->pusch_param.max_pduschs_tbs_per_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, &(pNfapiMsg->pusch_param.max_number_mimo_layers_non_cb_pusch), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, &(pNfapiMsg->pusch_param.supported_modulation_order_ul), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, &(pNfapiMsg->pusch_param.max_mu_mimo_users_ul), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, &(pNfapiMsg->pusch_param.dfts_ofdm_support), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, &(pNfapiMsg->pusch_param.pusch_aggregation_factor), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_long_formats), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_short_formats), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, &(pNfapiMsg->prach_param.prach_restricted_sets), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, &(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, &(pNfapiMsg->measurement_param.rssi_measurement_support), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- // config:
- pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_config_request_t *pNfapiMsg = (nfapi_config_request_t *)msg;
- return ( push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
- // Do we check the phy state and then just fill those sepecified, however
- // we do not know the duplex mode, so just attempt to pack all and assumme
- // that the callee has set the right tlvs
- pack_tlv(NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &(pNfapiMsg->subframe_config.duplex_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &(pNfapiMsg->subframe_config.pcfich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SUBFRAME_CONFIG_PB_TAG, &(pNfapiMsg->subframe_config.pb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.dl_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.ul_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.dl_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.ul_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &(pNfapiMsg->rf_config.reference_signal_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.tx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.rx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &(pNfapiMsg->phich_config.phich_resource), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &(pNfapiMsg->phich_config.phich_duration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &(pNfapiMsg->phich_config.phich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &(pNfapiMsg->sch_config.physical_cell_id), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->prach_config.configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->prach_config.zero_correlation_zone_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &(pNfapiMsg->prach_config.high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->prach_config.frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &(pNfapiMsg->pusch_config.hopping_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &(pNfapiMsg->pusch_config.hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &(pNfapiMsg->pusch_config.number_of_subbands), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &(pNfapiMsg->pucch_config.delta_pucch_shift), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &(pNfapiMsg->pucch_config.n_cqi_rb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &(pNfapiMsg->pucch_config.n_an_cs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &(pNfapiMsg->pucch_config.n1_pucch_an), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.bandwidth_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &(pNfapiMsg->srs_config.max_up_pts), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.srs_subframe_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &(pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &(pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &(pNfapiMsg->uplink_reference_signal_config.group_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &(pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG, &(pNfapiMsg->laa_config.ed_threshold_lbt_pdsch), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG, &(pNfapiMsg->laa_config.ed_threshold_lbt_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG, &(pNfapiMsg->laa_config.pd_threshold), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG, &(pNfapiMsg->laa_config.multi_carrier_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG, &(pNfapiMsg->laa_config.multi_carrier_tx), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG, &(pNfapiMsg->laa_config.multi_carrier_freeze), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG, &(pNfapiMsg->laa_config.tx_antenna_ports_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG, &(pNfapiMsg->laa_config.tx_power_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG, &(pNfapiMsg->emtc_config.pbch_repetitions_enable_r13), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_catm_root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->emtc_config.prach_catm_zero_correlation_zone_configuration), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG, &(pNfapiMsg->emtc_config.prach_catm_high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_starting_subframe_periodicity), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_starting_subframe_periodicity), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_starting_subframe_periodicity), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_starting_subframe_periodicity), ppWritePackedMsg, end,
- &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG, &(pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG, &(pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &(pNfapiMsg->tdd_frame_structure_config.subframe_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &(pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &(pNfapiMsg->l23_config.data_report_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_L23_CONFIG_SFNSF_TAG, &(pNfapiMsg->l23_config.sfnsf), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
- pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
- pack_tlv(NFAPI_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
- pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
- pack_tlv(NFAPI_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_PHY_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) &&
- pack_tlv(NFAPI_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_EARFCN_TAG, &(pNfapiMsg->nfapi_config.earfcn), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
- pack_tlv(NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_umts_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
- pack_tlv(NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_lte_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
- pack_tlv(NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &(pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-
-static uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- printf("\n\nEntering pack_config_request\n");
- nfapi_nr_config_request_scf_t *pNfapiMsg = (nfapi_nr_config_request_scf_t *)msg;
- return (push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.dl_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_DL_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.dl_frequency), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_DL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.dl_grid_size[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_DL_K0_TAG, &(pNfapiMsg->carrier_config.dl_k0[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_NUM_RX_ANT_TAG, &(pNfapiMsg->carrier_config.num_rx_ant), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_NUM_TX_ANT_TAG, &(pNfapiMsg->carrier_config.num_tx_ant), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_UL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.ul_grid_size[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_UL_K0_TAG, &(pNfapiMsg->carrier_config.ul_k0[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.uplink_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.uplink_frequency), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG, &(pNfapiMsg->cell_config.frame_duplex_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG, &(pNfapiMsg->prach_config.prach_sequence_length), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG, &(pNfapiMsg->prach_config.restricted_set_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SSB_PER_RACH_TAG, &(pNfapiMsg->prach_config.ssb_per_rach), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG, &(pNfapiMsg->prach_config.prach_sub_c_spacing), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_K1_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].k1), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_zero_corr_conf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].num_root_sequences), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SCS_COMMON_TAG, &(pNfapiMsg->ssb_config.scs_common), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG, &(pNfapiMsg->ssb_config.ss_pbch_power), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_BETA_PSS_TAG, &(pNfapiMsg->ssb_table.beta_pss), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_MIB_TAG, &(pNfapiMsg->ssb_table.MIB), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[0].ssb_mask), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[1].ssb_mask), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG, &(pNfapiMsg->ssb_table.ssb_offset_point_a), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SSB_PERIOD_TAG, &(pNfapiMsg->ssb_table.ssb_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, &(pNfapiMsg->ssb_table.ssb_subcarrier_offset), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_TDD_PERIOD_TAG, &(pNfapiMsg->tdd_table.tdd_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_CONFIG_SLOT_CONFIG_TAG, &(pNfapiMsg->tdd_table.max_tdd_periodicity_list[0].max_num_of_symbol_per_slot_list[0].slot_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- //pack_tlv(NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- //pack_tlv(NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- //pack_tlv(NFAPI_NR_NFAPI_NRARFCN_TAG, &(pNfapiMsg->nfapi_config.nrarfcn), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
- pack_tlv(NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- //pack_tlv(NFAPI_NR_NFAPI_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) &&
- pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_tlv(NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- //pack_tlv(NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-static uint8_t pack_nr_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_config_response_scf_t *pNfapiMsg = (nfapi_nr_config_response_scf_t *)msg;
- return ( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-static uint8_t pack_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t *)msg;
- return ( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-static uint8_t pack_nr_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_start_request_scf_t *pNfapiMsg = (nfapi_nr_start_request_scf_t *)msg;
- return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
-}
-
-static uint8_t pack_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_start_request_t *pNfapiMsg = (nfapi_start_request_t *)msg;
- return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
-}
-
-static uint8_t pack_nr_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_start_response_scf_t *pNfapiMsg = (nfapi_nr_start_response_scf_t *)msg;
- return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end ) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-static uint8_t pack_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_start_response_t *pNfapiMsg = (nfapi_start_response_t *)msg;
- return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end ) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-
-static uint8_t pack_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_stop_request_t *pNfapiMsg = (nfapi_stop_request_t *)msg;
- return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
-}
-
-static uint8_t pack_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t *)msg;
- return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
-}
-
-static uint8_t pack_measurement_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t *)msg;
- return( pack_tlv(NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &(pNfapiMsg->dl_rs_tx_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, &(pNfapiMsg->received_interference_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_tlv(NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &(pNfapiMsg->thermal_noise_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_recevied_interference_power_measurement_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_received_interference_power_measurement_t *value = (nfapi_received_interference_power_measurement_t *)tlv;
- return ( push16(value->number_of_resource_blocks, ppWritePackedMsg, end) &&
- pusharrays16(value->received_interference_power, NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS, value->number_of_resource_blocks, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_measurement_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- nfapi_measurement_response_t *pNfapiMsg = (nfapi_measurement_response_t *)msg;
- return( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_MEASUREMENT_RESPONSE_DL_RS_POWER_MEASUREMENT_TAG, &(pNfapiMsg->dl_rs_tx_power_measurement), ppWritePackedMsg, end, &pack_int16_tlv_value) &&
- pack_tlv(NFAPI_MEASUREMENT_RESPONSE_RECEIVED_INTERFERENCE_POWER_MEASUREMENT_TAG, &(pNfapiMsg->received_interference_power_measurement), ppWritePackedMsg, end,
- &pack_recevied_interference_power_measurement_value) &&
- pack_tlv(NFAPI_MEASUREMENT_RESPONSE_THERMAL_NOISE_MEASUREMENT_TAG, &(pNfapiMsg->thermal_noise_power_measurement), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
- pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- uint8_t result = 0;
-
- // look for the specific message
- switch (header->message_id) {
- case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
- result = pack_nr_pnf_param_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_PARAM_RESPONSE:
- result = pack_nr_pnf_param_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST:
- result = pack_nr_pnf_config_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE:
- result = pack_nr_pnf_config_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST:
- result = pack_nr_pnf_start_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE:
- result = pack_nr_pnf_start_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST:
- result = pack_nr_pnf_stop_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_STOP_RESPONSE:
- result = pack_nr_pnf_stop_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
- result = pack_nr_param_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
- result = pack_nr_param_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
- result = pack_nr_config_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
- result = pack_nr_config_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
- result = pack_nr_start_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
- result = pack_nr_start_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
- result = pack_stop_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE:
- result = pack_stop_response(header, ppWritePackedMsg, end, config);
- break;
-
- default: {
- if(header->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- header->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
- if(config && config->pack_p4_p5_vendor_extension) {
- result = (config->pack_p4_p5_vendor_extension)(header, ppWritePackedMsg, end, config);
- } else {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, header->message_id);
- }
- } else {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, header->message_id);
- }
- }
- break;
- }
-
- return result;
-}
-
-
-static uint8_t pack_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
- uint8_t result = 0;
-
- // look for the specific message
- switch (header->message_id) {
- case NFAPI_PNF_PARAM_REQUEST:
- result = pack_pnf_param_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_PARAM_RESPONSE:
- result = pack_pnf_param_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_CONFIG_REQUEST:
- result = pack_pnf_config_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_CONFIG_RESPONSE:
- result = pack_pnf_config_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_START_REQUEST:
- result = pack_pnf_start_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_START_RESPONSE:
- result = pack_pnf_start_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_STOP_REQUEST:
- result = pack_pnf_stop_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PNF_STOP_RESPONSE:
- result = pack_pnf_stop_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PARAM_REQUEST:
- result = pack_param_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_PARAM_RESPONSE:
- result = pack_param_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_CONFIG_REQUEST:
- result = pack_config_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_CONFIG_RESPONSE:
- result = pack_config_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_START_REQUEST:
- result = pack_start_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_START_RESPONSE:
- result = pack_start_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_STOP_REQUEST:
- result = pack_stop_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_STOP_RESPONSE:
- result = pack_stop_response(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_MEASUREMENT_REQUEST:
- result = pack_measurement_request(header, ppWritePackedMsg, end, config);
- break;
-
- case NFAPI_MEASUREMENT_RESPONSE:
- result = pack_measurement_response(header, ppWritePackedMsg, end, config);
- break;
-
- default: {
- if(header->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- header->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
- if(config && config->pack_p4_p5_vendor_extension) {
- result = (config->pack_p4_p5_vendor_extension)(header, ppWritePackedMsg, end, config);
- } else {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, header->message_id);
- }
- } else {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, header->message_id);
- }
- }
- break;
- }
-
- return result;
-}
-
-
-// helper function for message length calculation -
-// takes the pointers to the start of message to end of message
-
-static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd) {
- if (msgEnd < msgHead) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %d, %d\n", msgHead, msgEnd);
- return 0;
- }
-
- return (msgEnd - msgHead);
-}
-
-// Main pack function - public
-int nfapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t *config) {
- nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
- uint8_t *pWritePackedMessage = pPackedBuf;
- uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
- uint8_t *pPackedLengthField = &pWritePackedMessage[4];
- uint32_t packedMsgLen;
- uint16_t packedMsgLen16;
-
- if (pMessageBuf == NULL || pPackedBuf == NULL) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Pack supplied pointers are null\n");
- return -1;
- }
-
- // pack the message
- if(push16(pMessageHeader->phy_id, &pWritePackedMessage, pPackMessageEnd) &&
- push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd) &&
- push16(0, &pWritePackedMessage, pPackMessageEnd) &&
- push16(pMessageHeader->spare, &pWritePackedMessage, pPackMessageEnd) &&
- pack_nr_p5_message_body(pMessageHeader, &pWritePackedMessage, pPackMessageEnd, config)) {
- // check for a valid message length
- packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pWritePackedMessage);
-
- 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
- if(!push16(packedMsgLen16, &pPackedLengthField, pPackMessageEnd))
- return -1;
-
- // return the packed length
- return (packedMsgLen);
- } else {
- // Failed to pack the meassage
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Failed to pack message\n");
- return -1;
- }
-}
-
-int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t *config) {
- nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
- uint8_t *pWritePackedMessage = pPackedBuf;
- uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
- uint8_t *pPackedLengthField = &pWritePackedMessage[4];
- uint32_t packedMsgLen;
- uint16_t packedMsgLen16;
-
- if (pMessageBuf == NULL || pPackedBuf == NULL) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Pack supplied pointers are null\n");
- return -1;
- }
-
- // pack the message
- if(push16(pMessageHeader->phy_id, &pWritePackedMessage, pPackMessageEnd) &&
- push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd) &&
- push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, pPackMessageEnd) &&
- push16(pMessageHeader->spare, &pWritePackedMessage, pPackMessageEnd) &&
- pack_p5_message_body(pMessageHeader, &pWritePackedMessage, pPackMessageEnd, config)) {
- // check for a valid message length
- packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pWritePackedMessage);
-
- 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
- if(!push16(packedMsgLen16, &pPackedLengthField, pPackMessageEnd))
- return -1;
-
- // return the packed length
- return (packedMsgLen);
- } else {
- // Failed to pack the meassage
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Failed to pack message\n");
- return -1;
- }
-}
-
-
-
-// Unpack routines
-
-
-static uint8_t unpack_nr_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_param_request_t *pNfapiMsg = (nfapi_nr_pnf_param_request_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_param_request_t *pNfapiMsg = (nfapi_pnf_param_request_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_pnf_param_general_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_param_general_t *value = (nfapi_pnf_param_general_t *)tlv;
- return( pull8(ppReadPackedMsg, &value->nfapi_sync_mode, end) &&
- pull8(ppReadPackedMsg, &value->location_mode, end) &&
- pull16(ppReadPackedMsg, &value->location_coordinates_length, end) &&
- pullarray8(ppReadPackedMsg, value->location_coordinates, NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH, value->location_coordinates_length, end) &&
- pull32(ppReadPackedMsg, &value->dl_config_timing, end) &&
- pull32(ppReadPackedMsg, &value->tx_timing, end) &&
- pull32(ppReadPackedMsg, &value->ul_config_timing, end) &&
- pull32(ppReadPackedMsg, &value->hi_dci0_timing, end) &&
- pull16(ppReadPackedMsg, &value->maximum_number_phys, end) &&
- pull16(ppReadPackedMsg, &value->maximum_total_bandwidth, end) &&
- pull8(ppReadPackedMsg, &value->maximum_total_number_dl_layers, end) &&
- pull8(ppReadPackedMsg, &value->maximum_total_number_ul_layers, end) &&
- pull8(ppReadPackedMsg, &value->shared_bands, end) &&
- pull8(ppReadPackedMsg, &value->shared_pa, end) &&
- pulls16(ppReadPackedMsg, &value->maximum_total_power, end) &&
- pullarray8(ppReadPackedMsg, value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, end));
-}
-
-static uint8_t unpack_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_rf_config_info_t *info = (nfapi_rf_config_info_t *)elem;
- return pull16(ppReadPackedMsg, &info->rf_config_index, end);
-}
-
-static uint8_t unpack_pnf_phy_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_info_t *phy = (nfapi_pnf_phy_info_t *)elem;
- return ( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
- pull16(ppReadPackedMsg, &phy->number_of_rfs, end) &&
- unpackarray(ppReadPackedMsg, phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, end, &unpack_rf_config_info) &&
- pull16(ppReadPackedMsg, &phy->number_of_rf_exclusions, end) &&
- unpackarray(ppReadPackedMsg, phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, end, &unpack_rf_config_info) &&
- pull16(ppReadPackedMsg, &phy->downlink_channel_bandwidth_supported, end) &&
- pull16(ppReadPackedMsg, &phy->uplink_channel_bandwidth_supported, end) &&
- pull8(ppReadPackedMsg, &phy->number_of_dl_layers_supported, end) &&
- pull8(ppReadPackedMsg, &phy->number_of_ul_layers_supported, end) &&
- pull16(ppReadPackedMsg, &phy->maximum_3gpp_release_supported, end) &&
- pull8(ppReadPackedMsg, &phy->nmm_modes_supported, end));
-}
-
-
-static uint8_t unpack_pnf_phy_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_t *value = (nfapi_pnf_phy_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
- unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_info));
-}
-
-static uint8_t unpack_pnf_rf_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_rf_info_t *rf = (nfapi_pnf_rf_info_t *)elem;
- return( pull16(ppReadPackedMsg, &rf->rf_config_index, end) &&
- pull16(ppReadPackedMsg, &rf->band, end) &&
- pulls16(ppReadPackedMsg, &rf->maximum_transmit_power, end) &&
- pulls16(ppReadPackedMsg, &rf->minimum_transmit_power, end) &&
- pull8(ppReadPackedMsg, &rf->number_of_antennas_suppported, end) &&
- pull32(ppReadPackedMsg, &rf->minimum_downlink_frequency, end) &&
- pull32(ppReadPackedMsg, &rf->maximum_downlink_frequency, end) &&
- pull32(ppReadPackedMsg, &rf->minimum_uplink_frequency, end) &&
- pull32(ppReadPackedMsg, &rf->maximum_uplink_frequency, end));
-}
-static uint8_t unpack_pnf_rf_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_rf_t *value = (nfapi_pnf_rf_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_of_rfs, end) &&
- unpackarray(ppReadPackedMsg, value->rf, sizeof(nfapi_pnf_rf_info_t), NFAPI_MAX_PNF_RF, value->number_of_rfs, end, &unpack_pnf_rf_info));
-}
-
-static uint8_t unpack_pnf_phy_rel10_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel10_info_t *phy = (nfapi_pnf_phy_rel10_info_t *)elem;
- return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
- pull16(ppReadPackedMsg, &phy->transmission_mode_7_supported, end) &&
- pull16(ppReadPackedMsg, &phy->transmission_mode_8_supported, end) &&
- pull16(ppReadPackedMsg, &phy->two_antenna_ports_for_pucch, end) &&
- pull16(ppReadPackedMsg, &phy->transmission_mode_9_supported, end) &&
- pull16(ppReadPackedMsg, &phy->simultaneous_pucch_pusch, end) &&
- pull16(ppReadPackedMsg, &phy->four_layer_tx_with_tm3_and_tm4, end));
-}
-static uint8_t unpack_pnf_phy_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel10_t *value = (nfapi_pnf_phy_rel10_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
- unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel10_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel10_info));
-}
-
-
-static uint8_t unpack_pnf_phy_rel11_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel11_info_t *phy = (nfapi_pnf_phy_rel11_info_t *)elem;
- return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
- pull16(ppReadPackedMsg, &phy->edpcch_supported, end) &&
- pull16(ppReadPackedMsg, &phy->multi_ack_csi_reporting, end ) &&
- pull16(ppReadPackedMsg, &phy->pucch_tx_diversity, end) &&
- pull16(ppReadPackedMsg, &phy->ul_comp_supported, end) &&
- pull16(ppReadPackedMsg, &phy->transmission_mode_5_supported, end));
-}
-
-static uint8_t unpack_pnf_phy_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel11_t *value = (nfapi_pnf_phy_rel11_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
- unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel11_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel11_info));
-}
-
-static uint8_t unpack_phy_phy_rel12_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel12_info_t *phy = (nfapi_pnf_phy_rel12_info_t *)elem;
- return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
- pull16(ppReadPackedMsg, &phy->csi_subframe_set, end) &&
- pull16(ppReadPackedMsg, &phy->enhanced_4tx_codebook, end) &&
- pull16(ppReadPackedMsg, &phy->drs_supported, end) &&
- pull16(ppReadPackedMsg, &phy->ul_64qam_supported, end) &&
- pull16(ppReadPackedMsg, &phy->transmission_mode_10_supported, end) &&
- pull16(ppReadPackedMsg, &phy->alternative_bts_indices, end));
-}
-
-static uint8_t unpack_pnf_phy_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel12_t *value = (nfapi_pnf_phy_rel12_t *)tlv;
- return (pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
- unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel12_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_phy_phy_rel12_info));
-}
-
-static uint8_t unpack_pnf_phy_rel13_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel13_info_t *phy = (nfapi_pnf_phy_rel13_info_t *)elem;
- return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
- pull16(ppReadPackedMsg, &phy->pucch_format4_supported, end) &&
- pull16(ppReadPackedMsg, &phy->pucch_format5_supported, end) &&
- pull16(ppReadPackedMsg, &phy->more_than_5_ca_support, end) &&
- pull16(ppReadPackedMsg, &phy->laa_supported, end) &&
- pull16(ppReadPackedMsg, &phy->laa_ending_in_dwpts_supported, end) &&
- pull16(ppReadPackedMsg, &phy->laa_starting_in_second_slot_supported, end) &&
- pull16(ppReadPackedMsg, &phy->beamforming_supported, end) &&
- pull16(ppReadPackedMsg, &phy->csi_rs_enhancement_supported, end) &&
- pull16(ppReadPackedMsg, &phy->drms_enhancement_supported, end) &&
- pull16(ppReadPackedMsg, &phy->srs_enhancement_supported, end));
-}
-
-static uint8_t unpack_pnf_phy_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel13_t *value = (nfapi_pnf_phy_rel13_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
- unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel13_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel13_info));
-}
-
-static uint8_t unpack_pnf_phy_rel13_nb_info_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel13_nb_iot_info_t *phy = (nfapi_pnf_phy_rel13_nb_iot_info_t *)elem;
- return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
- pull16(ppReadPackedMsg, &phy->number_of_rfs, end) &&
- unpackarray(ppReadPackedMsg, phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, end, &unpack_rf_config_info) &&
- pull16(ppReadPackedMsg, &phy->number_of_rf_exclusions, end) &&
- unpackarray(ppReadPackedMsg, phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, end, &unpack_rf_config_info) &&
- pull8(ppReadPackedMsg, &phy->number_of_dl_layers_supported, end) &&
- pull8(ppReadPackedMsg, &phy->number_of_ul_layers_supported, end) &&
- pull16(ppReadPackedMsg, &phy->maximum_3gpp_release_supported, end) &&
- pull8(ppReadPackedMsg, &phy->nmm_modes_supported, end));
-}
-
-static uint8_t unpack_pnf_phy_rel13_nb_iot_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rel13_nb_iot_t *value = (nfapi_pnf_phy_rel13_nb_iot_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
- unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel13_nb_iot_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel13_nb_info_info));
-}
-
-static uint8_t unpack_nr_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_param_response_t *pNfapiMsg = (nfapi_nr_pnf_param_response_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, &unpack_pnf_param_general_value},
- { NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, &unpack_pnf_phy_value},
- };
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-
-static uint8_t unpack_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_param_response_t *pNfapiMsg = (nfapi_pnf_param_response_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, &unpack_pnf_param_general_value},
- { NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, &unpack_pnf_phy_value},
- { NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, &unpack_pnf_rf_value},
- { NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, &unpack_pnf_phy_rel10_value},
- { NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, &unpack_pnf_phy_rel11_value},
- { NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, &unpack_pnf_phy_rel12_value},
- { NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, &unpack_pnf_phy_rel13_value},
- { NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, &unpack_pnf_phy_rel13_nb_iot_value},
-
- };
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_phy_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_phy_rf_config_info_t *rf = (nfapi_phy_rf_config_info_t *)elem;
- return( pull16(ppReadPackedMsg, &rf->phy_id, end) &&
- pull16(ppReadPackedMsg, &rf->phy_config_index, end) &&
- pull16(ppReadPackedMsg, &rf->rf_config_index, end));
-}
-
-static uint8_t unpack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_phy_rf_config_info, end) &&
- unpackarray(ppReadPackedMsg, value->phy_rf_config, sizeof(nfapi_phy_rf_config_info_t), NFAPI_MAX_PHY_RF_INSTANCES, value->number_phy_rf_config_info, end, &unpack_phy_rf_config_info));
-}
-
-static uint8_t unpack_nr_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_config_request_t *pNfapiMsg = (nfapi_nr_pnf_config_request_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, &unpack_pnf_phy_rf_config_value},
- };
- return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension);
-}
-
-
-
-static uint8_t unpack_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_config_request_t *pNfapiMsg = (nfapi_pnf_config_request_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, &unpack_pnf_phy_rf_config_value},
- };
- return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension);
-}
-
-
-static uint8_t unpack_nr_pnf_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_config_response_t *pNfapiMsg = (nfapi_nr_pnf_config_response_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-static uint8_t unpack_pnf_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_config_response_t *pNfapiMsg = (nfapi_pnf_config_response_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-static uint8_t unpack_nr_pnf_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_start_request_t *pNfapiMsg = (nfapi_nr_pnf_start_request_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_pnf_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_start_request_t *pNfapiMsg = (nfapi_pnf_start_request_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_pnf_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_start_response_t *pNfapiMsg = (nfapi_pnf_start_response_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end ) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-static uint8_t unpack_nr_pnf_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_pnf_start_response_t *pNfapiMsg = (nfapi_nr_pnf_start_response_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end ) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-
-static uint8_t unpack_pnf_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_stop_request_t *pNfapiMsg = (nfapi_pnf_stop_request_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_pnf_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_pnf_stop_response_t *pNfapiMsg = (nfapi_pnf_stop_response_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-static uint8_t unpack_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_param_request_t *pNfapiMsg = (nfapi_param_request_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_nr_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_param_request_scf_t *pNfapiMsg = (nfapi_nr_param_request_scf_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_param_response_t *pNfapiMsg = (nfapi_param_response_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_L1_STATUS_PHY_STATE_TAG, &pNfapiMsg->l1_status.phy_state, &unpack_uint16_tlv_value},
-
- { NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.dl_bandwidth_support, &unpack_uint16_tlv_value},
- { NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.ul_bandwidth_support, &unpack_uint16_tlv_value},
- { NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.dl_modulation_support, &unpack_uint16_tlv_value},
- { NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.ul_modulation_support, &unpack_uint16_tlv_value},
- { NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.phy_antenna_capability, &unpack_uint16_tlv_value},
- { NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.release_capability, &unpack_uint16_tlv_value},
- { NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.mbsfn_capability, &unpack_uint16_tlv_value},
-
- { NFAPI_LAA_CAPABILITY_LAA_SUPPORT_TAG, &pNfapiMsg->laa_capability.laa_support, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CAPABILITY_PD_SENSING_LBT_SUPPORT_TAG, &pNfapiMsg->laa_capability.pd_sensing_lbt_support, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CAPABILITY_MULTI_CARRIER_LBT_SUPPORT_TAG, &pNfapiMsg->laa_capability.multi_carrier_lbt_support, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CAPABILITY_PARTIAL_SF_SUPPORT_TAG, &pNfapiMsg->laa_capability.partial_sf_support, &unpack_uint16_tlv_value},
-
- { NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &pNfapiMsg->subframe_config.duplex_mode, &unpack_uint16_tlv_value},
- { NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &pNfapiMsg->subframe_config.pcfich_power_offset, &unpack_uint16_tlv_value},
- { NFAPI_SUBFRAME_CONFIG_PB_TAG, &pNfapiMsg->subframe_config.pb, &unpack_uint16_tlv_value},
- { NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.dl_cyclic_prefix_type, &unpack_uint16_tlv_value},
- { NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.ul_cyclic_prefix_type, &unpack_uint16_tlv_value},
-
- { NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.dl_channel_bandwidth, &unpack_uint16_tlv_value},
- { NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.ul_channel_bandwidth, &unpack_uint16_tlv_value},
- { NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &pNfapiMsg->rf_config.reference_signal_power, &unpack_uint16_tlv_value},
- { NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.tx_antenna_ports, &unpack_uint16_tlv_value},
- { NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.rx_antenna_ports, &unpack_uint16_tlv_value},
-
- { NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &pNfapiMsg->phich_config.phich_resource, &unpack_uint16_tlv_value},
- { NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &pNfapiMsg->phich_config.phich_duration, &unpack_uint16_tlv_value},
- { NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &pNfapiMsg->phich_config.phich_power_offset, &unpack_uint16_tlv_value},
-
- { NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
- { NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
- { NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &pNfapiMsg->sch_config.physical_cell_id, &unpack_uint16_tlv_value},
-
- { NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &pNfapiMsg->prach_config.configuration_index, &unpack_uint16_tlv_value},
- { NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->prach_config.root_sequence_index, &unpack_uint16_tlv_value},
- { NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->prach_config.zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
- { NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &pNfapiMsg->prach_config.high_speed_flag, &unpack_uint16_tlv_value},
- { NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &pNfapiMsg->prach_config.frequency_offset, &unpack_uint16_tlv_value},
-
- { NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &pNfapiMsg->pusch_config.hopping_mode, &unpack_uint16_tlv_value},
- { NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &pNfapiMsg->pusch_config.hopping_offset, &unpack_uint16_tlv_value},
- { NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &pNfapiMsg->pusch_config.number_of_subbands, &unpack_uint16_tlv_value},
-
- { NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &pNfapiMsg->pucch_config.delta_pucch_shift, &unpack_uint16_tlv_value},
- { NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &pNfapiMsg->pucch_config.n_cqi_rb, &unpack_uint16_tlv_value},
- { NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &pNfapiMsg->pucch_config.n_an_cs, &unpack_uint16_tlv_value},
- { NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &pNfapiMsg->pucch_config.n1_pucch_an, &unpack_uint16_tlv_value},
-
- { NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &pNfapiMsg->srs_config.bandwidth_configuration, &unpack_uint16_tlv_value},
- { NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &pNfapiMsg->srs_config.max_up_pts, &unpack_uint16_tlv_value},
- { NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &pNfapiMsg->srs_config.srs_subframe_configuration, &unpack_uint16_tlv_value},
- { NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission, &unpack_uint16_tlv_value},
-
- { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping, &unpack_uint16_tlv_value},
- { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &pNfapiMsg->uplink_reference_signal_config.group_assignment, &unpack_uint16_tlv_value},
- { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms, &unpack_uint16_tlv_value},
-
- { NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &pNfapiMsg->tdd_frame_structure_config.subframe_assignment, &unpack_uint16_tlv_value},
- { NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns, &unpack_uint16_tlv_value},
-
- { NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &pNfapiMsg->l23_config.data_report_mode, &unpack_uint16_tlv_value},
- { NFAPI_L23_CONFIG_SFNSF_TAG, &pNfapiMsg->l23_config.sfnsf, &unpack_uint16_tlv_value},
-
- { NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value},
- { NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value},
- { NFAPI_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value},
- { NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value},
- { NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value},
- { NFAPI_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value},
- { NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.dl_ue_per_sf, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.ul_ue_per_sf, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_RF_BANDS_TAG, &pNfapiMsg->nfapi_config.rf_bands, &unpack_rf_bands_value},
- { NFAPI_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &pNfapiMsg->nfapi_config.max_transmit_power, &unpack_uint16_tlv_value},
- { NFAPI_NFAPI_EARFCN_TAG, &pNfapiMsg->nfapi_config.earfcn, &unpack_uint16_tlv_value},
- { NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands, &unpack_nmm_frequency_bands_value},
- { NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_umts_frequency_bands, &unpack_nmm_frequency_bands_value},
- { NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_lte_frequency_bands, &unpack_nmm_frequency_bands_value},
- { NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported, &unpack_uint8_tlv_value},
-
- };
- return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->cell_param.release_capability), &unpack_uint16_tlv_value},
- { NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, &(pNfapiMsg->cell_param.phy_state),&unpack_uint16_tlv_value},
- { NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_dl_config), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_ul_config), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, &(pNfapiMsg->cell_param.num_config_tlvs_to_report ), &unpack_uint16_tlv_value},
-
- { NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, &(pNfapiMsg->carrier_param.cyclic_prefix), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_dl), &unpack_uint16_tlv_value},
- { NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_dl), &unpack_uint16_tlv_value},
- { NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_ul), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_ul), &unpack_uint16_tlv_value},
-
-
- { NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, &(pNfapiMsg->pdcch_param.cce_mapping_type), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, &(pNfapiMsg->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, &(pNfapiMsg->pdcch_param.coreset_precoder_granularity_coreset), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, &(pNfapiMsg->pdcch_param.pdcch_mu_mimo), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, &(pNfapiMsg->pdcch_param.pdcch_precoder_cycling), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, &(pNfapiMsg->pdcch_param.max_pdcch_per_slot), &unpack_uint8_tlv_value},
-
- { NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, &(pNfapiMsg->pucch_param.pucch_formats), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, &(pNfapiMsg->pucch_param.max_pucchs_per_slot), &unpack_uint8_tlv_value},
-
- { NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pdsch_param.pdsch_mapping_type), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_allocation_types), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, &(pNfapiMsg->pdsch_param.pdsch_vrb_to_prb_mapping), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, &(pNfapiMsg->pdsch_param.pdsch_cbg), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_config_types), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_max_length), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_additional_pos), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_YBS_PER_SLOT_TAG, &(pNfapiMsg->pdsch_param.max_pdsch_tbs_per_slot), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, &(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, &(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.premption_support), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.pdsch_non_slot_support), &unpack_uint8_tlv_value},
-
- { NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_mux_ulsch_in_pusch), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_only_pusch), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, &(pNfapiMsg->pusch_param.pusch_frequency_hopping), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_config_types), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_max_len), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_additional_pos), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, &(pNfapiMsg->pusch_param.pusch_cbg), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pusch_param.pusch_mapping_type), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_allocation_types), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, &(pNfapiMsg->pusch_param.pusch_vrb_to_prb_mapping), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, &(pNfapiMsg->pusch_param.pusch_max_ptrs_ports), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, &(pNfapiMsg->pusch_param.max_pduschs_tbs_per_slot), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, &(pNfapiMsg->pusch_param.max_number_mimo_layers_non_cb_pusch), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, &(pNfapiMsg->pusch_param.supported_modulation_order_ul), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, &(pNfapiMsg->pusch_param.max_mu_mimo_users_ul), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, &(pNfapiMsg->pusch_param.dfts_ofdm_support), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, &(pNfapiMsg->pusch_param.pusch_aggregation_factor), &unpack_uint8_tlv_value},
-
- { NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_long_formats), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_short_formats), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, &(pNfapiMsg->prach_param.prach_restricted_sets), &unpack_uint8_tlv_value},
- { NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, &(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot), &unpack_uint8_tlv_value},
-
- { NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, &(pNfapiMsg->measurement_param.rssi_measurement_support), &unpack_uint8_tlv_value},
- //config
- { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value},
- { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value},
- { NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value},
- { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value},
- { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value},
- { NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value},
- { NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value},
- { NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value},
- { NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value},
- };
- // print ppReadPackedMsg
- uint8_t *ptr = *ppReadPackedMsg;
- printf("\n Read message unpack_param_response: ");
-
- while(ptr < end) {
- printf(" %d ", *ptr);
- ptr++;
- }
-
- printf("\n");
- return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_config_request_t *pNfapiMsg = (nfapi_config_request_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &pNfapiMsg->subframe_config.duplex_mode, &unpack_uint16_tlv_value},
- { NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &pNfapiMsg->subframe_config.pcfich_power_offset, &unpack_uint16_tlv_value},
- { NFAPI_SUBFRAME_CONFIG_PB_TAG, &pNfapiMsg->subframe_config.pb, &unpack_uint16_tlv_value},
- { NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.dl_cyclic_prefix_type, &unpack_uint16_tlv_value},
- { NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.ul_cyclic_prefix_type, &unpack_uint16_tlv_value},
-
- { NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.dl_channel_bandwidth, &unpack_uint16_tlv_value},
- { NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.ul_channel_bandwidth, &unpack_uint16_tlv_value},
- { NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &pNfapiMsg->rf_config.reference_signal_power, &unpack_uint16_tlv_value},
- { NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.tx_antenna_ports, &unpack_uint16_tlv_value},
- { NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.rx_antenna_ports, &unpack_uint16_tlv_value},
-
- { NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &pNfapiMsg->phich_config.phich_resource, &unpack_uint16_tlv_value},
- { NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &pNfapiMsg->phich_config.phich_duration, &unpack_uint16_tlv_value},
- { NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &pNfapiMsg->phich_config.phich_power_offset, &unpack_uint16_tlv_value},
-
- { NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
- { NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
- { NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &pNfapiMsg->sch_config.physical_cell_id, &unpack_uint16_tlv_value},
-
- { NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &pNfapiMsg->prach_config.configuration_index, &unpack_uint16_tlv_value},
- { NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->prach_config.root_sequence_index, &unpack_uint16_tlv_value},
- { NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->prach_config.zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
- { NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &pNfapiMsg->prach_config.high_speed_flag, &unpack_uint16_tlv_value},
- { NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &pNfapiMsg->prach_config.frequency_offset, &unpack_uint16_tlv_value},
-
- { NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &pNfapiMsg->pusch_config.hopping_mode, &unpack_uint16_tlv_value},
- { NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &pNfapiMsg->pusch_config.hopping_offset, &unpack_uint16_tlv_value},
- { NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &pNfapiMsg->pusch_config.number_of_subbands, &unpack_uint16_tlv_value},
-
- { NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &pNfapiMsg->pucch_config.delta_pucch_shift, &unpack_uint16_tlv_value},
- { NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &pNfapiMsg->pucch_config.n_cqi_rb, &unpack_uint16_tlv_value},
- { NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &pNfapiMsg->pucch_config.n_an_cs, &unpack_uint16_tlv_value},
- { NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &pNfapiMsg->pucch_config.n1_pucch_an, &unpack_uint16_tlv_value},
-
- { NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &pNfapiMsg->srs_config.bandwidth_configuration, &unpack_uint16_tlv_value},
- { NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &pNfapiMsg->srs_config.max_up_pts, &unpack_uint16_tlv_value},
- { NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &pNfapiMsg->srs_config.srs_subframe_configuration, &unpack_uint16_tlv_value},
- { NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission, &unpack_uint16_tlv_value},
-
- { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping, &unpack_uint16_tlv_value},
- { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &pNfapiMsg->uplink_reference_signal_config.group_assignment, &unpack_uint16_tlv_value},
- { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms, &unpack_uint16_tlv_value},
-
-
- { NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG, &pNfapiMsg->laa_config.ed_threshold_lbt_pdsch, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG, &pNfapiMsg->laa_config.ed_threshold_lbt_drs, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG, &pNfapiMsg->laa_config.pd_threshold, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG, &pNfapiMsg->laa_config.multi_carrier_type, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG, &pNfapiMsg->laa_config.multi_carrier_tx, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG, &pNfapiMsg->laa_config.multi_carrier_freeze, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG, &pNfapiMsg->laa_config.tx_antenna_ports_drs, &unpack_uint16_tlv_value},
- { NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG, &pNfapiMsg->laa_config.tx_power_drs, &unpack_uint16_tlv_value},
-
- { NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG, &pNfapiMsg->emtc_config.pbch_repetitions_enable_r13, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->emtc_config.prach_catm_root_sequence_index, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->emtc_config.prach_catm_zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG, &pNfapiMsg->emtc_config.prach_catm_high_speed_flag, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_enable, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_configuration_index, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_frequency_offset, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_starting_subframe_periodicity, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_hopping_enable, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_hopping_offset, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_enable, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_configuration_index, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_frequency_offset, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_starting_subframe_periodicity, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_hopping_enable, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_hopping_offset, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_enable, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_configuration_index, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_frequency_offset, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_starting_subframe_periodicity, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_hopping_enable, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_hopping_offset, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_enable, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_configuration_index, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_frequency_offset, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_starting_subframe_periodicity, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_hopping_enable, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_hopping_offset, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG, &pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea, &unpack_uint16_tlv_value},
- { NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG, &pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb, &unpack_uint16_tlv_value},
-
- { NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &pNfapiMsg->tdd_frame_structure_config.subframe_assignment, &unpack_uint16_tlv_value},
- { NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns, &unpack_uint16_tlv_value},
-
- { NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &pNfapiMsg->l23_config.data_report_mode, &unpack_uint16_tlv_value},
- { NFAPI_L23_CONFIG_SFNSF_TAG, &pNfapiMsg->l23_config.sfnsf, &unpack_uint16_tlv_value},
-
- { NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value},
- { NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value},
- { NFAPI_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value},
- { NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value},
- { NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value},
- { NFAPI_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value},
- { NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.dl_ue_per_sf, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.ul_ue_per_sf, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_RF_BANDS_TAG, &pNfapiMsg->nfapi_config.rf_bands, &unpack_rf_bands_value},
- { NFAPI_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value},
- { NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &pNfapiMsg->nfapi_config.max_transmit_power, &unpack_uint16_tlv_value},
- { NFAPI_NFAPI_EARFCN_TAG, &pNfapiMsg->nfapi_config.earfcn, &unpack_uint16_tlv_value},
- { NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands, &unpack_nmm_frequency_bands_value},
- { NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_umts_frequency_bands, &unpack_nmm_frequency_bands_value},
- { NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_lte_frequency_bands, &unpack_nmm_frequency_bands_value},
- { NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported, &unpack_uint8_tlv_value},
-
- };
- return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_config_request_scf_t *pNfapiMsg = (nfapi_nr_config_request_scf_t *)msg;
- pNfapiMsg->tdd_table.max_tdd_periodicity_list = (nfapi_nr_max_tdd_periodicity_t *) malloc(20*sizeof(nfapi_nr_max_tdd_periodicity_t));
-
- for(int i=0; i<40; i++)
- pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list = (nfapi_nr_max_num_of_symbol_per_slot_t *) malloc(14*sizeof(nfapi_nr_max_num_of_symbol_per_slot_t));
-
- pNfapiMsg->prach_config.num_prach_fd_occasions_list=(nfapi_nr_num_prach_fd_occasions_t *) malloc(sizeof(nfapi_nr_num_prach_fd_occasions_t));
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.dl_bandwidth), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_DL_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.dl_frequency), &unpack_uint32_tlv_value},
- { NFAPI_NR_CONFIG_DL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.dl_grid_size[1]), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_DL_K0_TAG, &(pNfapiMsg->carrier_config.dl_k0[1]), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_NUM_RX_ANT_TAG, &(pNfapiMsg->carrier_config.num_rx_ant), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_NUM_TX_ANT_TAG, &(pNfapiMsg->carrier_config.num_tx_ant), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_UL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.ul_grid_size[1]), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_UL_K0_TAG, &(pNfapiMsg->carrier_config.ul_k0[1]), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.uplink_bandwidth), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.uplink_frequency), &unpack_uint32_tlv_value},
- { NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG, &(pNfapiMsg->cell_config.frame_duplex_type), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG, &(pNfapiMsg->prach_config.prach_sequence_length), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG, &(pNfapiMsg->prach_config.restricted_set_config), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_SSB_PER_RACH_TAG, &(pNfapiMsg->prach_config.ssb_per_rach), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG, &(pNfapiMsg->prach_config.prach_sub_c_spacing), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_root_sequence_index), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_K1_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].k1), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_zero_corr_conf), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].num_root_sequences), &unpack_uint8_tlv_value},
-
- { NFAPI_NR_CONFIG_SCS_COMMON_TAG, &(pNfapiMsg->ssb_config.scs_common), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG, &(pNfapiMsg->ssb_config.ss_pbch_power), &unpack_uint32_tlv_value},
- { NFAPI_NR_CONFIG_BETA_PSS_TAG, &(pNfapiMsg->ssb_table.beta_pss), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_MIB_TAG, &(pNfapiMsg->ssb_table.MIB), &unpack_uint32_tlv_value},
- { NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[0].ssb_mask), &unpack_uint32_tlv_value},
- { NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[1].ssb_mask), &unpack_uint32_tlv_value},
-
- { NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG, &(pNfapiMsg->ssb_table.ssb_offset_point_a), &unpack_uint16_tlv_value},
- { NFAPI_NR_CONFIG_SSB_PERIOD_TAG, &(pNfapiMsg->ssb_table.ssb_period), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, &(pNfapiMsg->ssb_table.ssb_subcarrier_offset), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_TDD_PERIOD_TAG, &(pNfapiMsg->tdd_table.tdd_period), &unpack_uint8_tlv_value},
- { NFAPI_NR_CONFIG_SLOT_CONFIG_TAG, &(pNfapiMsg->tdd_table.max_tdd_periodicity_list[0].max_num_of_symbol_per_slot_list[0].slot_config), &unpack_uint8_tlv_value},
- { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), &unpack_ipv4_address_value},
- { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), &unpack_ipv6_address_value},
- { NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), &unpack_uint16_tlv_value},
- { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), &unpack_ipv4_address_value},
- { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), &unpack_ipv6_address_value},
- { NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), &unpack_uint16_tlv_value},
- { NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), &unpack_uint8_tlv_value},
- { NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), &unpack_uint8_tlv_value},
- { NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), &unpack_uint8_tlv_value},
- };
- return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-static uint8_t unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_config_response_scf_t *pNfapiMsg = (nfapi_nr_config_response_scf_t *)msg;
- return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-static uint8_t unpack_nr_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_start_request_scf_t *pNfapiMsg = ( nfapi_nr_start_request_scf_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_start_request_t *pNfapiMsg = ( nfapi_start_request_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_start_response_t *pNfapiMsg = (nfapi_start_response_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-static uint8_t unpack_nr_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_nr_start_response_scf_t *pNfapiMsg = (nfapi_nr_start_response_scf_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-
-static uint8_t unpack_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_stop_request_t *pNfapiMsg = (nfapi_stop_request_t *)msg;
- return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t *)msg;
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
-}
-static uint8_t unpack_measurement_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &pNfapiMsg->dl_rs_tx_power, &unpack_uint16_tlv_value},
- { NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, &pNfapiMsg->received_interference_power, &unpack_uint16_tlv_value},
- { NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &pNfapiMsg->thermal_noise_power, &unpack_uint16_tlv_value},
- };
- return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_received_interference_power_measurement_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_received_interference_power_measurement_t *value = (nfapi_received_interference_power_measurement_t *)tlv;
- return ( pull16(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
- pullarrays16(ppReadPackedMsg, value->received_interference_power, NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS, value->number_of_resource_blocks, end));
-}
-
-
-static uint8_t unpack_measurement_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
- nfapi_measurement_response_t *pNfapiMsg = (nfapi_measurement_response_t *)msg;
- unpack_tlv_t unpack_fns[] = {
- { NFAPI_MEASUREMENT_RESPONSE_DL_RS_POWER_MEASUREMENT_TAG, &pNfapiMsg->dl_rs_tx_power_measurement, &unpack_int16_tlv_value},
- { NFAPI_MEASUREMENT_RESPONSE_RECEIVED_INTERFERENCE_POWER_MEASUREMENT_TAG, &pNfapiMsg->received_interference_power_measurement, &unpack_received_interference_power_measurement_value},
- { NFAPI_MEASUREMENT_RESPONSE_THERMAL_NOISE_MEASUREMENT_TAG, &pNfapiMsg->thermal_noise_power_measurement, &unpack_int16_tlv_value},
- };
- return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-// unpack length check
-
-static int check_nr_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen) {
- int retLen = 0;
-
- switch (msgId) {
- case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_pnf_param_request_t))
- retLen = sizeof(nfapi_pnf_param_request_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_nr_pnf_param_response_t))
- retLen = sizeof(nfapi_nr_pnf_param_response_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_pnf_config_request_t))
- retLen = sizeof(nfapi_nr_pnf_config_request_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_nr_pnf_config_response_t))
- retLen = sizeof(nfapi_nr_pnf_config_response_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_pnf_start_request_t))
- retLen = sizeof(nfapi_nr_pnf_start_request_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_nr_pnf_start_response_t))
- retLen = sizeof(nfapi_nr_pnf_start_response_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_pnf_stop_request_t))
- retLen = sizeof(nfapi_nr_pnf_stop_request_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_nr_pnf_stop_response_t))
- retLen = sizeof(nfapi_nr_pnf_stop_response_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_param_request_scf_t))
- retLen = sizeof(nfapi_nr_param_request_scf_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_nr_param_response_scf_t))
- retLen = sizeof(nfapi_nr_param_response_scf_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_config_request_scf_t))
- retLen = sizeof(nfapi_nr_config_request_scf_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_nr_config_response_scf_t))
- retLen = sizeof(nfapi_nr_config_response_scf_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
- if (unpackedBufLen >= sizeof( nfapi_nr_start_request_scf_t))
- retLen = sizeof( nfapi_nr_start_request_scf_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_nr_start_response_scf_t))
- retLen = sizeof(nfapi_nr_start_response_scf_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_stop_request_t))
- retLen = sizeof(nfapi_stop_request_t);
-
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_stop_response_t))
- retLen = sizeof(nfapi_stop_response_t);
-
- break;
-
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s Unknown message ID %d\n", __FUNCTION__, msgId);
- break;
- }
-
- return retLen;
-}
-
-
-static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) {
- int retLen = 0;
-
- switch (msgId) {
- case NFAPI_PNF_PARAM_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_pnf_param_request_t))
- retLen = sizeof(nfapi_pnf_param_request_t);
-
- break;
-
- case NFAPI_PNF_PARAM_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_pnf_param_response_t))
- retLen = sizeof(nfapi_pnf_param_response_t);
-
- break;
-
- case NFAPI_PNF_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_pnf_config_request_t))
- retLen = sizeof(nfapi_pnf_config_request_t);
-
- break;
-
- case NFAPI_PNF_CONFIG_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_pnf_config_response_t))
- retLen = sizeof(nfapi_pnf_config_response_t);
-
- break;
-
- case NFAPI_PNF_START_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_pnf_start_request_t))
- retLen = sizeof(nfapi_pnf_start_request_t);
-
- break;
-
- case NFAPI_PNF_START_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_pnf_start_response_t))
- retLen = sizeof(nfapi_pnf_start_response_t);
-
- break;
-
- case NFAPI_PNF_STOP_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_pnf_stop_request_t))
- retLen = sizeof(nfapi_pnf_stop_request_t);
-
- break;
-
- case NFAPI_PNF_STOP_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_pnf_stop_response_t))
- retLen = sizeof(nfapi_pnf_stop_response_t);
-
- break;
-
- case NFAPI_PARAM_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_param_request_t))
- retLen = sizeof(nfapi_param_request_t);
-
- break;
-
- case NFAPI_PARAM_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_param_response_t))
- retLen = sizeof(nfapi_param_response_t);
-
- break;
-
- case NFAPI_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_config_request_t))
- retLen = sizeof(nfapi_config_request_t);
-
- break;
-
- case NFAPI_CONFIG_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_config_response_t))
- retLen = sizeof(nfapi_config_response_t);
-
- break;
-
- case NFAPI_START_REQUEST:
- if (unpackedBufLen >= sizeof( nfapi_start_request_t))
- retLen = sizeof( nfapi_start_request_t);
-
- break;
-
- case NFAPI_START_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_start_response_t))
- retLen = sizeof(nfapi_start_response_t);
-
- break;
-
- case NFAPI_STOP_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_stop_request_t))
- retLen = sizeof(nfapi_stop_request_t);
-
- break;
-
- case NFAPI_STOP_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_stop_response_t))
- retLen = sizeof(nfapi_stop_response_t);
-
- break;
-
- case NFAPI_MEASUREMENT_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_measurement_request_t))
- retLen = sizeof(nfapi_measurement_request_t);
-
- break;
-
- case NFAPI_MEASUREMENT_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_measurement_response_t))
- retLen = sizeof(nfapi_measurement_response_t);
-
- break;
-
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s Unknown message ID %d\n", __FUNCTION__, msgId);
- break;
- }
-
- return retLen;
-}
-
-
-// Main unpack functions - public
-
-int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
- nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t)) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
-
- // process the header
- return ( pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->spare, end) );
-}
-
-int nfapi_nr_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
- nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t)) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
-
- uint8_t *ptr = pReadPackedMessage;
- printf("\n Read 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->spare, end))) {
- // failed to read the header
- return -1;
- }
-
- int result = -1;
-
- if(check_nr_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) {
- // the unpack buffer is not big enough for the struct
- return -1;
- }
-
- // look for the specific message
- switch (pMessageHeader->message_id) {
- case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
- result = unpack_nr_pnf_param_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE:
- result = unpack_nr_pnf_param_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST:
- result = unpack_nr_pnf_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE:
- result = unpack_nr_pnf_config_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST:
- result = unpack_nr_pnf_start_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE:
- result = unpack_nr_pnf_start_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST:
- result = unpack_pnf_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE:
- result = unpack_pnf_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
- result = unpack_nr_param_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
- result = unpack_nr_param_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
- result = unpack_nr_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
- result = unpack_nr_config_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
- result = unpack_nr_start_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
- result = unpack_nr_start_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
- result = unpack_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE:
- result = unpack_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_MEASUREMENT_REQUEST:
- result = unpack_measurement_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_MEASUREMENT_RESPONSE:
- result = unpack_measurement_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- default:
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
- if(config && config->unpack_p4_p5_vendor_extension) {
- result = (config->unpack_p4_p5_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 P5 message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
-
- break;
- }
-
- return result;
-}
-
-int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
- nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t)) {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
-
- uint8_t *ptr = pReadPackedMessage;
- printf("\n Read 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->spare, end))) {
- // failed to read the header
- return -1;
- }
-
- int result = -1;
-
- if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) {
- // the unpack buffer is not big enough for the struct
- return -1;
- }
-
- // look for the specific message
- switch (pMessageHeader->message_id) {
- case NFAPI_PNF_PARAM_REQUEST:
- result = unpack_pnf_param_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PNF_PARAM_RESPONSE:
- result = unpack_pnf_param_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PNF_CONFIG_REQUEST:
- result = unpack_pnf_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PNF_CONFIG_RESPONSE:
- result = unpack_pnf_config_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PNF_START_REQUEST:
- result = unpack_pnf_start_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PNF_START_RESPONSE:
- result = unpack_pnf_start_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PNF_STOP_REQUEST:
- result = unpack_pnf_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PNF_STOP_RESPONSE:
- result = unpack_pnf_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PARAM_REQUEST:
- result = unpack_param_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_PARAM_RESPONSE:
- result = unpack_param_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_CONFIG_REQUEST:
- result = unpack_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_CONFIG_RESPONSE:
- result = unpack_config_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_START_REQUEST:
- result = unpack_start_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_START_RESPONSE:
- result = unpack_start_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_STOP_REQUEST:
- result = unpack_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_STOP_RESPONSE:
- result = unpack_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_MEASUREMENT_REQUEST:
- result = unpack_measurement_request(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- case NFAPI_MEASUREMENT_RESPONSE:
- result = unpack_measurement_response(&pReadPackedMessage, end, pMessageHeader, config);
- break;
-
- default:
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
- if(config && config->unpack_p4_p5_vendor_extension) {
- result = (config->unpack_p4_p5_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 P5 message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
-
- break;
- }
-
- return result;
-}
-
+/*
+ * 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 "nfapi_nr_interface.h"
+#include "nfapi_nr_interface_scf.h"
+#include
+
+
+// Pack routines
+//TODO: Add pacl/unpack fns for uint32 and uint64
+static uint8_t pack_nr_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_param_request_t *request = (nfapi_nr_pnf_param_request_t *)msg;
+ return pack_vendor_extension_tlv(request->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_param_request_t *request = (nfapi_pnf_param_request_t *)msg;
+ return pack_vendor_extension_tlv(request->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_pnf_param_general_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_param_general_t *value = (nfapi_pnf_param_general_t *)tlv;
+ return ( push8(value->nfapi_sync_mode, ppWritePackedMsg, end) &&
+ push8(value->location_mode, ppWritePackedMsg, end) &&
+ push16(value->location_coordinates_length, ppWritePackedMsg, end) &&
+ pusharray8(value->location_coordinates, NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH, value->location_coordinates_length, ppWritePackedMsg, end) &&
+ push32(value->dl_config_timing, ppWritePackedMsg, end) &&
+ push32(value->tx_timing, ppWritePackedMsg, end) &&
+ push32(value->ul_config_timing, ppWritePackedMsg, end) &&
+ push32(value->hi_dci0_timing, ppWritePackedMsg, end) &&
+ push16(value->maximum_number_phys, ppWritePackedMsg, end) &&
+ push16(value->maximum_total_bandwidth, ppWritePackedMsg, end) &&
+ push8(value->maximum_total_number_dl_layers, ppWritePackedMsg, end) &&
+ push8(value->maximum_total_number_ul_layers, ppWritePackedMsg, end) &&
+ push8(value->shared_bands, ppWritePackedMsg, end) &&
+ push8(value->shared_pa, ppWritePackedMsg, end) &&
+ pushs16(value->maximum_total_power, ppWritePackedMsg, end) &&
+ pusharray8(value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_rf_config_info_t *rf = (nfapi_rf_config_info_t *)elem;
+ return (push16(rf->rf_config_index, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_pnf_phy_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_info_t *phy = (nfapi_pnf_phy_info_t *)elem;
+ return ( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+ push16(phy->number_of_rfs, ppWritePackedMsg, end) &&
+ packarray(phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, ppWritePackedMsg, end, &pack_rf_config_info) &&
+ push16(phy->number_of_rf_exclusions, ppWritePackedMsg, end) &&
+ packarray(phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, ppWritePackedMsg, end, &pack_rf_config_info) &&
+ push16(phy->downlink_channel_bandwidth_supported, ppWritePackedMsg, end) &&
+ push16(phy->uplink_channel_bandwidth_supported, ppWritePackedMsg, end) &&
+ push8(phy->number_of_dl_layers_supported, ppWritePackedMsg, end) &&
+ push8(phy->number_of_ul_layers_supported, ppWritePackedMsg, end) &&
+ push16(phy->maximum_3gpp_release_supported, ppWritePackedMsg, end) &&
+ push8(phy->nmm_modes_supported, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_pnf_phy_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_t *value = (nfapi_pnf_phy_t *)tlv;
+ return ( push16(value->number_of_phys, ppWritePackedMsg, end) &&
+ packarray(value->phy, sizeof(nfapi_pnf_phy_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_info));
+}
+
+static uint8_t pack_pnf_rf_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_rf_t *value = (nfapi_pnf_rf_t *)tlv;
+ uint16_t rf_index = 0;
+
+ if(push16(value->number_of_rfs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ for(; rf_index < value->number_of_rfs; ++rf_index) {
+ if( !(push16(value->rf[rf_index].rf_config_index, ppWritePackedMsg, end) &&
+ push16(value->rf[rf_index].band, ppWritePackedMsg, end) &&
+ pushs16(value->rf[rf_index].maximum_transmit_power, ppWritePackedMsg, end) &&
+ pushs16(value->rf[rf_index].minimum_transmit_power, ppWritePackedMsg, end) &&
+ push8(value->rf[rf_index].number_of_antennas_suppported, ppWritePackedMsg, end) &&
+ push32(value->rf[rf_index].minimum_downlink_frequency, ppWritePackedMsg, end) &&
+ push32(value->rf[rf_index].maximum_downlink_frequency, ppWritePackedMsg, end) &&
+ push32(value->rf[rf_index].minimum_uplink_frequency, ppWritePackedMsg, end) &&
+ push32(value->rf[rf_index].maximum_uplink_frequency, ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ return 1;
+}
+static uint8_t pack_pnf_phy_rel10_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel10_info_t *phy = (nfapi_pnf_phy_rel10_info_t *)elem;
+ return(push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+ push16(phy->transmission_mode_7_supported, ppWritePackedMsg, end) &&
+ push16(phy->transmission_mode_8_supported, ppWritePackedMsg, end) &&
+ push16(phy->two_antenna_ports_for_pucch, ppWritePackedMsg, end) &&
+ push16(phy->transmission_mode_9_supported, ppWritePackedMsg, end) &&
+ push16(phy->simultaneous_pucch_pusch, ppWritePackedMsg, end) &&
+ push16(phy->four_layer_tx_with_tm3_and_tm4, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_pnf_phy_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel10_t *value = (nfapi_pnf_phy_rel10_t *)tlv;
+ return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+ packarray(value->phy, sizeof(nfapi_pnf_phy_rel10_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel10_info));
+}
+
+static uint8_t pack_pnf_phy_rel11_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel11_info_t *phy = (nfapi_pnf_phy_rel11_info_t *)elem;
+ return (push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+ push16(phy->edpcch_supported, ppWritePackedMsg, end) &&
+ push16(phy->multi_ack_csi_reporting, ppWritePackedMsg, end) &&
+ push16(phy->pucch_tx_diversity, ppWritePackedMsg, end) &&
+ push16(phy->ul_comp_supported, ppWritePackedMsg, end) &&
+ push16(phy->transmission_mode_5_supported, ppWritePackedMsg, end ));
+}
+static uint8_t pack_pnf_phy_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel11_t *value = (nfapi_pnf_phy_rel11_t *)tlv;
+ return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+ packarray(value->phy, sizeof(nfapi_pnf_phy_rel11_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel11_info));
+}
+static uint8_t pack_pnf_phy_rel12_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel12_info_t *phy = (nfapi_pnf_phy_rel12_info_t *)elem;
+ return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+ push16(phy->csi_subframe_set, ppWritePackedMsg, end) &&
+ push16(phy->enhanced_4tx_codebook, ppWritePackedMsg, end) &&
+ push16(phy->drs_supported, ppWritePackedMsg, end) &&
+ push16(phy->ul_64qam_supported, ppWritePackedMsg, end) &&
+ push16(phy->transmission_mode_10_supported, ppWritePackedMsg, end) &&
+ push16(phy->alternative_bts_indices, ppWritePackedMsg, end));
+}
+static uint8_t pack_pnf_phy_rel12_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel12_t *value = (nfapi_pnf_phy_rel12_t *)tlv;
+ return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+ packarray(value->phy, sizeof(nfapi_pnf_phy_rel12_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel12_info));
+}
+
+static uint8_t pack_pnf_phy_rel13_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel13_info_t *phy = (nfapi_pnf_phy_rel13_info_t *)elem;
+ return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+ push16(phy->pucch_format4_supported, ppWritePackedMsg, end) &&
+ push16(phy->pucch_format5_supported, ppWritePackedMsg, end) &&
+ push16(phy->more_than_5_ca_support, ppWritePackedMsg, end) &&
+ push16(phy->laa_supported, ppWritePackedMsg, end) &&
+ push16(phy->laa_ending_in_dwpts_supported, ppWritePackedMsg, end) &&
+ push16(phy->laa_starting_in_second_slot_supported, ppWritePackedMsg, end) &&
+ push16(phy->beamforming_supported, ppWritePackedMsg, end) &&
+ push16(phy->csi_rs_enhancement_supported, ppWritePackedMsg, end) &&
+ push16(phy->drms_enhancement_supported, ppWritePackedMsg, end) &&
+ push16(phy->srs_enhancement_supported, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_pnf_phy_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel13_t *value = (nfapi_pnf_phy_rel13_t *)tlv;
+ return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+ packarray(value->phy, sizeof(nfapi_pnf_phy_rel13_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel13_info));
+}
+
+static uint8_t pack_pnf_phy_rel13_nb_iot_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel13_nb_iot_info_t *phy = (nfapi_pnf_phy_rel13_nb_iot_info_t *)elem;
+ return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+ push16(phy->number_of_rfs, ppWritePackedMsg, end) &&
+ packarray(phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, ppWritePackedMsg, end, &pack_rf_config_info) &&
+ push16(phy->number_of_rf_exclusions, ppWritePackedMsg, end) &&
+ packarray(phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, ppWritePackedMsg, end, &pack_rf_config_info) &&
+ push8(phy->number_of_dl_layers_supported, ppWritePackedMsg, end) &&
+ push8(phy->number_of_ul_layers_supported, ppWritePackedMsg, end) &&
+ push16(phy->maximum_3gpp_release_supported, ppWritePackedMsg, end) &&
+ push8(phy->nmm_modes_supported, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_pnf_phy_rel13_nb_iot_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel13_nb_iot_t *value = (nfapi_pnf_phy_rel13_nb_iot_t *)tlv;
+ return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+ packarray(value->phy, sizeof(nfapi_pnf_phy_rel13_nb_iot_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_info));
+}
+/*
+static uint8_t pack_nr_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+ nfapi_nr_pnf_param_response_t *pNfapiMsg = (nfapi_nr_pnf_param_response_t*)msg;
+
+ return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) &&
+ pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+*/
+static uint8_t pack_nr_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_param_response_t *pNfapiMsg = (nfapi_nr_pnf_param_response_t *)msg;
+ return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) &&
+ pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_param_response_t *pNfapiMsg = (nfapi_pnf_param_response_t *)msg;
+ return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) &&
+ pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) &&
+ pack_tlv(NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, ppWritePackedMsg, end, &pack_pnf_rf_value) &&
+ pack_tlv(NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, ppWritePackedMsg, end, &pack_pnf_phy_rel10_value) &&
+ pack_tlv(NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, ppWritePackedMsg, end, &pack_pnf_phy_rel11_value) &&
+ pack_tlv(NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, ppWritePackedMsg, end, &pack_pnf_phy_rel12_value) &&
+ pack_tlv(NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, ppWritePackedMsg, end, &pack_pnf_phy_rel13_value) &&
+ pack_tlv(NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_value) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_phy_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_phy_rf_config_info_t *rf = (nfapi_phy_rf_config_info_t *)elem;
+ return (push16(rf->phy_id, ppWritePackedMsg, end) &&
+ push16(rf->phy_config_index, ppWritePackedMsg, end) &&
+ push16(rf->rf_config_index, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t *)tlv;
+ return(push16(value->number_phy_rf_config_info, ppWritePackedMsg, end) &&
+ packarray(value->phy_rf_config, sizeof(nfapi_phy_rf_config_info_t), NFAPI_MAX_PHY_RF_INSTANCES, value->number_phy_rf_config_info, ppWritePackedMsg, end, &pack_phy_rf_config_info));
+}
+
+static uint8_t pack_nr_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_config_request_t *pNfapiMsg = (nfapi_nr_pnf_config_request_t *)msg;
+ return (pack_tlv(NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, ppWritePackedMsg, end, &pack_pnf_phy_rf_config_value) &&
+ //push8(pNfapiMsg->num_tlvs,ppWritePackedMsg,end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_config_request_t *pNfapiMsg = (nfapi_pnf_config_request_t *)msg;
+ return (pack_tlv(NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, ppWritePackedMsg, end, &pack_pnf_phy_rf_config_value) &&
+ push8(pNfapiMsg->num_tlvs,ppWritePackedMsg,end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_nr_pnf_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_config_response_t *pNfapiMsg = (nfapi_nr_pnf_config_response_t *)msg;
+ return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_pnf_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_config_response_t *pNfapiMsg = (nfapi_pnf_config_response_t *)msg;
+ return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_pnf_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_start_request_t *pNfapiMsg = (nfapi_nr_pnf_start_request_t *)msg;
+ return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_pnf_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_start_request_t *pNfapiMsg = (nfapi_pnf_start_request_t *)msg;
+ return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_nr_pnf_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_start_response_t *pNfapiMsg = (nfapi_nr_pnf_start_response_t *)msg;
+ return( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_pnf_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_start_response_t *pNfapiMsg = (nfapi_pnf_start_response_t *)msg;
+ return( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_nr_pnf_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_stop_request_t *pNfapiMsg = (nfapi_nr_pnf_stop_request_t *)msg;
+ return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+
+
+static uint8_t pack_pnf_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_stop_request_t *pNfapiMsg = (nfapi_pnf_stop_request_t *)msg;
+ return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+
+static uint8_t pack_nr_pnf_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_stop_response_t *pNfapiMsg = (nfapi_nr_pnf_stop_response_t *)msg;
+ return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_pnf_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_stop_response_t *pNfapiMsg = (nfapi_pnf_stop_response_t *)msg;
+ return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_param_request_scf_t *pNfapiMsg = (nfapi_nr_param_request_scf_t *)msg;
+ return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_param_request_t *pNfapiMsg = (nfapi_param_request_t *)msg;
+ return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_uint32_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_uint32_tlv_t *value = (nfapi_uint32_tlv_t *)tlv;
+ return push32(value->value, ppWritePackedMsg, end);
+}
+
+static uint8_t unpack_uint32_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_uint32_tlv_t *value = (nfapi_uint32_tlv_t *)tlv;
+ return pull32(ppReadPackedMsg, &value->value, end);
+}
+
+
+static uint8_t pack_uint16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_uint16_tlv_t *value = (nfapi_uint16_tlv_t *)tlv;
+ return push16(value->value, ppWritePackedMsg, end);
+}
+
+static uint8_t unpack_uint16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_uint16_tlv_t *value = (nfapi_uint16_tlv_t *)tlv;
+ return pull16(ppReadPackedMsg, &value->value, end);
+}
+
+static uint8_t pack_int16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_int16_tlv_t *value = (nfapi_int16_tlv_t *)tlv;
+ return pushs16(value->value, ppWritePackedMsg, end);
+}
+
+static uint8_t unpack_int16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_int16_tlv_t *value = (nfapi_int16_tlv_t *)tlv;
+ return pulls16(ppReadPackedMsg, &value->value, end);
+}
+
+static uint8_t pack_uint8_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_uint8_tlv_t *value = (nfapi_uint8_tlv_t *)tlv;
+ return push8(value->value, ppWritePackedMsg, end);
+}
+static uint8_t unpack_uint8_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_uint8_tlv_t *value = (nfapi_uint8_tlv_t *)tlv;
+ return pull8(ppReadPackedMsg, &value->value, end);
+}
+
+static uint8_t pack_ipv4_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
+ return pusharray8(value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, ppWritePackedMsg, end);
+}
+static uint8_t unpack_ipv4_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
+ return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, end);
+}
+static uint8_t pack_ipv6_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_ipv6_address_t *value = (nfapi_ipv6_address_t *)tlv;
+ return pusharray8(value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, ppWritePackedMsg, end);
+}
+static uint8_t unpack_ipv6_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
+ return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, end);
+}
+
+static uint8_t pack_rf_bands_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_rf_bands_t *value = (nfapi_rf_bands_t *)tlv;
+ return ( push16(value->number_rf_bands, ppWritePackedMsg, end) &&
+ pusharray16(value->rf_band, NFAPI_MAX_NUM_RF_BANDS, value->number_rf_bands, ppWritePackedMsg, end));
+}
+static uint8_t unpack_rf_bands_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_rf_bands_t *value = (nfapi_rf_bands_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_rf_bands, end) &&
+ pullarray16(ppReadPackedMsg, value->rf_band, NFAPI_MAX_NUM_RF_BANDS, value->number_rf_bands, end));
+}
+
+static uint8_t pack_nmm_frequency_bands_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_nmm_frequency_bands_t *value = (nfapi_nmm_frequency_bands_t *)tlv;
+ return( push16(value->number_of_rf_bands, ppWritePackedMsg, end) &&
+ pusharray16(value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, ppWritePackedMsg, end));
+}
+static uint8_t unpack_nmm_frequency_bands_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_nmm_frequency_bands_t *value = (nfapi_nmm_frequency_bands_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_of_rf_bands, end) &&
+ pullarray16(ppReadPackedMsg, value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, end));
+}
+static uint8_t pack_embms_mbsfn_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_embms_mbsfn_config_t *value = (nfapi_embms_mbsfn_config_t *)tlv;
+ return ( push16(value->num_mbsfn_config, ppWritePackedMsg, end) &&
+ pusharray16(value->radioframe_allocation_period, 8,value->num_mbsfn_config,ppWritePackedMsg, end) &&
+ pusharray16(value->radioframe_allocation_offset, 8,value->num_mbsfn_config,ppWritePackedMsg, end) &&
+ pusharray8(value->fourframes_flag, 8,value->num_mbsfn_config,ppWritePackedMsg, end) &&
+ pusharrays32(value->mbsfn_subframeconfig, 8, value->num_mbsfn_config, ppWritePackedMsg, end));
+}
+// static uint8_t unpack_embms_mbsfn_config_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t* end)
+// {
+// nfapi_embms_mbsfn_config_t* value = (nfapi_embms_mbsfn_config_t*)tlv;
+
+// return ( pull16(ppReadPackedMsg, &value->num_mbsfn_config, end) &&
+// pull16(ppReadPackedMsg, &value->radioframe_allocation_period, end) &&
+// pull16(ppReadPackedMsg, &value->radioframe_allocation_offset, end) &&
+// pull8(ppReadPackedMsg, &value->fourframes_flag, end) &&
+// pullarrays32(ppReadPackedMsg, value->mbsfn_subframeconfig, 8, value->num_mbsfn_config, end));
+// }
+
+static uint8_t pack_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_param_response_t *pNfapiMsg = (nfapi_param_response_t *)msg;
+ return( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_L1_STATUS_PHY_STATE_TAG, &pNfapiMsg->l1_status.phy_state, ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ // Do we check the phy state and then just fill those sepecified, however
+ // we do not know the duplex mode, so just attempt to pack all and assumme
+ // that the callee has set the right tlvs
+ pack_tlv(NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.dl_bandwidth_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.ul_bandwidth_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.dl_modulation_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.ul_modulation_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.phy_antenna_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.release_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.mbsfn_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ // laa capability
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &(pNfapiMsg->subframe_config.duplex_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &(pNfapiMsg->subframe_config.pcfich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value)&&
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_PB_TAG, &(pNfapiMsg->subframe_config.pb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.dl_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.ul_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.dl_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.ul_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &(pNfapiMsg->rf_config.reference_signal_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.tx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.rx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &(pNfapiMsg->phich_config.phich_resource), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &(pNfapiMsg->phich_config.phich_duration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &(pNfapiMsg->phich_config.phich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &(pNfapiMsg->sch_config.physical_cell_id), ppWritePackedMsg, end,&pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->prach_config.configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->prach_config.zero_correlation_zone_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &(pNfapiMsg->prach_config.high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->prach_config.frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &(pNfapiMsg->pusch_config.hopping_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &(pNfapiMsg->pusch_config.hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &(pNfapiMsg->pusch_config.number_of_subbands), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &(pNfapiMsg->pucch_config.delta_pucch_shift), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &(pNfapiMsg->pucch_config.n_cqi_rb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &(pNfapiMsg->pucch_config.n_an_cs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &(pNfapiMsg->pucch_config.n1_pucch_an), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMBMS_MBSFN_CONFIG_AREA_IDX_TAG, &(pNfapiMsg->embms_sib13_config.mbsfn_area_idx), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_EMBMS_MBSFN_CONFIG_AREA_IDR9_TAG, &(pNfapiMsg->embms_sib13_config.mbsfn_area_id_r9), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMBMS_MBSFN_CONFIG_TAG, &(pNfapiMsg->embms_mbsfn_config), ppWritePackedMsg, end, &pack_embms_mbsfn_config_value) &&
+ pack_tlv(NFAPI_FEMBMS_CONFIG_RADIOFRAME_ALLOCATION_PERIOD_TAG, &(pNfapiMsg->fembms_config.radioframe_allocation_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_FEMBMS_CONFIG_RADIOFRAME_ALLOCATION_OFFSET_TAG, &(pNfapiMsg->fembms_config.radioframe_allocation_offset), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_FEMBMS_CONFIG_NON_MBSFN_FLAG_TAG, &(pNfapiMsg->fembms_config.non_mbsfn_config_flag), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_FEMBMS_CONFIG_NON_MBSFN_SUBFRAMECONFIG_TAG, &(pNfapiMsg->fembms_config.non_mbsfn_subframeconfig), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.bandwidth_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &(pNfapiMsg->srs_config.max_up_pts), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.srs_subframe_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &(pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &(pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &(pNfapiMsg->uplink_reference_signal_config.group_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &(pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &(pNfapiMsg->tdd_frame_structure_config.subframe_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &(pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &(pNfapiMsg->l23_config.data_report_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_L23_CONFIG_SFNSF_TAG, &(pNfapiMsg->l23_config.sfnsf), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) &&
+ pack_tlv(NFAPI_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_EARFCN_TAG, &(pNfapiMsg->nfapi_config.earfcn), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+ pack_tlv(NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_umts_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+ pack_tlv(NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_lte_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+ pack_tlv(NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &(pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ printf("\nRUNNING pack_param_response\n");
+ nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg;
+ return (push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->cell_param.release_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, &(pNfapiMsg->cell_param.phy_state), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_dl_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_ul_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, &(pNfapiMsg->cell_param.num_config_tlvs_to_report ), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, &(pNfapiMsg->carrier_param.cyclic_prefix), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_dl), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_dl), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_ul), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_ul), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, &(pNfapiMsg->pdcch_param.cce_mapping_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, &(pNfapiMsg->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, &(pNfapiMsg->pdcch_param.coreset_precoder_granularity_coreset), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, &(pNfapiMsg->pdcch_param.pdcch_mu_mimo), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, &(pNfapiMsg->pdcch_param.pdcch_precoder_cycling), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, &(pNfapiMsg->pdcch_param.max_pdcch_per_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, &(pNfapiMsg->pucch_param.pucch_formats), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, &(pNfapiMsg->pucch_param.max_pucchs_per_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pdsch_param.pdsch_mapping_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_allocation_types), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, &(pNfapiMsg->pdsch_param.pdsch_vrb_to_prb_mapping), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, &(pNfapiMsg->pdsch_param.pdsch_cbg), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_config_types), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_max_length), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_additional_pos), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_YBS_PER_SLOT_TAG, &(pNfapiMsg->pdsch_param.max_pdsch_tbs_per_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, &(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, &(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.premption_support), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.pdsch_non_slot_support), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_mux_ulsch_in_pusch), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_only_pusch), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, &(pNfapiMsg->pusch_param.pusch_frequency_hopping), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_config_types), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_max_len), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_additional_pos), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, &(pNfapiMsg->pusch_param.pusch_cbg), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pusch_param.pusch_mapping_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_allocation_types), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, &(pNfapiMsg->pusch_param.pusch_vrb_to_prb_mapping), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, &(pNfapiMsg->pusch_param.pusch_max_ptrs_ports), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, &(pNfapiMsg->pusch_param.max_pduschs_tbs_per_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, &(pNfapiMsg->pusch_param.max_number_mimo_layers_non_cb_pusch), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, &(pNfapiMsg->pusch_param.supported_modulation_order_ul), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, &(pNfapiMsg->pusch_param.max_mu_mimo_users_ul), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, &(pNfapiMsg->pusch_param.dfts_ofdm_support), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, &(pNfapiMsg->pusch_param.pusch_aggregation_factor), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_long_formats), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_short_formats), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, &(pNfapiMsg->prach_param.prach_restricted_sets), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, &(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, &(pNfapiMsg->measurement_param.rssi_measurement_support), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ // config:
+ pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_config_request_t *pNfapiMsg = (nfapi_config_request_t *)msg;
+ return ( push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
+ // Do we check the phy state and then just fill those sepecified, however
+ // we do not know the duplex mode, so just attempt to pack all and assumme
+ // that the callee has set the right tlvs
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &(pNfapiMsg->subframe_config.duplex_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &(pNfapiMsg->subframe_config.pcfich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_PB_TAG, &(pNfapiMsg->subframe_config.pb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.dl_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.ul_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.dl_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.ul_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &(pNfapiMsg->rf_config.reference_signal_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.tx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.rx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &(pNfapiMsg->phich_config.phich_resource), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &(pNfapiMsg->phich_config.phich_duration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &(pNfapiMsg->phich_config.phich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &(pNfapiMsg->sch_config.physical_cell_id), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->prach_config.configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->prach_config.zero_correlation_zone_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &(pNfapiMsg->prach_config.high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->prach_config.frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &(pNfapiMsg->pusch_config.hopping_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &(pNfapiMsg->pusch_config.hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &(pNfapiMsg->pusch_config.number_of_subbands), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &(pNfapiMsg->pucch_config.delta_pucch_shift), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &(pNfapiMsg->pucch_config.n_cqi_rb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &(pNfapiMsg->pucch_config.n_an_cs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &(pNfapiMsg->pucch_config.n1_pucch_an), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.bandwidth_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &(pNfapiMsg->srs_config.max_up_pts), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.srs_subframe_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &(pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &(pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &(pNfapiMsg->uplink_reference_signal_config.group_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &(pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG, &(pNfapiMsg->laa_config.ed_threshold_lbt_pdsch), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG, &(pNfapiMsg->laa_config.ed_threshold_lbt_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG, &(pNfapiMsg->laa_config.pd_threshold), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG, &(pNfapiMsg->laa_config.multi_carrier_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG, &(pNfapiMsg->laa_config.multi_carrier_tx), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG, &(pNfapiMsg->laa_config.multi_carrier_freeze), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG, &(pNfapiMsg->laa_config.tx_antenna_ports_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG, &(pNfapiMsg->laa_config.tx_power_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG, &(pNfapiMsg->emtc_config.pbch_repetitions_enable_r13), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_catm_root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->emtc_config.prach_catm_zero_correlation_zone_configuration), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG, &(pNfapiMsg->emtc_config.prach_catm_high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_starting_subframe_periodicity), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_starting_subframe_periodicity), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_starting_subframe_periodicity), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_starting_subframe_periodicity), ppWritePackedMsg, end,
+ &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG, &(pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG, &(pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &(pNfapiMsg->tdd_frame_structure_config.subframe_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &(pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &(pNfapiMsg->l23_config.data_report_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_L23_CONFIG_SFNSF_TAG, &(pNfapiMsg->l23_config.sfnsf), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+ pack_tlv(NFAPI_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_PHY_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) &&
+ pack_tlv(NFAPI_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_EARFCN_TAG, &(pNfapiMsg->nfapi_config.earfcn), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+ pack_tlv(NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_umts_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+ pack_tlv(NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_lte_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+ pack_tlv(NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &(pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+
+static uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+
+ nfapi_nr_config_request_scf_t *pNfapiMsg = (nfapi_nr_config_request_scf_t*)msg;
+
+ for(int i = 0; i<40; i++){ //packing tdd slot config
+ for(int symbol = 0; symbol<14;symbol++){
+ push8(pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[symbol].slot_config.value, ppWritePackedMsg,end);
+ }
+ }
+
+ return (push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.dl_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_DL_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.dl_frequency), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_DL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.dl_grid_size[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_DL_K0_TAG, &(pNfapiMsg->carrier_config.dl_k0[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_NUM_RX_ANT_TAG, &(pNfapiMsg->carrier_config.num_rx_ant), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_NUM_TX_ANT_TAG, &(pNfapiMsg->carrier_config.num_tx_ant), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_UL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.ul_grid_size[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_UL_K0_TAG, &(pNfapiMsg->carrier_config.ul_k0[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.uplink_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.uplink_frequency), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
+
+ pack_tlv(NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG, &(pNfapiMsg->cell_config.frame_duplex_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+ pack_tlv(NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG, &(pNfapiMsg->prach_config.prach_sequence_length), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG, &(pNfapiMsg->prach_config.restricted_set_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_SSB_PER_RACH_TAG, &(pNfapiMsg->prach_config.ssb_per_rach), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG, &(pNfapiMsg->prach_config.prach_sub_c_spacing), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_K1_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].k1), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_zero_corr_conf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].num_root_sequences), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+
+ pack_tlv(NFAPI_NR_CONFIG_SCS_COMMON_TAG, &(pNfapiMsg->ssb_config.scs_common), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG, &(pNfapiMsg->ssb_config.ss_pbch_power), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
+
+ pack_tlv(NFAPI_NR_CONFIG_BETA_PSS_TAG, &(pNfapiMsg->ssb_table.beta_pss), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_MIB_TAG, &(pNfapiMsg->ssb_table.MIB), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[0].ssb_mask), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[1].ssb_mask), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
+
+ pack_tlv(NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG, &(pNfapiMsg->ssb_table.ssb_offset_point_a), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_SSB_PERIOD_TAG, &(pNfapiMsg->ssb_table.ssb_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, &(pNfapiMsg->ssb_table.ssb_subcarrier_offset), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+ pack_tlv(NFAPI_NR_CONFIG_TDD_PERIOD_TAG, &(pNfapiMsg->tdd_table.tdd_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ //pack_tlv(NFAPI_NR_NFAPI_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ pack_tlv(NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+ //pack_tlv(NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_nr_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_config_response_scf_t *pNfapiMsg = (nfapi_nr_config_response_scf_t *)msg;
+ return ( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t *)msg;
+ return ( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_nr_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_start_request_scf_t *pNfapiMsg = (nfapi_nr_start_request_scf_t *)msg;
+ return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_start_request_t *pNfapiMsg = (nfapi_start_request_t *)msg;
+ return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_nr_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_start_response_scf_t *pNfapiMsg = (nfapi_nr_start_response_scf_t *)msg;
+ return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end ) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_start_response_t *pNfapiMsg = (nfapi_start_response_t *)msg;
+ return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end ) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+
+static uint8_t pack_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_stop_request_t *pNfapiMsg = (nfapi_stop_request_t *)msg;
+ return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t *)msg;
+ return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_measurement_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t *)msg;
+ return( pack_tlv(NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &(pNfapiMsg->dl_rs_tx_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, &(pNfapiMsg->received_interference_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_tlv(NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &(pNfapiMsg->thermal_noise_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_recevied_interference_power_measurement_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_received_interference_power_measurement_t *value = (nfapi_received_interference_power_measurement_t *)tlv;
+ return ( push16(value->number_of_resource_blocks, ppWritePackedMsg, end) &&
+ pusharrays16(value->received_interference_power, NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS, value->number_of_resource_blocks, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_measurement_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_measurement_response_t *pNfapiMsg = (nfapi_measurement_response_t *)msg;
+ return( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_MEASUREMENT_RESPONSE_DL_RS_POWER_MEASUREMENT_TAG, &(pNfapiMsg->dl_rs_tx_power_measurement), ppWritePackedMsg, end, &pack_int16_tlv_value) &&
+ pack_tlv(NFAPI_MEASUREMENT_RESPONSE_RECEIVED_INTERFERENCE_POWER_MEASUREMENT_TAG, &(pNfapiMsg->received_interference_power_measurement), ppWritePackedMsg, end,
+ &pack_recevied_interference_power_measurement_value) &&
+ pack_tlv(NFAPI_MEASUREMENT_RESPONSE_THERMAL_NOISE_MEASUREMENT_TAG, &(pNfapiMsg->thermal_noise_power_measurement), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+ pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ uint8_t result = 0;
+
+ // look for the specific message
+ switch (header->message_id) {
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
+ result = pack_nr_pnf_param_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_PARAM_RESPONSE:
+ result = pack_nr_pnf_param_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST:
+ result = pack_nr_pnf_config_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE:
+ result = pack_nr_pnf_config_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST:
+ result = pack_nr_pnf_start_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE:
+ result = pack_nr_pnf_start_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST:
+ result = pack_nr_pnf_stop_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_STOP_RESPONSE:
+ result = pack_nr_pnf_stop_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
+ result = pack_nr_param_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
+ result = pack_nr_param_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
+ result = pack_nr_config_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
+ result = pack_nr_config_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
+ result = pack_nr_start_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
+ result = pack_nr_start_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
+ result = pack_stop_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE:
+ result = pack_stop_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ default: {
+ if(header->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ header->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
+ if(config && config->pack_p4_p5_vendor_extension) {
+ result = (config->pack_p4_p5_vendor_extension)(header, ppWritePackedMsg, end, config);
+ } else {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, header->message_id);
+ }
+ } else {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, header->message_id);
+ }
+ }
+ break;
+ }
+
+ return result;
+}
+
+
+static uint8_t pack_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
+ uint8_t result = 0;
+
+ // look for the specific message
+ switch (header->message_id) {
+ case NFAPI_PNF_PARAM_REQUEST:
+ result = pack_pnf_param_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_PARAM_RESPONSE:
+ result = pack_pnf_param_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_CONFIG_REQUEST:
+ result = pack_pnf_config_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_CONFIG_RESPONSE:
+ result = pack_pnf_config_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_START_REQUEST:
+ result = pack_pnf_start_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_START_RESPONSE:
+ result = pack_pnf_start_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_STOP_REQUEST:
+ result = pack_pnf_stop_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PNF_STOP_RESPONSE:
+ result = pack_pnf_stop_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PARAM_REQUEST:
+ result = pack_param_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_PARAM_RESPONSE:
+ result = pack_param_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_CONFIG_REQUEST:
+ result = pack_config_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_CONFIG_RESPONSE:
+ result = pack_config_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_START_REQUEST:
+ result = pack_start_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_START_RESPONSE:
+ result = pack_start_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_STOP_REQUEST:
+ result = pack_stop_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_STOP_RESPONSE:
+ result = pack_stop_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_MEASUREMENT_REQUEST:
+ result = pack_measurement_request(header, ppWritePackedMsg, end, config);
+ break;
+
+ case NFAPI_MEASUREMENT_RESPONSE:
+ result = pack_measurement_response(header, ppWritePackedMsg, end, config);
+ break;
+
+ default: {
+ if(header->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ header->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
+ if(config && config->pack_p4_p5_vendor_extension) {
+ result = (config->pack_p4_p5_vendor_extension)(header, ppWritePackedMsg, end, config);
+ } else {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, header->message_id);
+ }
+ } else {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, header->message_id);
+ }
+ }
+ break;
+ }
+
+ return result;
+}
+
+
+// helper function for message length calculation -
+// takes the pointers to the start of message to end of message
+
+static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd) {
+ if (msgEnd < msgHead) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %d, %d\n", msgHead, msgEnd);
+ return 0;
+ }
+
+ return (msgEnd - msgHead);
+}
+
+// Main pack function - public
+int nfapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
+ uint8_t *pWritePackedMessage = pPackedBuf;
+ uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
+ uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+ uint32_t packedMsgLen;
+ uint16_t packedMsgLen16;
+
+ if (pMessageBuf == NULL || pPackedBuf == NULL) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Pack supplied pointers are null\n");
+ return -1;
+ }
+
+ // pack the message
+ if(push16(pMessageHeader->phy_id, &pWritePackedMessage, pPackMessageEnd) &&
+ push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd) &&
+ push16(0, &pWritePackedMessage, pPackMessageEnd) &&
+ push16(pMessageHeader->spare, &pWritePackedMessage, pPackMessageEnd) &&
+ pack_nr_p5_message_body(pMessageHeader, &pWritePackedMessage, pPackMessageEnd, config)) {
+ // check for a valid message length
+ packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pWritePackedMessage);
+
+ 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
+ if(!push16(packedMsgLen16, &pPackedLengthField, pPackMessageEnd))
+ return -1;
+
+ // return the packed length
+ return (packedMsgLen);
+ } else {
+ // Failed to pack the meassage
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Failed to pack message\n");
+ return -1;
+ }
+}
+
+int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
+ uint8_t *pWritePackedMessage = pPackedBuf;
+ uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
+ uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+ uint32_t packedMsgLen;
+ uint16_t packedMsgLen16;
+
+ if (pMessageBuf == NULL || pPackedBuf == NULL) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Pack supplied pointers are null\n");
+ return -1;
+ }
+
+ // pack the message
+ if(push16(pMessageHeader->phy_id, &pWritePackedMessage, pPackMessageEnd) &&
+ push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd) &&
+ push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, pPackMessageEnd) &&
+ push16(pMessageHeader->spare, &pWritePackedMessage, pPackMessageEnd) &&
+ pack_p5_message_body(pMessageHeader, &pWritePackedMessage, pPackMessageEnd, config)) {
+ // check for a valid message length
+ packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pWritePackedMessage);
+
+ 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
+ if(!push16(packedMsgLen16, &pPackedLengthField, pPackMessageEnd))
+ return -1;
+
+ // return the packed length
+ return (packedMsgLen);
+ } else {
+ // Failed to pack the meassage
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Failed to pack message\n");
+ return -1;
+ }
+}
+
+
+
+// Unpack routines
+
+
+static uint8_t unpack_nr_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_param_request_t *pNfapiMsg = (nfapi_nr_pnf_param_request_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_param_request_t *pNfapiMsg = (nfapi_pnf_param_request_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_pnf_param_general_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_param_general_t *value = (nfapi_pnf_param_general_t *)tlv;
+ return( pull8(ppReadPackedMsg, &value->nfapi_sync_mode, end) &&
+ pull8(ppReadPackedMsg, &value->location_mode, end) &&
+ pull16(ppReadPackedMsg, &value->location_coordinates_length, end) &&
+ pullarray8(ppReadPackedMsg, value->location_coordinates, NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH, value->location_coordinates_length, end) &&
+ pull32(ppReadPackedMsg, &value->dl_config_timing, end) &&
+ pull32(ppReadPackedMsg, &value->tx_timing, end) &&
+ pull32(ppReadPackedMsg, &value->ul_config_timing, end) &&
+ pull32(ppReadPackedMsg, &value->hi_dci0_timing, end) &&
+ pull16(ppReadPackedMsg, &value->maximum_number_phys, end) &&
+ pull16(ppReadPackedMsg, &value->maximum_total_bandwidth, end) &&
+ pull8(ppReadPackedMsg, &value->maximum_total_number_dl_layers, end) &&
+ pull8(ppReadPackedMsg, &value->maximum_total_number_ul_layers, end) &&
+ pull8(ppReadPackedMsg, &value->shared_bands, end) &&
+ pull8(ppReadPackedMsg, &value->shared_pa, end) &&
+ pulls16(ppReadPackedMsg, &value->maximum_total_power, end) &&
+ pullarray8(ppReadPackedMsg, value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, end));
+}
+
+static uint8_t unpack_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_rf_config_info_t *info = (nfapi_rf_config_info_t *)elem;
+ return pull16(ppReadPackedMsg, &info->rf_config_index, end);
+}
+
+static uint8_t unpack_pnf_phy_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_info_t *phy = (nfapi_pnf_phy_info_t *)elem;
+ return ( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+ pull16(ppReadPackedMsg, &phy->number_of_rfs, end) &&
+ unpackarray(ppReadPackedMsg, phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, end, &unpack_rf_config_info) &&
+ pull16(ppReadPackedMsg, &phy->number_of_rf_exclusions, end) &&
+ unpackarray(ppReadPackedMsg, phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, end, &unpack_rf_config_info) &&
+ pull16(ppReadPackedMsg, &phy->downlink_channel_bandwidth_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->uplink_channel_bandwidth_supported, end) &&
+ pull8(ppReadPackedMsg, &phy->number_of_dl_layers_supported, end) &&
+ pull8(ppReadPackedMsg, &phy->number_of_ul_layers_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->maximum_3gpp_release_supported, end) &&
+ pull8(ppReadPackedMsg, &phy->nmm_modes_supported, end));
+}
+
+
+static uint8_t unpack_pnf_phy_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_t *value = (nfapi_pnf_phy_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+ unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_info));
+}
+
+static uint8_t unpack_pnf_rf_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_rf_info_t *rf = (nfapi_pnf_rf_info_t *)elem;
+ return( pull16(ppReadPackedMsg, &rf->rf_config_index, end) &&
+ pull16(ppReadPackedMsg, &rf->band, end) &&
+ pulls16(ppReadPackedMsg, &rf->maximum_transmit_power, end) &&
+ pulls16(ppReadPackedMsg, &rf->minimum_transmit_power, end) &&
+ pull8(ppReadPackedMsg, &rf->number_of_antennas_suppported, end) &&
+ pull32(ppReadPackedMsg, &rf->minimum_downlink_frequency, end) &&
+ pull32(ppReadPackedMsg, &rf->maximum_downlink_frequency, end) &&
+ pull32(ppReadPackedMsg, &rf->minimum_uplink_frequency, end) &&
+ pull32(ppReadPackedMsg, &rf->maximum_uplink_frequency, end));
+}
+static uint8_t unpack_pnf_rf_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_rf_t *value = (nfapi_pnf_rf_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_of_rfs, end) &&
+ unpackarray(ppReadPackedMsg, value->rf, sizeof(nfapi_pnf_rf_info_t), NFAPI_MAX_PNF_RF, value->number_of_rfs, end, &unpack_pnf_rf_info));
+}
+
+static uint8_t unpack_pnf_phy_rel10_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel10_info_t *phy = (nfapi_pnf_phy_rel10_info_t *)elem;
+ return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+ pull16(ppReadPackedMsg, &phy->transmission_mode_7_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->transmission_mode_8_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->two_antenna_ports_for_pucch, end) &&
+ pull16(ppReadPackedMsg, &phy->transmission_mode_9_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->simultaneous_pucch_pusch, end) &&
+ pull16(ppReadPackedMsg, &phy->four_layer_tx_with_tm3_and_tm4, end));
+}
+static uint8_t unpack_pnf_phy_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel10_t *value = (nfapi_pnf_phy_rel10_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+ unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel10_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel10_info));
+}
+
+
+static uint8_t unpack_pnf_phy_rel11_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel11_info_t *phy = (nfapi_pnf_phy_rel11_info_t *)elem;
+ return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+ pull16(ppReadPackedMsg, &phy->edpcch_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->multi_ack_csi_reporting, end ) &&
+ pull16(ppReadPackedMsg, &phy->pucch_tx_diversity, end) &&
+ pull16(ppReadPackedMsg, &phy->ul_comp_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->transmission_mode_5_supported, end));
+}
+
+static uint8_t unpack_pnf_phy_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel11_t *value = (nfapi_pnf_phy_rel11_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+ unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel11_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel11_info));
+}
+
+static uint8_t unpack_phy_phy_rel12_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel12_info_t *phy = (nfapi_pnf_phy_rel12_info_t *)elem;
+ return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+ pull16(ppReadPackedMsg, &phy->csi_subframe_set, end) &&
+ pull16(ppReadPackedMsg, &phy->enhanced_4tx_codebook, end) &&
+ pull16(ppReadPackedMsg, &phy->drs_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->ul_64qam_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->transmission_mode_10_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->alternative_bts_indices, end));
+}
+
+static uint8_t unpack_pnf_phy_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel12_t *value = (nfapi_pnf_phy_rel12_t *)tlv;
+ return (pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+ unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel12_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_phy_phy_rel12_info));
+}
+
+static uint8_t unpack_pnf_phy_rel13_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel13_info_t *phy = (nfapi_pnf_phy_rel13_info_t *)elem;
+ return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+ pull16(ppReadPackedMsg, &phy->pucch_format4_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->pucch_format5_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->more_than_5_ca_support, end) &&
+ pull16(ppReadPackedMsg, &phy->laa_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->laa_ending_in_dwpts_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->laa_starting_in_second_slot_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->beamforming_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->csi_rs_enhancement_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->drms_enhancement_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->srs_enhancement_supported, end));
+}
+
+static uint8_t unpack_pnf_phy_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel13_t *value = (nfapi_pnf_phy_rel13_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+ unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel13_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel13_info));
+}
+
+static uint8_t unpack_pnf_phy_rel13_nb_info_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel13_nb_iot_info_t *phy = (nfapi_pnf_phy_rel13_nb_iot_info_t *)elem;
+ return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+ pull16(ppReadPackedMsg, &phy->number_of_rfs, end) &&
+ unpackarray(ppReadPackedMsg, phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, end, &unpack_rf_config_info) &&
+ pull16(ppReadPackedMsg, &phy->number_of_rf_exclusions, end) &&
+ unpackarray(ppReadPackedMsg, phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, end, &unpack_rf_config_info) &&
+ pull8(ppReadPackedMsg, &phy->number_of_dl_layers_supported, end) &&
+ pull8(ppReadPackedMsg, &phy->number_of_ul_layers_supported, end) &&
+ pull16(ppReadPackedMsg, &phy->maximum_3gpp_release_supported, end) &&
+ pull8(ppReadPackedMsg, &phy->nmm_modes_supported, end));
+}
+
+static uint8_t unpack_pnf_phy_rel13_nb_iot_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rel13_nb_iot_t *value = (nfapi_pnf_phy_rel13_nb_iot_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+ unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel13_nb_iot_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel13_nb_info_info));
+}
+
+static uint8_t unpack_nr_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_param_response_t *pNfapiMsg = (nfapi_nr_pnf_param_response_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, &unpack_pnf_param_general_value},
+ { NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, &unpack_pnf_phy_value},
+ };
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+
+static uint8_t unpack_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_param_response_t *pNfapiMsg = (nfapi_pnf_param_response_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, &unpack_pnf_param_general_value},
+ { NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, &unpack_pnf_phy_value},
+ { NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, &unpack_pnf_rf_value},
+ { NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, &unpack_pnf_phy_rel10_value},
+ { NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, &unpack_pnf_phy_rel11_value},
+ { NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, &unpack_pnf_phy_rel12_value},
+ { NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, &unpack_pnf_phy_rel13_value},
+ { NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, &unpack_pnf_phy_rel13_nb_iot_value},
+
+ };
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_phy_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_phy_rf_config_info_t *rf = (nfapi_phy_rf_config_info_t *)elem;
+ return( pull16(ppReadPackedMsg, &rf->phy_id, end) &&
+ pull16(ppReadPackedMsg, &rf->phy_config_index, end) &&
+ pull16(ppReadPackedMsg, &rf->rf_config_index, end));
+}
+
+static uint8_t unpack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_phy_rf_config_info, end) &&
+ unpackarray(ppReadPackedMsg, value->phy_rf_config, sizeof(nfapi_phy_rf_config_info_t), NFAPI_MAX_PHY_RF_INSTANCES, value->number_phy_rf_config_info, end, &unpack_phy_rf_config_info));
+}
+
+static uint8_t unpack_nr_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_config_request_t *pNfapiMsg = (nfapi_nr_pnf_config_request_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, &unpack_pnf_phy_rf_config_value},
+ };
+ return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension);
+}
+
+
+
+static uint8_t unpack_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_config_request_t *pNfapiMsg = (nfapi_pnf_config_request_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, &unpack_pnf_phy_rf_config_value},
+ };
+ return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension);
+}
+
+
+static uint8_t unpack_nr_pnf_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_config_response_t *pNfapiMsg = (nfapi_nr_pnf_config_response_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_pnf_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_config_response_t *pNfapiMsg = (nfapi_pnf_config_response_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_nr_pnf_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_start_request_t *pNfapiMsg = (nfapi_nr_pnf_start_request_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_pnf_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_start_request_t *pNfapiMsg = (nfapi_pnf_start_request_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_pnf_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_start_response_t *pNfapiMsg = (nfapi_pnf_start_response_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end ) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_nr_pnf_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_pnf_start_response_t *pNfapiMsg = (nfapi_nr_pnf_start_response_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end ) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+
+static uint8_t unpack_pnf_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_stop_request_t *pNfapiMsg = (nfapi_pnf_stop_request_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_pnf_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_pnf_stop_response_t *pNfapiMsg = (nfapi_pnf_stop_response_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_param_request_t *pNfapiMsg = (nfapi_param_request_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nr_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_param_request_scf_t *pNfapiMsg = (nfapi_nr_param_request_scf_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_param_response_t *pNfapiMsg = (nfapi_param_response_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_L1_STATUS_PHY_STATE_TAG, &pNfapiMsg->l1_status.phy_state, &unpack_uint16_tlv_value},
+
+ { NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.dl_bandwidth_support, &unpack_uint16_tlv_value},
+ { NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.ul_bandwidth_support, &unpack_uint16_tlv_value},
+ { NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.dl_modulation_support, &unpack_uint16_tlv_value},
+ { NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.ul_modulation_support, &unpack_uint16_tlv_value},
+ { NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.phy_antenna_capability, &unpack_uint16_tlv_value},
+ { NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.release_capability, &unpack_uint16_tlv_value},
+ { NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.mbsfn_capability, &unpack_uint16_tlv_value},
+
+ { NFAPI_LAA_CAPABILITY_LAA_SUPPORT_TAG, &pNfapiMsg->laa_capability.laa_support, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CAPABILITY_PD_SENSING_LBT_SUPPORT_TAG, &pNfapiMsg->laa_capability.pd_sensing_lbt_support, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CAPABILITY_MULTI_CARRIER_LBT_SUPPORT_TAG, &pNfapiMsg->laa_capability.multi_carrier_lbt_support, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CAPABILITY_PARTIAL_SF_SUPPORT_TAG, &pNfapiMsg->laa_capability.partial_sf_support, &unpack_uint16_tlv_value},
+
+ { NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &pNfapiMsg->subframe_config.duplex_mode, &unpack_uint16_tlv_value},
+ { NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &pNfapiMsg->subframe_config.pcfich_power_offset, &unpack_uint16_tlv_value},
+ { NFAPI_SUBFRAME_CONFIG_PB_TAG, &pNfapiMsg->subframe_config.pb, &unpack_uint16_tlv_value},
+ { NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.dl_cyclic_prefix_type, &unpack_uint16_tlv_value},
+ { NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.ul_cyclic_prefix_type, &unpack_uint16_tlv_value},
+
+ { NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.dl_channel_bandwidth, &unpack_uint16_tlv_value},
+ { NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.ul_channel_bandwidth, &unpack_uint16_tlv_value},
+ { NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &pNfapiMsg->rf_config.reference_signal_power, &unpack_uint16_tlv_value},
+ { NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.tx_antenna_ports, &unpack_uint16_tlv_value},
+ { NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.rx_antenna_ports, &unpack_uint16_tlv_value},
+
+ { NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &pNfapiMsg->phich_config.phich_resource, &unpack_uint16_tlv_value},
+ { NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &pNfapiMsg->phich_config.phich_duration, &unpack_uint16_tlv_value},
+ { NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &pNfapiMsg->phich_config.phich_power_offset, &unpack_uint16_tlv_value},
+
+ { NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
+ { NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
+ { NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &pNfapiMsg->sch_config.physical_cell_id, &unpack_uint16_tlv_value},
+
+ { NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &pNfapiMsg->prach_config.configuration_index, &unpack_uint16_tlv_value},
+ { NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->prach_config.root_sequence_index, &unpack_uint16_tlv_value},
+ { NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->prach_config.zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
+ { NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &pNfapiMsg->prach_config.high_speed_flag, &unpack_uint16_tlv_value},
+ { NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &pNfapiMsg->prach_config.frequency_offset, &unpack_uint16_tlv_value},
+
+ { NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &pNfapiMsg->pusch_config.hopping_mode, &unpack_uint16_tlv_value},
+ { NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &pNfapiMsg->pusch_config.hopping_offset, &unpack_uint16_tlv_value},
+ { NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &pNfapiMsg->pusch_config.number_of_subbands, &unpack_uint16_tlv_value},
+
+ { NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &pNfapiMsg->pucch_config.delta_pucch_shift, &unpack_uint16_tlv_value},
+ { NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &pNfapiMsg->pucch_config.n_cqi_rb, &unpack_uint16_tlv_value},
+ { NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &pNfapiMsg->pucch_config.n_an_cs, &unpack_uint16_tlv_value},
+ { NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &pNfapiMsg->pucch_config.n1_pucch_an, &unpack_uint16_tlv_value},
+
+ { NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &pNfapiMsg->srs_config.bandwidth_configuration, &unpack_uint16_tlv_value},
+ { NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &pNfapiMsg->srs_config.max_up_pts, &unpack_uint16_tlv_value},
+ { NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &pNfapiMsg->srs_config.srs_subframe_configuration, &unpack_uint16_tlv_value},
+ { NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission, &unpack_uint16_tlv_value},
+
+ { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping, &unpack_uint16_tlv_value},
+ { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &pNfapiMsg->uplink_reference_signal_config.group_assignment, &unpack_uint16_tlv_value},
+ { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms, &unpack_uint16_tlv_value},
+
+ { NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &pNfapiMsg->tdd_frame_structure_config.subframe_assignment, &unpack_uint16_tlv_value},
+ { NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns, &unpack_uint16_tlv_value},
+
+ { NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &pNfapiMsg->l23_config.data_report_mode, &unpack_uint16_tlv_value},
+ { NFAPI_L23_CONFIG_SFNSF_TAG, &pNfapiMsg->l23_config.sfnsf, &unpack_uint16_tlv_value},
+
+ { NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value},
+ { NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value},
+ { NFAPI_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value},
+ { NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value},
+ { NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value},
+ { NFAPI_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value},
+ { NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.dl_ue_per_sf, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.ul_ue_per_sf, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_RF_BANDS_TAG, &pNfapiMsg->nfapi_config.rf_bands, &unpack_rf_bands_value},
+ { NFAPI_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &pNfapiMsg->nfapi_config.max_transmit_power, &unpack_uint16_tlv_value},
+ { NFAPI_NFAPI_EARFCN_TAG, &pNfapiMsg->nfapi_config.earfcn, &unpack_uint16_tlv_value},
+ { NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands, &unpack_nmm_frequency_bands_value},
+ { NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_umts_frequency_bands, &unpack_nmm_frequency_bands_value},
+ { NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_lte_frequency_bands, &unpack_nmm_frequency_bands_value},
+ { NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported, &unpack_uint8_tlv_value},
+
+ };
+ return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->cell_param.release_capability), &unpack_uint16_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, &(pNfapiMsg->cell_param.phy_state),&unpack_uint16_tlv_value},
+ { NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_dl_config), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_ul_config), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, &(pNfapiMsg->cell_param.num_config_tlvs_to_report ), &unpack_uint16_tlv_value},
+
+ { NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, &(pNfapiMsg->carrier_param.cyclic_prefix), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_dl), &unpack_uint16_tlv_value},
+ { NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_dl), &unpack_uint16_tlv_value},
+ { NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_ul), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_ul), &unpack_uint16_tlv_value},
+
+
+ { NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, &(pNfapiMsg->pdcch_param.cce_mapping_type), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, &(pNfapiMsg->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, &(pNfapiMsg->pdcch_param.coreset_precoder_granularity_coreset), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, &(pNfapiMsg->pdcch_param.pdcch_mu_mimo), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, &(pNfapiMsg->pdcch_param.pdcch_precoder_cycling), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, &(pNfapiMsg->pdcch_param.max_pdcch_per_slot), &unpack_uint8_tlv_value},
+
+ { NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, &(pNfapiMsg->pucch_param.pucch_formats), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, &(pNfapiMsg->pucch_param.max_pucchs_per_slot), &unpack_uint8_tlv_value},
+
+ { NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pdsch_param.pdsch_mapping_type), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_allocation_types), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, &(pNfapiMsg->pdsch_param.pdsch_vrb_to_prb_mapping), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, &(pNfapiMsg->pdsch_param.pdsch_cbg), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_config_types), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_max_length), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_additional_pos), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_YBS_PER_SLOT_TAG, &(pNfapiMsg->pdsch_param.max_pdsch_tbs_per_slot), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, &(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, &(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.premption_support), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.pdsch_non_slot_support), &unpack_uint8_tlv_value},
+
+ { NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_mux_ulsch_in_pusch), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_only_pusch), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, &(pNfapiMsg->pusch_param.pusch_frequency_hopping), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_config_types), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_max_len), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_additional_pos), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, &(pNfapiMsg->pusch_param.pusch_cbg), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pusch_param.pusch_mapping_type), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_allocation_types), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, &(pNfapiMsg->pusch_param.pusch_vrb_to_prb_mapping), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, &(pNfapiMsg->pusch_param.pusch_max_ptrs_ports), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, &(pNfapiMsg->pusch_param.max_pduschs_tbs_per_slot), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, &(pNfapiMsg->pusch_param.max_number_mimo_layers_non_cb_pusch), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, &(pNfapiMsg->pusch_param.supported_modulation_order_ul), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, &(pNfapiMsg->pusch_param.max_mu_mimo_users_ul), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, &(pNfapiMsg->pusch_param.dfts_ofdm_support), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, &(pNfapiMsg->pusch_param.pusch_aggregation_factor), &unpack_uint8_tlv_value},
+
+ { NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_long_formats), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_short_formats), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, &(pNfapiMsg->prach_param.prach_restricted_sets), &unpack_uint8_tlv_value},
+ { NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, &(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot), &unpack_uint8_tlv_value},
+
+ { NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, &(pNfapiMsg->measurement_param.rssi_measurement_support), &unpack_uint8_tlv_value},
+ //config
+ { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value},
+ { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value},
+ { NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value},
+ { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value},
+ { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value},
+ { NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value},
+ { NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value},
+ { NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value},
+ { NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value},
+ };
+ // print ppReadPackedMsg
+ uint8_t *ptr = *ppReadPackedMsg;
+ printf("\n Read message unpack_param_response: ");
+
+ while(ptr < end) {
+ printf(" %d ", *ptr);
+ ptr++;
+ }
+
+ printf("\n");
+ return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_config_request_t *pNfapiMsg = (nfapi_config_request_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &pNfapiMsg->subframe_config.duplex_mode, &unpack_uint16_tlv_value},
+ { NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &pNfapiMsg->subframe_config.pcfich_power_offset, &unpack_uint16_tlv_value},
+ { NFAPI_SUBFRAME_CONFIG_PB_TAG, &pNfapiMsg->subframe_config.pb, &unpack_uint16_tlv_value},
+ { NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.dl_cyclic_prefix_type, &unpack_uint16_tlv_value},
+ { NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.ul_cyclic_prefix_type, &unpack_uint16_tlv_value},
+
+ { NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.dl_channel_bandwidth, &unpack_uint16_tlv_value},
+ { NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.ul_channel_bandwidth, &unpack_uint16_tlv_value},
+ { NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &pNfapiMsg->rf_config.reference_signal_power, &unpack_uint16_tlv_value},
+ { NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.tx_antenna_ports, &unpack_uint16_tlv_value},
+ { NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.rx_antenna_ports, &unpack_uint16_tlv_value},
+
+ { NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &pNfapiMsg->phich_config.phich_resource, &unpack_uint16_tlv_value},
+ { NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &pNfapiMsg->phich_config.phich_duration, &unpack_uint16_tlv_value},
+ { NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &pNfapiMsg->phich_config.phich_power_offset, &unpack_uint16_tlv_value},
+
+ { NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
+ { NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
+ { NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &pNfapiMsg->sch_config.physical_cell_id, &unpack_uint16_tlv_value},
+
+ { NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &pNfapiMsg->prach_config.configuration_index, &unpack_uint16_tlv_value},
+ { NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->prach_config.root_sequence_index, &unpack_uint16_tlv_value},
+ { NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->prach_config.zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
+ { NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &pNfapiMsg->prach_config.high_speed_flag, &unpack_uint16_tlv_value},
+ { NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &pNfapiMsg->prach_config.frequency_offset, &unpack_uint16_tlv_value},
+
+ { NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &pNfapiMsg->pusch_config.hopping_mode, &unpack_uint16_tlv_value},
+ { NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &pNfapiMsg->pusch_config.hopping_offset, &unpack_uint16_tlv_value},
+ { NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &pNfapiMsg->pusch_config.number_of_subbands, &unpack_uint16_tlv_value},
+
+ { NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &pNfapiMsg->pucch_config.delta_pucch_shift, &unpack_uint16_tlv_value},
+ { NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &pNfapiMsg->pucch_config.n_cqi_rb, &unpack_uint16_tlv_value},
+ { NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &pNfapiMsg->pucch_config.n_an_cs, &unpack_uint16_tlv_value},
+ { NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &pNfapiMsg->pucch_config.n1_pucch_an, &unpack_uint16_tlv_value},
+
+ { NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &pNfapiMsg->srs_config.bandwidth_configuration, &unpack_uint16_tlv_value},
+ { NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &pNfapiMsg->srs_config.max_up_pts, &unpack_uint16_tlv_value},
+ { NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &pNfapiMsg->srs_config.srs_subframe_configuration, &unpack_uint16_tlv_value},
+ { NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission, &unpack_uint16_tlv_value},
+
+ { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping, &unpack_uint16_tlv_value},
+ { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &pNfapiMsg->uplink_reference_signal_config.group_assignment, &unpack_uint16_tlv_value},
+ { NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms, &unpack_uint16_tlv_value},
+
+
+ { NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG, &pNfapiMsg->laa_config.ed_threshold_lbt_pdsch, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG, &pNfapiMsg->laa_config.ed_threshold_lbt_drs, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG, &pNfapiMsg->laa_config.pd_threshold, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG, &pNfapiMsg->laa_config.multi_carrier_type, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG, &pNfapiMsg->laa_config.multi_carrier_tx, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG, &pNfapiMsg->laa_config.multi_carrier_freeze, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG, &pNfapiMsg->laa_config.tx_antenna_ports_drs, &unpack_uint16_tlv_value},
+ { NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG, &pNfapiMsg->laa_config.tx_power_drs, &unpack_uint16_tlv_value},
+
+ { NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG, &pNfapiMsg->emtc_config.pbch_repetitions_enable_r13, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->emtc_config.prach_catm_root_sequence_index, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->emtc_config.prach_catm_zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG, &pNfapiMsg->emtc_config.prach_catm_high_speed_flag, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_enable, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_configuration_index, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_frequency_offset, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_starting_subframe_periodicity, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_hopping_enable, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_hopping_offset, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_enable, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_configuration_index, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_frequency_offset, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_starting_subframe_periodicity, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_hopping_enable, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_hopping_offset, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_enable, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_configuration_index, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_frequency_offset, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_starting_subframe_periodicity, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_hopping_enable, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_hopping_offset, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_enable, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_configuration_index, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_frequency_offset, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_starting_subframe_periodicity, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_hopping_enable, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_hopping_offset, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG, &pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea, &unpack_uint16_tlv_value},
+ { NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG, &pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb, &unpack_uint16_tlv_value},
+
+ { NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &pNfapiMsg->tdd_frame_structure_config.subframe_assignment, &unpack_uint16_tlv_value},
+ { NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns, &unpack_uint16_tlv_value},
+
+ { NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &pNfapiMsg->l23_config.data_report_mode, &unpack_uint16_tlv_value},
+ { NFAPI_L23_CONFIG_SFNSF_TAG, &pNfapiMsg->l23_config.sfnsf, &unpack_uint16_tlv_value},
+
+ { NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value},
+ { NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value},
+ { NFAPI_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value},
+ { NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value},
+ { NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value},
+ { NFAPI_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value},
+ { NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.dl_ue_per_sf, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.ul_ue_per_sf, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_RF_BANDS_TAG, &pNfapiMsg->nfapi_config.rf_bands, &unpack_rf_bands_value},
+ { NFAPI_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value},
+ { NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &pNfapiMsg->nfapi_config.max_transmit_power, &unpack_uint16_tlv_value},
+ { NFAPI_NFAPI_EARFCN_TAG, &pNfapiMsg->nfapi_config.earfcn, &unpack_uint16_tlv_value},
+ { NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands, &unpack_nmm_frequency_bands_value},
+ { NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_umts_frequency_bands, &unpack_nmm_frequency_bands_value},
+ { NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_lte_frequency_bands, &unpack_nmm_frequency_bands_value},
+ { NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported, &unpack_uint8_tlv_value},
+
+ };
+ return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+ nfapi_nr_config_request_scf_t *pNfapiMsg = (nfapi_nr_config_request_scf_t*)msg;
+
+ pNfapiMsg->tdd_table.max_tdd_periodicity_list = (nfapi_nr_max_tdd_periodicity_t*) malloc(40*sizeof(nfapi_nr_max_tdd_periodicity_t));
+
+ for(int i=0;i<40;i++)
+ pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list = (nfapi_nr_max_num_of_symbol_per_slot_t*) malloc(14*sizeof(nfapi_nr_max_num_of_symbol_per_slot_t));
+
+ pNfapiMsg->prach_config.num_prach_fd_occasions_list=(nfapi_nr_num_prach_fd_occasions_t *) malloc(sizeof(nfapi_nr_num_prach_fd_occasions_t));
+
+ for(int i = 0; i < 40; i++){ //unpacking tdd slot config
+ for(int symbol = 0; symbol<14;symbol++){
+ pull8(ppReadPackedMsg,&pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[symbol].slot_config.value, end);
+ }
+ }
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.dl_bandwidth), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_DL_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.dl_frequency), &unpack_uint32_tlv_value},
+ { NFAPI_NR_CONFIG_DL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.dl_grid_size[1]), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_DL_K0_TAG, &(pNfapiMsg->carrier_config.dl_k0[1]), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_NUM_RX_ANT_TAG, &(pNfapiMsg->carrier_config.num_rx_ant), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_NUM_TX_ANT_TAG, &(pNfapiMsg->carrier_config.num_tx_ant), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_UL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.ul_grid_size[1]), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_UL_K0_TAG, &(pNfapiMsg->carrier_config.ul_k0[1]), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.uplink_bandwidth), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.uplink_frequency), &unpack_uint32_tlv_value},
+ { NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG, &(pNfapiMsg->cell_config.frame_duplex_type), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG, &(pNfapiMsg->prach_config.prach_sequence_length), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG, &(pNfapiMsg->prach_config.restricted_set_config), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_SSB_PER_RACH_TAG, &(pNfapiMsg->prach_config.ssb_per_rach), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG, &(pNfapiMsg->prach_config.prach_sub_c_spacing), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_root_sequence_index), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_K1_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].k1), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_zero_corr_conf), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].num_root_sequences), &unpack_uint8_tlv_value},
+
+ { NFAPI_NR_CONFIG_SCS_COMMON_TAG, &(pNfapiMsg->ssb_config.scs_common), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG, &(pNfapiMsg->ssb_config.ss_pbch_power), &unpack_uint32_tlv_value},
+ { NFAPI_NR_CONFIG_BETA_PSS_TAG, &(pNfapiMsg->ssb_table.beta_pss), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_MIB_TAG, &(pNfapiMsg->ssb_table.MIB), &unpack_uint32_tlv_value},
+ { NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[0].ssb_mask), &unpack_uint32_tlv_value},
+ { NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[1].ssb_mask), &unpack_uint32_tlv_value},
+
+ { NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG, &(pNfapiMsg->ssb_table.ssb_offset_point_a), &unpack_uint16_tlv_value},
+ { NFAPI_NR_CONFIG_SSB_PERIOD_TAG, &(pNfapiMsg->ssb_table.ssb_period), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, &(pNfapiMsg->ssb_table.ssb_subcarrier_offset), &unpack_uint8_tlv_value},
+ { NFAPI_NR_CONFIG_TDD_PERIOD_TAG, &(pNfapiMsg->tdd_table.tdd_period), &unpack_uint8_tlv_value},
+ { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), &unpack_ipv6_address_value},
+ { NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), &unpack_uint16_tlv_value},
+ { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), &unpack_ipv4_address_value},
+ { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), &unpack_ipv6_address_value},
+ { NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), &unpack_uint16_tlv_value},
+ { NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), &unpack_uint8_tlv_value},
+ { NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), &unpack_uint8_tlv_value},
+ { NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), &unpack_uint8_tlv_value},
+ };
+
+ return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+}
+
+static uint8_t unpack_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_config_response_scf_t *pNfapiMsg = (nfapi_nr_config_response_scf_t *)msg;
+ return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_nr_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_start_request_scf_t *pNfapiMsg = ( nfapi_nr_start_request_scf_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_start_request_t *pNfapiMsg = ( nfapi_start_request_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_start_response_t *pNfapiMsg = (nfapi_start_response_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_nr_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_nr_start_response_scf_t *pNfapiMsg = (nfapi_nr_start_response_scf_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_stop_request_t *pNfapiMsg = (nfapi_stop_request_t *)msg;
+ return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t *)msg;
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+static uint8_t unpack_measurement_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &pNfapiMsg->dl_rs_tx_power, &unpack_uint16_tlv_value},
+ { NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, &pNfapiMsg->received_interference_power, &unpack_uint16_tlv_value},
+ { NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &pNfapiMsg->thermal_noise_power, &unpack_uint16_tlv_value},
+ };
+ return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_received_interference_power_measurement_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_received_interference_power_measurement_t *value = (nfapi_received_interference_power_measurement_t *)tlv;
+ return ( pull16(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
+ pullarrays16(ppReadPackedMsg, value->received_interference_power, NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS, value->number_of_resource_blocks, end));
+}
+
+
+static uint8_t unpack_measurement_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_measurement_response_t *pNfapiMsg = (nfapi_measurement_response_t *)msg;
+ unpack_tlv_t unpack_fns[] = {
+ { NFAPI_MEASUREMENT_RESPONSE_DL_RS_POWER_MEASUREMENT_TAG, &pNfapiMsg->dl_rs_tx_power_measurement, &unpack_int16_tlv_value},
+ { NFAPI_MEASUREMENT_RESPONSE_RECEIVED_INTERFERENCE_POWER_MEASUREMENT_TAG, &pNfapiMsg->received_interference_power_measurement, &unpack_received_interference_power_measurement_value},
+ { NFAPI_MEASUREMENT_RESPONSE_THERMAL_NOISE_MEASUREMENT_TAG, &pNfapiMsg->thermal_noise_power_measurement, &unpack_int16_tlv_value},
+ };
+ return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+// unpack length check
+
+static int check_nr_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen) {
+ int retLen = 0;
+
+ switch (msgId) {
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_param_request_t))
+ retLen = sizeof(nfapi_pnf_param_request_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_nr_pnf_param_response_t))
+ retLen = sizeof(nfapi_nr_pnf_param_response_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_pnf_config_request_t))
+ retLen = sizeof(nfapi_nr_pnf_config_request_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_nr_pnf_config_response_t))
+ retLen = sizeof(nfapi_nr_pnf_config_response_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_pnf_start_request_t))
+ retLen = sizeof(nfapi_nr_pnf_start_request_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_nr_pnf_start_response_t))
+ retLen = sizeof(nfapi_nr_pnf_start_response_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_pnf_stop_request_t))
+ retLen = sizeof(nfapi_nr_pnf_stop_request_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_nr_pnf_stop_response_t))
+ retLen = sizeof(nfapi_nr_pnf_stop_response_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_param_request_scf_t))
+ retLen = sizeof(nfapi_nr_param_request_scf_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_nr_param_response_scf_t))
+ retLen = sizeof(nfapi_nr_param_response_scf_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_config_request_scf_t))
+ retLen = sizeof(nfapi_nr_config_request_scf_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_nr_config_response_scf_t))
+ retLen = sizeof(nfapi_nr_config_response_scf_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
+ if (unpackedBufLen >= sizeof( nfapi_nr_start_request_scf_t))
+ retLen = sizeof( nfapi_nr_start_request_scf_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_nr_start_response_scf_t))
+ retLen = sizeof(nfapi_nr_start_response_scf_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_stop_request_t))
+ retLen = sizeof(nfapi_stop_request_t);
+
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_stop_response_t))
+ retLen = sizeof(nfapi_stop_response_t);
+
+ break;
+
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s Unknown message ID %d\n", __FUNCTION__, msgId);
+ break;
+ }
+
+ return retLen;
+}
+
+
+static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) {
+ int retLen = 0;
+
+ switch (msgId) {
+ case NFAPI_PNF_PARAM_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_param_request_t))
+ retLen = sizeof(nfapi_pnf_param_request_t);
+
+ break;
+
+ case NFAPI_PNF_PARAM_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_param_response_t))
+ retLen = sizeof(nfapi_pnf_param_response_t);
+
+ break;
+
+ case NFAPI_PNF_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_config_request_t))
+ retLen = sizeof(nfapi_pnf_config_request_t);
+
+ break;
+
+ case NFAPI_PNF_CONFIG_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_config_response_t))
+ retLen = sizeof(nfapi_pnf_config_response_t);
+
+ break;
+
+ case NFAPI_PNF_START_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_start_request_t))
+ retLen = sizeof(nfapi_pnf_start_request_t);
+
+ break;
+
+ case NFAPI_PNF_START_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_start_response_t))
+ retLen = sizeof(nfapi_pnf_start_response_t);
+
+ break;
+
+ case NFAPI_PNF_STOP_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_stop_request_t))
+ retLen = sizeof(nfapi_pnf_stop_request_t);
+
+ break;
+
+ case NFAPI_PNF_STOP_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_pnf_stop_response_t))
+ retLen = sizeof(nfapi_pnf_stop_response_t);
+
+ break;
+
+ case NFAPI_PARAM_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_param_request_t))
+ retLen = sizeof(nfapi_param_request_t);
+
+ break;
+
+ case NFAPI_PARAM_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_param_response_t))
+ retLen = sizeof(nfapi_param_response_t);
+
+ break;
+
+ case NFAPI_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_config_request_t))
+ retLen = sizeof(nfapi_config_request_t);
+
+ break;
+
+ case NFAPI_CONFIG_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_config_response_t))
+ retLen = sizeof(nfapi_config_response_t);
+
+ break;
+
+ case NFAPI_START_REQUEST:
+ if (unpackedBufLen >= sizeof( nfapi_start_request_t))
+ retLen = sizeof( nfapi_start_request_t);
+
+ break;
+
+ case NFAPI_START_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_start_response_t))
+ retLen = sizeof(nfapi_start_response_t);
+
+ break;
+
+ case NFAPI_STOP_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_stop_request_t))
+ retLen = sizeof(nfapi_stop_request_t);
+
+ break;
+
+ case NFAPI_STOP_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_stop_response_t))
+ retLen = sizeof(nfapi_stop_response_t);
+
+ break;
+
+ case NFAPI_MEASUREMENT_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_measurement_request_t))
+ retLen = sizeof(nfapi_measurement_request_t);
+
+ break;
+
+ case NFAPI_MEASUREMENT_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_measurement_response_t))
+ retLen = sizeof(nfapi_measurement_response_t);
+
+ break;
+
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s Unknown message ID %d\n", __FUNCTION__, msgId);
+ break;
+ }
+
+ return retLen;
+}
+
+
+// Main unpack functions - public
+
+int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t)) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+
+ // process the header
+ return ( pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->spare, end) );
+}
+
+int nfapi_nr_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t)) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+
+ uint8_t *ptr = pReadPackedMessage;
+ printf("\n Read 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->spare, end))) {
+ // failed to read the header
+ return -1;
+ }
+
+ int result = -1;
+
+ if(check_nr_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) {
+ // the unpack buffer is not big enough for the struct
+ return -1;
+ }
+
+ // look for the specific message
+ switch (pMessageHeader->message_id) {
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
+ result = unpack_nr_pnf_param_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE:
+ result = unpack_nr_pnf_param_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST:
+ result = unpack_nr_pnf_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE:
+ result = unpack_nr_pnf_config_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST:
+ result = unpack_nr_pnf_start_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE:
+ result = unpack_nr_pnf_start_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST:
+ result = unpack_pnf_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE:
+ result = unpack_pnf_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
+ result = unpack_nr_param_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
+ result = unpack_nr_param_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
+ result = unpack_nr_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
+ result = unpack_nr_config_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
+ result = unpack_nr_start_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
+ result = unpack_nr_start_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
+ result = unpack_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE:
+ result = unpack_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_MEASUREMENT_REQUEST:
+ result = unpack_measurement_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_MEASUREMENT_RESPONSE:
+ result = unpack_measurement_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ default:
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
+ if(config && config->unpack_p4_p5_vendor_extension) {
+ result = (config->unpack_p4_p5_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 P5 message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+
+ break;
+ }
+
+ return result;
+}
+
+int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
+ nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t)) {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+
+ uint8_t *ptr = pReadPackedMessage;
+ printf("\n Read 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->spare, end))) {
+ // failed to read the header
+ return -1;
+ }
+
+ int result = -1;
+
+ if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) {
+ // the unpack buffer is not big enough for the struct
+ return -1;
+ }
+
+ // look for the specific message
+ switch (pMessageHeader->message_id) {
+ case NFAPI_PNF_PARAM_REQUEST:
+ result = unpack_pnf_param_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PNF_PARAM_RESPONSE:
+ result = unpack_pnf_param_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PNF_CONFIG_REQUEST:
+ result = unpack_pnf_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PNF_CONFIG_RESPONSE:
+ result = unpack_pnf_config_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PNF_START_REQUEST:
+ result = unpack_pnf_start_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PNF_START_RESPONSE:
+ result = unpack_pnf_start_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PNF_STOP_REQUEST:
+ result = unpack_pnf_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PNF_STOP_RESPONSE:
+ result = unpack_pnf_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PARAM_REQUEST:
+ result = unpack_param_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_PARAM_RESPONSE:
+ result = unpack_param_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_CONFIG_REQUEST:
+ result = unpack_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_CONFIG_RESPONSE:
+ result = unpack_config_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_START_REQUEST:
+ result = unpack_start_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_START_RESPONSE:
+ result = unpack_start_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_STOP_REQUEST:
+ result = unpack_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_STOP_RESPONSE:
+ result = unpack_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_MEASUREMENT_REQUEST:
+ result = unpack_measurement_request(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ case NFAPI_MEASUREMENT_RESPONSE:
+ result = unpack_measurement_response(&pReadPackedMessage, end, pMessageHeader, config);
+ break;
+
+ default:
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
+ if(config && config->unpack_p4_p5_vendor_extension) {
+ result = (config->unpack_p4_p5_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 P5 message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+
+ break;
+ }
+
+ return result;
+}
+
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
index 9e9c9d5496..ecd8e3dbfe 100644
--- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
@@ -1,7362 +1,7948 @@
-/*
- * 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, DCI_PAYLOAD_BYTE_LEN, 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) {
- 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, DCI_PAYLOAD_BYTE_LEN, 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));
-}
-
-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;
- //Fixme: allocate some mem to fix pure bug, need to find out proper size
- pNfapiMsg->vendor_extension=NULL;//(nfapi_vendor_extension_tlv_t)malloc( sizeof(* pNfapiMsg->vendor_extension));
- 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, DCI_PAYLOAD_BYTE_LEN, 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) {
- 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(!(pull32(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, DCI_PAYLOAD_BYTE_LEN, 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;
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) &&
- unpack_p7_tlv_list(NULL, 0, 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;
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) &&
- unpack_p7_tlv_list(NULL, 0, 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;
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
- unpack_p7_tlv_list(NULL, 0, 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;
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
- unpack_p7_tlv_list(NULL, 0, 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;
- 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(NULL, 0, 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;
- 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(NULL, 0, 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) {
+ 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(!(push32(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;
+ //Fixme: allocate some mem to fix pure bug, need to find out proper size
+ pNfapiMsg->vendor_extension=NULL;//(nfapi_vendor_extension_tlv_t)malloc( sizeof(* pNfapiMsg->vendor_extension));
+ 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));
+}
+
+//NR UPLINK indication function packing
+
+//SLOT INDICATION
+
+static uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
+
+ if (!(push16((uint16_t)pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16((uint16_t)pNfapiMsg->slot , ppWritePackedMsg, end)
+ ))
+ return 0;
+
+return 1;
+}
+
+//RX DATA INDICATION
+
+static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_rx_data_pdu_t* value = (nfapi_nr_rx_data_pdu_t*)tlv;
+
+ if(!(push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->harq_id, ppWritePackedMsg, end) &&
+ push16(value->pdu_length, ppWritePackedMsg, end) &&
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push16(value->rssi, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ return 1;
+}
+
+
+static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_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_nr_rx_data_indication_body(pNfapiMsg->pdu_list,ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+//NR CRC INDICATION
+
+static uint8_t pack_nr_crc_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_crc_t* value = (nfapi_nr_crc_t*)tlv;
+
+ if(!(push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->harq_id, ppWritePackedMsg, end) &&
+ push8(value->tb_crc_status, ppWritePackedMsg, end) &&
+ push16(value->num_cb, ppWritePackedMsg, end) &&
+ //pusharray8(value->cb_crc_status, (int)(value->num_cb / 8) + 1, (int)(value->num_cb / 8) + 1, ppWritePackedMsg, end) && //length is ceil(NumCb/8)
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push16(value->rssi, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ return 1;
+}
+
+static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
+
+ if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->number_crcs, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; inumber_crcs;i++)
+ {
+ if(!pack_nr_crc_indication_body(pNfapiMsg->crc_list,ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+//SRS INDICATION
+
+static uint8_t pack_nr_srs_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_srs_indication_pdu_t* value = (nfapi_nr_srs_indication_pdu_t*)tlv;
+
+ if(!(push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push8(value->num_symbols, ppWritePackedMsg, end) &&
+ push8(value->wide_band_snr, ppWritePackedMsg, end) &&
+ push8(value->num_reported_symbols, ppWritePackedMsg, end) &&
+ push8(value->reported_symbol_list->num_rbs, ppWritePackedMsg, end)
+ ))
+ return 0;
+ for(int i = 0; i < value->reported_symbol_list->num_rbs; i++)
+ {
+ if(!(push8(value->reported_symbol_list->rb_list->rb_snr, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_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_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+//RACH INDICATION
+
+static uint8_t pack_nr_rach_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
+
+ if(!(push16(value->phy_cell_id, ppWritePackedMsg, end) &&
+ push8(value->symbol_index, ppWritePackedMsg, end) &&
+ push8(value->slot_index, ppWritePackedMsg, end) &&
+ push8(value->freq_index, ppWritePackedMsg, end) &&
+ push8(value->avg_rssi, ppWritePackedMsg, end) &&
+ push8(value->avg_snr, ppWritePackedMsg, end) &&
+ push8(value->num_preamble, ppWritePackedMsg, end)
+ ))
+ return 0;
+ for(int i = 0; i < value->num_preamble; i++)
+ {
+ if(!(push8(value->preamble_list->preamble_index, ppWritePackedMsg, end) &&
+ push16(value->preamble_list->timing_advance, ppWritePackedMsg, end) &&
+ push32(value->preamble_list->preamble_pwr, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
+
+ if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; inumber_of_pdus;i++)
+ {
+ if(!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+
+//UCI INDICATION
+
+static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
+
+ if(!(push8(value->pduBitmap, ppWritePackedMsg, end) &&
+ push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->pucch_format, ppWritePackedMsg, end) &&
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push16(value->rssi, ppWritePackedMsg, end)
+ ))
+ return 0;
+ if (value->pduBitmap & 0x01) { //SR
+ if(!(push8(value->sr->sr_indication, ppWritePackedMsg, end) &&
+ push8(value->sr->sr_confidence_level, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
+ if(!(push8(value->harq->num_harq, ppWritePackedMsg, end) &&
+ push8(value->harq->harq_confidence_level, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; iharq->num_harq;i++)
+ {
+ if(!(push8(value->harq->harq_list[i].harq_value, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
+
+ if(!(push8(value->pduBitmap, ppWritePackedMsg, end) &&
+ push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->pucch_format, ppWritePackedMsg, end) &&
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push16(value->rssi, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ if (value->pduBitmap & 0x01) { //SR
+ if(!(push8(value->sr.sr_bit_len, ppWritePackedMsg, end) &&
+ pusharray8(value->sr.sr_payload, (int)(value->sr.sr_bit_len / 8) + 1, (int)(value->sr.sr_bit_len / 8) + 1, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
+ if(!(push8(value->harq.harq_crc, ppWritePackedMsg, end) &&
+ push8(value->harq.harq_bit_len, ppWritePackedMsg, end) &&
+ pusharray8(value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8) + 1, (int)(value->harq.harq_bit_len / 8) + 1, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
+ if(!(push8(value->csi_part1.csi_part1_crc, ppWritePackedMsg, end) &&
+ push8(value->csi_part1.csi_part1_bit_len, ppWritePackedMsg, end) &&
+ pusharray8(value->csi_part1.csi_part1_payload, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
+ if(!(push8(value->csi_part2.csi_part2_crc, ppWritePackedMsg, end) &&
+ push8(value->csi_part2.csi_part2_bit_len, ppWritePackedMsg, end) &&
+ pusharray8(value->csi_part2.csi_part2_payload, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_uci_t* value = (nfapi_nr_uci_t*)tlv;
+
+ if(!(push16(value->pdu_type, ppWritePackedMsg, end) &&
+ push16(value->pdu_size, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ switch (value->pdu_type) {
+ case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
+ printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
+ break;
+
+ case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
+ pack_nr_uci_pucch_0_1(&value->pucch_pdu_format_0_1, ppWritePackedMsg, end);
+ break;
+
+ case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
+ pack_nr_uci_pucch_2_3_4(&value->pucch_pdu_format_2_3_4, ppWritePackedMsg, end);
+ break;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
+
+ if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->num_ucis, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; inum_ucis;i++)
+ {
+ if(!pack_nr_uci_indication_body(pNfapiMsg->uci_list,ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+
+// 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_NR_PHY_MSG_TYPE_SLOT_INDICATION:
+ result = pack_nr_slot_indication(pMessageHeader, &pWritePackedMessage, end, config);
+
+ case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
+ result = pack_nr_rx_data_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
+ result = pack_nr_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
+ result = pack_nr_uci_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
+ result = pack_nr_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
+ result = pack_nr_rach_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) {
+ 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(!(pull32(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;
+}
+
+//UNPACK NR UPLINK INDICATION FUNCTIONS
+
+//SLOT INDICATION
+
+static uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_slot_indication_scf_t *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->slot , end)
+ ))
+ return 0;
+
+return 1;
+}
+
+//RX DATA INDICATION
+
+static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_rx_data_pdu_t* value = (nfapi_nr_rx_data_pdu_t*)tlv;
+
+ if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->harq_id, end) &&
+ pull16(ppReadPackedMsg, &value->pdu_length, end) &&
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &value->rssi, end)
+ ))
+ return 0;
+ return 1;
+}
+
+
+static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_rx_data_indication_t *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_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; inumber_of_pdus;i++)
+ {
+ if(!unpack_nr_rx_data_indication_body(pNfapiMsg->pdu_list, ppReadPackedMsg, end))
+ return 0;
+ }
+
+return 1;
+}
+
+//NR CRC INDICATION
+
+static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->harq_id, end) &&
+ pull8(ppReadPackedMsg, &value->tb_crc_status, end) &&
+ pull16(ppReadPackedMsg, &value->num_cb, end) &&
+ //pullarray8(ppReadPackedMsg, value->cb_crc_status, (int)(value->num_cb / 8) + 1, (int)(value->num_cb / 8) + 1, end) && //length is ceil(NumCb/8)
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &value->rssi, end)
+ ))
+ return 0;
+
+ //memcpy((nfapi_nr_crc_t *)tlv,value,sizeof(nfapi_nr_crc_t));
+
+ return 1;
+}
+
+static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_crc_indication_t *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t *) msg;
+ // pNfapiMsg = (nfapi_nr_crc_indication_t *) malloc(sizeof(nfapi_nr_crc_indication_t));
+ // pNfapiMsg->crc_list = (nfapi_nr_crc_t *) malloc(sizeof(nfapi_nr_crc_t));
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->slot, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
+ ))
+ return 0;
+
+ for(int i=0; inumber_crcs;i++)
+ {
+ if(!unpack_nr_crc_indication_body(pNfapiMsg->crc_list,ppReadPackedMsg,end))
+ //if(!unpack_nr_crc_indication_body(value,ppReadPackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+//SRS INDICATION
+
+static uint8_t unpack_nr_srs_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_srs_indication_pdu_t* value = (nfapi_nr_srs_indication_pdu_t*)tlv;
+
+ if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull8(ppReadPackedMsg, &value->num_symbols, end) &&
+ pull8(ppReadPackedMsg, &value->wide_band_snr, end) &&
+ pull8(ppReadPackedMsg, &value->num_reported_symbols, end) &&
+ pull16(ppReadPackedMsg, &value->reported_symbol_list->num_rbs, end)
+ ))
+ return 0;
+ for(int i = 0; i < value->reported_symbol_list->num_rbs; i++)
+ {
+ if(!(pull8(ppReadPackedMsg, &value->reported_symbol_list->rb_list->rb_snr, end)
+ ))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg,&pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg,&pNfapiMsg->slot , end) &&
+ pull8(ppReadPackedMsg,&pNfapiMsg->number_of_pdus, end)
+ ))
+ return 0;
+
+ for(int i=0; inumber_of_pdus;i++)
+ {
+ if(!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+//NR RACH
+
+static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
+
+ if(!(pull16(ppReadPackedMsg, &value->phy_cell_id, end) &&
+ pull8(ppReadPackedMsg, &value->symbol_index, end) &&
+ pull8(ppReadPackedMsg, &value->slot_index, end) &&
+ pull8(ppReadPackedMsg, &value->freq_index, end) &&
+ pull8(ppReadPackedMsg, &value->avg_rssi, end) &&
+ pull8(ppReadPackedMsg, &value->avg_snr, end) &&
+ pull8(ppReadPackedMsg, &value->num_preamble, end)
+ ))
+ return 0;
+ value->preamble_list = (nfapi_nr_prach_indication_preamble_t*) malloc(sizeof(nfapi_nr_prach_indication_preamble_t) * value->num_preamble);
+ for(int i = 0; i < value->num_preamble; i++)
+ {
+ if(!(pull8(ppReadPackedMsg, &value->preamble_list->preamble_index, end) &&
+ pull16(ppReadPackedMsg, &value->preamble_list->timing_advance, end) &&
+ pull32(ppReadPackedMsg, &value->preamble_list->preamble_pwr, end)
+ ))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_rach_indication_t* msg, nfapi_p7_codec_config_t* config) {
+
+ nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
+ ))
+ return 0;
+ pNfapiMsg->pdu_list = (nfapi_nr_prach_indication_pdu_t*) malloc(sizeof(nfapi_nr_prach_indication_pdu_t) * pNfapiMsg->number_of_pdus);
+ for(int i=0; i< pNfapiMsg->number_of_pdus;i++)
+ {
+ if(!unpack_nr_rach_indication_body(pNfapiMsg->pdu_list,ppReadPackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+//NR UCI
+
+static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
+
+ // uint8_t *ptr = *ppReadPackedMsg;
+ // printf("\n Read P7 message uci_0_1 indication unpack: ");
+ // while(ptr < end){
+ // printf(" %d ", *ptr);
+ // ptr++;
+ // }
+ // printf("\n");
+
+ if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
+ pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->pucch_format, end) &&
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &value->rssi, end)
+ ))
+ return 0;
+ if (value->pduBitmap & 0x01) { //SR
+ value->sr = (nfapi_nr_sr_pdu_0_1_t*) malloc(sizeof(nfapi_nr_sr_pdu_0_1_t));
+ if(!(pull8(ppReadPackedMsg, &value->sr->sr_indication, end) &&
+ pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
+ value->harq = (nfapi_nr_harq_pdu_0_1_t*) malloc(sizeof(nfapi_nr_harq_pdu_0_1_t));
+ if(!(pull8(ppReadPackedMsg, &value->harq->num_harq, end) &&
+ pull8(ppReadPackedMsg, &value->harq->harq_confidence_level, end)
+ ))
+ return 0;
+ value->harq->harq_list = (nfapi_nr_harq_t*) malloc(sizeof(nfapi_nr_harq_t*) * value->harq->num_harq);
+ for(int i=0; iharq->num_harq;i++)
+ {
+ if(!(pull8(ppReadPackedMsg, &value->harq->harq_list->harq_value, end)
+ ))
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
+ pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->pucch_format, end) &&
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &value->rssi, end)
+ ))
+ return 0;
+ if (value->pduBitmap & 0x01) { //SR
+ if(!(pull16(ppReadPackedMsg, &value->sr.sr_bit_len, end)))
+ return 0;
+
+ value->sr.sr_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->sr.sr_bit_len/8)));
+
+ if(!(pullarray8(ppReadPackedMsg, &value->sr.sr_payload[0], (int)(value->sr.sr_bit_len / 8), (int)(value->sr.sr_bit_len / 8), end)))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
+ if(!(pull8(ppReadPackedMsg, &value->harq.harq_crc, end)) &&
+ (pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end)))
+ return 0;
+
+ value->harq.harq_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->harq.harq_bit_len/8 )));
+
+ if(!(pullarray8(ppReadPackedMsg, value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8), (int)(value->harq.harq_bit_len / 8), end)))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
+ if(!(pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end)) &&
+ (pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, end)))
+ return 0;
+
+ value->csi_part1.csi_part1_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->csi_part1.csi_part1_bit_len/8)));
+
+// if(!(pullarray8(ppReadPackedMsg, value->csi_part1.csi_part1_payload, (int)(value->csi_part1.csi_part1_bit_len / 8), (int)(value->csi_part1.csi_part1_bit_len / 8), end)))
+// return 0;
+ }
+
+ if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
+ if(!(pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end)) &&
+ (pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, end)))
+ return 0;
+
+ value->csi_part2.csi_part2_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->csi_part2.csi_part2_bit_len/8 )));
+
+ if(!(pullarray8(ppReadPackedMsg, value->csi_part2.csi_part2_payload, (int)(value->csi_part2.csi_part2_bit_len / 8) , (int)(value->csi_part2.csi_part2_bit_len / 8) , end)))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ if(!(pull16(ppReadPackedMsg, &value->pdu_type, end) &&
+ pull16(ppReadPackedMsg, &value->pdu_size, end)
+ ))
+ return 0;
+
+ switch (value->pdu_type) {
+ case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
+ printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
+ break;
+
+ case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
+ nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu = &value->pucch_pdu_format_0_1;
+ unpack_nr_uci_pucch_0_1(uci_pdu, ppReadPackedMsg, end);
+ break;
+ }
+ case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
+ nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
+ unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end);
+ break;
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->num_ucis, end)
+ ))
+ return 0;
+
+ for(int i=0; inum_ucis;i++)
+ {
+ if(!unpack_nr_uci_indication_body(pNfapiMsg->uci_list,ppReadPackedMsg,end))
+ return 0;
+ }
+
+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;
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) &&
+ unpack_p7_tlv_list(NULL, 0, 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;
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) &&
+ unpack_p7_tlv_list(NULL, 0, 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;
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
+ unpack_p7_tlv_list(NULL, 0, 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;
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
+ unpack_p7_tlv_list(NULL, 0, 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;
+ 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(NULL, 0, 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;
+ 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(NULL, 0, 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_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_rx_data_indication_t))
+ retLen = sizeof(nfapi_nr_rx_data_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_crc_indication_t))
+ retLen = sizeof(nfapi_nr_crc_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_rach_indication_t))
+ retLen = sizeof(nfapi_nr_rach_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_uci_indication_t))
+ retLen = sizeof(nfapi_nr_uci_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_srs_indication_t))
+ retLen = sizeof(nfapi_nr_srs_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_NR_PHY_MSG_TYPE_SLOT_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION, unpackedBufLen)){
+ nfapi_nr_slot_indication_scf_t* msg = (nfapi_nr_slot_indication_scf_t*) pMessageHeader;
+ result = unpack_nr_slot_indication(&pReadPackedMessage, end, msg, config);
+ }
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen)){
+ nfapi_nr_rx_data_indication_t* msg = (nfapi_nr_rx_data_indication_t*) pMessageHeader;
+ msg->pdu_list = (nfapi_nr_rx_data_pdu_t*) malloc(sizeof(nfapi_nr_rx_data_pdu_t));
+ msg->pdu_list->pdu = (uint8_t *) malloc(sizeof(uint8_t));
+ result = unpack_nr_rx_data_indication(&pReadPackedMessage, end, msg, config);
+ }
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION, unpackedBufLen)){
+
+ nfapi_nr_crc_indication_t* msg = (nfapi_nr_crc_indication_t*) pMessageHeader;
+ msg->crc_list = (nfapi_nr_crc_t*) malloc(sizeof(nfapi_nr_crc_t));
+ result = unpack_nr_crc_indication(&pReadPackedMessage,end , msg, config);
+ }
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION, unpackedBufLen)){
+ nfapi_nr_uci_indication_t* msg = (nfapi_nr_uci_indication_t*) pMessageHeader;
+ msg->uci_list = (nfapi_nr_uci_t*) malloc(sizeof(nfapi_nr_uci_t));
+ result = unpack_nr_uci_indication(&pReadPackedMessage, end, msg, config);
+ }
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION, unpackedBufLen)){
+ nfapi_nr_srs_indication_t* msg = (nfapi_nr_srs_indication_t*) pMessageHeader;
+ msg->pdu_list = (nfapi_nr_srs_indication_pdu_t*) malloc(sizeof(nfapi_nr_srs_indication_pdu_t));
+ result = unpack_nr_srs_indication(&pReadPackedMessage, end, msg, config);
+ }
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION, unpackedBufLen)){
+ nfapi_nr_rach_indication_t* msg = (nfapi_nr_rach_indication_t*) pMessageHeader;
+ result = unpack_nr_rach_indication(&pReadPackedMessage, end, msg, 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/inc/pnf_p7.h b/nfapi/open-nFAPI/pnf/inc/pnf_p7.h
index 1e2e2fa21d..763b5c9abe 100644
--- a/nfapi/open-nFAPI/pnf/inc/pnf_p7.h
+++ b/nfapi/open-nFAPI/pnf/inc/pnf_p7.h
@@ -153,10 +153,17 @@ int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t msg_len);
int pnf_p7_slot_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
int pnf_p7_subframe_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn_sf);
-
+int nfapi_pnf_p7_nr_slot_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_slot_indication_scf_t* ind);
+int nfapi_pnf_p7_nr_rx_data_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rx_data_indication_t* ind);
+int nfapi_pnf_p7_nr_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_crc_indication_t* ind);
+int nfapi_pnf_p7_nr_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_srs_indication_t* ind);
+int nfapi_pnf_p7_nr_uci_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_uci_indication_t* ind);
+int nfapi_pnf_p7_nr_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rach_indication_t* ind);
pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len);
void pnf_p7_rx_reassembly_queue_remove_msg(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, pnf_p7_rx_message_t* msg);
void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint32_t delta);
+int pnf_nr_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* header, uint32_t msg_len);
+
#endif /* _PNF_P7_H_ */
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 8520a5d162..fc9cd66077 100644
--- a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
+++ b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
@@ -27,6 +27,7 @@ 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/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
index 18891cdee9..092b967189 100644
--- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c
+++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
@@ -156,17 +156,16 @@ nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7)
void deallocate_nfapi_dl_tti_request(nfapi_nr_dl_tti_request_t* req, pnf_p7_t* pnf_p7)
{
//printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->dl_config_request_body.dl_config_pdu_list);
- /*
- if(pnf_p7->_public.codec_config.deallocate)
- {
- //nfapi_nr_dl_tti_request_pdu_t *temp = &req->dl_tti_pdu_list;
- (pnf_p7->_public.codec_config.deallocate)(req);
- }
- else
- {
- free(req);
- }
-*/
+
+ // if(pnf_p7->_public.codec_config.deallocate)
+ // {
+ // (pnf_p7->_public.codec_config.deallocate)(req);
+ // }
+ // else
+ // {
+ // free(req);
+ // }
+
pnf_p7_free(pnf_p7, req);
}
@@ -915,14 +914,13 @@ void send_dummy_subframe(pnf_p7_t* pnf_p7, uint16_t sfn_sf)
int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t slot)
-{
+{
+ //This function is aligned with rx sfn/slot
+
// We could either send an event to the p7 thread have have it run the
// subframe or we could handle it here and lock access to the subframe
// buffers. If we do it on the p7 thread then we run the risk of blocking
// on the udp send.
- //
- // todo : start a timer to give us more of the 1 ms tick before send back
- // the frame
// todo : consider a more efficent lock mechasium
//uint16_t NUM_SLOTS = 20;//10* 2^mu
@@ -935,21 +933,21 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
// save the curren time, sfn and slot
pnf_p7->slot_start_time_hr = pnf_get_current_time_hr();
- pnf_p7->sfn = sfn;
-
- pnf_p7->slot = slot;
-
-
-
+ slot_ahead = 6;
uint32_t sfn_slot_tx = sfnslot_add_slot(sfn, slot, slot_ahead);
- uint16_t sfn_tx = sfn_slot_tx>>6;
- uint16_t slot_tx = sfn_slot_tx & 0X3F;
+ uint16_t sfn_tx = NFAPI_SFNSLOT2SFN(sfn_slot_tx);
+ uint8_t slot_tx = NFAPI_SFNSLOT2SLOT(sfn_slot_tx);
- // uint32_t tx_sfn_slot_dec = NFAPI_SFNSLOT2DEC(sfn,slot);
- uint32_t tx_slot_dec = NFAPI_SFNSLOT2DEC(sfn,slot);
+ //We align the pnf_p7 sfn/slot with tx sfn/slot, and vnf is synced with pnf_p7 sfn/slot. This is so that the scheduler runs slot_ahead from rx thread.
+ pnf_p7->sfn = sfn_tx;
+ pnf_p7->slot = slot_tx;
- //uint32_t tx_sfn_slot_dec = NFAPI_SFNSLOT2DEC(sfn_slot_tx);
+ uint32_t rx_slot_dec = NFAPI_SFNSLOT2DEC(sfn, slot);
+ uint8_t buffer_index_rx = rx_slot_dec % 20;
+
+ uint32_t tx_slot_dec = NFAPI_SFNSLOT2DEC(sfn_tx,slot_tx);
+ uint8_t buffer_index_tx = tx_slot_dec % 20;
// If the subframe_buffer has been configured
if(pnf_p7->_public.slot_buffer_size!= 0) // for now value is same as sf_buffer_size
@@ -976,28 +974,20 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
pnf_p7->slot_shift = 0;
}
- uint32_t slot_dec = NFAPI_SFNSLOT2DEC(sfn, slot);
- uint8_t buffer_index = slot_dec % pnf_p7->_public.slot_buffer_size;
+ nfapi_pnf_p7_slot_buffer_t* rx_slot_buffer = &(pnf_p7->slot_buffer[buffer_index_rx]);
- nfapi_pnf_p7_slot_buffer_t* slot_buffer = &(pnf_p7->slot_buffer[buffer_index]);
- // see where the PNF_P7 slot buffer its getting filled
+ nfapi_pnf_p7_slot_buffer_t* tx_slot_buffer = &(pnf_p7->slot_buffer[buffer_index_tx]);
- uint8_t tx_buffer_index = tx_slot_dec % pnf_p7->_public.slot_buffer_size;
- nfapi_pnf_p7_slot_buffer_t* tx_slot_buffer = &(pnf_p7->slot_buffer[tx_buffer_index]);
-
- if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d slot_buffer->sfn_sf:%d tx_slot_buffer->sfn_slot:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
- "TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n",
- __FUNCTION__,
- pnf_p7->slot_shift,
- NFAPI_SFNSLOT2DEC(slot_buffer->sfn, slot_buffer->slot),
- NFAPI_SFNSLOT2DEC(tx_slot_buffer->sfn, tx_slot_buffer->slot),
- slot_dec, buffer_index, slot_buffer->dl_tti_req, slot_buffer->tx_data_req,
- tx_slot_dec, tx_buffer_index, tx_slot_buffer->dl_tti_req, tx_slot_buffer->tx_data_req);
+ // if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d slot_buffer->sfn_sf:%d tx_slot_buffer->sfn_slot:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
+ // "TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n",
+ // __FUNCTION__,
+ // pnf_p7->slot_shift,
+ // NFAPI_SFNSLOT2DEC(rx_slot_buffer->sfn, rx_slot_buffer->slot),
+ // NFAPI_SFNSLOT2DEC(tx_slot_buffer->sfn, tx_slot_buffer->slot),
+ // slot_dec, buffer_index_rx, rx_slot_buffer->dl_tti_req, rx_slot_buffer->tx_data_req,
+ // tx_slot_dec, buffer_index_tx, tx_slot_buffer->dl_tti_req, tx_slot_buffer->tx_data_req);
//TODO: Change later if required
-
- // if the subframe buffer sfn sf is set then we have atlease 1 message
- // from the vnf.
// todo : how to handle the messages we don't have, send dummies for
// now
@@ -1006,37 +996,39 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
//printf("tx_slot_buff_sfn - %d, tx_slot_buf_slot - %d, sfn_tx = %d, sllot_tx - %d \n",tx_slot_buffer->sfn,tx_slot_buffer->slot,sfn_tx,slot_tx);
// if(tx_slot_buffer->slot == slot_tx && tx_slot_buffer->sfn == sfn_tx)
// {
-
- if(tx_slot_buffer->tx_data_req != 0)
- {
-
- if(pnf_p7->_public.tx_data_req_fn)
- {
- (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), tx_slot_buffer->tx_data_req);
- }
- }
- else
- {
- // send dummy
- if(pnf_p7->_public.tx_data_req_fn && pnf_p7->_public.dummy_slot.tx_data_req)
- {
- pnf_p7->_public.dummy_slot.tx_data_req->SFN = sfn_tx;
- pnf_p7->_public.dummy_slot.tx_data_req->Slot = slot_tx;
-
- (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), pnf_p7->_public.dummy_slot.tx_data_req);
- }
- }
- //}
+
+ //checking in the tx slot buffers to see if a p7 msg is present. todo: what if it's a mixed slot?
- if( tx_slot_buffer->dl_tti_req != 0) // ADDED & TO BYPASS ERROR
+ if(tx_slot_buffer->tx_data_req != 0 && tx_slot_buffer->tx_data_req->SFN == sfn_tx && tx_slot_buffer->tx_data_req->Slot == slot_tx)
+ {
+
+ if(pnf_p7->_public.tx_data_req_fn)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling tx_data_req_fn in SFN/slot %d.%d \n",sfn,slot);
+ LOG_D(PHY, "Process tx_data SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
+ (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), tx_slot_buffer->tx_data_req);
+ }
+ }
+ else
+ {
+ // send dummy
+ if(pnf_p7->_public.tx_data_req_fn && pnf_p7->_public.dummy_slot.tx_data_req)
+ {
+ pnf_p7->_public.dummy_slot.tx_data_req->SFN = sfn_tx;
+ pnf_p7->_public.dummy_slot.tx_data_req->Slot = slot_tx;
+
+ (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), pnf_p7->_public.dummy_slot.tx_data_req);
+ }
+ }
+
+ if(tx_slot_buffer->dl_tti_req != 0 && tx_slot_buffer->dl_tti_req->SFN == sfn_tx && tx_slot_buffer->dl_tti_req->Slot == slot_tx)
{
if(pnf_p7->_public.dl_tti_req_fn)
{
+ LOG_D(PHY, "Process dl_tti SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
(pnf_p7->_public.dl_tti_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->dl_tti_req);
}
}
-
-
else
{
// send dummy
@@ -1048,10 +1040,13 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
}
}
- if(tx_slot_buffer->ul_dci_req!= 0)
+
+ if(tx_slot_buffer->ul_dci_req!= 0 && tx_slot_buffer->ul_dci_req->SFN == sfn_tx && tx_slot_buffer->ul_dci_req->Slot == slot_tx)
{
if(pnf_p7->_public.ul_dci_req_fn)
{
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling UL_dci_req_fn in SFN/slot %d.%d \n",sfn,slot);
+ LOG_D(PHY, "Process ul_dci SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
(pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->ul_dci_req);
}
}
@@ -1065,10 +1060,14 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
(pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_dci_req);
}
}
+
+ //deallocate slot buffers after passing down the PDUs to PHY processing
+
if(tx_slot_buffer->dl_tti_req != 0)
{
deallocate_nfapi_dl_tti_request(tx_slot_buffer->dl_tti_req, pnf_p7);
tx_slot_buffer->dl_tti_req = 0;
+ LOG_D(PHY,"SFN/slot %d.%d Buffer index : %d freed \n",sfn_tx,slot_tx,buffer_index_tx);
}
if(tx_slot_buffer->tx_data_req != 0)
@@ -1082,73 +1081,52 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
deallocate_nfapi_ul_dci_request(tx_slot_buffer->ul_dci_req, pnf_p7);
tx_slot_buffer->ul_dci_req = 0;
}
+
+
+ //checking in the rx slot buffers to see if a p7 msg is present.
+
+ if(rx_slot_buffer->ul_tti_req != 0 && rx_slot_buffer->ul_tti_req->SFN == sfn && rx_slot_buffer->ul_tti_req->Slot == slot)
+ {
+ if(pnf_p7->_public.ul_tti_req_fn)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling UL_tti_req_fn in SFN/slot %d.%d \n",sfn,slot);
+ (pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), rx_slot_buffer->ul_tti_req);
+ }
+ }
else
{
- // If we ever need to "send" a dummy ul_config this won't work!!!
- // send_dummy_subframe(pnf_p7, sfn_sf_tx);
+ // send dummy
+ if(pnf_p7->_public.ul_tti_req_fn && pnf_p7->_public.dummy_slot.ul_tti_req)
+ {
+ pnf_p7->_public.dummy_slot.ul_tti_req->SFN = sfn;
+ pnf_p7->_public.dummy_slot.ul_tti_req->Slot = slot;
+ LOG_D(PHY, "Process ul_tti SFN/slot %d.%d buffer index: %d \n",sfn,slot,buffer_index_rx);
+ (pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_tti_req);
+ }
+ }
+ if(rx_slot_buffer->ul_tti_req != 0)
+ {
+ deallocate_nfapi_ul_tti_request(rx_slot_buffer->ul_tti_req, pnf_p7);
+ rx_slot_buffer->ul_tti_req = 0;
- // send_dummy_slot(pnf_p7, sfn_tx, slot_tx);
}
+ //reset slot buffer
-
- if(slot_buffer->sfn == sfn && slot_buffer->slot == slot )
+ if ( rx_slot_buffer->dl_tti_req == 0 &&
+ rx_slot_buffer->tx_data_req == 0 &&
+ rx_slot_buffer->ul_tti_req == 0)
{
-
- if(slot_buffer->ul_tti_req != 0)
- {
- if(pnf_p7->_public.ul_tti_req_fn)
- {
- (pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), slot_buffer->ul_tti_req);
- }
- //deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
- }
- else
- {
- // send dummy
- if(pnf_p7->_public.ul_tti_req_fn && pnf_p7->_public.dummy_slot.ul_tti_req)
- {
- pnf_p7->_public.dummy_slot.ul_tti_req->SFN = sfn;
- pnf_p7->_public.dummy_slot.ul_tti_req->Slot = slot;
- (pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_tti_req);
- }
- }
- //if(subframe_buffer->dl_config_req != 0)
- //deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
- //if(subframe_buffer->tx_req != 0)
- //deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
- if(slot_buffer->ul_tti_req != 0)
- {
- deallocate_nfapi_ul_tti_request(slot_buffer->ul_tti_req, pnf_p7);
- slot_buffer->ul_tti_req = 0;
-
- }
- #if 0
- if(slot_buffer->lbt_dl_config_req != 0)
- {
- deallocate_nfapi_lbt_dl_config_request(slot_buffer->lbt_dl_config_req, pnf_p7);
- slot_buffer->lbt_dl_config_req = 0;
- }
- #endif
- } // sfn_slot match
-
-
- if ( slot_buffer->dl_tti_req == 0 &&
- slot_buffer->tx_data_req == 0 &&
- slot_buffer->ul_tti_req == 0)
- //slot_buffer->lbt_dl_config_req == 0 &&
- //slot_buffer->ue_release_req == 0)
- {
- memset(&(pnf_p7->slot_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_slot_buffer_t));
- pnf_p7->slot_buffer[buffer_index].sfn = -1;
- pnf_p7->slot_buffer[buffer_index].slot = -1;
+ memset(&(pnf_p7->slot_buffer[buffer_index_rx]), 0, sizeof(nfapi_pnf_p7_slot_buffer_t));
+ pnf_p7->slot_buffer[buffer_index_rx].sfn = -1;
+ pnf_p7->slot_buffer[buffer_index_rx].slot = -1;
}
//printf("pnf_p7->_public.timing_info_mode_periodic:%d pnf_p7->timing_info_period_counter:%d pnf_p7->_public.timing_info_period:%d\n", pnf_p7->_public.timing_info_mode_periodic, pnf_p7->timing_info_period_counter, pnf_p7->_public.timing_info_period);
//printf("pnf_p7->_public.timing_info_mode_aperiodic:%d pnf_p7->timing_info_aperiodic_send:%d\n", pnf_p7->_public.timing_info_mode_aperiodic, pnf_p7->timing_info_aperiodic_send);
//printf("pnf_p7->timing_info_ms_counter:%d\n", pnf_p7->timing_info_ms_counter);
- // send the periodic timing info if configured
+ //send the periodic timing info if configured
if(pnf_p7->_public.timing_info_mode_periodic && (pnf_p7->timing_info_period_counter++) == pnf_p7->_public.timing_info_period)
{
pnf_nr_pack_and_send_timing_info(pnf_p7);
@@ -1167,26 +1145,6 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
}
}
- else
- {
- //send_dummy_subframe(pnf_p7, sfn_sf_tx);
- }
-
-
- //printf("pnf_p7->tick:%d\n", pnf_p7->tick);
- // if(pnf_p7->tick == 1000) // why?
- // {
- // // TODO: change stats to nr_stats
- // NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] (ONTIME/LATE) DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
- // pnf_p7->stats.dl_conf_ontime, pnf_p7->stats.dl_conf_late,
- // pnf_p7->stats.ul_conf_ontime, pnf_p7->stats.ul_conf_late,
- // pnf_p7->stats.hi_dci0_ontime, pnf_p7->stats.hi_dci0_late,
- // pnf_p7->stats.tx_ontime, pnf_p7->stats.tx_late);
- // pnf_p7->tick = 0;
- // memset(&pnf_p7->stats, 0, sizeof(pnf_p7->stats));
- // }
- // pnf_p7->tick++;
-
if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
{
@@ -1495,7 +1453,7 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name,
{
uint32_t recv_sfn_slot_dec = NFAPI_SFNSLOT2DEC(sfn,slot);
uint32_t current_sfn_slot_dec = NFAPI_SFNSLOT2DEC(phy->sfn,phy->slot);
- printf("p7_msg_sfn: %d, p7_msg_slot: %d, phy_sfn:%d , phy_slot:%d \n",sfn,slot,phy->sfn,phy->slot);
+ //printf("p7_msg_sfn: %d, p7_msg_slot: %d, phy_sfn:%d , phy_slot:%d \n",sfn,slot,phy->sfn,phy->slot);
uint8_t in_window = 0;
uint8_t timing_window = phy->_public.slot_buffer_size;
@@ -1546,11 +1504,11 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name,
// }
if(current_sfn_slot_dec <= recv_sfn_slot_dec + timing_window){
in_window = 1;
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
+ //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
}
else if(current_sfn_slot_dec + NFAPI_MAX_SFNSLOTDEC <= recv_sfn_slot_dec + timing_window){ //checking for wrap
in_window = 1;
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
+ //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
}
else
@@ -1630,7 +1588,6 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_dl_tti_request structure\n");
return;
}
-
int unpack_result = nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_nr_dl_tti_request_t), &(pnf_p7->_public.codec_config));
if(unpack_result == 0)
@@ -1640,34 +1597,18 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
return;
}
-#if 0
- if (
- 0 &&
- (NFAPI_SFNSF2DEC(req->sfn_sf) % 100 ==0 ||
- NFAPI_SFNSF2DEC(req->sfn_sf) % 105 ==0
- )
- )
- NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req sfn_sf:%d pdcch:%u dci:%u pdu:%u pdsch_rnti:%u pcfich:%u\n",
- NFAPI_SFNSF2DEC(req->sfn_sf),
- req->dl_config_request_body.number_pdcch_ofdm_symbols,
- req->dl_config_request_body.number_dci,
- req->dl_config_request_body.number_pdu,
- req->dl_config_request_body.number_pdsch_rnti,
- req->dl_config_request_body.transmission_power_pcfich
- );
-#endif
- if(is_nr_p7_request_in_window(req->SFN,req->Slot, "dl_tti_request", pnf_p7))
- {
- uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
- uint8_t buffer_index = sfn_slot_dec % pnf_p7->_public.slot_buffer_size;
+ if(is_nr_p7_request_in_window(req->SFN,req->Slot, "dl_tti_request", pnf_p7))
+ {
+ uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
+ uint8_t buffer_index = sfn_slot_dec % 20;
- struct timespec t;
- clock_gettime(CLOCK_MONOTONIC, &t);
+ struct timespec t;
+ clock_gettime(CLOCK_MONOTONIC, &t);
- //NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_TTI_REQ sfn_slot:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
+ NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
- // if there is already an dl_config_req make sure we free it.
+ // if there is already an dl_tti_req make sure we free it.
if(pnf_p7->slot_buffer[buffer_index].dl_tti_req != 0)
{
NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_nr_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_slot:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSLOT2DEC(req->SFN,req->Slot), buffer_index);
@@ -1677,7 +1618,7 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
deallocate_nfapi_dl_tti_request(pnf_p7->slot_buffer[buffer_index].dl_tti_req, pnf_p7);
}
- // saving dl_config_request in subframe buffer
+ // filling dl_tti_request in slot buffer
pnf_p7->slot_buffer[buffer_index].sfn = req->SFN;
pnf_p7->slot_buffer[buffer_index].slot = req->Slot;
pnf_p7->slot_buffer[buffer_index].dl_tti_req = req;
@@ -1826,12 +1767,12 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
if(is_nr_p7_request_in_window(req->SFN,req->Slot, "ul_tti_request", pnf_p7))
{
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
- uint8_t buffer_index = sfn_slot_dec % pnf_p7->_public.slot_buffer_size;
+ uint8_t buffer_index = (sfn_slot_dec % 20);
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
- NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_TTI_REQ sfn_slot:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
+ NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
if(pnf_p7->slot_buffer[buffer_index].ul_tti_req != 0)
{
@@ -1841,6 +1782,8 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
deallocate_nfapi_ul_tti_request(pnf_p7->slot_buffer[buffer_index].ul_tti_req, pnf_p7);
}
+
+ //filling slot buffer
pnf_p7->slot_buffer[buffer_index].sfn = req->SFN;
pnf_p7->slot_buffer[buffer_index].slot = req->Slot;
@@ -1972,7 +1915,7 @@ void pnf_handle_ul_dci_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
if(is_nr_p7_request_in_window(req->SFN,req->Slot,"ul_dci_request", pnf_p7))
{
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
- uint8_t buffer_index = sfn_slot_dec % pnf_p7->_public.slot_buffer_size;
+ uint8_t buffer_index = sfn_slot_dec % 20;
if(pnf_p7->slot_buffer[buffer_index].ul_dci_req!= 0)
{
@@ -2010,7 +1953,7 @@ void pnf_handle_ul_dci_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
}
else
{
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack hi_dci0_req\n");
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack UL DCI req\n");
deallocate_nfapi_ul_dci_request(req, pnf_p7);
}
}
@@ -2111,12 +2054,12 @@ void pnf_handle_tx_data_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
if(is_nr_p7_request_in_window(req->SFN, req->Slot,"tx_request", pnf_p7))
{
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
- uint8_t buffer_index = sfn_slot_dec % pnf_p7->_public.slot_buffer_size;
+ uint8_t buffer_index = sfn_slot_dec % 20;
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
- NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE TX_DATA_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
+ //NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE TX_DATA_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
#if 0
if (0 && NFAPI_SFNSF2DEC(req->sfn_sf)%100==0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX_REQ.req sfn_sf:%d pdus:%d - TX_REQ is within window\n",
__FUNCTION__,
@@ -2678,9 +2621,7 @@ void pnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
pnf_nr_handle_dl_node_sync(pRecvMsg, recvMsgLen, pnf_p7, rx_hr_time);
break;
-
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
- //printf("\nEntering pnf_handle_dl_tti_request sfn=%d,slot=%d \n",pnf_p7->sfn,pnf_p7->slot);
pnf_handle_dl_tti_request(pRecvMsg, recvMsgLen, pnf_p7);
break;
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
@@ -2989,13 +2930,11 @@ void pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_tim
struct sockaddr_in remote_addr;
socklen_t remote_addr_size = sizeof(remote_addr);
remote_addr.sin_family = 2; //hardcoded
-
do
{
// peek the header
uint8_t header_buffer[NFAPI_P7_HEADER_LENGTH];
recvfrom_result = recvfrom(pnf_p7->p7_sock, header_buffer, NFAPI_P7_HEADER_LENGTH, MSG_DONTWAIT | MSG_PEEK, (struct sockaddr*)&remote_addr, &remote_addr_size);
-
if(recvfrom_result > 0)
{
// get the segment size
@@ -3272,7 +3211,7 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
FD_SET(pnf_p7->p7_sock, &rfds);
struct timeval timeout;
- timeout.tv_sec = 1;
+ timeout.tv_sec = 100;
timeout.tv_usec = 0;
selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout);
diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c b/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
index efcb60ce96..0db1feb398 100644
--- a/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
+++ b/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
@@ -265,3 +265,77 @@ int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_re
return pnf_p7_pack_and_send_p7_message(_this, &(resp->header), sizeof(nfapi_ue_release_response_t));
}
+
+//NR UPLINK INDICATION
+
+int nfapi_pnf_p7_nr_slot_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_slot_indication_scf_t* ind)
+{
+ if(config == NULL || ind == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+ return -1;
+ }
+
+ pnf_p7_t* _this = (pnf_p7_t*)(config);
+ return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_rx_data_indication_t));
+}
+
+int nfapi_pnf_p7_nr_rx_data_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rx_data_indication_t* ind)
+{
+ if(config == NULL || ind == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+ return -1;
+ }
+
+ pnf_p7_t* _this = (pnf_p7_t*)(config);
+ return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_rx_data_indication_t));
+}
+
+int nfapi_pnf_p7_nr_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_crc_indication_t* ind)
+{
+ if(config == NULL || ind == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+ return -1;
+ }
+
+ pnf_p7_t* _this = (pnf_p7_t*)(config);
+ return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_crc_indication_t));
+}
+
+int nfapi_pnf_p7_nr_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_srs_indication_t* ind)
+{
+ if(config == NULL || ind == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+ return -1;
+ }
+
+ pnf_p7_t* _this = (pnf_p7_t*)(config);
+ return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_srs_indication_t));
+}
+
+int nfapi_pnf_p7_nr_uci_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_uci_indication_t* ind)
+{
+ if(config == NULL || ind == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+ return -1;
+ }
+
+ pnf_p7_t* _this = (pnf_p7_t*)(config);
+ return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_uci_indication_t));
+}
+
+int nfapi_pnf_p7_nr_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rach_indication_t* ind)
+{
+ if(config == NULL || ind == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+ return -1;
+ }
+
+ pnf_p7_t* _this = (pnf_p7_t*)(config);
+ return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_rach_indication_t));
+}
diff --git a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
index 4fe5065cea..1c2f0bef80 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 %u bytes/sec\n", instance->tx_byte_count);
+ printf("[FAPI] Tx rate %d 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 %u %u\n", last_millisec, millisec);
+ printf("*** missing millisec %d %d\n", last_millisec, millisec);
catchup = millisec - last_millisec - 1;
}
diff --git a/nfapi/open-nFAPI/vnf/inc/vnf_p7.h b/nfapi/open-nFAPI/vnf/inc/vnf_p7.h
index ad1c5e7944..4fcc99f79b 100644
--- a/nfapi/open-nFAPI/vnf/inc/vnf_p7.h
+++ b/nfapi/open-nFAPI/vnf/inc/vnf_p7.h
@@ -25,7 +25,6 @@
#define TIME2TIMEHR(_time) (((uint32_t)(_time.tv_sec) & 0xFFF) << 20 | ((uint32_t)(_time.tv_usec) & 0xFFFFF))
-
typedef struct {
uint8_t* buffer;
uint16_t length;
diff --git a/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h b/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h
index 518b01864e..31328393c9 100644
--- a/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h
+++ b/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h
@@ -852,7 +852,15 @@ typedef struct nfapi_vnf_p7_config
* use the codec_config.deallocate function to release it at a future point
*/
int (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind);
-
+
+ //The NR indication functions below copy uplink information received at the VNF into the UL info struct
+ int (*nr_slot_indication)(nfapi_nr_slot_indication_scf_t* ind);
+ int (*nr_crc_indication)(nfapi_nr_crc_indication_t* ind);
+ int (*nr_rx_data_indication)(nfapi_nr_rx_data_indication_t* ind);
+ int (*nr_uci_indication)(nfapi_nr_uci_indication_t* ind);
+ int (*nr_rach_indication)(nfapi_nr_rach_indication_t* ind);
+ int (*nr_srs_indication)(nfapi_nr_srs_indication_t* ind);
+
/*! A callback for any vendor extension messages
* \param config A pointer to the vnf p7 configuration
* \param msg A data structure for the decoded vendor extention message allocated
diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c
index ffbc5819bc..e390031554 100644
--- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c
+++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c
@@ -22,7 +22,7 @@
#include
#include
#include
-
+#include
#include "vnf_p7.h"
#define SYNC_CYCLE_COUNT 2
@@ -456,7 +456,7 @@ int send_mac_subframe_indications(vnf_p7_t* vnf_p7)
int vnf_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info, uint8_t* msg, const uint32_t len)
{
int sendto_result = sendto(vnf_p7->socket, msg, len, 0, (struct sockaddr*)&(p7_info->remote_addr), sizeof(p7_info->remote_addr));
- //printf("\nSending p7 message sfn=%d,slot=%d\n",vnf_p7->p7_connections->sfn,vnf_p7->p7_connections->slot);
+ //printf("P7 msg sent \n");
if(sendto_result != len)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sendto_result %d %d\n", __FUNCTION__, sendto_result, errno);
@@ -533,6 +533,7 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t*
nfapi_p7_update_transmit_timestamp(buffer, calculate_transmit_timestamp(p7_connection->sfn, p7_connection->slot, vnf_p7->slot_start_time_hr));
send_result = vnf_send_p7_msg(vnf_p7, p7_connection, &tx_buffer[0], segment_size);
+
}
}
else
@@ -549,7 +550,6 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t*
}
p7_connection->sequence_number++;
-
return send_result;
}
else
@@ -667,7 +667,6 @@ int vnf_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t
int vnf_nr_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info)
{
-
nfapi_nr_dl_node_sync_t dl_node_sync;
memset(&dl_node_sync, 0, sizeof(dl_node_sync));
@@ -1290,7 +1289,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
if(phy->in_sync == 0)
{
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
+ //NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
if(vnf_p7->_public.sync_indication)
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1);
@@ -1454,6 +1453,161 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
}
}
+//NR HANDLES FOR UPLINK MESSAGES
+void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+ // ensure it's valid
+ if (pRecvMsg == NULL || vnf_p7 == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+ }
+ else
+ {
+ nfapi_nr_slot_indication_scf_t ind;
+
+ if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+ }
+ else
+ {
+ if(vnf_p7->_public.nr_slot_indication)
+ {
+ (vnf_p7->_public.nr_slot_indication)(&ind);
+ }
+ }
+
+ }
+}
+void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+ // ensure it's valid
+ if (pRecvMsg == NULL || vnf_p7 == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+ }
+ else
+ {
+ nfapi_nr_rx_data_indication_t ind;
+
+ if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+ }
+ else
+ {
+ if(vnf_p7->_public.nr_rx_data_indication)
+ {
+ (vnf_p7->_public.nr_rx_data_indication)(&ind);
+ }
+ }
+
+ }
+}
+
+void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+ // ensure it's valid
+ if (pRecvMsg == NULL || vnf_p7 == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+ }
+ else
+ {
+ nfapi_nr_crc_indication_t ind;
+
+ if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+ }
+ else
+ {
+ if(vnf_p7->_public.nr_crc_indication)
+ {
+ (vnf_p7->_public.nr_crc_indication)(&ind);
+ }
+ }
+
+ }
+}
+
+void vnf_handle_nr_srs_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+ // ensure it's valid
+ if (pRecvMsg == NULL || vnf_p7 == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+ }
+ else
+ {
+ nfapi_nr_srs_indication_t ind;
+
+ if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+ }
+ else
+ {
+ if(vnf_p7->_public.nr_srs_indication)
+ {
+ (vnf_p7->_public.nr_srs_indication)(&ind);
+ }
+ }
+ }
+}
+
+void vnf_handle_nr_uci_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+ // ensure it's valid
+ if (pRecvMsg == NULL || vnf_p7 == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+ }
+ else
+ {
+ nfapi_nr_uci_indication_t ind;
+
+ if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+ }
+ else
+ {
+ if(vnf_p7->_public.nr_uci_indication)
+ {
+ (vnf_p7->_public.nr_uci_indication)(&ind);
+ }
+ }
+
+ }
+}
+
+void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+ // ensure it's valid
+ if (pRecvMsg == NULL || vnf_p7 == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+ }
+ else
+ {
+ nfapi_nr_rach_indication_t ind;
+
+ if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+ }
+ else
+ {
+ if(vnf_p7->_public.nr_rach_indication)
+ {
+ (vnf_p7->_public.nr_rach_indication)(&ind);
+ }
+ }
+
+ }
+}
+
void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
//printf("received UL Node sync");
@@ -1484,6 +1638,8 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
// divide by 2 using shift operator
uint32_t latency = (tx_2_rx - pnf_proc_time) >> 1;
+ //phy->in_sync = 1;
+
if(!(phy->filtered_adjust))
{
phy->latency[phy->min_sync_cycle_count] = latency;
@@ -1533,17 +1689,24 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
- //NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
- // phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
- // ind.t1, ind.t2, ind.t3, t4,
- // tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
- // (ind.t1previous_t1), (ind.t2previous_t2));
+ // NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
+ // phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
+ // ind.t1, ind.t2, ind.t3, t4,
+ // tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
+ // (ind.t1previous_t1), (ind.t2previous_t2));
}
}
if (phy->filtered_adjust && (phy->slot_offset_filtered > 1e6 || phy->slot_offset_filtered < -1e6))
- {
+ { struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
+ phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
+ ind.t1, ind.t2, ind.t3, t4,
+ tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
+ (ind.t1previous_t1), (ind.t2previous_t2));
+
phy->filtered_adjust = 0;
phy->zero_count=0;
phy->min_sync_cycle_count = 2;
@@ -1575,7 +1738,7 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
sfn_slot_dec += (phy->slot_offset / 500);
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF slot offset:%d sfn :%d slot:%d \n",phy->slot_offset,NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec),NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec) );
+ //NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF slot offset:%d sfn :%d slot:%d \n",phy->slot_offset,NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec),NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec) );
}
@@ -2033,47 +2196,31 @@ void vnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
case NFAPI_TIMING_INFO:
vnf_nr_handle_timing_info(pRecvMsg, recvMsgLen, vnf_p7);
break;
-
- case NFAPI_HARQ_INDICATION:
- vnf_handle_harq_indication(pRecvMsg, recvMsgLen, vnf_p7);
+
+ case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
+ vnf_handle_nr_slot_indication(pRecvMsg, recvMsgLen, vnf_p7);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
+ vnf_handle_nr_rx_data_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
- case NFAPI_CRC_INDICATION:
- vnf_handle_crc_indication(pRecvMsg, recvMsgLen, vnf_p7);
+ case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
+ vnf_handle_nr_crc_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
- case NFAPI_RX_ULSCH_INDICATION:
- vnf_handle_rx_ulsch_indication(pRecvMsg, recvMsgLen, vnf_p7);
+ case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
+ vnf_handle_nr_uci_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
- case NFAPI_RACH_INDICATION:
- vnf_handle_rach_indication(pRecvMsg, recvMsgLen, vnf_p7);
+ case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
+ vnf_handle_nr_srs_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
- case NFAPI_SRS_INDICATION:
- vnf_handle_srs_indication(pRecvMsg, recvMsgLen, vnf_p7);
+ case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
+ vnf_handle_nr_rach_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
- case NFAPI_RX_SR_INDICATION:
- vnf_handle_rx_sr_indication(pRecvMsg, recvMsgLen, vnf_p7);
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- vnf_handle_rx_cqi_indication(pRecvMsg, recvMsgLen, vnf_p7);
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- vnf_handle_lbt_dl_indication(pRecvMsg, recvMsgLen, vnf_p7);
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- vnf_handle_nb_harq_indication(pRecvMsg, recvMsgLen, vnf_p7);
- break;
-
- case NFAPI_NRACH_INDICATION:
- vnf_handle_nrach_indication(pRecvMsg, recvMsgLen, vnf_p7);
- break;
-
case NFAPI_UE_RELEASE_RESPONSE:
vnf_handle_ue_release_resp(pRecvMsg, recvMsgLen, vnf_p7);
break;
diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
index 3fa1f035fd..8cebf2b468 100644
--- a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
+++ b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
@@ -25,9 +25,14 @@
#include
#include "vnf_p7.h"
+#include "nfapi_vnf.h"
+#include "common/ran_context.h"
+
+#include "openair1/PHY/defs_gNB.h"
#define FAPI2_IP_DSCP 0
+extern RAN_CONTEXT_t RC;
nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
{
@@ -92,7 +97,9 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
// monitor the p7 endpoints and the timing loop and
// send indications to mac
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
-{
+{
+ struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
+ uint8_t prev_slot = 0;
if(config == 0)
return -1;
@@ -145,40 +152,14 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
//struct timespec original_pselect_timeout;
struct timespec pselect_timeout;
- pselect_timeout.tv_sec = 0;
- pselect_timeout.tv_nsec = 500000; // ns in a 0.5 ms
- //pselect_timeout.tv_nsec = 500000;
+ pselect_timeout.tv_sec = 100;
+ pselect_timeout.tv_nsec = 0;
- struct timespec pselect_start;
- struct timespec pselect_stop;
-
- //struct timespec sf_end;
-
- long last_millisecond = -1;
-
-
-// struct timespec sf_duration; //Change to slot_duration?
-// sf_duration.tv_sec = 0;
-// sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR
- struct timespec slot_duration;
- slot_duration.tv_sec = 0;
- //slot_duration.tv_nsec = 0.5e6;
- slot_duration.tv_nsec = 0.5e6;
-
-
-// struct timespec sf_start; //Change to slot_start?
- struct timespec slot_start;
-// clock_gettime(CLOCK_MONOTONIC, &sf_start);
- clock_gettime(CLOCK_MONOTONIC, &slot_start);
- long millisecond = slot_start.tv_nsec / 1e6; //Check if we have to change
- //long millisecond = slot_start.tv_nsec / 0.5e6;
-// sf_start = timespec_add(sf_start, sf_duration);
- slot_start = timespec_add(slot_start, slot_duration);
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", slot_start.tv_sec, slot_start.tv_nsec);
-
+ struct timespec ref_time;
+ clock_gettime(CLOCK_MONOTONIC, &ref_time);
+ uint8_t setup_time;
while(vnf_p7->terminate == 0)
- {
+ {
fd_set rfds;
int maxSock = 0;
FD_ZERO(&rfds);
@@ -188,239 +169,33 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
FD_SET(vnf_p7->socket, &rfds);
maxSock = vnf_p7->socket;
- clock_gettime(CLOCK_MONOTONIC, &pselect_start);
- //long millisecond = pselect_start.tv_nsec / 1e6;
+ struct timespec curr_time;
+ clock_gettime(CLOCK_MONOTONIC, &curr_time);
+ setup_time = curr_time.tv_sec - ref_time.tv_sec;
- if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) )
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
+ if(setup_time > 10 && prev_slot != gNB->UL_INFO.slot){ //Give the VNF sufficient time to setup before starting scheduling
-
- //if((pselect_start.tv_sec > sf_start.tv_sec) ||
- // ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
- if((pselect_start.tv_sec > slot_start.tv_sec) || ((pselect_start.tv_sec == slot_start.tv_sec) && (pselect_start.tv_nsec > slot_start.tv_nsec)))
- {
- // overran the end of the subframe we do not want to wait
- pselect_timeout.tv_sec = 0;
- pselect_timeout.tv_nsec = 0;
-
- //struct timespec overrun = timespec_sub(pselect_start, sf_start);
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec);
- }
- else
- {
- // still time before the end of the subframe wait
- //pselect_timeout = timespec_sub(sf_start, pselect_start);
- pselect_timeout = timespec_sub(slot_start, pselect_start);
- }
-
-//original_pselect_timeout = pselect_timeout;
-
- // detemine how long to sleep in ns before the start of the next 1ms
- //pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
-
- //uint8_t underrun_possible =0;
-
- // if we are not sleeping until the next milisecond due to the
- // insycn minor adjment flag it so we don't consider it an error
- //uint8_t underrun_possible =0;
- /*
- {
- nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
- if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0 && pselect_start.tv_nsec != 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %d (%d->%d)\n", phy->insync_minor_adjustment,
- pselect_timeout.tv_nsec, pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000))
- if(phy->insync_minor_adjustment > 0)
- {
- // todo check we don't go below 0
- if((phy->insync_minor_adjustment * 1000) > pselect_timeout.tv_nsec)
- pselect_timeout.tv_nsec = 0;
- else
- pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
-
-
- //underrun_possible = 1;
- }
- else if(phy->insync_minor_adjustment < 0)
- {
- // todo check we don't go below 0
- pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
-
-
- //phy->insync_minor_adjustment = 0;
- phy->insync_minor_adjustment_duration--;
- }
- }
- */
-
-
-//long wraps = pselect_timeout.tv_nsec % 1e9;
-
-
- selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
- // selectRetval = pselect(120, &rfds, NULL, NULL, &pselect_timeout, NULL);
-
- clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
-
- nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
-
-if (selectRetval==-1 && errno == 22)
-{
-// NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
-// pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
-// phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
-// sf_duration.tv_sec, sf_duration.tv_nsec);
-
-NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
- pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
- phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
- slot_duration.tv_sec, slot_duration.tv_nsec);
-
-}
- if(selectRetval == 0)
- {
- // calculate the start of the next slot
- //sf_start = timespec_add(sf_start, sf_duration);
- slot_start = timespec_add(slot_start, slot_duration);
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
-
- if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
- {
- long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
-
- //sf_start.tv_nsec -= insync_minor_adjustment_ns;
- slot_start.tv_nsec -= insync_minor_adjustment_ns;
-
-#if 1
-/* if (sf_start.tv_nsec > 1e9) //Change to 0.5e6?
- {
- sf_start.tv_sec++;
- sf_start.tv_nsec-=1e9;
- }
- else if (sf_start.tv_nsec < 0)
- {
- sf_start.tv_sec--;
- sf_start.tv_nsec+=1e9;
- }*/
- if (slot_start.tv_nsec > 1e9)
- {
- slot_start.tv_sec++;
- slot_start.tv_nsec-=1e9;
- }
- else if (slot_start.tv_nsec < 0)
- {
- slot_start.tv_sec--;
- slot_start.tv_nsec+=1e9;
- }
-#else
- //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
- if(phy->insync_minor_adjustment > 0)
- {
- // decrease the subframe duration a little
- if (sf_start.tv_nsec > insync_minor_adjustment_ns)
- sf_start.tv_nsec -= insync_minor_adjustment_ns;
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
- sf_start.tv_sec--;
- sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
- }
- }
- else if(phy->insync_minor_adjustment < 0)
- {
- // todo check we don't go below 0
- // increase the subframe duration a little
- sf_start.tv_nsec += insync_minor_adjustment_ns;
-
- if (sf_start.tv_nsec < 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
- sf_start.tv_sec++;
- sf_start.tv_nsec += 1e9;
- }
- }
-#endif
-
- //phy->insync_minor_adjustment = 0;
- phy->insync_minor_adjustment_duration--;
-
-// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
-// phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
- // NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Slot minor adjustment %dus slot_start.tv_nsec:%d duration:%u\n",
- // phy->insync_minor_adjustment, slot_start.tv_nsec, phy->insync_minor_adjustment_duration);
-
- if (phy->insync_minor_adjustment_duration==0)
- {
- phy->insync_minor_adjustment = 0;
- }
- }
- /*
- long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
- if(millisecond == pselect_stop_millisecond)
- {
- // we have woke up in the same subframe
- if(underrun_possible == 0)
- NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect underrun %ld (%d.%d)\n", millisecond, pselect_stop.tv_sec, pselect_stop.tv_nsec);
- }
- else if(((millisecond + 1) % 1000) != pselect_stop_millisecond)
- {
- // we have overrun the subframe
- NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect overrun %ld %ld\n", millisecond, pselect_stop_millisecond);
- NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe underrun %ld\n", millisecond);
- }
- last_millisecond = millisecond;
- */
-
- //millisecond ++;
- millisecond = millisecond + 1;
-
- }
+ //Call the scheduler
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+ 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);
+ prev_slot = gNB->UL_INFO.slot;
}
- else
- {
- // we have overrun the subframe advance to go and collect $200
- if((millisecond - last_millisecond) > 3)
- NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1);
-
- last_millisecond = ( last_millisecond + 1 ) % 1000;
- selectRetval = 0;
- }
+ selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
if(selectRetval == 0)
{
- //vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
- vnf_p7->slot_start_time_hr = vnf_get_current_time_hr();
-struct timespec current_time;
- clock_gettime(CLOCK_MONOTONIC, ¤t_time);
- // pselect timed out
- nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
- while(curr != 0)
- {
- if (curr->slot == 19)
- { //curr->slot = 0;
- if(curr->sfn == 1023)
- curr->sfn=0;
- else
- curr->sfn++;
- curr->slot=0;
- }
- else
- {
- curr->slot++;
- }
- vnf_nr_sync(vnf_p7, curr);
- curr = curr->next;
- }
- send_mac_slot_indications(vnf_p7);
+ // pselect timed out, continue
}
else if(selectRetval > 0)
{
// have a p7 message
if(FD_ISSET(vnf_p7->socket, &rfds))
- {
- vnf_nr_p7_read_dispatch_message(vnf_p7);
+ {
+ vnf_nr_p7_read_dispatch_message(vnf_p7);
}
}
else
@@ -432,7 +207,7 @@ struct timespec current_time;
}
else
{
- NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
// should we exit now?
if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
{
@@ -440,10 +215,7 @@ struct timespec current_time;
}
}
}
-
}
-
-
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
close(vnf_p7->socket);
@@ -862,7 +634,6 @@ int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_reque
{
if(config == 0 || req == 0)
return -1;
-
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
}
diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
index 5b923e18eb..587b2bceaa 100644
--- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
+++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
@@ -80,7 +80,6 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
uint8_t numMaxIter = p_decParams->numMaxIter;
e_nrLDPC_outMode outMode = p_decParams->outMode;
- printf("nrLDCP_decoder_core: numMaxIter %d\n",numMaxIter);
// Minimum number of iterations is 1
// 0 iterations means hard-decision on input LLRs
uint32_t i = 1;
@@ -488,6 +487,5 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
stop_meas(&p_profiler->llr2bit);
#endif
- printf("num ldpc iterations %d\n",i);
return i;
}
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index de2786b31a..881d03f106 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -460,6 +460,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
nr_init_frame_parms(gNB_config, fp);
+ fp->ofdm_offset_divisor = UINT_MAX;
gNB->configured = 1;
LOG_I(PHY,"gNB configured\n");
}
@@ -511,7 +512,9 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
// }
RC.gNB[Mod_id]->configured = 1;
+ fp->ofdm_offset_divisor = RC.gNB[Mod_id]->ofdm_offset_divisor;
init_symbol_rotation(fp);
+ init_timeshift_rotation(fp);
LOG_I(PHY,"gNB %d configured\n",Mod_id);
}
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index b29d679fe5..b60e77e814 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -124,7 +124,7 @@ void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
AssertFatal( pusch, "pusch==0" );
for (int i=0; itxdataF_layers[i] = (int32_t *)malloc16_clear((NR_MAX_PUSCH_ENCODED_LENGTH)*sizeof(int32_t *));
+ pusch->txdataF_layers[i] = (int32_t *)malloc16_clear(NR_MAX_PUSCH_ENCODED_LENGTH*sizeof(int32_t));
}
}
diff --git a/openair1/PHY/MODULATION/modulation_common.h b/openair1/PHY/MODULATION/modulation_common.h
index f550eeca5f..1a19bec78c 100644
--- a/openair1/PHY/MODULATION/modulation_common.h
+++ b/openair1/PHY/MODULATION/modulation_common.h
@@ -49,7 +49,7 @@ void PHY_ofdm_mod(int *input,
void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms);
-void nr_normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,NR_DL_FRAME_PARMS *frame_parms);
+void nr_normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,NR_DL_FRAME_PARMS *frame_parms, uint32_t slot);
void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms);
diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c
index e32f6bf575..c81a88ff30 100644
--- a/openair1/PHY/MODULATION/nr_modulation.c
+++ b/openair1/PHY/MODULATION/nr_modulation.c
@@ -745,6 +745,23 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
}
}
+void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
+{
+ for (int i = 0; i < fp->ofdm_symbol_size; i++) {
+ double poff = -i * 2.0 * M_PI * 144.0 / 2048.0 / fp->ofdm_offset_divisor;
+ double exp_re = cos(poff);
+ double exp_im = sin(-poff);
+ fp->timeshift_symbol_rotation[i*2] = (int16_t)round(exp_re * 32767);
+ fp->timeshift_symbol_rotation[i*2+1] = (int16_t)round(exp_im * 32767);
+
+ if (i < 10)
+ LOG_I(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",i,
+ fp->timeshift_symbol_rotation[i*2],
+ fp->timeshift_symbol_rotation[i*2+1],
+ poff);
+ }
+}
+
int nr_layer_precoder(int16_t **datatx_F_precoding, char *prec_matrix, uint8_t n_layers, int32_t re_offset)
{
int32_t precodatatx_F = 0;
diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h
index 547d20952f..75541a1361 100644
--- a/openair1/PHY/MODULATION/nr_modulation.h
+++ b/openair1/PHY/MODULATION/nr_modulation.h
@@ -117,6 +117,8 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp);
+void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp);
+
void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
int32_t *rxdataF,
int slot,
diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c
index 8cf9f05b9b..2f075e8218 100644
--- a/openair1/PHY/MODULATION/ofdm_mod.c
+++ b/openair1/PHY/MODULATION/ofdm_mod.c
@@ -63,20 +63,62 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
}
-void nr_normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,NR_DL_FRAME_PARMS *frame_parms)
+void nr_normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,NR_DL_FRAME_PARMS *frame_parms, uint32_t slot)
{
- PHY_ofdm_mod(txdataF, // input
- txdata, // output
- frame_parms->ofdm_symbol_size,
- 1, // number of symbols
- frame_parms->nb_prefix_samples0, // number of prefix samples
- CYCLIC_PREFIX);
- PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size, // input
- txdata + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0, // output
- frame_parms->ofdm_symbol_size,
- nsymb - 1,
- frame_parms->nb_prefix_samples, // number of prefix samples
- CYCLIC_PREFIX);
+ // This function works only slot wise. For more generic symbol generation refer nr_feptx0()
+ if (frame_parms->numerology_index != 0) { // case where numerology != 0
+ if (!(slot%(frame_parms->slots_per_subframe/2))) {
+ PHY_ofdm_mod(txdataF,
+ txdata,
+ frame_parms->ofdm_symbol_size,
+ 1,
+ frame_parms->nb_prefix_samples0,
+ CYCLIC_PREFIX);
+ PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size,
+ txdata + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0,
+ frame_parms->ofdm_symbol_size,
+ nsymb - 1,
+ frame_parms->nb_prefix_samples,
+ CYCLIC_PREFIX);
+ }
+ else {
+ PHY_ofdm_mod(txdataF,
+ txdata,
+ frame_parms->ofdm_symbol_size,
+ nsymb,
+ frame_parms->nb_prefix_samples,
+ CYCLIC_PREFIX);
+ }
+ }
+ else { // numerology = 0, longer CP for every 7th symbol
+ PHY_ofdm_mod(txdataF,
+ txdata,
+ frame_parms->ofdm_symbol_size,
+ 1,
+ frame_parms->nb_prefix_samples0,
+ CYCLIC_PREFIX);
+ PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size,
+ txdata + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0,
+ frame_parms->ofdm_symbol_size,
+ 6,
+ frame_parms->nb_prefix_samples,
+ CYCLIC_PREFIX);
+ PHY_ofdm_mod(txdataF + 7*frame_parms->ofdm_symbol_size,
+ txdata + 6*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples) +
+ frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0,
+ frame_parms->ofdm_symbol_size,
+ 1,
+ frame_parms->nb_prefix_samples0,
+ CYCLIC_PREFIX);
+ PHY_ofdm_mod(txdataF + 8*frame_parms->ofdm_symbol_size,
+ txdata + 6*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples) +
+ 2*(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0),
+ frame_parms->ofdm_symbol_size,
+ 6,
+ frame_parms->nb_prefix_samples,
+ CYCLIC_PREFIX);
+ }
+
}
void PHY_ofdm_mod(int *input, /// pointer to complex input
diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c
index 1c98ac39af..4084b680b5 100644
--- a/openair1/PHY/MODULATION/slot_fep_nr.c
+++ b/openair1/PHY/MODULATION/slot_fep_nr.c
@@ -107,7 +107,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
rx_offset += frame_parms->ofdm_symbol_size * symbol;
// use OFDM symbol from within 1/8th of the CP to avoid ISI
- rx_offset -= nb_prefix_samples / 8;
+ rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
//#ifdef DEBUG_FEP
// if (ue->frame <100)
@@ -157,6 +157,15 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
frame_parms->ofdm_symbol_size,
15);
+
+ int16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
+
+ multadd_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
+ shift_rot,
+ (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
+ 1,
+ frame_parms->ofdm_symbol_size,
+ 15);
}
#ifdef DEBUG_FEP
@@ -292,14 +301,15 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
// This is for misalignment issues
int32_t tmp_dft_in[8192] __attribute__ ((aligned (32)));
- unsigned int slot_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
-
// offset of first OFDM symbol
- int32_t rxdata_offset = slot_offset + nb_prefix_samples0;
- // offset of n-th OFDM symbol
- rxdata_offset += symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples);
+ unsigned int rxdata_offset = frame_parms->get_samples_slot_timestamp(Ns,frame_parms,0);
+ unsigned int abs_symbol = Ns * frame_parms->symbols_per_slot + symbol;
+ for (int idx_symb = Ns*frame_parms->symbols_per_slot; idx_symb <= abs_symbol; idx_symb++)
+ rxdata_offset += (idx_symb%(0x7<numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
+ rxdata_offset += frame_parms->ofdm_symbol_size * symbol;
+
// use OFDM symbol from within 1/8th of the CP to avoid ISI
- rxdata_offset -= nb_prefix_samples / 8;
+ rxdata_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
int16_t *rxdata_ptr;
@@ -333,9 +343,6 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size],
1);
- // clear DC carrier from OFDM symbols
- rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0;
-
return 0;
}
@@ -349,7 +356,8 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
int symb_offset = (slot%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
int soffset = (slot&3)*frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size;
- for (int symbol=0;symbolsymbol_rotation[1])[symbol + symb_offset];
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
@@ -359,5 +367,14 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
(int16_t *)&rxdataF[soffset+(frame_parms->ofdm_symbol_size*symbol)],
length,
15);
+
+ int16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
+
+ multadd_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
+ shift_rot,
+ (int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
+ 1,
+ length,
+ 15);
}
}
diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
index acb12fbaa2..d2bea5a80d 100644
--- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
+++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
@@ -39,23 +39,22 @@ extern openair0_config_t openair0_cfg[MAX_CARDS];
int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id)
{
- int i, aa, max_pos = 0, max_val = 0;
-
+ int max_pos = 0, max_val = 0;
+
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
NR_gNB_PUSCH *gNB_pusch_vars = gNB->pusch_vars[UE_id];
int32_t **ul_ch_estimates_time = gNB_pusch_vars->ul_ch_estimates_time;
-
- int sync_pos = frame_parms->nb_prefix_samples / 8;
- for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
+ const int sync_pos = 0;
+
+ for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) {
int temp = 0;
- for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
- short Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)];
- short Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)];
+ for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
+ int Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)];
+ int Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)];
temp += (Re*Re/2) + (Im*Im/2);
}
-
if (temp > max_val) {
max_pos = i;
max_val = temp;
@@ -65,7 +64,6 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id)
if (max_pos > frame_parms->ofdm_symbol_size/2)
max_pos = max_pos - frame_parms->ofdm_symbol_size;
-
return max_pos - sync_pos;
}
diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
index 61870bf557..902e681f62 100644
--- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
+++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
@@ -31,11 +31,13 @@
#include "PHY/NR_UE_ESTIMATION/filt16a_32.h"
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
+#include "executables/softmodem-common.h"
//#define DEBUG_CH
//#define DEBUG_PUSCH
+#define NO_INTERP 1
#define dBc(x,y) (dB_fixed(((int32_t)(x))*(x) + ((int32_t)(y))*(y)))
int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
@@ -185,8 +187,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
#endif
//if ((gNB->frame_parms.N_RB_UL&1)==0) {
- if (pusch_pdu->dmrs_config_type == pusch_dmrs_type1){
-
+ if (pusch_pdu->dmrs_config_type == pusch_dmrs_type1 && gNB->prb_interpolation == 0){
+ LOG_D(PHY,"PUSCH estimation DMRS type 1, Freq-domain interpolation");
// Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
@@ -210,7 +212,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ch,
ul_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(soffset+symbol_offset+nushift+re_offset)];
//for (int i= 0; i<8; i++)
@@ -241,7 +243,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ch,
ul_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(soffset+symbol_offset+nushift+re_offset)];
//printf("ul_ch addr %p\n",ul_ch);
@@ -275,12 +277,12 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//for (int i= 0; i<16; i++)
//printf("ul_ch addr %p %d\n", ul_ch+i, *(ul_ch+i));
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(soffset+symbol_offset+nushift+re_offset)];
ul_ch+=8;
- for (pilot_cnt=3; pilot_cnt<(6*nb_rb_pusch-3); pilot_cnt+=2) {
+ for (pilot_cnt=3; pilot_cnt<(6*nb_rb_pusch-3); pilot_cnt += 2) {
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
@@ -293,7 +295,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ch,
ul_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(soffset+symbol_offset+nushift+re_offset)];
//printf("ul_ch addr %p\n",ul_ch);
@@ -313,7 +315,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//for (int i= 0; i<16; i++)
//printf("ul_ch addr %p %d\n", ul_ch+i, *(ul_ch+i));
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][soffset+(symbol_offset+nushift+re_offset)];
ul_ch+=8;
@@ -335,7 +337,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//for (int i= 0; i<8; i++)
//printf("ul_ch addr %p %d\n", ul_ch+i, *(ul_ch+i));
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][soffset+(symbol_offset+nushift+re_offset)];
@@ -351,7 +353,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ul_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][soffset+(symbol_offset+nushift+re_offset)];
ul_ch+=8;
@@ -423,15 +425,15 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
#ifdef DEBUG_PUSCH
ul_ch = (int16_t *)&ul_ch_estimates[p*gNB->frame_parms.nb_antennas_rx+aarx][ch_offset];
for(uint16_t idxP=0; idxPdmrs_config_type == pusch_dmrs_type2 && gNB->prb_interpolation == 0) { //pusch_dmrs_type2 |p_r,p_l,d,d,d,d,p_r,p_l,d,d,d,d|
+ LOG_D(PHY,"PUSCH estimation DMRS type 2, Freq-domain interpolation");
// Treat first DMRS specially (left edge)
rxF = (int16_t *)&rxdataF[aarx][soffset+(symbol_offset+nushift+re_offset)];
@@ -439,12 +441,12 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ul_ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ul_ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
- pil+=2;
- ul_ch+=2;
+ pil += 2;
+ ul_ch += 2;
re_offset = (re_offset + 1)%gNB->frame_parms.ofdm_symbol_size;
ch_offset++;
- for (re_cnt = 1; re_cnt < (nb_rb_pusch*NR_NB_SC_PER_RB) - 5; re_cnt+=6){
+ for (re_cnt = 1; re_cnt < (nb_rb_pusch*NR_NB_SC_PER_RB) - 5; re_cnt += 6){
rxF = (int16_t *)&rxdataF[aarx][soffset+(symbol_offset+nushift+re_offset)];
@@ -454,8 +456,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ul_ch[0] = ch_l[0];
ul_ch[1] = ch_l[1];
- pil+=2;
- ul_ch+=2;
+ pil += 2;
+ ul_ch += 2;
ch_offset++;
multadd_real_four_symbols_vector_complex_scalar(filt8_ml2,
@@ -474,17 +476,17 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ch_r,
ul_ch);
- //for (int re_idx = 0; re_idx < 8; re_idx+=2)
+ //for (int re_idx = 0; re_idx < 8; re_idx += 2)
//printf("ul_ch = %d + j*%d\n", ul_ch[re_idx], ul_ch[re_idx+1]);
- ul_ch+=8;
- ch_offset+=4;
+ ul_ch += 8;
+ ch_offset += 4;
ul_ch[0] = ch_r[0];
ul_ch[1] = ch_r[1];
- pil+=2;
- ul_ch+=2;
+ pil += 2;
+ ul_ch += 2;
ch_offset++;
re_offset = (re_offset + 1)%gNB->frame_parms.ofdm_symbol_size;
@@ -500,7 +502,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ul_ch[0] = ch_l[0];
ul_ch[1] = ch_l[1];
- ul_ch+=2;
+ ul_ch += 2;
ch_offset++;
multadd_real_four_symbols_vector_complex_scalar(filt8_rr1,
@@ -516,6 +518,385 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ul_ch_128[0] = _mm_slli_epi16 (ul_ch_128[0], 2);
}
+ else if (pusch_pdu->dmrs_config_type == pusch_dmrs_type1) {// this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 6 DMRS REs and use a common value for the whole PRB
+ LOG_D(PHY,"PUSCH estimation DMRS type 1, no Freq-domain interpolation");
+ int32_t ch_0, ch_1;
+ // First PRB
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 6;
+ ch[1] = ch_1 / 6;
+
+
+
+
+#if NO_INTERP
+ for (int i=0;i<12;i++) ((int32_t*)ul_ch)[i] = *(int32_t*)ch;
+ ul_ch+=24;
+#else
+ multadd_real_vector_complex_scalar(filt8_avlip0,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip1,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip2,
+ ch,
+ ul_ch,
+ 8);
+ ul_ch -= 24;
+#endif
+
+ for (pilot_cnt=6; pilot_cnt<6*(nb_rb_pusch-1); pilot_cnt += 6) {
+
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 6;
+ ch[1] = ch_1 / 6;
+
+#if NO_INTERP
+ for (int i=0;i<12;i++) ((int32_t*)ul_ch)[i] = *(int32_t*)ch;
+ ul_ch+=24;
+#else
+ ul_ch[6] += (ch[0] * 1365)>>15; // 1/12*16384
+ ul_ch[7] += (ch[1] * 1365)>>15; // 1/12*16384
+
+ ul_ch += 8;
+ multadd_real_vector_complex_scalar(filt8_avlip3,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip4,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip5,
+ ch,
+ ul_ch,
+ 8);
+ ul_ch -= 16;
+#endif
+ }
+ // Last PRB
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 6;
+ ch[1] = ch_1 / 6;
+
+#if NO_INTERP
+ for (int i=0;i<12;i++) ((int32_t*)ul_ch)[i] = *(int32_t*)ch;
+ ul_ch+=24;
+#else
+ ul_ch[6] += (ch[0] * 1365)>>15; // 1/12*16384
+ ul_ch[7] += (ch[1] * 1365)>>15; // 1/12*16384
+
+ ul_ch += 8;
+ multadd_real_vector_complex_scalar(filt8_avlip3,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip6,
+ ch,
+ ul_ch,
+ 8);
+#endif
+ }
+ else { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 4 DMRS REs and use a common value for the whole PRB
+ LOG_D(PHY,"PUSCH estimation DMRS type 2, no Freq-domain interpolation");
+ int32_t ch_0, ch_1;
+ //First PRB
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 4;
+ ch[1] = ch_1 / 4;
+
+ multadd_real_vector_complex_scalar(filt8_avlip0,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip1,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip2,
+ ch,
+ ul_ch,
+ 8);
+ ul_ch -= 24;
+
+ for (pilot_cnt=4; pilot_cnt<4*(nb_rb_pusch-1); pilot_cnt += 4) {
+
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 4;
+ ch[1] = ch_1 / 4;
+
+ ul_ch[6] += (ch[0] * 1365)>>15; // 1/12*16384
+ ul_ch[7] += (ch[1] * 1365)>>15; // 1/12*16384
+
+ ul_ch += 8;
+ multadd_real_vector_complex_scalar(filt8_avlip3,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip4,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip5,
+ ch,
+ ul_ch,
+ 8);
+ ul_ch -= 16;
+ }
+ // Last PRB
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % gNB->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 4;
+ ch[1] = ch_1 / 4;
+
+ ul_ch[6] += (ch[0] * 1365)>>15; // 1/12*16384
+ ul_ch[7] += (ch[1] * 1365)>>15; // 1/12*16384
+
+ ul_ch += 8;
+ multadd_real_vector_complex_scalar(filt8_avlip3,
+ ch,
+ ul_ch,
+ 8);
+
+ ul_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip6,
+ ch,
+ ul_ch,
+ 8);
+ }
+#ifdef DEBUG_PUSCH
+ ul_ch = (int16_t *)&ul_ch_estimates[p*gNB->frame_parms.nb_antennas_rx+aarx][ch_offset];
+ for(uint16_t idxP=0; idxPconfig.prach_config.num_prach_fd_occasions_list[numRA].k1.value;
- int sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1));
+ int sample_offset_slot;
+ if (!(slot%(fp->slots_per_subframe/2)))
+ sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1));
+ else
+ sample_offset_slot = (prachStartSymbol==0?0:prachStartSymbol*(fp->ofdm_symbol_size+fp->nb_prefix_samples));
//to be checked for mu=0;
LOG_D(PHY,"frame %d, slot %d: doing rx_nr_prach_ru for format %d, numRA %d, prachStartSymbol %d, prachOccasion %d\n",frame,slot,prachFormat,numRA,prachStartSymbol,prachOccasion);
diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c
index f19eba23c3..9331a0a4dd 100644
--- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c
+++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c
@@ -48,6 +48,8 @@
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
+#include "nfapi/oai_integration/vendor_ext.h"
+
#include "T.h"
//#define DEBUG_NR_PUCCH_RX 1
diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c
index 990f3101fd..65ae288252 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c
@@ -239,3 +239,24 @@ short filt8_dcll2[8] = {
short filt8_dclh2[8] = {
0,0,0,0,1489,2979,4468,5958};
+
+short filt8_avlip0[8] = {
+16384,16384,16384,16384,16384,16384,16384,15019};
+
+short filt8_avlip1[8] = {
+13653,12288,10923,9557,8192,6827,5461,4096};
+
+short filt8_avlip2[8] = {
+2731,1365,0,0,0,0,0,0};
+
+short filt8_avlip3[8] = {
+2731,4096,5461,6827,8192,9557,10923,12288};
+
+short filt8_avlip4[8] = {
+13653,15019,16384,15019,13653,12288,10923,9557};
+
+short filt8_avlip5[8] = {
+8192,6827,5461,4096,2731,1365,0,0};
+
+short filt8_avlip6[8] = {
+13653,15019,16384,16384,16384,16384,16384,16384};
diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h
index ef6137a07f..e28736b51d 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h
+++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h
@@ -169,4 +169,17 @@ extern short filt8_dcll2[8];
extern short filt8_dclh2[8];
-#endif
\ No newline at end of file
+extern short filt8_avlip0[8];
+
+extern short filt8_avlip1[8];
+
+extern short filt8_avlip2[8];
+
+extern short filt8_avlip3[8];
+
+extern short filt8_avlip4[8];
+
+extern short filt8_avlip5[8];
+
+extern short filt8_avlip6[8];
+#endif
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
index a2f824e468..3908febae9 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
@@ -45,25 +45,23 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
static int max_pos_fil = 0;
static int count_max_pos_ok = 0;
static int first_time = 1;
- int temp = 0, i, aa, max_val = 0, max_pos = 0;
- int diff;
- short Re,Im,ncoef;
+ int max_val = 0, max_pos = 0;
+ const int sync_pos = 0;
uint8_t sync_offset = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_IN);
- ncoef = 32767 - coef;
+ short ncoef = 32767 - coef;
LOG_D(PHY,"AbsSubframe %d: rx_offset (before) = %d\n",subframe,ue->rx_offset);
-
// we only use channel estimates from tx antenna 0 here
- for (i = 0; i < frame_parms->nb_prefix_samples; i++) {
- temp = 0;
+ for (int i = 0; i < frame_parms->nb_prefix_samples; i++) {
+ int temp = 0;
- for (aa=0; aanb_antennas_rx; aa++) {
- Re = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[(i<<1)];
- Im = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[1+(i<<1)];
+ for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
+ int Re = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[(i<<1)];
+ int Im = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[1+(i<<1)];
temp += (Re*Re/2) + (Im*Im/2);
}
@@ -73,6 +71,9 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
}
}
+ if (max_pos > frame_parms->ofdm_symbol_size/2)
+ max_pos = max_pos - frame_parms->ofdm_symbol_size;
+
// filter position to reduce jitter
if (clear == 1)
max_pos_fil = max_pos;
@@ -82,61 +83,58 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
// do not filter to have proactive timing adjustment
//max_pos_fil = max_pos;
- diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3);
+ int diff = max_pos_fil - sync_pos;
- if (frame_parms->freq_range==nr_FR2)
- sync_offset = 2;
- else
- sync_offset = 0;
-
- if ( abs(diff) < (SYNCH_HYST+sync_offset) )
- ue->rx_offset = 0;
- else
- ue->rx_offset = diff;
+ if (frame_parms->freq_range==nr_FR2)
+ sync_offset = 2;
+ else
+ sync_offset = 0;
- if(abs(diff)<5)
- count_max_pos_ok ++;
- else
- count_max_pos_ok = 0;
-
- //printf("adjust sync count_max_pos_ok = %d\n",count_max_pos_ok);
+ if ( abs(diff) < (SYNCH_HYST+sync_offset) )
+ ue->rx_offset = 0;
+ else
+ ue->rx_offset = diff;
- if(count_max_pos_ok > 10 && first_time == 1)
- {
- first_time = 0;
- ue->time_sync_cell = 1;
- if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) {
- LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
- //mac_resynch();
- //dl_phy_sync_success(ue->Mod_id,frame,0,1);//ue->common_vars.eNb_id);
- ue->UE_mode[0] = PRACH;
- ue->prach_resources[gNB_id]->sync_frame = frame;
- ue->prach_resources[gNB_id]->init_msg1 = 0;
- } else {
- ue->UE_mode[0] = PUSCH;
- }
- }
+ if(abs(diff)<5)
+ count_max_pos_ok ++;
+ else
+ count_max_pos_ok = 0;
+
+ //printf("adjust sync count_max_pos_ok = %d\n",count_max_pos_ok);
- if (ue->rx_offset < 0)
- ue->rx_offset += frame_parms->samples_per_frame;
+ if(count_max_pos_ok > 10 && first_time == 1)
+ {
+ first_time = 0;
+ ue->time_sync_cell = 1;
+ if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) {
+ LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
+ //mac_resynch();
+ //dl_phy_sync_success(ue->Mod_id,frame,0,1);//ue->common_vars.eNb_id);
+ ue->UE_mode[0] = PRACH;
+ ue->prach_resources[gNB_id]->sync_frame = frame;
+ ue->prach_resources[gNB_id]->init_msg1 = 0;
+ } else {
+ ue->UE_mode[0] = PUSCH;
+ }
+ }
- if (ue->rx_offset >= frame_parms->samples_per_frame)
- ue->rx_offset -= frame_parms->samples_per_frame;
+ if (ue->rx_offset < 0)
+ ue->rx_offset += frame_parms->samples_per_frame;
+ if (ue->rx_offset >= frame_parms->samples_per_frame)
+ ue->rx_offset -= frame_parms->samples_per_frame;
+#ifdef DEBUG_PHY
+ LOG_D(PHY,"AbsSubframe %d: diff = %i, rx_offset (final) = %i : clear = %d, max_pos = %d, max_pos_fil = %d, max_val = %d, sync_pos %d\n",
+ subframe,
+ diff,
+ ue->rx_offset,
+ clear,
+ max_pos,
+ max_pos_fil,
+ max_val,
+ sync_pos);
+#endif //DEBUG_PHY
- #ifdef DEBUG_PHY
- LOG_D(PHY,"AbsSubframe %d: diff =%i rx_offset (final) = %i : clear %d,max_pos = %d,max_pos_fil = %d (peak %d) max_val %d target_pos %d \n",
- subframe,
- diff,
- ue->rx_offset,
- clear,
- max_pos,
- max_pos_fil,
- temp,max_val,
- (frame_parms->nb_prefix_samples>>3));
- #endif //DEBUG_PHY
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_OUT);
-
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_OUT);
}
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
index e4a82e7021..8097b9b3ea 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
@@ -94,15 +94,15 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
- current_ssb->c_re +=ch[0];
- current_ssb->c_im +=ch[1];
+ current_ssb->c_re += ch[0];
+ current_ssb->c_im += ch[1];
#ifdef DEBUG_CH
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
#endif
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
@@ -110,29 +110,29 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
- current_ssb->c_re +=ch[0];
- current_ssb->c_im +=ch[1];
+ current_ssb->c_re += ch[0];
+ current_ssb->c_im += ch[1];
#ifdef DEBUG_CH
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
- current_ssb->c_re +=ch[0];
- current_ssb->c_im +=ch[1];
+ current_ssb->c_re += ch[0];
+ current_ssb->c_im += ch[1];
#ifdef DEBUG_CH
printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
- for (pilot_cnt=3; pilot_cnt<(3*20); pilot_cnt+=3) {
+ for (pilot_cnt=3; pilot_cnt<(3*20); pilot_cnt += 3) {
// if (pilot_cnt == 30)
// rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k)];
@@ -146,14 +146,14 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
- current_ssb->c_re +=ch[0];
- current_ssb->c_im +=ch[1];
+ current_ssb->c_re += ch[0];
+ current_ssb->c_im += ch[1];
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
@@ -161,13 +161,13 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
- current_ssb->c_re +=ch[0];
- current_ssb->c_im +=ch[1];
+ current_ssb->c_re += ch[0];
+ current_ssb->c_im += ch[1];
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
@@ -175,14 +175,14 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
- current_ssb->c_re +=ch[0];
- current_ssb->c_im +=ch[1];
+ current_ssb->c_re += ch[0];
+ current_ssb->c_im += ch[1];
#ifdef DEBUG_CH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
@@ -287,7 +287,6 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
printf("rxF addr %p\n", rxF);
printf("dl_ch addr %p\n",dl_ch);
#endif
- //if ((ue->frame_parms.N_RB_DL&1)==0) {
// Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -301,7 +300,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch,
dl_ch,
16);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
@@ -319,7 +318,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch,
dl_ch,
16);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
@@ -334,12 +333,12 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch,
dl_ch,
16);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
- dl_ch+=24;
+ dl_ch += 24;
- for (pilot_cnt=3; pilot_cnt<(3*20); pilot_cnt+=3) {
+ for (pilot_cnt=3; pilot_cnt<(3*20); pilot_cnt += 3) {
// if (pilot_cnt == 30)
// rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k)];
@@ -365,7 +364,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
//for (int i= 0; i<8; i++)
// printf("pilot_cnt %d dl_ch %d %d\n", pilot_cnt, dl_ch+i, *(dl_ch+i));
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
@@ -380,7 +379,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch,
dl_ch,
16);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
@@ -396,10 +395,10 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch,
dl_ch,
16);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
- dl_ch+=24;
+ dl_ch += 24;
}
@@ -458,8 +457,6 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
}
}
- //}
-
}
return(0);
}
@@ -526,111 +523,111 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
printf("dl_ch addr %p\n",dl_ch);
#endif
// if ((ue->frame_parms.N_RB_DL&1)==0) {
- // Treat first 2 pilots specially (left edge)
+ // Treat first 2 pilots specially (left edge)
+ ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
+ ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
+#ifdef DEBUG_PDCCH
+ printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
+ printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
+#endif
+ multadd_real_vector_complex_scalar(fl,
+ ch,
+ dl_ch,
+ 16);
+ pil += 2;
+ rxF += 8;
+ //for (int i= 0; i<8; i++)
+ //printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
+
+ ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
+ ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
+#ifdef DEBUG_PDCCH
+ printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
+#endif
+ multadd_real_vector_complex_scalar(fm,
+ ch,
+ dl_ch,
+ 16);
+ pil += 2;
+ rxF += 8;
+
+ ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
+ ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
+
+#ifdef DEBUG_PDCCH
+ printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
+#endif
+
+ multadd_real_vector_complex_scalar(fr,
+ ch,
+ dl_ch,
+ 16);
+
+#ifdef DEBUG_PDCCH
+ for (int m =0; m<12; m++)
+ printf("data : dl_ch -> (%d,%d)\n",dl_ch[0+2*m],dl_ch[1+2*m]);
+#endif
+ pil += 2;
+ rxF += 8;
+ dl_ch += 24;
+ k += 12;
+
+
+
+ for (pilot_cnt=3; pilot_cnt<(3*nb_rb_coreset); pilot_cnt += 3) {
+
+ if (k >= ue->frame_parms.ofdm_symbol_size){
+ k-=ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)];}
+
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDCCH
- printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
- printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
+ printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fl,
- ch,
- dl_ch,
- 16);
- pil+=2;
- rxF+=8;
+ ch,
+ dl_ch,
+ 16);
+
//for (int i= 0; i<8; i++)
- //printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
+ // printf("pilot_cnt %d dl_ch %d %d\n", pilot_cnt, dl_ch+i, *(dl_ch+i));
+
+ pil += 2;
+ rxF += 8;
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDCCH
- printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
+ printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fm,
- ch,
- dl_ch,
- 16);
- pil+=2;
- rxF+=8;
+ ch,
+ dl_ch,
+ 16);
+ pil += 2;
+ rxF += 8;
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDCCH
- printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
+ printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fr,
- ch,
- dl_ch,
- 16);
-
-#ifdef DEBUG_PDCCH
- for (int m =0; m<12; m++)
- printf("data : dl_ch -> (%d,%d)\n",dl_ch[0+2*m],dl_ch[1+2*m]);
-#endif
- pil+=2;
- rxF+=8;
- dl_ch+=24;
- k+=12;
-
-
+ ch,
+ dl_ch,
+ 16);
+ pil += 2;
+ rxF += 8;
+ dl_ch += 24;
+ k += 12;
- for (pilot_cnt=3; pilot_cnt<(3*nb_rb_coreset); pilot_cnt+=3) {
-
- if (k >= ue->frame_parms.ofdm_symbol_size){
- k-=ue->frame_parms.ofdm_symbol_size;
- rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)];}
-
- ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
- ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
-#ifdef DEBUG_PDCCH
- printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
-#endif
- multadd_real_vector_complex_scalar(fl,
- ch,
- dl_ch,
- 16);
-
- //for (int i= 0; i<8; i++)
- // printf("pilot_cnt %d dl_ch %d %d\n", pilot_cnt, dl_ch+i, *(dl_ch+i));
-
- pil+=2;
- rxF+=8;
-
- ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
- ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
-#ifdef DEBUG_PDCCH
- printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
-#endif
- multadd_real_vector_complex_scalar(fm,
- ch,
- dl_ch,
- 16);
- pil+=2;
- rxF+=8;
-
- ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
- ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
-
-#ifdef DEBUG_PDCCH
- printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
-#endif
-
- multadd_real_vector_complex_scalar(fr,
- ch,
- dl_ch,
- 16);
- pil+=2;
- rxF+=8;
- dl_ch+=24;
- k+=12;
-
- }
+ }
- //}
+ //}
}
@@ -653,7 +650,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned short k;
unsigned int pilot_cnt;
int16_t ch_l[2],ch_r[2],ch[2],*pil,*rxF,*dl_ch;
- int16_t *fl,*fm,*fr,*fml,*fmr,*fmm,*fdcl,*fdcr,*fdclh,*fdcrh, *frl, *frr;
+ int16_t *fl=NULL,*fm=NULL,*fr=NULL,*fml=NULL,*fmr=NULL,*fmm=NULL,*fdcl=NULL,*fdcr=NULL,*fdclh=NULL,*fdcrh=NULL, *frl=NULL, *frr=NULL;
int ch_offset,symbol_offset;
NR_UE_DLSCH_t **dlsch = ue->dlsch[proc->thread_id][gNB_id];
@@ -698,99 +695,97 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
if (p<4) ue->frame_parms.nushift = nushift;
switch (delta) {
- case 0://port 0,1
- fl = filt8_l0;//left interpolation Filter for DMRS config. 1
- fm = filt8_m0;//left middle interpolation Filter
- fr = filt8_r0;//right interpolation Filter
- fmm = filt8_mm0;;//middle middle interpolation Filter
- fml = filt8_m0;//left middle interpolation Filter
- fmr = filt8_mr0;//middle right interpolation Filter
- fdcl = filt8_dcl0;//left DC interpolation Filter (even RB)
- fdcr = filt8_dcr0;//right DC interpolation Filter (even RB)
- fdclh = filt8_dcl0_h;//left DC interpolation Filter (odd RB)
- fdcrh = filt8_dcr0_h;//right DC interpolation Filter (odd RB)
- frl = NULL;
- frr = NULL;
- break;
+ case 0://port 0,1
+ fl = filt8_l0;//left interpolation Filter for DMRS config. 1
+ fm = filt8_m0;//left middle interpolation Filter
+ fr = filt8_r0;//right interpolation Filter
+ fmm = filt8_mm0;;//middle middle interpolation Filter
+ fml = filt8_m0;//left middle interpolation Filter
+ fmr = filt8_mr0;//middle right interpolation Filter
+ fdcl = filt8_dcl0;//left DC interpolation Filter (even RB)
+ fdcr = filt8_dcr0;//right DC interpolation Filter (even RB)
+ fdclh = filt8_dcl0_h;//left DC interpolation Filter (odd RB)
+ fdcrh = filt8_dcr0_h;//right DC interpolation Filter (odd RB)
+ frl = NULL;
+ frr = NULL;
+ break;
- case 1://port2,3
- fl = filt8_l1;
- fm = filt8_m1;
- fr = filt8_r1;
- fmm = filt8_mm1;
- fml = filt8_ml1;
- fmr = filt8_m1;
- fdcl = filt8_dcl1;
- fdcr = filt8_dcr1;
- fdclh = filt8_dcl1_h;
- fdcrh = filt8_dcr1_h;
- frl = NULL;
- frr = NULL;
- break;
+ case 1://port2,3
+ fl = filt8_l1;
+ fm = filt8_m1;
+ fr = filt8_r1;
+ fmm = filt8_mm1;
+ fml = filt8_ml1;
+ fmr = filt8_m1;
+ fdcl = filt8_dcl1;
+ fdcr = filt8_dcr1;
+ fdclh = filt8_dcl1_h;
+ fdcrh = filt8_dcr1_h;
+ frl = NULL;
+ frr = NULL;
+ break;
- default:
- msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
- return -1;
- break;
+ default:
+ LOG_E(PHY,"pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
+ return -1;
+ break;
}
} else {//NFAPI_NR_DMRS_TYPE2
nushift = delta;
if (p<6) ue->frame_parms.nushift = nushift;
switch (delta) {
- case 0://port 0,1
- fl = filt8_l2;//left interpolation Filter should be fml
- fr = filt8_r2;//right interpolation Filter should be fmr
- fm = filt8_l2;
- fmm = filt8_r2;
- fml = filt8_ml2;
- fmr = filt8_mr2;
- frl = filt8_rl2;
- frr = filt8_rm2;
- fdcl = filt8_dcl1;
- fdcr = filt8_dcr1;
- fdclh = filt8_dcl1_h;
- fdcrh = filt8_dcr1_h;
- break;
+ case 0://port 0,1
+ fl = filt8_l2;//left interpolation Filter should be fml
+ fr = filt8_r2;//right interpolation Filter should be fmr
+ fm = filt8_l2;
+ fmm = filt8_r2;
+ fml = filt8_ml2;
+ fmr = filt8_mr2;
+ frl = filt8_rl2;
+ frr = filt8_rm2;
+ fdcl = filt8_dcl1;
+ fdcr = filt8_dcr1;
+ fdclh = filt8_dcl1_h;
+ fdcrh = filt8_dcr1_h;
+ break;
- case 2://port2,3
- fl = filt8_l3;
- fm = filt8_m2;
- fr = filt8_r3;
- fmm = filt8_mm2;
- fml = filt8_l2;
- fmr = filt8_r2;
- frl = filt8_rl3;
- frr = filt8_rr3;
- fdcl = NULL;
- fdcr = NULL;
- fdclh = NULL;
- fdcrh = NULL;
- break;
+ case 2://port2,3
+ fl = filt8_l3;
+ fm = filt8_m2;
+ fr = filt8_r3;
+ fmm = filt8_mm2;
+ fml = filt8_l2;
+ fmr = filt8_r2;
+ frl = filt8_rl3;
+ frr = filt8_rr3;
+ fdcl = NULL;
+ fdcr = NULL;
+ fdclh = NULL;
+ fdcrh = NULL;
+ break;
- default:
- msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
- return -1;
- break;
+ default:
+ LOG_E(PHY,"pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
+ return -1;
+ break;
}
}
for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) {
- pil = (int16_t *)&pilot[rb_offset*((config_type==NFAPI_NR_DMRS_TYPE1) ? 6:4)];
+ pil = (int16_t *)&pilot[rb_offset*((config_type == NFAPI_NR_DMRS_TYPE1) ? 6:4)];
k = k % ue->frame_parms.ofdm_symbol_size;
re_offset = k;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+re_offset+nushift)];
dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size));
-
#ifdef DEBUG_PDSCH
printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
printf("rxF addr %p p %d\n", rxF,p);
printf("dl_ch addr %p nushift %d\n",dl_ch,nushift);
#endif
-
- if (config_type == NFAPI_NR_DMRS_TYPE1) {
+ if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->prb_interpolation == 0) {
// Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -804,7 +799,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch,
dl_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
//for (int i= 0; i<8; i++)
@@ -819,7 +814,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch,
dl_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
//printf("dl_ch addr %p\n",dl_ch);
@@ -834,18 +829,12 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- //for (int i= 0; i<16; i++)
- //printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
-
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
- dl_ch+=8;
+ dl_ch += 8;
- for (pilot_cnt=3; pilot_cnt<(6*nb_rb_pdsch-3); pilot_cnt+=2) {
- //if ((pilot_cnt%6)==0)
- //dl_ch+=4;
- //printf("re_offset %d\n",re_offset);
+ for (pilot_cnt=3; pilot_cnt<(6*nb_rb_pdsch-3); pilot_cnt += 2) {
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
@@ -857,7 +846,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
@@ -870,10 +859,10 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch,
dl_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
- dl_ch+=8;
+ dl_ch += 8;
}
@@ -881,7 +870,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
- printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
+ printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fm,
ch,
@@ -891,7 +880,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
//for (int i= 0; i<8; i++)
//printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
@@ -906,10 +895,10 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
- dl_ch+=8;
+ dl_ch += 8;
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
@@ -921,59 +910,59 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- // check if PRB crosses DC and improve estimates around DC
- if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pdsch*12 >= ue->frame_parms.ofdm_symbol_size)) {
- dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
- uint16_t idxDC = 2*(ue->frame_parms.ofdm_symbol_size - bwp_start_subcarrier);
- uint16_t idxPil = idxDC/2;
- re_offset = k;
- pil = (int16_t *)&pilot[rb_offset*((config_type==NFAPI_NR_DMRS_TYPE1) ? 6:4)];
- pil += (idxPil-2);
- dl_ch += (idxDC-4);
- dl_ch = memset(dl_ch, 0, sizeof(int16_t)*10);
- re_offset = (re_offset+idxDC/2-2) % ue->frame_parms.ofdm_symbol_size;
- rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
- ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
- ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
-
- // for proper allignment of SIMD vectors
- if((ue->frame_parms.N_RB_DL&1)==0) {
-
- multadd_real_vector_complex_scalar(fdcl,
- ch,
- dl_ch-4,
- 8);
-
- pil += 4;
- re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
+ // check if PRB crosses DC and improve estimates around DC
+ if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pdsch*12 >= ue->frame_parms.ofdm_symbol_size)) {
+ dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset];
+ uint16_t idxDC = 2*(ue->frame_parms.ofdm_symbol_size - bwp_start_subcarrier);
+ uint16_t idxPil = idxDC/2;
+ re_offset = k;
+ pil = (int16_t *)&pilot[rb_offset*((config_type == NFAPI_NR_DMRS_TYPE1) ? 6:4)];
+ pil += (idxPil-2);
+ dl_ch += (idxDC-4);
+ dl_ch = memset(dl_ch, 0, sizeof(int16_t)*10);
+ re_offset = (re_offset+idxDC/2-2) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
-
- multadd_real_vector_complex_scalar(fdcr,
- ch,
- dl_ch-4,
- 8);
- } else {
+
+ // for proper allignment of SIMD vectors
+ if((ue->frame_parms.N_RB_DL&1) == 0) {
+
+ multadd_real_vector_complex_scalar(fdcl,
+ ch,
+ dl_ch-4,
+ 8);
+
+ pil += 4;
+ re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+ ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
+ ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
+
+ multadd_real_vector_complex_scalar(fdcr,
+ ch,
+ dl_ch-4,
+ 8);
+ } else {
- multadd_real_vector_complex_scalar(fdclh,
- ch,
- dl_ch,
- 8);
-
- pil += 4;
- re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
- rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
- ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
- ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
-
- multadd_real_vector_complex_scalar(fdcrh,
- ch,
- dl_ch,
- 8);
+ multadd_real_vector_complex_scalar(fdclh,
+ ch,
+ dl_ch,
+ 8);
+
+ pil += 4;
+ re_offset = (re_offset+4) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+ ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
+ ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
+
+ multadd_real_vector_complex_scalar(fdcrh,
+ ch,
+ dl_ch,
+ 8);
+ }
}
- }
- } else { //NFAPI_NR_DMRS_TYPE2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0|
+ } else if (config_type == NFAPI_NR_DMRS_TYPE2 && ue->prb_interpolation == 0){ //pdsch_dmrs_type2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0|
// Treat first 4 pilots specially (left edge)
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -984,7 +973,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch_l[0],ch_l[1],pil[0],pil[1]);
#endif
- pil+=2;
+ pil += 2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -1003,13 +992,13 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -1023,20 +1012,20 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- dl_ch+=12;
+ dl_ch += 12;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
- dl_ch+=4;
+ dl_ch += 4;
- for (pilot_cnt=4; pilot_cnt<4*nb_rb_pdsch; pilot_cnt+=4) {
+ for (pilot_cnt=4; pilot_cnt<4*nb_rb_pdsch; pilot_cnt += 4) {
multadd_real_vector_complex_scalar(fml,
ch,
dl_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -1046,7 +1035,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch_l[0],ch_l[1],pil[0],pil[1]);
#endif
- pil+=2;
+ pil += 2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -1064,7 +1053,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- dl_ch+=8;
+ dl_ch += 8;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
@@ -1075,13 +1064,13 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
- pil+=2;
+ pil += 2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -1099,12 +1088,12 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch,
8);
- dl_ch+=12;
+ dl_ch += 12;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
- dl_ch+=4;
+ dl_ch += 4;
}
// Treat last 2 pilots specially (right edge)
@@ -1136,7 +1125,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
ch_l[1]= dl_ch[1] ;
// for proper allignment of SIMD vectors
- if((ue->frame_parms.N_RB_DL&1)==0) {
+ if((ue->frame_parms.N_RB_DL&1) == 0) {
dl_ch -= 20;
//Interpolate fdcrl1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrl1,
@@ -1185,11 +1174,359 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
}
}
}
+ else if (config_type == NFAPI_NR_DMRS_TYPE1) { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 6 DMRS REs and use a common value for the whole PRB
+ int32_t ch_0, ch_1;
+
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 6;
+ ch[1] = ch_1 / 6;
+
+ multadd_real_vector_complex_scalar(filt8_avlip0,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip1,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip2,
+ ch,
+ dl_ch,
+ 8);
+ dl_ch -= 24;
+
+ for (pilot_cnt=6; pilot_cnt<6*(nb_rb_pdsch-1); pilot_cnt += 6) {
+
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 6;
+ ch[1] = ch_1 / 6;
+ dl_ch[6] += (ch[0] * 1365)>>15; // 1/12*16384
+ dl_ch[7] += (ch[1] * 1365)>>15; // 1/12*16384
+
+ dl_ch += 8;
+ multadd_real_vector_complex_scalar(filt8_avlip3,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip4,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip5,
+ ch,
+ dl_ch,
+ 8);
+ dl_ch -= 16;
+ }
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+2) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 6;
+ ch[1] = ch_1 / 6;
+
+ dl_ch[6] += (ch[0] * 1365)>>15; // 1/12*16384
+ dl_ch[7] += (ch[1] * 1365)>>15; // 1/12*16384
+
+ dl_ch += 8;
+ multadd_real_vector_complex_scalar(filt8_avlip3,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip6,
+ ch,
+ dl_ch,
+ 8);
+ }
+ else { // this is case without frequency-domain linear interpolation, just take average of LS channel estimates of 4 DMRS REs and use a common value for the whole PRB
+ int32_t ch_0, ch_1;
+
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 4;
+ ch[1] = ch_1 / 4;
+
+ multadd_real_vector_complex_scalar(filt8_avlip0,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip1,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip2,
+ ch,
+ dl_ch,
+ 8);
+ dl_ch -= 24;
+
+ for (pilot_cnt=4; pilot_cnt<4*(nb_rb_pdsch-1); pilot_cnt += 4) {
+ int32_t ch_0, ch_1;
+
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 4;
+ ch[1] = ch_1 / 4;
+
+ dl_ch[6] += (ch[0] * 1365)>>15; // 1/12*16384
+ dl_ch[7] += (ch[1] * 1365)>>15; // 1/12*16384
+
+ dl_ch += 8;
+ multadd_real_vector_complex_scalar(filt8_avlip3,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip4,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip5,
+ ch,
+ dl_ch,
+ 8);
+ dl_ch -= 16;
+ }
+
+ ch_0 = ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 = ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch_0 += ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15;
+ ch_1 += ((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15;
+
+ pil += 2;
+ re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
+ rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
+
+ ch[0] = ch_0 / 4;
+ ch[1] = ch_1 / 4;
+
+ dl_ch[6] += (ch[0] * 1365)>>15; // 1/12*16384
+ dl_ch[7] += (ch[1] * 1365)>>15; // 1/12*16384
+
+ dl_ch += 8;
+ multadd_real_vector_complex_scalar(filt8_avlip3,
+ ch,
+ dl_ch,
+ 8);
+
+ dl_ch += 16;
+ multadd_real_vector_complex_scalar(filt8_avlip6,
+ ch,
+ dl_ch,
+ 8);
+ }
#ifdef DEBUG_PDSCH
dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
for(uint16_t idxP=0; idxPnb_search_space = 0;
return(dci_ind->number_of_dcis);
}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index f27bf52038..fb6e7bf6b5 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -445,8 +445,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//LOG_I(PHY, "avgs Power per SC is %d\n", avgs);
median[(aatx*frame_parms->nb_antennas_rx)+aarx] = avg[(aatx*frame_parms->nb_antennas_rx)+aarx];
}
- pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1;
- //LOG_I(PHY, "avgs Power per SC is %d lg2_maxh %d\n", avgs, pdsch_vars[gNB_id]->log2_maxh);
if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) {
nr_dlsch_channel_level_median(pdsch_vars[gNB_id]->dl_ch_estimates_ext,
@@ -461,8 +459,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
avgs = cmax(avgs, median[aatx*n_rx + aarx]);
}
}
- pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1;
}
+
+ pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1;
+ //LOG_I(PHY, "avgs Power per SC is %d lg2_maxh %d\n", avgs, pdsch_vars[gNB_id]->log2_maxh);
}
LOG_D(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n",
frame%1024,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c
index e7cf3c15a9..24299fd788 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c
@@ -102,7 +102,11 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].prach_root_sequence_index,
ue->X_u);
- sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1));
+ if (slot % (fp->slots_per_subframe / 2) == 0)
+ sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1));
+ else
+ sample_offset_slot = (fp->ofdm_symbol_size + fp->nb_prefix_samples) * prachStartSymbol;
+
prach_start = fp->get_samples_slot_timestamp(slot, fp, 0) + sample_offset_slot;
//printf("prachstartsymbold %d, sample_offset_slot %d, prach_start %d\n",prachStartSymbol, sample_offset_slot, prach_start);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
index fa61b78605..c277a8ffcc 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
@@ -1044,7 +1044,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint8_t is_crnti,
uint8_t llr8_flag);
-int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
+int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
+ NR_UE_ULSCH_t *ulsch,
NR_DL_FRAME_PARMS* frame_parms,
uint8_t harq_pid,
unsigned int G);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
index 5733ef6eb3..ba5c65ceb7 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
@@ -215,11 +215,13 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
}
-int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
+int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
+ NR_UE_ULSCH_t *ulsch,
NR_DL_FRAME_PARMS* frame_parms,
uint8_t harq_pid,
unsigned int G)
{
+ start_meas(&ue->ulsch_encoding_stats);
/////////////////////////parameters and variables declaration/////////////////////////
///////////
@@ -332,6 +334,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_IN);
+ start_meas(&ue->ulsch_segmentation_stats);
Kb=nr_segmentation(harq_process->b,
harq_process->c,
harq_process->B,
@@ -340,6 +343,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
pz,
&harq_process->F,
harq_process->BG);
+ stop_meas(&ue->ulsch_segmentation_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_OUT);
F = harq_process->F;
@@ -374,14 +378,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
//for (int i=0;i<68*384;i++)
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
- int temp_opp = 0;
-
- if (opp_enabled) {
- opp_enabled = 0;
- temp_opp = 1;
- }
-
-
/*printf("output %d %d %d %d %d \n", harq_process->d[0][0], harq_process->d[0][1], harq_process->d[r][2],harq_process->d[0][3], harq_process->d[0][4]);
for (int cnt =0 ; cnt < 66*(*pz); cnt ++){
printf("%d \n", harq_process->d[0][cnt]);
@@ -397,11 +393,13 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_IN);
+ start_meas(&ue->ulsch_ldpc_encoding_stats);
for(int j = 0; j < (harq_process->C/8 + 1); j++)
{
impp.macro_num = j;
nrLDPC_encoder(harq_process->c,harq_process->d,*pz,Kb,Kr,harq_process->BG,&impp);
}
+ stop_meas(&ue->ulsch_ldpc_encoding_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_OUT);
@@ -412,8 +410,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
write_output("ulsch_enc_output0.m","enc0",&harq_process->d[0][0],(3*8*Kr_bytes)+12,1,4);
#endif
- if (temp_opp) opp_enabled = 1;
-
///////////
///////////////////////////////////////////////////////////////////////////////
LOG_D(PHY,"setting ndi to %d from pusch_data\n", harq_process->pusch_pdu.pusch_data.new_data_indicator);
@@ -449,6 +445,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
+ start_meas(&ue->ulsch_rate_matching_stats);
nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
harq_process->BG,
@@ -460,6 +457,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
Kr-F-2*(*pz),
harq_process->pusch_pdu.pusch_data.rv_index,
E);
+ stop_meas(&ue->ulsch_rate_matching_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_OUT);
@@ -481,10 +479,12 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
//start_meas(i_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_IN);
+ start_meas(&ue->ulsch_interleaving_stats);
nr_interleaving_ldpc(E,
mod_order,
harq_process->e+r_offset,
harq_process->f+r_offset);
+ stop_meas(&ue->ulsch_interleaving_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_OUT);
//stop_meas(i_stats);
@@ -509,5 +509,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
+ stop_meas(&ue->ulsch_encoding_stats);
return(0);
}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
index 4ada19ba33..b1addf740a 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
@@ -159,7 +159,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl);
- nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G);
+ nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G);
///////////
////////////////////////////////////////////////////////////////////
@@ -529,7 +529,8 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
nr_normal_prefix_mod(txdataF[ap],
&txdata[ap][tx_offset],
14,
- frame_parms);
+ frame_parms,
+ slot);
}
}
diff --git a/openair1/PHY/TOOLS/signal_energy.c b/openair1/PHY/TOOLS/signal_energy.c
index f3dea58374..96ee211285 100644
--- a/openair1/PHY/TOOLS/signal_energy.c
+++ b/openair1/PHY/TOOLS/signal_energy.c
@@ -264,7 +264,7 @@ double signal_energy_fp(double *s_re[2],double *s_im[2],uint32_t nb_antennas,uin
return(V/length/nb_antennas);
}
-double signal_energy_fp2(struct complex *s,uint32_t length)
+double signal_energy_fp2(struct complexd *s,uint32_t length)
{
int32_t i;
@@ -273,7 +273,7 @@ double signal_energy_fp2(struct complex *s,uint32_t length)
for (i=0; i %f\n",s[i].x,s[i].y,V);
// V= V + (s[i].y*s[i].x) + (s[i].y*s[i].x);
- V= V + (s[i].x*s[i].x) + (s[i].y*s[i].y);
+ V= V + (s[i].r*s[i].r) + (s[i].i*s[i].i);
}
return(V/length);
diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h
index 4c68c15cb6..966e93440e 100644
--- a/openair1/PHY/TOOLS/tools_defs.h
+++ b/openair1/PHY/TOOLS/tools_defs.h
@@ -39,11 +39,6 @@ extern "C" {
#define CEILIDIV(a,b) ((a+b-1)/b)
#define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1))
-struct complex {
- double x;
- double y;
-};
-
struct complexd {
double r;
double i;
@@ -468,7 +463,7 @@ double signal_energy_fp(double *s_re[2], double *s_im[2], uint32_t nb_antennas,
/*!\fn double signal_energy_fp2(struct complex *, uint32_t);
\brief Computes the signal energy per subcarrier
*/
-double signal_energy_fp2(struct complex *s, uint32_t length);
+double signal_energy_fp2(struct complexd *s, uint32_t length);
int32_t iSqrt(int32_t value);
diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h
index 86db130691..09dc50242a 100644
--- a/openair1/PHY/defs_gNB.h
+++ b/openair1/PHY/defs_gNB.h
@@ -822,6 +822,8 @@ typedef struct PHY_VARS_gNB_s {
uint32_t max_peak_val;
+ /// OFDM symbol offset divisor for UL
+ uint32_t ofdm_offset_divisor;
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// first index: ? [0..N_RB_DL*12[
double *sinr_dB;
@@ -841,6 +843,8 @@ typedef struct PHY_VARS_gNB_s {
int **dl_precoder_SgNB[3];
char log2_maxp; /// holds the maximum channel/precoder coefficient
+ int prb_interpolation;
+
/// if ==0 enables phy only test mode
int mac_enabled;
/// counter to average prach energh over first 100 prach opportunities
diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h
index 7251dd6a73..33322bccb2 100644
--- a/openair1/PHY/defs_nr_UE.h
+++ b/openair1/PHY/defs_nr_UE.h
@@ -868,7 +868,9 @@ typedef struct {
uint32_t perfect_ce;
-
+ // flag to activate PRB based averaging of channel estimates
+ // when off, defaults to frequency domain interpolation
+ int prb_interpolation;
int generate_ul_signal[NUMBER_OF_CONNECTED_gNB_MAX];
UE_NR_SCAN_INFO_t scan_info[NB_BANDS_MAX];
@@ -1005,6 +1007,7 @@ typedef struct {
time_stats_t ofdm_mod_stats;
time_stats_t ulsch_encoding_stats;
+ time_stats_t ulsch_ldpc_encoding_stats;
time_stats_t ulsch_modulation_stats;
time_stats_t ulsch_segmentation_stats;
time_stats_t ulsch_rate_matching_stats;
diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h
index d333732d1f..c385d323e3 100644
--- a/openair1/PHY/defs_nr_common.h
+++ b/openair1/PHY/defs_nr_common.h
@@ -234,8 +234,6 @@ typedef struct {
int RA_PCMAX;
/// Corresponding RA-RNTI for UL-grant
uint16_t ra_RNTI;
- /// Pointer to Msg3 payload for UL-grant
- uint8_t *Msg3;
/// Frame of last completed synch
uint16_t sync_frame;
/// Flag to indicate that prach is ready to start: it is enabled with an initial delay after the sync
@@ -331,6 +329,9 @@ struct NR_DL_FRAME_PARMS {
/// sequence which is computed based on carrier frequency and numerology to rotate/derotate each OFDM symbol according to Section 5.3 in 38.211
/// First dimension is for the direction of the link (0 DL, 1 UL)
int16_t symbol_rotation[2][224*2];
+ /// sequence used to compensate the phase rotation due to timeshifted OFDM symbols
+ /// First dimenstion is for different CP lengths
+ int16_t timeshift_symbol_rotation[4096*2] __attribute__ ((aligned (16)));
/// shift of pilot position in one RB
uint8_t nushift;
/// SRS configuration from TS 38.331 RRC
@@ -364,6 +365,8 @@ struct NR_DL_FRAME_PARMS {
uint8_t ssb_index;
/// PBCH polar encoder params
t_nrPolar_params pbch_polar_params;
+ /// OFDM symbol offset divisor for UL
+ uint32_t ofdm_offset_divisor;
};
diff --git a/openair1/SCHED/nfapi_lte_dummy.c b/openair1/SCHED/nfapi_lte_dummy.c
index 9562e2de30..7d1e7e7684 100644
--- a/openair1/SCHED/nfapi_lte_dummy.c
+++ b/openair1/SCHED/nfapi_lte_dummy.c
@@ -17,6 +17,10 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu){
}
+void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB,
+ int frame, int slot,
+ nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu){
+ }
int l1_north_init_gNB(void){return 0;}
uint8_t slot_ahead=6;
diff --git a/openair1/SCHED/nfapi_nr_dummy.c b/openair1/SCHED/nfapi_nr_dummy.c
index db20017fb8..1286a4e48a 100644
--- a/openair1/SCHED/nfapi_nr_dummy.c
+++ b/openair1/SCHED/nfapi_nr_dummy.c
@@ -17,6 +17,10 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu){
}
+void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB,
+ int frame, int slot,
+ nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu){
+ }
int l1_north_init_gNB(void){return 0;}
uint8_t slot_ahead=6;
diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c
index 5314df5153..fa762fa5b8 100644
--- a/openair1/SCHED_NR/fapi_nr_l1.c
+++ b/openair1/SCHED_NR/fapi_nr_l1.c
@@ -181,71 +181,64 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
uint8_t number_dl_pdu = (DL_req==NULL) ? 0 : DL_req->dl_tti_request_body.nPDUs;
uint8_t number_ul_dci_pdu = (UL_dci_req==NULL) ? 0 : UL_dci_req->numPdus;
uint8_t number_ul_tti_pdu = (UL_tti_req==NULL) ? 0 : UL_tti_req->n_pdus;
+ uint8_t number_tx_data_pdu = (TX_req == NULL) ? 0 : TX_req->Number_of_PDUs;
- if (DL_req != NULL && TX_req!=NULL && (number_dl_pdu > 0 || number_ul_dci_pdu > 0 || number_ul_tti_pdu > 0))
- LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SLOT:%04d/%d DL_req:SFN/SLO:%04d/%d:dl_pdu:%d tx_req:SFN/SLOT:%04d/%d:pdus:%d;ul_dci %d ul_tti %d\n",
- frame,slot,
- DL_req->SFN,DL_req->Slot,number_dl_pdu,
- TX_req->SFN,TX_req->Slot,TX_req->Number_of_PDUs,
- number_ul_dci_pdu,number_ul_tti_pdu);
+ if (NFAPI_MODE == NFAPI_MONOLITHIC){
+ if (DL_req != NULL && TX_req!=NULL)
+ LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SLOT:%04d/%d DL_req:SFN/SLO:%04d/%d:dl_pdu:%d tx_req:SFN/SLOT:%04d/%d:pdus:%d;ul_dci %d ul_tti %d\n",
+ frame,slot,
+ DL_req->SFN,DL_req->Slot,number_dl_pdu,
+ TX_req->SFN,TX_req->Slot,TX_req->Number_of_PDUs,
+ number_ul_dci_pdu,number_ul_tti_pdu);
- int pdcch_received=0;
- gNB->num_pdsch_rnti[slot]=0;
- for (int i=0; inumber_of_nr_dlsch_max; i++) {
- gNB->dlsch[i][0]->rnti=0;
- gNB->dlsch[i][0]->harq_mask=0;
- }
+ int pdcch_received=0;
+ gNB->num_pdsch_rnti[slot]=0;
+ for (int i=0; inumber_of_nr_dlsch_max; i++) {
+ gNB->dlsch[i][0]->rnti=0;
+ gNB->dlsch[i][0]->harq_mask=0;
+ }
- for (int i=0;idl_tti_request_body.dl_tti_pdu_list[i];
- LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_tti_pdu->PDUType);
- switch (dl_tti_pdu->PDUType) {
- case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
+ for (int i=0;idl_tti_request_body.dl_tti_pdu_list[i];
+ LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_tti_pdu->PDUType);
+ switch (dl_tti_pdu->PDUType) {
+ case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
+ handle_nr_nfapi_ssb_pdu(gNB,frame,slot,
+ dl_tti_pdu);
+ break;
- if(NFAPI_MODE != NFAPI_MODE_VNF)
- handle_nr_nfapi_ssb_pdu(gNB,frame,slot,
- dl_tti_pdu);
+ case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
+ AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n");
+ handle_nfapi_nr_pdcch_pdu(gNB,
+ frame, slot,
+ &dl_tti_pdu->pdcch_pdu);
+ pdcch_received = 1;
+ break;
- break;
+ case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
+ LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
+ handle_nfapi_nr_csirs_pdu(gNB,
+ frame, slot,
+ &dl_tti_pdu->csi_rs_pdu);
+ break;
- case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
- AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n");
- if(NFAPI_MODE != NFAPI_MODE_VNF)
- handle_nfapi_nr_pdcch_pdu(gNB,
- frame, slot,
- &dl_tti_pdu->pdcch_pdu);
-
- pdcch_received = 1;
-
- break;
- case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
- LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
- handle_nfapi_nr_csirs_pdu(gNB,
- frame, slot,
- &dl_tti_pdu->csi_rs_pdu);
- break;
- case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
-
- {
- LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
- nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdu->pdsch_pdu.pdsch_pdu_rel15;
- uint16_t pduIndex = pdsch_pdu_rel15->pduIndex;
- AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
- pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
- uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
- if(NFAPI_MODE != NFAPI_MODE_VNF)
- handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
+ case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
+ LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
+ nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdu->pdsch_pdu.pdsch_pdu_rel15;
+ uint16_t pduIndex = pdsch_pdu_rel15->pduIndex;
+ AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
+ pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
+ uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
+ handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
+ break;
}
}
- }
- // if (UL_tti_req!=NULL) memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t));
- if(NFAPI_MODE != NFAPI_MODE_VNF)
+
for (int i=0;iul_dci_pdu_list[i]);
}
-
- if(NFAPI_MODE != NFAPI_MODE_VNF)
+
for (int i = 0; i < number_ul_tti_pdu; i++) {
switch (UL_tti_req->pdus_list[i].pdu_type) {
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
@@ -264,30 +257,22 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
break;
}
}
-
- if(NFAPI_MODE != NFAPI_MONOLITHIC && number_ul_tti_pdu>0)
- {
- oai_nfapi_ul_tti_req(UL_tti_req);
}
-
- if (NFAPI_MODE != NFAPI_MONOLITHIC && Sched_INFO->UL_dci_req->numPdus!=0)
- {
- oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req);
+
+ if (NFAPI_MODE == NFAPI_MODE_VNF) { //If VNF, oai_nfapi functions send respective p7 msgs to PNF for which nPDUs is greater than 0
+
+ if(number_ul_tti_pdu>0)
+ oai_nfapi_ul_tti_req(UL_tti_req);
+
+ if (number_ul_dci_pdu>0)
+ oai_nfapi_ul_dci_req(UL_dci_req);
+
+ if (number_dl_pdu>0)
+ oai_nfapi_dl_tti_req(DL_req);
+
+ if (number_tx_data_pdu>0)
+ oai_nfapi_tx_data_req(TX_req);
+
}
- if (NFAPI_MODE != NFAPI_MONOLITHIC)
- {
- if(Sched_INFO->DL_req->dl_tti_request_body.nPDUs>0)
- {
- Sched_INFO->DL_req->SFN = frame;
- Sched_INFO->DL_req->Slot = slot;
- oai_nfapi_dl_tti_req(Sched_INFO->DL_req);
- }
- if (Sched_INFO->TX_req->Number_of_PDUs > 0)
- {
- oai_nfapi_tx_data_req(Sched_INFO->TX_req);
- }
-
- }
-
}
diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c
index a43300ef23..d8fa11d157 100644
--- a/openair1/SCHED_NR/nr_ru_procedures.c
+++ b/openair1/SCHED_NR/nr_ru_procedures.c
@@ -119,6 +119,7 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
fp->nb_prefix_samples,
CYCLIC_PREFIX);
slot_offset += fp->nb_prefix_samples+fp->ofdm_symbol_size;
+ slot_offsetF += fp->ofdm_symbol_size;
}
else {
PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF],
@@ -128,6 +129,7 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
fp->nb_prefix_samples0,
CYCLIC_PREFIX);
slot_offset += fp->nb_prefix_samples0+fp->ofdm_symbol_size;
+ slot_offsetF += fp->ofdm_symbol_size;
}
}
}
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 5b33ecfb67..dbc6c1332e 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -147,14 +147,14 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
- if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) {
- for (int i=0; iLmax; i++) {
- if (gNB->ssb[i].active) {
- nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[i].ssb_pdu);
- gNB->ssb[i].active = false;
- }
+
+ for (int i=0; iLmax; i++) {
+ if (gNB->ssb[i].active) {
+ nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[i].ssb_pdu);
+ gNB->ssb[i].active = false;
}
}
+
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,0);
int pdcch_pdu_id=find_nr_pdcch(frame,slot,gNB,SEARCH_EXIST);
@@ -421,7 +421,13 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
uint16_t bw_scaling = 16 * gNB->frame_parms.ofdm_symbol_size / 2048;
- timing_advance_update = sync_pos / bw_scaling;
+ int sync_pos_rounded;
+ // do some integer rounding to improve TA accuracy
+ if (sync_pos > 0)
+ sync_pos_rounded = sync_pos + (bw_scaling / 2) - 1;
+ else
+ sync_pos_rounded = sync_pos - (bw_scaling / 2) - 1;
+ timing_advance_update = sync_pos_rounded / bw_scaling;
// put timing advance command in 0..63 range
timing_advance_update += 31;
diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
index 64be30943a..5653e2a2f1 100644
--- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
+++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
@@ -70,7 +70,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
for (i = 0; i < dl_config->number_pdus; ++i){
AssertFatal(dl_config->number_pdus < FAPI_NR_DL_CONFIG_LIST_NUM,"dl_config->number_pdus %d out of bounds\n",dl_config->number_pdus);
AssertFatal(dl_config->dl_config_list[i].pdu_type<=FAPI_NR_DL_CONFIG_TYPES,"pdu_type %d > 2\n",dl_config->dl_config_list[i].pdu_type);
- LOG_D(PHY, "In %s: received 1 DL %s PDU of %d total DL PDUs:\n", __FUNCTION__, dl_pdu_type[dl_config->dl_config_list[i].pdu_type - 1], dl_config->number_pdus);
+ LOG_D(PHY, "In %s: frame %d slot %d received 1 DL %s PDU of %d total DL PDUs:\n",
+ __FUNCTION__, scheduled_response->frame, slot, dl_pdu_type[dl_config->dl_config_list[i].pdu_type - 1], dl_config->number_pdus);
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) {
@@ -227,9 +228,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
break;
}
}
-
memset(ul_config, 0, sizeof(fapi_nr_ul_config_request_t));
-
}
}
return 0;
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index 0f0834864e..406705ab98 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -252,7 +252,7 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling;
- LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
+ LOG_I(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
__FUNCTION__,
ue->Mod_id,
frame_tx,
@@ -2141,7 +2141,8 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
int16_t ra_preamble_rx_power = (int16_t)(prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER - pathloss + 30);
ue->tx_power_dBm[nr_slot_tx] = min(nr_get_Pcmax(mod_id), ra_preamble_rx_power);
- LOG_D(PHY,"DEBUG [UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d dB, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n",
+ LOG_D(PHY, "In %s: [UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d dB, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n",
+ __FUNCTION__,
mod_id,
frame_tx,
nr_slot_tx,
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index adfda7a0c8..9a9ccaf1f7 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -200,8 +200,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
- channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].x;
- channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].y;
+ channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].r;
+ channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].i;
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
}
}
@@ -213,8 +213,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
- channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].x;
- channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].y;
+ channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].r;
+ channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].i;
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
}
}
@@ -225,8 +225,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
- channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].x;
- channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].y;
+ channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].r;
+ channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].i;
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
}
}
@@ -237,8 +237,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
- channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].x;
- channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].y;
+ channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].r;
+ channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].i;
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
}
}
diff --git a/openair1/SIMULATION/LTE_PHY/test.c b/openair1/SIMULATION/LTE_PHY/test.c
index 06785f7cdc..6b78dad4e7 100644
--- a/openair1/SIMULATION/LTE_PHY/test.c
+++ b/openair1/SIMULATION/LTE_PHY/test.c
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
double rx_gain;
int rx_pwr2, target_rx_pwr_dB;
- struct complex **ch;
+ struct complexd **ch;
unsigned char first_call = 1;
LTE_DL_FRAME_PARMS frame_parms;
@@ -169,10 +169,10 @@ int main(int argc, char **argv)
channel_length = (int) 11+2*BW*Td;
- ch = (struct complex**) malloc(4 * sizeof(struct complex*));
+ ch = (struct complexd**) malloc(4 * sizeof(struct complexd*));
for (i = 0; i<4; i++)
- ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
+ ch[i] = (struct complexd*) malloc(channel_length * sizeof(struct complexd));
randominit(0);
set_taus_seed(0);
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 0d39e6e533..20a348f6c3 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -1111,8 +1111,8 @@ int main(int argc, char **argv) {
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
// abs_channel = (eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].x*eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].x + eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].y*eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].y);
- channelx = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].x;
- channely = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].y;
+ channelx = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].r;
+ channely = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].i;
// if(transmission_m==5){
fprintf(csv_fdUL,"%e+i*(%e),",channelx,channely);
// }
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim2.c b/openair1/SIMULATION/LTE_PHY/ulsim2.c
index 69d4dc2e3f..e994d4fc36 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim2.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim2.c
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
double amps[8] = {0.3868472 , 0.3094778 , 0.1547389 , 0.0773694 , 0.0386847 , 0.0193424 , 0.0096712 , 0.0038685};
double aoa=.03,ricean_factor=1; //0.0000005;
int channel_length;
- struct complex **ch;
+ struct complexd **ch;
unsigned char pbch_pdu[6];
int sync_pos, sync_pos_slot;
FILE *rx_frame_file;
@@ -170,10 +170,10 @@ int main(int argc, char **argv)
bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
}
- ch = (struct complex**) malloc(4 * sizeof(struct complex*));
+ ch = (struct complexd**) malloc(4 * sizeof(struct complexd*));
for (i = 0; i<4; i++)
- ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
+ ch[i] = (struct complexd*) malloc(channel_length * sizeof(struct complexd));
generate_srs_tx(lte_frame_parms,lte_ue_common_vars->txdataF[0],AMP,0);
generate_drs_puch(lte_frame_parms,lte_ue_common_vars->txdataF[0],AMP,0,first_rb,nb_rb);
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 39da315561..77da42051c 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -226,12 +226,17 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
void processSlotTX(void *arg) {}
-//nFAPI P7 dummy functions
+//nFAPI P7 dummy functions to avoid linking errors
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
+int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
+int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
+int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
+int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
+int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
// needed for some functions
openair0_config_t openair0_cfg[MAX_CARDS];
@@ -408,6 +413,7 @@ int main(int argc, char **argv)
uint16_t rbSize = 106;
uint8_t mcsIndex = 9;
uint8_t dlsch_threads = 0;
+ int prb_inter = 0;
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
exit_fun("[NR_DLSIM] Error, configuration module init failed\n");
}
@@ -418,7 +424,7 @@ int main(int argc, char **argv)
FILE *scg_fd=NULL;
- while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:m:w:T:U:q")) != -1) {
+ while ((c = getopt (argc, argv, "f:hA:pf:g:in:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:m:w:T:U:q")) != -1) {
switch (c) {
case 'f':
scg_fd = fopen(optarg,"r");
@@ -474,14 +480,10 @@ int main(int argc, char **argv)
break;
- /*case 'i':
- interf1=atoi(optarg);
+ case 'i':
+ prb_inter=1;
break;
- case 'j':
- interf2=atoi(optarg);
- break;*/
-
case 'n':
n_trials = atoi(optarg);
break;
@@ -640,7 +642,7 @@ int main(int argc, char **argv)
printf("-g [A,B,C,D,E,F,G,R] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models or R for MIMO model (ignores delay spread and Ricean factor)\n");
printf("-y Number of TX antennas used in gNB\n");
printf("-z Number of RX antennas used in UE\n");
- //printf("-i Relative strength of first intefering gNB (in dB) - cell_id mod 3 = 1\n");
+ printf("-i Activate PRB based averaging for channel estimation. Frequncy domain interpolation by default.\n");
//printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n");
printf("-R N_RB_DL\n");
printf("-O oversampling factor (1,2,4,8,16)\n");
@@ -686,6 +688,7 @@ int main(int argc, char **argv)
memset(RC.gNB[0],0,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
+ gNB->ofdm_offset_divisor = UINT_MAX;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx;
@@ -906,6 +909,7 @@ int main(int argc, char **argv)
UE->if_inst->phy_config_request = nr_ue_phy_config_request;
UE->if_inst->dl_indication = nr_ue_dl_indication;
UE->if_inst->ul_indication = dummy_nr_ue_ul_indication;
+ UE->prb_interpolation = prb_inter;
UE_mac->if_module = nr_ue_if_module_init(0);
@@ -1079,7 +1083,8 @@ int main(int argc, char **argv)
nr_normal_prefix_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
&txdata[aa][tx_offset],
14,
- frame_parms);
+ frame_parms,
+ slot);
}
}
@@ -1314,7 +1319,7 @@ int main(int argc, char **argv)
LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1);
if (UE->frame_parms.nb_antennas_rx>1)
LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1);
- LOG_M("chestF0.m","chF0",UE->pdsch_vars[0][0]->dl_ch_estimates_ext,N_RB_DL*12*14,1,1);
+ LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0][0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1);
write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1);
LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[UE_proc.thread_id][0]->llr[0],available_bits,1,0);
break;
diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
index 70d65a3dc2..056b018504 100644
--- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
+++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
@@ -8,6 +8,12 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0);
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
+int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
+int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
+int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
+int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
+int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
+
int32_t get_uldl_offset(int nr_bandP) { return(0); }
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
nfapi_mode_t nfapi_mod;
diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c
index a930c96a75..76f4e826ee 100644
--- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c
+++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions_prach.c
@@ -3,9 +3,15 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { re
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
- int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
- int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
- int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
+int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
+int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
+int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
+int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
+int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
+int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
+int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
+int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
+
int32_t get_uldl_offset(int nr_bandP) { return(0); }
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
@@ -315,7 +321,7 @@ void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
mac->RA_attempt_number++;
}
-void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id){
+void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, slot_t slotP, uint8_t gNB_id){
AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
LOG_D(MAC,"[UE %d][RAPROC] Frame %d : Msg3_tx: Starting contention resolution timer\n", mod_id, frameP);
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index 80608fd95b..46b42666b5 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -135,7 +135,9 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
+ fp->ofdm_offset_divisor = UINT_MAX;
nr_init_frame_parms(gNB_config, fp);
+ init_timeshift_rotation(fp);
init_symbol_rotation(fp);
@@ -431,6 +433,7 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
+ gNB->ofdm_offset_divisor = UINT_MAX;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx;
diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c
index 0e64839118..6167c809ff 100644
--- a/openair1/SIMULATION/NR_PHY/prachsim.c
+++ b/openair1/SIMULATION/NR_PHY/prachsim.c
@@ -82,6 +82,11 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0);
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
+int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
+int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
+int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
+int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
+int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
void
rrc_data_ind(
diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c
index c889e6dcb9..94aea36a67 100644
--- a/openair1/SIMULATION/NR_PHY/ulschsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulschsim.c
@@ -504,7 +504,7 @@ int main(int argc, char **argv)
unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, Nl);
if (input_fd == NULL) {
- nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G);
+ nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G);
}
printf("\n");
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index d99f5b8e7d..4604ad5fe9 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -212,6 +212,11 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0);
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
+int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
+int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
+int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
+int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
+int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
int nr_derive_key(int alg_type, uint8_t alg_id,
const uint8_t key[32], uint8_t **out)
@@ -297,6 +302,7 @@ int main(int argc, char **argv)
float effRate;
//float eff_tp_check = 0.7;
uint8_t snrRun;
+ int prb_inter = 0;
int enable_ptrs = 0;
int modify_dmrs = 0;
@@ -330,7 +336,7 @@ int main(int argc, char **argv)
/* initialize the sin-cos table */
InitSinLUT();
- while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:j:kl:m:n:p:r:s:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) {
+ while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:p:r:s:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) {
printf("handling optarg %c\n",c);
switch (c) {
@@ -422,14 +428,10 @@ int main(int argc, char **argv)
break;
- /*case 'i':
- interf1 = atoi(optarg);
- break;
+ case 'i':
+ prb_inter=1;
+ break;
- case 'j':
- interf2 = atoi(optarg);
- break;*/
-
case 'k':
printf("Setting threequarter_fs_flag\n");
openair0_cfg[0].threequarter_fs= 1;
@@ -460,6 +462,14 @@ int main(int argc, char **argv)
printf("Setting SNR0 to %f\n", snr0);
break;
+ case 'u':
+ mu = atoi(optarg);
+ break;
+
+ case 'w':
+ start_rb = atoi(optarg);
+ break;
+
/*
case 't':
eff_tp_check = (float)atoi(optarg)/100;
@@ -581,13 +591,15 @@ int main(int argc, char **argv)
printf("-f Number of frames to simulate\n");
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
printf("-h This message\n");
- //printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
+ printf("-i Activate PRB based averaging for channel estimation. Frequncy domain interpolation by default.\n");
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if ending SNR isn't given\n");
printf("-m MCS value\n");
printf("-n Number of trials to simulate\n");
printf("-p Use extended prefix mode\n");
printf("-t Delay spread for multipath channel\n");
+ printf("-u Set the numerology\n");
+ printf("-w Start PRB for PUSCH\n");
//printf("-x Transmission mode (1,2,6 for the moment)\n");
printf("-y Number of TX antennas used in eNB\n");
printf("-z Number of RX antennas used in UE\n");
@@ -628,10 +640,12 @@ int main(int argc, char **argv)
if (N_RB_UL >= 217) sampling_frequency = 122.88;
else if (N_RB_UL >= 106) sampling_frequency = 61.44;
+ else if (N_RB_UL >= 32) sampling_frequency = 32.72;
else { printf("Need at least 106 PRBs\b"); exit(-1); }
if (N_RB_UL == 273) bandwidth = 100;
else if (N_RB_UL == 217) bandwidth = 80;
else if (N_RB_UL == 106) bandwidth = 40;
+ else if (N_RB_UL == 32) bandwidth = 50;
else { printf("Add N_RB_UL %d\n",N_RB_UL); exit(-1); }
if (openair0_cfg[0].threequarter_fs == 1) sampling_frequency*=.75;
@@ -652,6 +666,7 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
+ gNB->ofdm_offset_divisor = UINT_MAX;
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
char tp_param[] = "n";
@@ -664,6 +679,7 @@ int main(int argc, char **argv)
gNB->UL_INFO.crc_ind.crc_list = (nfapi_nr_crc_t *)malloc(NB_UE_INST*sizeof(nfapi_nr_crc_t));
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
gNB->UL_INFO.crc_ind.number_crcs = 0;
+ gNB->prb_interpolation = prb_inter;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
@@ -803,7 +819,11 @@ int main(int argc, char **argv)
nr_scheduled_response_t scheduled_response;
fapi_nr_ul_config_request_t ul_config;
fapi_nr_tx_request_t tx_req;
-
+
+ memset(&scheduled_response, 0, sizeof(scheduled_response));
+ memset(&ul_config, 0, sizeof(ul_config));
+ memset(&tx_req, 0, sizeof(tx_req));
+
uint8_t ptrs_mcs1 = 2;
uint8_t ptrs_mcs2 = 4;
uint8_t ptrs_mcs3 = 10;
@@ -951,9 +971,12 @@ int main(int argc, char **argv)
input_fd);
if (read_errors==0) exit(1);
for (int i=0;i<16;i+=2) printf("slot_offset %d : %d,%d\n",
- slot_offset,
- ((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i],
- ((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]);
+ slot_offset,
+ ((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i],
+ ((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]);
+
+ mod_order = nr_get_Qm_ul(Imcs, mcs_table);
+ code_rate = nr_get_code_rate_ul(Imcs, mcs_table);
}
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
@@ -975,6 +998,10 @@ int main(int argc, char **argv)
reset_meas(&gNB->ulsch_llr_stats);
reset_meas(&gNB->ulsch_channel_compensation_stats);
reset_meas(&gNB->ulsch_rbs_extraction_stats);
+ reset_meas(&UE->ulsch_ldpc_encoding_stats);
+ reset_meas(&UE->ulsch_rate_matching_stats);
+ reset_meas(&UE->ulsch_interleaving_stats);
+ reset_meas(&UE->ulsch_encoding_stats);
clear_pusch_stats(gNB);
for (trial = 0; trial < n_trials; trial++) {
@@ -1167,7 +1194,7 @@ int main(int argc, char **argv)
frame_parms->ofdm_symbol_size/(12*nb_rb));
for (i=0; inb_antennas_rx; aa++) {
+ for (int aa=0; aanb_antennas_tx; aa++) {
s_re[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)]);
s_im[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)+1]);
}
@@ -1235,6 +1262,8 @@ int main(int argc, char **argv)
&gNB->pusch_vars[0]->rxdataF_ext[0][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
LOG_M("chestF0.m","chF0",
&gNB->pusch_vars[0]->ul_ch_estimates[0][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
+ LOG_M("chestT0.m","chT0",
+ &gNB->pusch_vars[0]->ul_ch_estimates_time[0][0],frame_parms->ofdm_symbol_size,1,1);
LOG_M("chestF0_ext.m","chF0_ext",
&gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
@@ -1346,6 +1375,11 @@ int main(int argc, char **argv)
printStatIndent2(&gNB->ulsch_llr_stats,"ULSCH llr computation");
printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling");
printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time");
+ printStatIndent(&UE->ulsch_encoding_stats,"ULSCH total encoding time");
+ printStatIndent2(&UE->ulsch_segmentation_stats,"ULSCH segmentation time");
+ printStatIndent2(&UE->ulsch_ldpc_encoding_stats,"ULSCH LDPC encoder time");
+ printStatIndent2(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time");
+ printStatIndent2(&UE->ulsch_interleaving_stats,"ULSCH interleaving time");
//printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving");
//printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx");
//printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding");
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
index 4d17fe723c..b8a5c7a780 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
@@ -146,6 +146,11 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0);
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
+int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
+int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
+int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
+int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
+int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
diff --git a/openair1/SIMULATION/TOOLS/abstraction.c b/openair1/SIMULATION/TOOLS/abstraction.c
index 9fa9d91d66..a6b0586882 100644
--- a/openair1/SIMULATION/TOOLS/abstraction.c
+++ b/openair1/SIMULATION/TOOLS/abstraction.c
@@ -112,14 +112,14 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs)
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
AssertFatal(n_samples/2+f2 < (2+(275*12)),"reading past chF %d (n_samples %d, f2 %d)\n",n_samples/2+f2,n_samples,f2);
- desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x=0.0;
- desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y=0.0;
+ desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].r=0.0;
+ desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].i=0.0;
for (l=0; l<(int)desc->nb_taps; l++) {
- desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x+=(desc->a[l][aarx+(aatx*desc->nb_rx)].x*clut[l]+
- desc->a[l][aarx+(aatx*desc->nb_rx)].y*slut[l]);
- desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
- desc->a[l][aarx+(aatx*desc->nb_rx)].y*clut[l]);
+ desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].r+=(desc->a[l][aarx+(aatx*desc->nb_rx)].r*clut[l]+
+ desc->a[l][aarx+(aatx*desc->nb_rx)].i*slut[l]);
+ desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].i+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].r*slut[l]+
+ desc->a[l][aarx+(aatx*desc->nb_rx)].i*clut[l]);
}
}
}
@@ -139,42 +139,42 @@ double compute_pbch_sinr(channel_desc_t *desc,
uint16_t f;
uint8_t aarx,aatx;
double S;
- struct complex S_i1;
- struct complex S_i2;
+ struct complexd S_i1;
+ struct complexd S_i2;
avg_sinr=0.0;
// printf("nb_rb %d\n",nb_rb);
for (f=(nb_rb-6); f<(nb_rb+6); f++) {
S = 0.0;
- S_i1.x =0.0;
- S_i1.y =0.0;
- S_i2.x =0.0;
- S_i2.y =0.0;
+ S_i1.r =0.0;
+ S_i1.i =0.0;
+ S_i2.r =0.0;
+ S_i2.i =0.0;
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
- S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc->chF[aarx+(aatx*desc->nb_rx)][f].x +
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
+ S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc->chF[aarx+(aatx*desc->nb_rx)][f].r +
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc->chF[aarx+(aatx*desc->nb_rx)][f].i);
// printf("%d %d chF[%d] => (%f,%f)\n",aarx,aatx,f,desc->chF[aarx+(aatx*desc->nb_rx)][f].x,desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
if (desc_i1) {
- S_i1.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x +
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y);
- S_i1.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y -
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x);
+ S_i1.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r +
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i);
+ S_i1.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i -
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r);
}
if (desc_i2) {
- S_i2.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x +
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y);
- S_i2.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y -
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x);
+ S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r +
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i);
+ S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i -
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r);
}
}
}
// printf("snr %f f %d : S %f, S_i1 %f, S_i2 %f\n",snr,f-nb_rb,S,snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y),snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y));
- avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y)+snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y)));
+ avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.r*S_i1.r + S_i1.i*S_i1.i)+snr_i2*sqrt(S_i2.r*S_i2.r + S_i2.i*S_i2.i)));
}
// printf("avg_sinr %f (%f,%f,%f)\n",avg_sinr/12.0,snr,snr_i1,snr_i2);
@@ -192,42 +192,42 @@ double compute_sinr(channel_desc_t *desc,
uint16_t f;
uint8_t aarx,aatx;
double S;
- struct complex S_i1;
- struct complex S_i2;
+ struct complexd S_i1;
+ struct complexd S_i2;
DevAssert( nb_rb > 0 );
avg_sinr=0.0;
// printf("nb_rb %d\n",nb_rb);
for (f=0; f<2*nb_rb; f++) {
S = 0.0;
- S_i1.x =0.0;
- S_i1.y =0.0;
- S_i2.x =0.0;
- S_i2.y =0.0;
+ S_i1.r =0.0;
+ S_i1.i =0.0;
+ S_i2.r =0.0;
+ S_i2.i =0.0;
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
- S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc->chF[aarx+(aatx*desc->nb_rx)][f].x +
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
+ S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc->chF[aarx+(aatx*desc->nb_rx)][f].r +
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc->chF[aarx+(aatx*desc->nb_rx)][f].i);
if (desc_i1) {
- S_i1.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x +
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y);
- S_i1.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y -
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x);
+ S_i1.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r +
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i);
+ S_i1.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i -
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r);
}
if (desc_i2) {
- S_i2.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x +
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y);
- S_i2.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y -
- desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x);
+ S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r +
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i);
+ S_i2.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i -
+ desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r);
}
}
}
// printf("f %d : S %f, S_i1 %f, S_i2 %f\n",f-nb_rb,snr*S,snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y),snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y));
- avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y)+snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y)));
+ avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.r*S_i1.r + S_i1.i*S_i1.i)+snr_i2*sqrt(S_i2.r*S_i2.r + S_i2.i*S_i2.i)));
}
// printf("avg_sinr %f (%f,%f,%f)\n",avg_sinr/12.0,snr,snr_i1,snr_i2);
diff --git a/openair1/SIMULATION/TOOLS/multipath_channel.c b/openair1/SIMULATION/TOOLS/multipath_channel.c
index 3608eb7da2..3045d8ca6c 100644
--- a/openair1/SIMULATION/TOOLS/multipath_channel.c
+++ b/openair1/SIMULATION/TOOLS/multipath_channel.c
@@ -156,7 +156,7 @@ void multipath_channel(channel_desc_t *desc,
{
int i,ii,j,l;
- struct complex rx_tmp,tx;
+ struct complexd rx_tmp,tx;
double path_loss = pow(10,desc->path_loss_dB/20);
int dd;
@@ -183,32 +183,32 @@ void multipath_channel(channel_desc_t *desc,
for (i=0; i<((int)length-dd); i++) {
for (ii=0; iinb_rx; ii++) {
- rx_tmp.x = 0;
- rx_tmp.y = 0;
+ rx_tmp.r = 0;
+ rx_tmp.i = 0;
for (j=0; jnb_tx; j++) {
for (l = 0; l<(int)desc->channel_length; l++) {
if ((i>=0) && (i-l)>=0) {
- tx.x = tx_sig_re[j][i-l];
- tx.y = tx_sig_im[j][i-l];
+ tx.r = tx_sig_re[j][i-l];
+ tx.i = tx_sig_im[j][i-l];
} else {
- tx.x =0;
- tx.y =0;
+ tx.r =0;
+ tx.i =0;
}
- rx_tmp.x += (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].x) - (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].y);
- rx_tmp.y += (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].x) + (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].y);
+ rx_tmp.r += (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].r) - (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].i);
+ rx_tmp.i += (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].r) + (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].i);
if (i==0 && log_channel == 1) {
- printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].x,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].y,2.0)),
- desc->ch[ii+(j*desc->nb_rx)][l].x,
- desc->ch[ii+(j*desc->nb_rx)][l].y);
+ printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].r,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].i,2.0)),
+ desc->ch[ii+(j*desc->nb_rx)][l].r,
+ desc->ch[ii+(j*desc->nb_rx)][l].i);
}
} //l
} // j
- rx_sig_re[ii][i+dd] = rx_tmp.x*path_loss;
- rx_sig_im[ii][i+dd] = rx_tmp.y*path_loss;
+ rx_sig_re[ii][i+dd] = rx_tmp.r*path_loss;
+ rx_sig_im[ii][i+dd] = rx_tmp.i*path_loss;
#ifdef DEBUG_CHANNEL
if ((i%32)==0) {
printf("rx aa %d: %p %p %f,%f => %e,%e\n",ii,rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]);
diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c
index 31fb0681bb..d937b7cd52 100644
--- a/openair1/SIMULATION/TOOLS/random_channel.c
+++ b/openair1/SIMULATION/TOOLS/random_channel.c
@@ -72,7 +72,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
uint8_t channel_length,
double *amps,
double *delays,
- struct complex *R_sqrt,
+ struct complexd *R_sqrt,
double Td,
double sampling_rate,
double channel_bandwidth,
@@ -116,44 +116,44 @@ void fill_channel_desc(channel_desc_t *chan_desc,
chan_desc->first_run = 1;
chan_desc->ip = 0.0;
chan_desc->max_Doppler = max_Doppler;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(nb_taps*sizeof(struct complexd *));
LOG_D(OCM,"[CHANNEL] Filling ch \n");
for (i = 0; ich[i] = (struct complex *) malloc(channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); // allocate for up to 100 RBs, 12 samples per RB
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd)); // allocate for up to 100 RBs, 12 samples per RB
LOG_D(OCM,"[CHANNEL] Filling a (nb_taps %d)\n",nb_taps);
for (i = 0; ia[i],nb_tx*nb_rx * sizeof(struct complex));
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ LOG_D(OCM,"tap %d (%p,%zu)\n",i,&chan_desc->a[i],nb_tx*nb_rx * sizeof(struct complexd));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
}
LOG_D(OCM,"[CHANNEL] Doing R_sqrt ...\n");
if (R_sqrt == NULL) {
- chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *));
+ chan_desc->R_sqrt = (struct complexd **) calloc(nb_taps,sizeof(struct complexd *));
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_NTAPS ;
for (i = 0; iR_sqrt[i] = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
- chan_desc->R_sqrt[i][j].y = 0.0;
+ chan_desc->R_sqrt[i][j].r = 1.0;
+ chan_desc->R_sqrt[i][j].i = 0.0;
}
}
} else {
- chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *));
+ chan_desc->R_sqrt = (struct complexd **) calloc(nb_taps,sizeof(struct complexd *));
for (i = 0; iR_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
- //chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0];
+ //chan_desc->R_sqrt[i] = (struct complexd*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complexd));
+ //chan_desc->R_sqrt = (struct complexd*)&R_sqrt[i][0];
/* all chan_desc share the same R_sqrt, coming from caller */
chan_desc->R_sqrt[i] = R_sqrt;
}
@@ -161,7 +161,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
for (i = 0; iR_sqrt[i][j].x,chan_desc->R_sqrt[i][j].y);
+ LOG_D(OCM,"Rsqrt[%d][%d] %f %f\n",i,j,chan_desc->R_sqrt[i][j].r,chan_desc->R_sqrt[i][j].i);
}
}
@@ -418,61 +418,61 @@ static double default_amps_lin[] = {0.3868472, 0.3094778, 0.1547389, 0.0773694,
static double default_amp_lin[] = {1};
//correlation matrix for a 2x2 channel with full Tx correlation
-static struct complex R_sqrt_22_corr[16] = {{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
+static struct complexd R_sqrt_22_corr[16] = {{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0},
{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0}
};
//correlation matrix for a fully correlated 2x1 channel (h1==h2)
-static struct complex R_sqrt_21_corr[] = {{0.70711,0}, {0.70711,0}, {0.70711,0}, {0.70711,0}};
+static struct complexd R_sqrt_21_corr[] = {{0.70711,0}, {0.70711,0}, {0.70711,0}, {0.70711,0}};
//correlation matrix for a 2x2 channel with full Tx anti-correlation
-static struct complex R_sqrt_22_anticorr[16] = {{0.70711,0}, {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0},
+static struct complexd R_sqrt_22_anticorr[16] = {{0.70711,0}, {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0},
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {-0.70711,0},
{-0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
{0.0, 0.0}, {-0.70711,0}, {0.0, 0.0}, {0.70711,0}
};
//correlation matrix for a fully anti-correlated 2x1 channel (h1==-h2)
-static struct complex R_sqrt_21_anticorr[4] = {{0.70711,0}, {-0.70711,0}, {-0.70711,0}, {0.70711,0}};
+static struct complexd R_sqrt_21_anticorr[4] = {{0.70711,0}, {-0.70711,0}, {-0.70711,0}, {0.70711,0}};
// full correlation matrix in vectorized form for 2x2 channel, where h1 is perfectly orthogonal to h2
-static struct complex R_sqrt_22_orthogonal[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0},
+static struct complexd R_sqrt_22_orthogonal[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0},
{0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.0,0.0},
{0.0,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0},
{0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.70711,0.0}
};
// full correlation matrix for TM4 to make orthogonal effective channel
-static struct complex R_sqrt_22_orth_eff_ch_TM4_prec_real[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0},
+static struct complexd R_sqrt_22_orth_eff_ch_TM4_prec_real[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0},
{0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {-0.70711,0.0},
{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0},
{0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}
};
-static struct complex R_sqrt_22_orth_eff_ch_TM4_prec_imag[16] = {{0.70711,0.0}, {0.0,0.0}, {0.0, -0.70711}, {0.0,0.0},
+static struct complexd R_sqrt_22_orth_eff_ch_TM4_prec_imag[16] = {{0.70711,0.0}, {0.0,0.0}, {0.0, -0.70711}, {0.0,0.0},
{0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {0.0,0.70711},
{0.0,-0.70711}, {0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0},
{0.0, 0.0}, {0.0,0.70711}, {0.0, 0.0}, {-0.70711,0.0}
};
//Correlation matrix for EPA channel
-static struct complex R_sqrt_22_EPA_low[16] = {{1.0,0.0}, {0.0,0.0}, {0.0,0.0}, {0.0,0.0},
+static struct complexd R_sqrt_22_EPA_low[16] = {{1.0,0.0}, {0.0,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.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}, {1.0,0.0}
};
-static struct complex R_sqrt_22_EPA_high[16] = {
+static struct complexd R_sqrt_22_EPA_high[16] = {
{0.7179,0.0}, {0.4500,0.0}, {0.4500,0.0}, {0.2821,0.0},
{0.4500,0.0}, {0.7179,0.0}, {0.2821,0.0}, {0.4500,0.0},
{0.4500,0.0}, {0.2821,0.0}, {0.7179,0.0}, {0.4500,0.0},
{0.2821,0.0}, {0.4500,0.0}, {0.4500,0.0}, {0.7179,0.0}
};
-static struct complex R_sqrt_22_EPA_medium[16] = {{0.8375,0.0}, {0.5249,0.0}, {0.1286,0.0}, {0.0806,0.0},
+static struct complexd R_sqrt_22_EPA_medium[16] = {{0.8375,0.0}, {0.5249,0.0}, {0.1286,0.0}, {0.0806,0.0},
{0.5249,0.0}, {0.8375,0.0}, {0.0806,0.0}, {0.1286,0.0},
{0.1286,0.0}, {0.0806,0.0}, {0.8375,0.0}, {0.5249,0.0},
{0.0806,0.0}, {0.1286,0.0}, {0.5249,0.0}, {0.8375,0.0}
@@ -511,37 +511,37 @@ void tdlModel(int tdl_paths, double *tdl_delays, double *tdl_amps_dB, double DS
chan_desc->delays = tdl_delays;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (int i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (int i = 0; ichF[i] = (struct complex *) malloc((2+(275*12)) * sizeof(struct complex));
for (int i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
chan_desc->R_sqrt = (struct complex **) malloc(tdl_pathsby3*sizeof(struct complex **));
if (nb_tx==2 && nb_rx==2) {
for (int i = 0; i<(tdl_pathsby3); i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
} else if (nb_tx==2 && nb_rx==1) {
for (int i = 0; i<(tdl_pathsby3); i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R21_sqrt[i][0];
} else if (nb_tx==1 && nb_rx==2) {
for (int i = 0; i<(tdl_pathsby3); i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R12_sqrt[i][0];
} else {
for (int i = 0; i<(tdl_pathsby3); i++) {
- chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (int j = 0; jR_sqrt[i][j].x = 1.0;
- chan_desc->R_sqrt[i][j].y = 0.0;
+ chan_desc->R_sqrt[i][j].r = 1.0;
+ chan_desc->R_sqrt[i][j].i = 0.0;
}
LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx);
@@ -576,7 +576,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
double sum_amps;
double aoa,ricean_factor,Td,maxDoppler;
int channel_length,nb_taps;
- struct complex *R_sqrt_ptr2;
+ struct complexd *R_sqrt_ptr2;
chan_desc->modelid = channel_model;
chan_desc->nb_tx = nb_tx;
chan_desc->nb_rx = nb_rx;
@@ -625,39 +625,39 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
if (nb_tx==2 && nb_rx==2) {
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
} else if (nb_tx==2 && nb_rx==1) {
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R21_sqrt[i][0];
} else if (nb_tx==1 && nb_rx==2) {
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R12_sqrt[i][0];
} else {
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
- chan_desc->R_sqrt[i][j].y = 0.0;
+ chan_desc->R_sqrt[i][j].r = 1.0;
+ chan_desc->R_sqrt[i][j].i = 0.0;
}
LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx);
@@ -687,39 +687,39 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 0.1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
if (nb_tx==2 && nb_rx==2) {
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
} else if (nb_tx==2 && nb_rx==1) {
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R21_sqrt[i][0];
} else if (nb_tx==1 && nb_rx==2) {
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R12_sqrt[i][0];
} else {
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
- chan_desc->R_sqrt[i][j].y = 0.0;
+ chan_desc->R_sqrt[i][j].r = 1.0;
+ chan_desc->R_sqrt[i][j].i = 0.0;
}
LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx);
@@ -784,34 +784,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
if (nb_tx==2 && nb_rx==2) {
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
} else {
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
- chan_desc->R_sqrt[i][j].y = 0.0;
+ chan_desc->R_sqrt[i][j].r = 1.0;
+ chan_desc->R_sqrt[i][j].i = 0.0;
}
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
@@ -840,21 +840,21 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
if (nb_tx==2 && nb_rx==2) {
- chan_desc->R_sqrt = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd **));
for (i = 0; inb_taps; i++)
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_low;
@@ -863,9 +863,9 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
}
/*else {
- chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
+ chan_desc->R_sqrt = (struct complexd**) malloc(6*sizeof(struct complexd**));
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0;
@@ -895,21 +895,21 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
if (nb_tx==2 && nb_rx==2) {
- chan_desc->R_sqrt = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd **));
for (i = 0; inb_taps; i++)
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_high;
@@ -918,9 +918,9 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
}
/*else {
- chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
+ chan_desc->R_sqrt = (struct complexd**) malloc(6*sizeof(struct complexd**));
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0;
@@ -950,21 +950,21 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
if (nb_tx==2 && nb_rx==2) {
- chan_desc->R_sqrt = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd **));
for (i = 0; inb_taps; i++)
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_medium;
@@ -973,9 +973,9 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
}
/*else {
- chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
+ chan_desc->R_sqrt = (struct complexd**) malloc(6*sizeof(struct complexd**));
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0;
@@ -1005,34 +1005,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
if (nb_tx==2 && nb_rx==2) {
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
} else {
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
- chan_desc->R_sqrt[i][j].y = 0.0;
+ chan_desc->R_sqrt[i][j].r = 1.0;
+ chan_desc->R_sqrt[i][j].i = 0.0;
}
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
@@ -1061,34 +1061,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
if (nb_tx==2 && nb_rx==2) {
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
for (i = 0; i<6; i++)
- chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
+ chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
} else {
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
- chan_desc->R_sqrt[i][j].y = 0.0;
+ chan_desc->R_sqrt[i][j].r = 1.0;
+ chan_desc->R_sqrt[i][j].i = 0.0;
}
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
@@ -1117,28 +1117,28 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
- chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
- chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
+ chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
+ chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
+ chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
+ chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
for (i = 0; inb_taps; i++)
- chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
- chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex *));
+ chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd *));
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6;
for (i = 0; i<6; i++) {
- chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
+ chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
for (j = 0; jR_sqrt[i][j].x = 1.0;
- chan_desc->R_sqrt[i][j].y = 0.0;
+ chan_desc->R_sqrt[i][j].r = 1.0;
+ chan_desc->R_sqrt[i][j].i = 0.0;
}
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
@@ -1716,8 +1716,8 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
for (i=0; i<(int)desc->nb_taps; i++) {
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
- anew[aarx+(aatx*desc->nb_rx)].x = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
- anew[aarx+(aatx*desc->nb_rx)].y = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
+ anew[aarx+(aatx*desc->nb_rx)].r = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
+ anew[aarx+(aatx*desc->nb_rx)].i = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
if ((i==0) && (desc->ricean_factor != 1.0)) {
if (desc->random_aoa==1) {
@@ -1727,14 +1727,14 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
// this assumes that both RX and TX have linear antenna arrays with lambda/2 antenna spacing.
// Furhter it is assumed that the arrays are parallel to each other and that they are far enough apart so
// that we can safely assume plane wave propagation.
- phase.x = cos(M_PI*((aarx-aatx)*sin(desc->aoa)));
- phase.y = sin(M_PI*((aarx-aatx)*sin(desc->aoa)));
- anew[aarx+(aatx*desc->nb_rx)].x += phase.x * sqrt(1.0-desc->ricean_factor);
- anew[aarx+(aatx*desc->nb_rx)].y += phase.y * sqrt(1.0-desc->ricean_factor);
+ phase.r = cos(M_PI*((aarx-aatx)*sin(desc->aoa)));
+ phase.i = sin(M_PI*((aarx-aatx)*sin(desc->aoa)));
+ anew[aarx+(aatx*desc->nb_rx)].r += phase.r * sqrt(1.0-desc->ricean_factor);
+ anew[aarx+(aatx*desc->nb_rx)].i += phase.i * sqrt(1.0-desc->ricean_factor);
}
#ifdef DEBUG_CH
- printf("(%d,%d,%d) %f->(%f,%f) (%f,%f) phase (%f,%f)\n",aarx,aatx,i,desc->amps[i],anew[aarx+(aatx*desc->nb_rx)].x,anew[aarx+(aatx*desc->nb_rx)].y,desc->aoa,desc->ricean_factor,phase.x,phase.y);
+ printf("(%d,%d,%d) %f->(%f,%f) (%f,%f) phase (%f,%f)\n",aarx,aatx,i,desc->amps[i],anew[aarx+(aatx*desc->nb_rx)].r,anew[aarx+(aatx*desc->nb_rx)].i,desc->aoa,desc->ricean_factor,phase.r,phase.i);
#endif
} //aatx
} //aarx
@@ -1751,10 +1751,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
*/
//apply correlation matrix
//compute acorr = R_sqrt[i] * anew
- alpha.x = 1.0;
- alpha.y = 0.0;
- beta.x = 0.0;
- beta.y = 0.0;
+ alpha.r = 1.0;
+ alpha.i = 0.0;
+ beta.r = 0.0;
+ beta.i = 0.0;
cblas_zgemv(CblasRowMajor, CblasNoTrans, desc->nb_tx*desc->nb_rx, desc->nb_tx*desc->nb_rx,
(void *) &alpha, (void *) desc->R_sqrt[i/3], desc->nb_rx*desc->nb_tx,
(void *) anew, 1, (void *) &beta, (void *) acorr, 1);
@@ -1775,10 +1775,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
// a = alpha*acorr+beta*a
// a = beta*a
// a = a+alpha*acorr
- alpha.x = sqrt(1-desc->forgetting_factor);
- alpha.y = 0;
- beta.x = sqrt(desc->forgetting_factor);
- beta.y = 0;
+ alpha.r = sqrt(1-desc->forgetting_factor);
+ alpha.i = 0;
+ beta.r = sqrt(desc->forgetting_factor);
+ beta.i = 0;
cblas_zscal(desc->nb_tx*desc->nb_rx, (void *) &beta, (void *) desc->a[i], 1);
cblas_zaxpy(desc->nb_tx*desc->nb_rx, (void *) &alpha, (void *) acorr, 1, (void *) desc->a[i], 1);
// desc->a[i][aarx+(aatx*desc->nb_rx)].x = (sqrt(desc->forgetting_factor)*desc->a[i][aarx+(aatx*desc->nb_rx)].x) + sqrt(1-desc->forgetting_factor)*anew.x;
@@ -1798,7 +1798,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
stop_meas(&desc->random_channel);
- //memset((void *)desc->ch[aarx+(aatx*desc->nb_rx)],0,(int)(desc->channel_length)*sizeof(struct complex));
+ //memset((void *)desc->ch[aarx+(aatx*desc->nb_rx)],0,(int)(desc->channel_length)*sizeof(struct complexd));
if (abstraction_flag==0) {
start_meas(&desc->interp_time);
@@ -1806,12 +1806,12 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
for (aarx=0; aarxnb_rx; aarx++) {
for (aatx=0; aatxnb_tx; aatx++) {
if (desc->channel_length == 1) {
- desc->ch[aarx+(aatx*desc->nb_rx)][0].x = desc->a[0][aarx+(aatx*desc->nb_rx)].x;
- desc->ch[aarx+(aatx*desc->nb_rx)][0].y = desc->a[0][aarx+(aatx*desc->nb_rx)].y;
+ desc->ch[aarx+(aatx*desc->nb_rx)][0].r = desc->a[0][aarx+(aatx*desc->nb_rx)].r;
+ desc->ch[aarx+(aatx*desc->nb_rx)][0].i = desc->a[0][aarx+(aatx*desc->nb_rx)].i;
} else {
for (k=0; k<(int)desc->channel_length; k++) {
- desc->ch[aarx+(aatx*desc->nb_rx)][k].x = 0.0;
- desc->ch[aarx+(aatx*desc->nb_rx)][k].y = 0.0;
+ desc->ch[aarx+(aatx*desc->nb_rx)][k].r = 0.0;
+ desc->ch[aarx+(aatx*desc->nb_rx)][k].i = 0.0;
for (l=0; l