Commit 437149ae authored by Rúben Soares Silva's avatar Rúben Soares Silva Committed by Robert Schmidt

Fix packing/unpacking procedures for DL_TTI.request

Add pack/unpack functionality for parameters
added in previous commit
Add utility functions related to DL_TTI.request,
creating 2 news files to contain these functions
Reorder switch to follow PDU Type order
parent fee7c74f
...@@ -13,6 +13,7 @@ target_link_libraries(nr_fapi_p5 PUBLIC nr_fapi_common) ...@@ -13,6 +13,7 @@ target_link_libraries(nr_fapi_p5 PUBLIC nr_fapi_common)
add_library(nr_fapi_p7 add_library(nr_fapi_p7
src/nr_fapi_p7.c src/nr_fapi_p7.c
src/nr_fapi_p7_utils.c
) )
target_include_directories(nr_fapi_p7 PUBLIC inc) target_include_directories(nr_fapi_p7 PUBLIC inc)
# Note: Dependencies with NFAPI_LIB NFAPI_USER_LIB only necessary until last FAPI function is moved into new library, to be removed at a later stage # Note: Dependencies with NFAPI_LIB NFAPI_USER_LIB only necessary until last FAPI function is moved into new library, to be removed at a later stage
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nfapi/open-nFAPI/fapi/inc/p5/nr_fapi_p5_utils.h
* \brief
* \author Ruben S. Silva
* \date 2024
* \version 0.1
* \company OpenAirInterface Software Alliance
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
* \note
* \warning
*/
#ifndef OPENAIRINTERFACE_NR_FAPI_P7_UTILS_H
#define OPENAIRINTERFACE_NR_FAPI_P7_UTILS_H
#include "stdio.h"
#include "stdint.h"
#include "nr_fapi.h"
bool eq_dl_tti_request(const nfapi_nr_dl_tti_request_t *a, const nfapi_nr_dl_tti_request_t *b);
void free_dl_tti_request(nfapi_nr_dl_tti_request_t *msg);
void copy_dl_tti_request(const nfapi_nr_dl_tti_request_t *src, nfapi_nr_dl_tti_request_t *dst);
#endif // OPENAIRINTERFACE_NR_FAPI_P7_UTILS_H
This diff is collapsed.
...@@ -237,17 +237,35 @@ static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t *value, uint8_t **ppW ...@@ -237,17 +237,35 @@ static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t *value, uint8_t **ppW
static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) 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; 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) if (!(push16(value->bwp_size, ppWritePackedMsg, end) && push16(value->bwp_start, ppWritePackedMsg, end)
&& push8(value->subcarrier_spacing, ppWritePackedMsg, end) && push8(value->cyclic_prefix, 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) && push16(value->start_rb, ppWritePackedMsg, end) && push16(value->nr_of_rbs, ppWritePackedMsg, end)
&& push8(value->csi_type, ppWritePackedMsg, end) && push8(value->row, 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) && 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->symb_l1, ppWritePackedMsg, end) && push8(value->cdm_type, ppWritePackedMsg, end)
&& push8(value->freq_density, ppWritePackedMsg, end) && push16(value->scramb_id, 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, ppWritePackedMsg, end)
&& push8(value->power_control_offset_ss, ppWritePackedMsg, end) && && push8(value->power_control_offset_ss, ppWritePackedMsg, end))) {
// TODO Add Precoding and Beamforming, hardcoded for now return 0;
push16(0, ppWritePackedMsg, end) && push16(0, ppWritePackedMsg, end) && push8(0, ppWritePackedMsg, end)); }
// Precoding and Beamforming
if (!(push16(value->precodingAndBeamforming.num_prgs, ppWritePackedMsg, end)
&& push16(value->precodingAndBeamforming.prg_size, ppWritePackedMsg, end)
&& push8(value->precodingAndBeamforming.dig_bf_interfaces, ppWritePackedMsg, end))) {
return 0;
}
for (int prg = 0; prg < value->precodingAndBeamforming.num_prgs; prg++) {
if (!push16(value->precodingAndBeamforming.prgs_list[prg].pm_idx, ppWritePackedMsg, end)) {
return 0;
}
for (int digInt = 0; digInt < value->precodingAndBeamforming.dig_bf_interfaces; digInt++) {
if (!push16(value->precodingAndBeamforming.prgs_list[prg].dig_bf_interface_list[digInt].beam_idx, ppWritePackedMsg, end)) {
return 0;
}
}
}
return 1;
} }
static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
...@@ -339,7 +357,7 @@ static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppWritePac ...@@ -339,7 +357,7 @@ static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppWritePac
return 0; return 0;
} }
// Check pduBitMap bit 1 to add or not PTRS parameters // Check pduBitMap bit 0 to add or not PTRS parameters
if (value->pduBitmap & 0b1) { if (value->pduBitmap & 0b1) {
if (!(push8(value->PTRSPortIndex, ppWritePackedMsg, end) && push8(value->PTRSTimeDensity, ppWritePackedMsg, end) if (!(push8(value->PTRSPortIndex, ppWritePackedMsg, end) && push8(value->PTRSTimeDensity, ppWritePackedMsg, end)
&& push8(value->PTRSFreqDensity, ppWritePackedMsg, end) && push8(value->PTRSReOffset, ppWritePackedMsg, end) && push8(value->PTRSFreqDensity, ppWritePackedMsg, end) && push8(value->PTRSReOffset, ppWritePackedMsg, end)
...@@ -363,13 +381,19 @@ static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppWritePac ...@@ -363,13 +381,19 @@ static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppWritePac
} }
} }
} }
// TODO Add TX power info
// Hardcoded values that represent 0db if (!(push8(value->powerControlOffset, ppWritePackedMsg, end) && push8(value->powerControlOffsetSS, ppWritePackedMsg, end))) {
if (!(push8(0, ppWritePackedMsg, end) && // powerControlOffset
push8(0, ppWritePackedMsg, end))) { // powerControlOffsetSS
return 0; return 0;
} }
// Check pduBitMap bit 1 to add or not CBG parameters
if (value->pduBitmap & 0b10) {
if (!(push8(value->isLastCbPresent, ppWritePackedMsg, end) && push8(value->isInlineTbCrc, ppWritePackedMsg, end)
&& push32(value->dlTbCrc, ppWritePackedMsg, end))) {
return 0;
}
}
if (!push8(value->maintenance_parms_v3.ldpcBaseGraph, ppWritePackedMsg, end) if (!push8(value->maintenance_parms_v3.ldpcBaseGraph, ppWritePackedMsg, end)
|| !push32(value->maintenance_parms_v3.tbSizeLbrmBytes, ppWritePackedMsg, end)) || !push32(value->maintenance_parms_v3.tbSizeLbrmBytes, ppWritePackedMsg, end))
return 0; return 0;
...@@ -4041,7 +4065,6 @@ static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppReadPa ...@@ -4041,7 +4065,6 @@ static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppReadPa
{ {
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t *)tlv; 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) // TODO: resolve the packaging of array (currently sending a single element)
uint8_t powerControlOffset = 0, powerControlOffsetSS = 0;
if (!(pull16(ppReadPackedMsg, &value->pduBitmap, end) && pull16(ppReadPackedMsg, &value->rnti, end) if (!(pull16(ppReadPackedMsg, &value->pduBitmap, end) && pull16(ppReadPackedMsg, &value->rnti, end)
&& pull16(ppReadPackedMsg, &value->pduIndex, end) && pull16(ppReadPackedMsg, &value->BWPSize, end) && pull16(ppReadPackedMsg, &value->pduIndex, end) && pull16(ppReadPackedMsg, &value->BWPSize, end)
...@@ -4068,7 +4091,7 @@ static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppReadPa ...@@ -4068,7 +4091,7 @@ static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppReadPa
&& pull8(ppReadPackedMsg, &value->NrOfSymbols, end))) { && pull8(ppReadPackedMsg, &value->NrOfSymbols, end))) {
return 0; return 0;
} }
// Check pduBitMap bit 1 to pull PTRS parameters or not // Check pduBitMap bit 0 to pull PTRS parameters or not
if (value->pduBitmap & 0b1) { if (value->pduBitmap & 0b1) {
if (!(pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) && pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) if (!(pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) && pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end)
&& pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) && pull8(ppReadPackedMsg, &value->PTRSReOffset, end) && pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) && pull8(ppReadPackedMsg, &value->PTRSReOffset, end)
...@@ -4093,14 +4116,19 @@ static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppReadPa ...@@ -4093,14 +4116,19 @@ static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppReadPa
} }
} }
} }
// TODO Add TX power info // Tx power info
// Hardcoded values that represent 0db if (!(pull8(ppReadPackedMsg, &value->powerControlOffset, end) && pull8(ppReadPackedMsg, &value->powerControlOffsetSS, end))) {
if (!(pull8(ppReadPackedMsg, &powerControlOffset, end) && // powerControlOffset
pull8(ppReadPackedMsg, &powerControlOffsetSS, end))) { // powerControlOffsetSS
return 0; return 0;
} }
// Check pduBitMap bit 1 to pull CBG parameters or not
if (value->pduBitmap & 0b10) {
if (!(pull8(ppReadPackedMsg, &value->isLastCbPresent, end) && pull8(ppReadPackedMsg, &value->isInlineTbCrc, end)
&& pull32(ppReadPackedMsg, &value->dlTbCrc, end))) {
return 0;
}
}
if (!pull8(ppReadPackedMsg, &value->maintenance_parms_v3.ldpcBaseGraph, end) if (!pull8(ppReadPackedMsg, &value->maintenance_parms_v3.ldpcBaseGraph, end)
|| !pull32(ppReadPackedMsg, &value->maintenance_parms_v3.tbSizeLbrmBytes, end)) || !pull32(ppReadPackedMsg, &value->maintenance_parms_v3.tbSizeLbrmBytes, end))
return 0; return 0;
...@@ -4545,12 +4573,6 @@ static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8 ...@@ -4545,12 +4573,6 @@ static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8
// first match the pdu type, then call the respective function // first match the pdu type, then call the respective function
switch(value->PDUType) { 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: { case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: {
if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end))) if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end)))
return 0; return 0;
...@@ -4563,6 +4585,11 @@ static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8 ...@@ -4563,6 +4585,11 @@ static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8
} }
break; break;
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_SSB_PDU_TYPE: { case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: {
if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end))) if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end)))
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment