1 /******************************************************************************
3 * Copyright (c) 2019 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 *******************************************************************************/
20 * This file consist of implementation of FAPI DLIQSamples.request message.
23 #include "nr5g_fapi_framework.h"
24 #include "gnb_l1_l2_api.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_fapi_req Pointer to FAPI DLIQSamples.request message structure.
34 * @return Returns ::SUCCESS and ::FAILURE.
37 * This is a timer mode specific message used to transmit IQ Sample API to L1.
38 * In DL direction, L1 copies the IQ samples into a file.
43 uint8_t nr5g_fapi_dl_iq_samples_request(
44 fapi_vendor_ext_iq_samples_req_t * p_fapi_req)
48 fapi_vendor_ext_iq_samples_info_t *p_file_info;
49 PMAC2PHY_QUEUE_EL p_list_elem;
51 if (NULL == p_fapi_req) {
52 NR5G_FAPI_LOG(ERROR_LOG, ("[DL_IQ_Samples.request] Invalid FAPI "
57 p_list_elem = nr5g_fapi_fapi2phy_create_api_list_elem((uint8_t)
58 MSG_TYPE_PHY_DL_IQ_SAMPLES, 1,
59 (uint32_t) sizeof(fapi_vendor_ext_iq_samples_info_t));
61 NR5G_FAPI_LOG(ERROR_LOG, ("[DL_IQ_Samples.request] Unable to create "
62 "list element. Out of memory!!!"));
66 p_file_info = (fapi_vendor_ext_iq_samples_info_t *) (p_list_elem + 1);
67 p_file_info->carrNum = p_fapi_req->iq_samples_info.carrNum;
68 p_file_info->numSubframes = p_fapi_req->iq_samples_info.numSubframes;
69 p_file_info->nIsRadioMode = p_fapi_req->iq_samples_info.nIsRadioMode;
70 p_file_info->timerModeFreqDomain =
71 p_fapi_req->iq_samples_info.timerModeFreqDomain;
72 p_file_info->phaseCompensationEnable =
73 p_fapi_req->iq_samples_info.phaseCompensationEnable;
74 p_file_info->startFrameNum = p_fapi_req->iq_samples_info.startFrameNum;
75 p_file_info->startSlotNum = p_fapi_req->iq_samples_info.startSlotNum;
76 p_file_info->startSymNum = p_fapi_req->iq_samples_info.startSymNum;
77 if (FAILURE == NR5G_FAPI_MEMCPY(p_file_info->buffer,
78 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_BUFFER_SIZE,
79 p_fapi_req->iq_samples_info.buffer, sizeof(CONFIGREQUESTStruct))) {
80 NR5G_FAPI_LOG(ERROR_LOG, ("[DL_IQ_Samples.request] Buffer copy "
84 if (FAILURE == NR5G_FAPI_STRCPY(p_file_info->filename_out_dl_iq,
85 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE,
86 p_fapi_req->iq_samples_info.filename_out_dl_iq,
87 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) {
88 NR5G_FAPI_LOG(ERROR_LOG, ("[DL_IQ_Samples.request] file name copy "
92 for (num_ant = 0; num_ant < FAPI_MAX_IQ_SAMPLE_DL_PORTS; num_ant++) {
94 NR5G_FAPI_STRCPY(p_file_info->filename_out_dl_beam[num_ant],
95 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE,
96 p_fapi_req->iq_samples_info.filename_out_dl_beam[num_ant],
97 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) {
99 NR5G_FAPI_LOG(ERROR_LOG, ("[DL_IQ_Samples.request] DL Beam "
100 "file name copy failed!!!"));
104 for (num_ant = 0; num_ant < FAPI_MAX_IQ_SAMPLE_UL_VIRTUAL_PORTS; num_ant++) {
106 NR5G_FAPI_STRCPY(p_file_info->filename_out_ul_beam[num_ant],
107 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE,
108 p_fapi_req->iq_samples_info.filename_out_ul_beam[num_ant],
109 sizeof(uint8_t) * FAPI_MAX_IQ_SAMPLE_FILE_SIZE)) {
110 NR5G_FAPI_LOG(ERROR_LOG,
111 ("[DL_IQ_Samples.request] UL Beam "
112 "file name copy failed!!!"));
116 nr5g_fapi_fapi2phy_add_to_api_list(p_list_elem);
118 NR5G_FAPI_LOG(INFO_LOG, ("[DL_IQ_Samples.request][%d]",
119 p_fapi_req->iq_samples_info.carrNum));