X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fphy.git;a=blobdiff_plain;f=fapi_5g%2Fsource%2Fapi%2Ffapi2phy%2Fp5%2Fnr5g_fapi_proc_ul_iq_samples_req.c;fp=fapi_5g%2Fsource%2Fapi%2Ffapi2phy%2Fp5%2Fnr5g_fapi_proc_ul_iq_samples_req.c;h=c95193747fdcdc503a6a6b796b863f3b629f1e92;hp=0000000000000000000000000000000000000000;hb=9d66fca5c45c8b3e0d6eab6d51a90c8e9d2614dc;hpb=2fbf70096f64af622da983e88c5a64e90ad9bdbd diff --git a/fapi_5g/source/api/fapi2phy/p5/nr5g_fapi_proc_ul_iq_samples_req.c b/fapi_5g/source/api/fapi2phy/p5/nr5g_fapi_proc_ul_iq_samples_req.c new file mode 100644 index 0000000..c951937 --- /dev/null +++ b/fapi_5g/source/api/fapi2phy/p5/nr5g_fapi_proc_ul_iq_samples_req.c @@ -0,0 +1,133 @@ +/****************************************************************************** +* +* Copyright (c) 2019 Intel. +* +* 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. +* +*******************************************************************************/ + +/** + * @file + * This file consist of implementation of FAPI UL_IQ_SAMPLES.request message. + * + **/ +#include "nr5g_fapi_framework.h" +#include "gnb_l1_l2_api.h" +#include "nr5g_fapi_fapi2mac_api.h" +#include "nr5g_fapi_fapi2phy_api.h" +#include "nr5g_fapi_fapi2phy_p5_proc.h" +#include "nr5g_fapi_fapi2phy_p5_pvt_proc.h" +#include "nr5g_fapi_memory.h" + + /** @ingroup group_source_api_p5_fapi2phy_proc + * + * @param[in] p_phy_instance Pointer to PHY instance. + * @param[in] p_fapi_req Pointer to FAPI UL_IQ_SAMPLES.request message structure. + * @return Returns ::SUCCESS and ::FAILURE. + * + * @description + * This is a timer mode specific message used to transmit IQ Sample API to L1. + * In UL direction, L1 opens the IQ samples file and stores it into local + * buffers for processing. + * + * +**/ +#ifdef DEBUG_MODE +uint8_t nr5g_fapi_ul_iq_samples_request( + fapi_vendor_ext_iq_samples_req_t * p_fapi_req) +{ + uint16_t num_ant; + + fapi_vendor_ext_iq_samples_info_t *p_file_info; + PMAC2PHY_QUEUE_EL p_list_elem; + + /* Below print is for better logging on console in debug mode. */ + NR5G_FAPI_LOG(INFO_LOG, ("")); + + if (NULL == p_fapi_req) { + NR5G_FAPI_LOG(ERROR_LOG, (" [UL_IQ_SAMPLES.request] Invalid fapi " + "message")); + return FAILURE; + } + + p_list_elem = nr5g_fapi_fapi2phy_create_api_list_elem((uint8_t) + MSG_TYPE_PHY_UL_IQ_SAMPLES, 1, + (uint32_t) sizeof(fapi_vendor_ext_iq_samples_info_t)); + if (!p_list_elem) { + NR5G_FAPI_LOG(ERROR_LOG, ("[UL_IQ_SAMPLES.request] Unable to create " + "list element. Out of memory!!!")); + return FAILURE; + } + + p_file_info = (fapi_vendor_ext_iq_samples_info_t *) (p_list_elem + 1); + p_file_info->carrNum = p_fapi_req->iq_samples_info.carrNum; + p_file_info->numSubframes = p_fapi_req->iq_samples_info.numSubframes; + p_file_info->testUeMode = p_fapi_req->iq_samples_info.testUeMode; + p_file_info->timerModeFreqDomain = + p_fapi_req->iq_samples_info.timerModeFreqDomain; + p_file_info->phaseCompensationEnable = + p_fapi_req->iq_samples_info.phaseCompensationEnable; + p_file_info->startFrameNum = p_fapi_req->iq_samples_info.startFrameNum; + p_file_info->startSlotNum = p_fapi_req->iq_samples_info.startSlotNum; + if (FAILURE == NR5G_FAPI_MEMCPY(p_file_info->buffer, + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_BUFFER_SIZE, + p_fapi_req->iq_samples_info.buffer, sizeof(CONFIGREQUESTStruct))) { + NR5G_FAPI_LOG(ERROR_LOG, ("[UL_IQ_Samples.request] Buffer copy " + "failed!!!")); + } + + for (num_ant = 0; num_ant < FAPI_MAX_IQ_SAMPLE_UL_VIRTUAL_PORTS; num_ant++) { + if (FAILURE == NR5G_FAPI_STRCPY(p_file_info->filename_in_ul_iq[num_ant], + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE, + p_fapi_req->iq_samples_info.filename_in_ul_iq[num_ant], + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) { + NR5G_FAPI_LOG(ERROR_LOG, ("[UL_IQ_Samples.request] file name copy " + "failed!!!")); + } + + if (FAILURE == + NR5G_FAPI_STRCPY(p_file_info->filename_in_ul_urllc[num_ant], + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE, + p_fapi_req->iq_samples_info.filename_in_ul_urllc[num_ant], + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) { + NR5G_FAPI_LOG(ERROR_LOG, + ("[UL_IQ_Samples.request] URLLC file name " "copy failed!!!")); + } + if (FAILURE == + NR5G_FAPI_STRCPY(p_file_info->filename_in_prach_iq[num_ant], + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE, + p_fapi_req->iq_samples_info.filename_in_prach_iq[num_ant], + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) { + NR5G_FAPI_LOG(ERROR_LOG, + ("[UL_IQ_Samples.request] PRACH file name " "copy failed!!!")); + } + } + + for (num_ant = 0; num_ant < FAPI_MAX_IQ_SAMPLE_UL_ANTENNA; num_ant++) { + if (FAILURE == + NR5G_FAPI_STRCPY(p_file_info->filename_in_srs_iq[num_ant], + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE, + p_fapi_req->iq_samples_info.filename_in_srs_iq[num_ant], + sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) { + NR5G_FAPI_LOG(ERROR_LOG, + ("[UL_IQ_Samples.request] SRS file name " "copy failed!!!")); + } + } + + nr5g_fapi_fapi2phy_add_to_api_list(p_list_elem); + NR5G_FAPI_LOG(INFO_LOG, ("[UL_IQ_SAMPLES.request][%d]", + p_fapi_req->iq_samples_info.carrNum)); + + return SUCCESS; +} +#endif