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 *******************************************************************************/
21 * This file consist of implementation of FAPI STOP.request message.
25 #include "nr5g_fapi_framework.h"
26 #include "gnb_l1_l2_api.h"
27 #include "nr5g_fapi_fapi2mac_api.h"
28 #include "nr5g_fapi_fapi2phy_api.h"
29 #include "nr5g_fapi_fapi2phy_p5_proc.h"
30 #include "nr5g_fapi_fapi2phy_p5_pvt_proc.h"
32 /** @ingroup group_source_api_p5_fapi2phy_proc
34 * @param[in] p_phy_instance Pointer to PHY instance.
35 * @param[in] p_fapi_req Pointer to FAPI STOP.request message structure.
36 * @param[in] p_fapi_vendor_msg Pointer to FAPI vendor message structure.
37 * @return Returns ::SUCCESS and ::FAILURE.
40 * This message allows L2/L3 to move the PHY from RUNNING state to CONFIGURED
41 * state. This stops the PHY transmitting as an gNB.
43 * The *nSFN*, *nSlot*, and *nCarrierIdx* parameters are vendor specific
44 * configuration and programmed through Vendor Specific Message structure
45 * ::fapi_start_req_vendor_msg_t
48 uint8_t nr5g_fapi_stop_request(
50 p_nr5g_fapi_phy_instance_t p_phy_instance,
51 fapi_stop_req_t * p_fapi_req,
52 fapi_vendor_msg_t * p_fapi_vendor_msg)
54 PSTOPREQUESTStruct p_stop_req;
55 PMAC2PHY_QUEUE_EL p_list_elem;
56 nr5g_fapi_stats_t *p_stats;
58 if (NULL == p_phy_instance) {
59 NR5G_FAPI_LOG(ERROR_LOG, ("[STOP.request] Invalid " "phy instance"));
62 p_stats = &p_phy_instance->stats;
63 p_stats->fapi_stats.fapi_stop_req++;
65 if (NULL == p_fapi_req) {
66 NR5G_FAPI_LOG(ERROR_LOG, ("[STOP.request] Invalid fapi " "message"));
70 if (NULL == p_fapi_vendor_msg) {
71 NR5G_FAPI_LOG(ERROR_LOG, ("[STOP.request] Invalid fapi "
76 p_list_elem = nr5g_fapi_fapi2phy_create_api_list_elem((uint8_t)
77 MSG_TYPE_PHY_STOP_REQ, 1, (uint32_t) sizeof(STOPREQUESTStruct));
79 NR5G_FAPI_LOG(ERROR_LOG, ("[STOP.request] Unable to create "
80 "list element. Out of memory!!!"));
84 p_stop_req = (PSTOPREQUESTStruct) (p_list_elem + 1);
85 p_stop_req->sMsgHdr.nMessageType = MSG_TYPE_PHY_STOP_REQ;
86 p_stop_req->sMsgHdr.nMessageLen = (uint16_t) sizeof(STOPREQUESTStruct);
87 p_stop_req->sSFN_Slot.nSFN = p_fapi_vendor_msg->stop_req_vendor.sfn;
88 p_stop_req->sSFN_Slot.nSlot = p_fapi_vendor_msg->stop_req_vendor.slot;
89 p_stop_req->sSFN_Slot.nCarrierIdx = p_phy_instance->phy_id;
91 /* Add element to send list */
92 nr5g_fapi_fapi2phy_add_to_api_list(is_urllc, p_list_elem);
94 p_stats->iapi_stats.iapi_stop_req++;
95 NR5G_FAPI_LOG(INFO_LOG, ("[STOP.request][%d]", p_phy_instance->phy_id));