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 *******************************************************************************/
19 #include "nr5g_mac_phy_api.h"
20 #include "fapi_vendor_extension.h"
21 #include "nr5g_fapi_common_types.h"
22 #include "nr5g_fapi_fapi2phy_api.h"
23 #include "nr5g_fapi_log.h"
27 * This file consist of implementation of FAPI VENDOR ADD_REMOVE_CORE message.
31 /** @ingroup group_source_api_p5_fapi2phy_proc
33 * @param[in] p_fapi_req Pointer to FAPI VENDOR ADD_REMOVE_CORE message structure.
34 * @return Returns ::SUCCESS and ::FAILURE.
37 * This is a timer mode specific message used to set options on bbupool cores.
41 uint8_t nr5g_fapi_add_remove_core_message(
43 fapi_vendor_ext_add_remove_core_msg_t * p_fapi_req)
46 PMAC2PHY_QUEUE_EL p_list_elem;
47 PADD_REMOVE_BBU_CORES_NR5G p_add_remove_bbu_cores_nr5g;
48 PADD_REMOVE_BBU_CORES p_add_remove_bbu_cores;
50 /* Below print is for better logging on console in debug mode. */
51 NR5G_FAPI_LOG(INFO_LOG, (""));
53 if (NULL == p_fapi_req) {
54 NR5G_FAPI_LOG(ERROR_LOG, ("[FAPI_VENDOR_EXT_ADD_REMOVE_CORE] Invalid fapi message"));
58 p_list_elem = nr5g_fapi_fapi2phy_create_api_list_elem(
59 (uint8_t)MSG_TYPE_PHY_ADD_REMOVE_CORE, 1, (uint32_t) sizeof(ADD_REMOVE_BBU_CORES_NR5G));
62 NR5G_FAPI_LOG(ERROR_LOG, ("[FAPI_VENDOR_EXT_ADD_REMOVE_CORE] Unable to create "
63 "list element. Out of memory!!!"));
67 p_add_remove_bbu_cores_nr5g = (PADD_REMOVE_BBU_CORES_NR5G) (p_list_elem + 1);
68 p_add_remove_bbu_cores_nr5g->sMsgHdr.nMessageType = MSG_TYPE_PHY_ADD_REMOVE_CORE;
69 p_add_remove_bbu_cores_nr5g->sMsgHdr.nMessageLen = sizeof(ADD_REMOVE_BBU_CORES_NR5G);
71 p_add_remove_bbu_cores = &p_add_remove_bbu_cores_nr5g->sAddRemoveBbuCores;
72 for (i = 0; i < FAPI_MAX_NUM_SET_CORE_MASK; ++i)
74 for (k = 0; k < FAPI_MAX_MASK_OPTIONS; ++k)
76 p_add_remove_bbu_cores->nCoreMask[k][i] = p_fapi_req->add_remove_core_info.nCoreMask[k][i];
79 for (i = 0; i < FAPI_NUM_SPLIT_OPTIONS; ++i)
81 p_add_remove_bbu_cores->nMacOptions[i] = p_fapi_req->add_remove_core_info.nMacOptions[i];
83 for(k = 0; k < FAPI_MAX_NUM_CELLS; ++k) {
84 for(i = 0; i < FAPI_MAX_GROUP_NUM; ++i) {
85 p_add_remove_bbu_cores->nPuschInterOptions[k][i] = p_fapi_req->add_remove_core_info.nPuschInterOptions[k][i];
88 p_add_remove_bbu_cores->eOption = (BBUPOOL_CORE_OPERATION)p_fapi_req->add_remove_core_info.eOption;
90 nr5g_fapi_fapi2phy_add_to_api_list(is_urllc, p_list_elem);
92 NR5G_FAPI_LOG(INFO_LOG, ("[FAPI_VENDOR_EXT_ADD_REMOVE_CORE.message]"));