1 /******************************************************************************
3 * Copyright (c) 2021 Intel.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 *******************************************************************************/
21 * This file consist of implementation of FAPI UL_IQ_SAMPLES.request message.
24 #include "nr5g_fapi_framework.h"
25 #include "nr5g_fapi_fapi2mac_api.h"
26 #include "nr5g_fapi_fapi2phy_api.h"
27 #include "nr5g_fapi_fapi2phy_p5_proc.h"
28 #include "nr5g_fapi_fapi2phy_p5_pvt_proc.h"
29 #include "nr5g_fapi_memory.h"
31 /** @ingroup group_source_api_p5_fapi2phy_proc
33 * @param[in] p_phy_instance Pointer to PHY instance.
34 * @param[in] p_fapi_req Pointer to FAPI UL_IQ_SAMPLES.request message structure.
35 * @return Returns ::SUCCESS and ::FAILURE.
38 * This is a timer mode specific message used to transmit IQ Sample API to L1.
39 * In UL direction, L1 opens the IQ samples file and stores it into local
40 * buffers for processing.
45 uint8_t nr5g_fapi_ul_iq_samples_request(
47 fapi_vendor_ext_iq_samples_req_t * p_fapi_req)
51 fapi_vendor_ext_iq_samples_info_t *p_file_info;
52 PMAC2PHY_QUEUE_EL p_list_elem;
54 if (NULL == p_fapi_req) {
55 NR5G_FAPI_LOG(ERROR_LOG, (" [UL_IQ_SAMPLES.request] Invalid fapi "
60 p_list_elem = nr5g_fapi_fapi2phy_create_api_list_elem((uint8_t)
61 MSG_TYPE_PHY_UL_IQ_SAMPLES, 1,
62 (uint32_t) sizeof(fapi_vendor_ext_iq_samples_info_t));
64 NR5G_FAPI_LOG(ERROR_LOG, ("[UL_IQ_SAMPLES.request] Unable to create "
65 "list element. Out of memory!!!"));
69 p_file_info = (fapi_vendor_ext_iq_samples_info_t *) (p_list_elem + 1);
70 p_file_info->carrNum = p_fapi_req->iq_samples_info.carrNum;
71 p_file_info->numSubframes = p_fapi_req->iq_samples_info.numSubframes;
72 p_file_info->nIsRadioMode = p_fapi_req->iq_samples_info.nIsRadioMode;
73 p_file_info->timerModeFreqDomain =
74 p_fapi_req->iq_samples_info.timerModeFreqDomain;
75 p_file_info->phaseCompensationEnable =
76 p_fapi_req->iq_samples_info.phaseCompensationEnable;
77 p_file_info->startFrameNum = p_fapi_req->iq_samples_info.startFrameNum;
78 p_file_info->startSlotNum = p_fapi_req->iq_samples_info.startSlotNum;
79 p_file_info->startSymNum = p_fapi_req->iq_samples_info.startSymNum;
81 p_file_info->nDLCompressionIdx = p_fapi_req->iq_samples_info.nDLCompressionIdx;
82 p_file_info->nDLCompiqWidth = p_fapi_req->iq_samples_info.nDLCompiqWidth;
83 p_file_info->nDLCompScaleFactor = p_fapi_req->iq_samples_info.nDLCompScaleFactor;
84 p_file_info->nDLCompreMask = p_fapi_req->iq_samples_info.nDLCompreMask;
85 p_file_info->nULDecompressionIdx = p_fapi_req->iq_samples_info.nULDecompressionIdx;
86 p_file_info->nULDecompiqWidth = p_fapi_req->iq_samples_info.nULDecompiqWidth;
88 if (FAILURE == NR5G_FAPI_MEMCPY(p_file_info->buffer,
89 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_BUFFER_SIZE,
90 p_fapi_req->iq_samples_info.buffer, sizeof(CONFIGREQUESTStruct))) {
91 NR5G_FAPI_LOG(ERROR_LOG, ("[UL_IQ_Samples.request] Buffer copy "
95 for (num_ant = 0; num_ant < FAPI_MAX_IQ_SAMPLE_UL_VIRTUAL_PORTS; num_ant++) {
96 if (FAILURE == NR5G_FAPI_STRCPY(p_file_info->filename_in_ul_iq[num_ant],
97 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE,
98 p_fapi_req->iq_samples_info.filename_in_ul_iq[num_ant],
99 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) {
100 NR5G_FAPI_LOG(ERROR_LOG, ("[UL_IQ_Samples.request] file name copy "
105 NR5G_FAPI_STRCPY(p_file_info->filename_in_prach_iq[num_ant],
106 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE,
107 p_fapi_req->iq_samples_info.filename_in_prach_iq[num_ant],
108 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) {
109 NR5G_FAPI_LOG(ERROR_LOG,
110 ("[UL_IQ_Samples.request] PRACH file name " "copy failed!!!"));
114 NR5G_FAPI_STRCPY(p_file_info->filename_in_ul_iq_compressed[num_ant],
115 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE,
116 p_fapi_req->iq_samples_info.filename_in_ul_iq_compressed[num_ant],
117 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) {
118 NR5G_FAPI_LOG(ERROR_LOG,
119 ("[UL_IQ_Samples.request] compressed file name copy failed!!!"));
123 for (num_ant = 0; num_ant < FAPI_MAX_IQ_SAMPLE_UL_ANTENNA; num_ant++) {
125 NR5G_FAPI_STRCPY(p_file_info->filename_in_srs_iq[num_ant],
126 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE,
127 p_fapi_req->iq_samples_info.filename_in_srs_iq[num_ant],
128 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) {
129 NR5G_FAPI_LOG(ERROR_LOG,
130 ("[UL_IQ_Samples.request] SRS file name " "copy failed!!!"));
134 nr5g_fapi_fapi2phy_add_to_api_list(is_urllc, p_list_elem);
135 NR5G_FAPI_LOG(INFO_LOG, ("[UL_IQ_SAMPLES.request][%d]",
136 p_fapi_req->iq_samples_info.carrNum));