Merge remote-tracking branch 'origin/nFAPI_P5_Common' into integration_2024_w26b
This commit is contained in:
+20
-16
@@ -723,20 +723,14 @@ target_link_libraries(SCHED_NR_UE_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs
|
||||
|
||||
# nFAPI
|
||||
#################################
|
||||
set(NFAPI_COMMON_SRC
|
||||
${NFAPI_DIR}/common/src/debug.c
|
||||
)
|
||||
add_library(NFAPI_COMMON_LIB ${NFAPI_COMMON_SRC})
|
||||
|
||||
include_directories(${NFAPI_DIR}/common/public_inc)
|
||||
|
||||
set(NFAPI_SRC
|
||||
${NFAPI_DIR}/nfapi/src/nfapi.c
|
||||
${NFAPI_DIR}/nfapi/src/nfapi_p4.c
|
||||
${NFAPI_DIR}/nfapi/src/nfapi_p5.c
|
||||
${NFAPI_DIR}/nfapi/src/nfapi_p7.c
|
||||
)
|
||||
add_library(NFAPI_LIB ${NFAPI_SRC})
|
||||
target_link_libraries(NFAPI_LIB PUBLIC nfapi_common)
|
||||
target_link_libraries(NFAPI_LIB PUBLIC nr_fapi_p5)
|
||||
|
||||
include_directories(${NFAPI_DIR}/nfapi/public_inc)
|
||||
include_directories(${NFAPI_DIR}/nfapi/inc)
|
||||
@@ -761,7 +755,10 @@ set(NFAPI_VNF_SRC
|
||||
)
|
||||
add_library(NFAPI_VNF_LIB ${NFAPI_VNF_SRC})
|
||||
target_link_libraries(NFAPI_VNF_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
|
||||
|
||||
target_link_libraries(NFAPI_VNF_LIB PRIVATE nr_fapi_p5)
|
||||
if(OAI_AERIAL)
|
||||
target_compile_definitions(NFAPI_VNF_LIB PRIVATE ENABLE_AERIAL)
|
||||
endif()
|
||||
include_directories(${NFAPI_DIR}/vnf/public_inc)
|
||||
include_directories(${NFAPI_DIR}/vnf/inc)
|
||||
|
||||
@@ -1457,6 +1454,9 @@ add_library(e1_if
|
||||
target_link_libraries(e1_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs asn1_f1ap SECURITY ${OPENSSL_LIBRARIES} e1ap GTPV1U)
|
||||
|
||||
target_link_libraries(L2_NR PRIVATE f1ap x2ap s1ap ngap nr_rrc e1ap nr_rlc nr_common)
|
||||
if(OAI_AERIAL)
|
||||
target_compile_definitions(L2_NR PRIVATE ENABLE_AERIAL)
|
||||
endif()
|
||||
if(E2_AGENT)
|
||||
target_link_libraries(L2_NR PUBLIC e2_agent e2_agent_arg e2_ran_func_du_cucp_cuup)
|
||||
target_compile_definitions(L2_NR PRIVATE ${E2AP_VERSION} ${KPM_VERSION} E2_AGENT)
|
||||
@@ -1968,7 +1968,7 @@ add_dependencies(lte-softmodem oai_iqplayer)
|
||||
target_link_libraries(lte-softmodem PRIVATE
|
||||
-Wl,--start-group
|
||||
lte_rrc nr_rrc s1ap m2ap x2ap m3ap GTPV1U SECURITY UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB
|
||||
PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
|
||||
PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
|
||||
${NAS_UE_LIB} ITTI SIMU SIMU_ETH shlib_loader
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
@@ -2028,7 +2028,7 @@ target_link_libraries(lte-uesoftmodem PRIVATE
|
||||
-Wl,--start-group
|
||||
lte_rrc nr_rrc s1ap x2ap m2ap m3ap
|
||||
SECURITY UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
|
||||
PHY_UE PHY_RU L2_UE L2_LTE SIMU SIMU_ETH NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
|
||||
PHY_UE PHY_RU L2_UE L2_LTE SIMU SIMU_ETH NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
|
||||
${NAS_UE_LIB} ITTI shlib_loader
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
@@ -2061,13 +2061,11 @@ add_executable(nr-softmodem
|
||||
${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c
|
||||
)
|
||||
|
||||
include(${OPENAIR_DIR}/nfapi/CMakeLists.txt)
|
||||
|
||||
target_link_libraries(nr-softmodem PRIVATE
|
||||
-Wl,--start-group
|
||||
UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU GTPV1U SECURITY
|
||||
ITTI ${NAS_UE_LIB} lte_rrc nr_rrc
|
||||
ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU SIMU_ETH
|
||||
ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU SIMU_ETH
|
||||
x2ap f1ap m2ap m3ap e1ap shlib_loader
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
@@ -2075,6 +2073,11 @@ target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt sctp)
|
||||
target_link_libraries(nr-softmodem PRIVATE ${T_LIB})
|
||||
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
|
||||
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
|
||||
add_boolean_option(OAI_AERIAL OFF "Activate OAI's AERIAL driver" OFF)
|
||||
if (OAI_AERIAL)
|
||||
target_compile_definitions(nr-softmodem PUBLIC ENABLE_AERIAL)
|
||||
target_link_libraries(nr-softmodem PUBLIC aerial_lib)
|
||||
endif()
|
||||
if(E2_AGENT)
|
||||
target_compile_definitions(nr-softmodem PRIVATE ${E2AP_VERSION} ${KPM_VERSION} E2_AGENT)
|
||||
endif()
|
||||
@@ -2131,7 +2134,7 @@ add_executable(nr-uesoftmodem
|
||||
target_link_libraries(nr-uesoftmodem PRIVATE
|
||||
-Wl,--start-group
|
||||
nr_rrc SECURITY UTIL HASHTABLE SCHED_RU_LIB SCHED_NR_UE_LIB
|
||||
PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
|
||||
PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_LIB NFAPI_PNF_LIB
|
||||
NFAPI_USER_LIB MISC_NFAPI_NR_LIB
|
||||
ITTI LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU SIMU_ETH shlib_loader
|
||||
-Wl,--end-group z dl)
|
||||
@@ -2367,7 +2370,7 @@ if (${T_TRACER})
|
||||
params_libconfig oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer
|
||||
oai_eth_transpro oai_mobipass coding HASHTABLE UTIL OMG_SUMO
|
||||
SECURITY SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL
|
||||
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
|
||||
NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
|
||||
MISC_NFAPI_LTE_LIB MISC_NFAPI_NR_LIB
|
||||
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
|
||||
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_UE_NR ngap
|
||||
@@ -2488,6 +2491,7 @@ endif()
|
||||
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(nfapi)
|
||||
add_subdirectory(openair1)
|
||||
add_subdirectory(openair2)
|
||||
add_subdirectory(openair3)
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
include(${OPENAIR_DIR}/nfapi/oai_integration/aerial/CMakeLists.txt)
|
||||
add_subdirectory(oai_integration/aerial)
|
||||
add_subdirectory(open-nFAPI)
|
||||
add_subdirectory(tests)
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
add_boolean_option(OAI_AERIAL OFF "Activate OAI's AERIAL driver" OFF)
|
||||
if (OAI_AERIAL)
|
||||
message(STATUS "Building with support for Aerial")
|
||||
|
||||
target_sources(
|
||||
nr-softmodem
|
||||
PRIVATE
|
||||
${OPENAIR_DIR}/nfapi/oai_integration/aerial/fapi_nvIPC.c
|
||||
${OPENAIR_DIR}/nfapi/oai_integration/aerial/fapi_vnf_p7.c
|
||||
${OPENAIR_DIR}/nfapi/oai_integration/aerial/fapi_vnf_p5.c )
|
||||
add_library(aerial_lib
|
||||
fapi_nvIPC.c
|
||||
fapi_vnf_p7.c
|
||||
fapi_vnf_p5.c
|
||||
)
|
||||
|
||||
find_library(NVIPC_LIB nvipc REQUIRED)
|
||||
if (NOT NVIPC_LIB)
|
||||
message(FATAL_ERROR "-- nvipc library not found")
|
||||
else ()
|
||||
message(STATUS " nvipc library found in ${NVIPC_LIB}")
|
||||
#add_library(nvipc STATIC SHARED IMPORTED GLOBAL)
|
||||
endif ()
|
||||
|
||||
find_library(NVLOG_LIB nvlog REQUIRED)
|
||||
@@ -23,11 +19,10 @@ if (OAI_AERIAL)
|
||||
else ()
|
||||
message(STATUS " nvlog library found in ${NVLOG_LIB}")
|
||||
endif ()
|
||||
|
||||
add_compile_definitions(ENABLE_L2_SLT_RSP)
|
||||
add_compile_definitions(FAPI_BYTE_ORDERING_BIG_ENDIAN)
|
||||
add_compile_definitions(ENABLE_AERIAL)
|
||||
target_link_libraries(nr-softmodem PRIVATE "${NVLOG_LIB}" "${NVIPC_LIB}")
|
||||
else()
|
||||
target_compile_definitions(aerial_lib PUBLIC ENABLE_L2_SLT_RSP ENABLE_AERIAL)
|
||||
target_link_libraries(aerial_lib PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
|
||||
target_link_libraries(aerial_lib PRIVATE nr_fapi_p5)
|
||||
target_link_libraries(aerial_lib PRIVATE "${NVLOG_LIB}" "${NVIPC_LIB}")
|
||||
else ()
|
||||
message(STATUS "No Support for Aerial")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -32,8 +32,9 @@
|
||||
#ifdef ENABLE_AERIAL
|
||||
#include "fapi_vnf_p5.h"
|
||||
#include "fapi_vnf_p7.h"
|
||||
#include "nfapi/open-nFAPI/nfapi/src/nfapi_p5.c"
|
||||
#include "nfapi/open-nFAPI/vnf/inc/vnf_p7.h"
|
||||
#include "nr_fapi.h"
|
||||
#include "nr_fapi_p5.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern UL_RCC_IND_t UL_RCC_INFO;
|
||||
@@ -621,61 +622,6 @@ int aerial_nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t *config)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t *config){
|
||||
|
||||
nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
|
||||
uint8_t *pWritePackedMessage = pPackedBuf;
|
||||
|
||||
uint32_t packedMsgLen;
|
||||
//uint16_t packedMsgLen16;
|
||||
|
||||
if (pMessageBuf == NULL || pPackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Pack supplied pointers are null\n");
|
||||
return -1;
|
||||
}
|
||||
uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
|
||||
uint8_t *pPackedLengthField = &pWritePackedMessage[4];
|
||||
uint8_t *pPacketBodyField = &pWritePackedMessage[8];
|
||||
uint8_t *pPacketBodyFieldStart = &pWritePackedMessage[8];
|
||||
|
||||
pack_nr_p5_message_body(pMessageHeader, &pPacketBodyField, pPackMessageEnd, config);
|
||||
|
||||
// PHY API message header
|
||||
push8(1, &pWritePackedMessage, pPackMessageEnd); // Number of messages
|
||||
push8(0, &pWritePackedMessage, pPackMessageEnd); // Opaque handle
|
||||
|
||||
// PHY API Message structure
|
||||
push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd); // Message type ID
|
||||
|
||||
if(1==1) {
|
||||
// check for a valid message length
|
||||
packedMsgLen = get_packed_msg_len((uintptr_t)pPacketBodyFieldStart, (uintptr_t)pPacketBodyField);
|
||||
packedMsgLen-=1;
|
||||
if(pMessageHeader->message_id == NFAPI_NR_PHY_MSG_TYPE_START_REQUEST){
|
||||
//START.request doesn't have a body, length is 0
|
||||
packedMsgLen = 0;
|
||||
}else if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message 0x%02x length error %d, buffer supplied %d\n",pMessageHeader->message_id, packedMsgLen, packedBufLen);
|
||||
return -1;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
// Update the message length in the header
|
||||
if(!push32(packedMsgLen, &pPackedLengthField, pPackMessageEnd))
|
||||
return -1;
|
||||
|
||||
// return the packed length
|
||||
return (packedMsgLen);
|
||||
} else {
|
||||
// Failed to pack the meassage
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Failed to pack message\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req)
|
||||
{
|
||||
nfapi_vnf_p7_config_t *p7_config = aerial_vnf.p7_vnfs[0].config;
|
||||
|
||||
@@ -65,7 +65,6 @@ uint8_t aerial_unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end,
|
||||
uint8_t aerial_unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
int aerial_pnf_nr_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx);
|
||||
int aerial_nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t *config);
|
||||
int fapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
|
||||
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
|
||||
int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
#ifdef ENABLE_AERIAL
|
||||
#include "fapi_vnf_p7.h"
|
||||
#include "nfapi/open-nFAPI/nfapi/src/nfapi_p7.c"
|
||||
#include "nr_nfapi_p7.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern UL_RCC_IND_t UL_RCC_INFO;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nfapi_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "nfapi_vnf_interface.h"
|
||||
#include "nfapi_vnf.h"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(fapi)
|
||||
@@ -0,0 +1,7 @@
|
||||
add_library(nfapi_common
|
||||
src/debug.c
|
||||
src/nfapi.c)
|
||||
target_include_directories(nfapi_common PUBLIC public_inc/)
|
||||
if (OAI_AERIAL)
|
||||
target_compile_definitions(nfapi_common PRIVATE FAPI_BYTE_ORDERING_BIG_ENDIAN)
|
||||
endif()
|
||||
@@ -77,8 +77,8 @@ uint8_t unpackarray(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
unpack_array_elem_fn fn);
|
||||
|
||||
uint32_t pack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **out, uint8_t *end);
|
||||
uint32_t unpack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **in, uint8_t *end);
|
||||
uint32_t pack_dci_payload(uint8_t *payload, uint16_t payloadSizeBits, uint8_t **out, uint8_t *end);
|
||||
uint32_t unpack_dci_payload(uint8_t *payload, uint16_t payloadSizeBits, uint8_t **in, uint8_t *end);
|
||||
|
||||
uint8_t pack_tl(nfapi_tl_t *tl, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_tl(uint8_t **ppReadPackedMsg, nfapi_tl_t *tl, uint8_t *end);
|
||||
@@ -86,6 +86,7 @@ uint8_t unpack_tl(uint8_t **ppReadPackedMsg, nfapi_tl_t *tl, uint8_t *end);
|
||||
typedef uint8_t (*pack_tlv_fn)(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, pack_tlv_fn fn);
|
||||
uint8_t pack_nr_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, pack_tlv_fn fn);
|
||||
uint8_t pack_nr_generic_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
|
||||
uint32_t pack_vendor_extension_tlv(nfapi_tl_t *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
int unpack_vendor_extension_tlv(nfapi_tl_t *tl,
|
||||
@@ -94,6 +95,8 @@ int unpack_vendor_extension_tlv(nfapi_tl_t *tl,
|
||||
nfapi_p4_p5_codec_config_t *config,
|
||||
nfapi_tl_t **ve_tlv);
|
||||
|
||||
uint8_t unpack_nr_generic_tlv_list(void *tlv_list, uint8_t tlv_count, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t get_tlv_padding(uint16_t tlv_length);
|
||||
|
||||
typedef uint8_t (*unpack_tlv_fn)(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
@@ -136,6 +139,50 @@ int unpack_nr_p7_tlv_list(unpack_p7_tlv_t unpack_fns[],
|
||||
nfapi_p7_codec_config_t *config,
|
||||
nfapi_tl_t **ve);
|
||||
|
||||
uint8_t pack_pnf_param_general_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_pnf_param_general_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_pnf_phy_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_pnf_phy_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_pnf_phy_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_pnf_phy_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_phy_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_phy_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_ipv4_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_ipv4_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_ipv6_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_ipv6_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
|
||||
uint8_t pack_measurement_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_measurement_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
|
||||
uint8_t pack_uint32_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_uint32_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_uint16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_uint16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_int16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_int16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint8_t pack_uint8_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
uint8_t unpack_uint8_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end);
|
||||
|
||||
uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
add_library(nr_fapi_p5
|
||||
src/nr_fapi_p5.c
|
||||
src/nr_fapi_p5_utils.c
|
||||
)
|
||||
target_include_directories(nr_fapi_p5 PUBLIC inc)
|
||||
target_link_libraries(nr_fapi_p5 PUBLIC nfapi_common)
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/open-nFAPI/fapi/inc/nr_fapi.h
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef OPENAIRINTERFACE_NR_FAPI_H
|
||||
#define OPENAIRINTERFACE_NR_FAPI_H
|
||||
|
||||
#include "stdint.h"
|
||||
#include "string.h"
|
||||
#include "nfapi_interface.h"
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "nfapi.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include "assertions.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t num_msg;
|
||||
uint8_t opaque_handle;
|
||||
uint16_t message_id;
|
||||
uint32_t message_length;
|
||||
} fapi_message_header_t;
|
||||
|
||||
int fapi_nr_p5_message_header_unpack(uint8_t **pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config);
|
||||
|
||||
int fapi_nr_p5_message_pack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pPackedBuf,
|
||||
uint32_t packedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config);
|
||||
|
||||
int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config);
|
||||
|
||||
int check_nr_fapi_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen);
|
||||
#endif // OPENAIRINTERFACE_NR_FAPI_H
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef OPENAIRINTERFACE_NR_FAPI_P5_H
|
||||
#define OPENAIRINTERFACE_NR_FAPI_P5_H
|
||||
#include "stdint.h"
|
||||
#include "nfapi_interface.h"
|
||||
|
||||
uint8_t pack_nr_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t pack_nr_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t pack_nr_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t pack_nr_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t pack_nr_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t pack_nr_stop_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_stop_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t pack_nr_error_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||
uint8_t unpack_nr_error_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||
#endif // OPENAIRINTERFACE_NR_FAPI_P5_H
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/open-nFAPI/fapi/inc/nr_fapi_p5_utils.h
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
||||
#define OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
||||
#include "stdio.h"
|
||||
#include "stdint.h"
|
||||
#include "nr_fapi.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
#define EQ_TLV(_tlv_a, _tlv_b) \
|
||||
do { \
|
||||
EQ(_tlv_a.tl.tag, _tlv_b.tl.tag); \
|
||||
EQ(_tlv_a.value, _tlv_b.value); \
|
||||
} while (0)
|
||||
|
||||
#define EQ(_a, _b) \
|
||||
do { \
|
||||
if ((_a) != (_b)) { \
|
||||
return false; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define COPY_TL(_dst_tl, _src_tl) \
|
||||
do { \
|
||||
_dst_tl.tag = _src_tl.tag; \
|
||||
_dst_tl.length = _src_tl.length; \
|
||||
} while (0)
|
||||
|
||||
#define COPY_TLV(_dst, _src) \
|
||||
do { \
|
||||
COPY_TL(_dst.tl, _src.tl); \
|
||||
_dst.value = _src.value; \
|
||||
} while (0)
|
||||
|
||||
void copy_vendor_extension_value(nfapi_vendor_extension_tlv_t *dst, const nfapi_vendor_extension_tlv_t *src);
|
||||
|
||||
bool eq_param_request(const nfapi_nr_param_request_scf_t *unpacked_req, const nfapi_nr_param_request_scf_t *req);
|
||||
bool eq_param_response(const nfapi_nr_param_response_scf_t *unpacked_req, const nfapi_nr_param_response_scf_t *req);
|
||||
bool eq_config_request(const nfapi_nr_config_request_scf_t *unpacked_req, const nfapi_nr_config_request_scf_t *req);
|
||||
bool eq_config_response(const nfapi_nr_config_response_scf_t *unpacked_req, const nfapi_nr_config_response_scf_t *req);
|
||||
bool eq_start_request(const nfapi_nr_start_request_scf_t *unpacked_req, const nfapi_nr_start_request_scf_t *req);
|
||||
bool eq_start_response(const nfapi_nr_start_response_scf_t *unpacked_req, const nfapi_nr_start_response_scf_t *req);
|
||||
bool eq_stop_request(const nfapi_nr_stop_request_scf_t *unpacked_req, const nfapi_nr_stop_request_scf_t *req);
|
||||
bool eq_stop_indication(const nfapi_nr_stop_indication_scf_t *unpacked_req, const nfapi_nr_stop_indication_scf_t *req);
|
||||
bool eq_error_indication(const nfapi_nr_error_indication_scf_t *unpacked_req, const nfapi_nr_error_indication_scf_t *req);
|
||||
|
||||
void free_param_request(nfapi_nr_param_request_scf_t *msg);
|
||||
void free_param_response(nfapi_nr_param_response_scf_t *msg);
|
||||
void free_config_request(nfapi_nr_config_request_scf_t *msg);
|
||||
void free_config_response(nfapi_nr_config_response_scf_t *msg);
|
||||
void free_start_request(nfapi_nr_start_request_scf_t *msg);
|
||||
void free_start_response(nfapi_nr_start_response_scf_t *msg);
|
||||
void free_stop_request(nfapi_nr_stop_request_scf_t *msg);
|
||||
void free_stop_indication(nfapi_nr_stop_indication_scf_t *msg);
|
||||
void free_error_indication(nfapi_nr_error_indication_scf_t *msg);
|
||||
|
||||
void copy_param_request(const nfapi_nr_param_request_scf_t *src, nfapi_nr_param_request_scf_t *dst);
|
||||
void copy_param_response(const nfapi_nr_param_response_scf_t *src, nfapi_nr_param_response_scf_t *dst);
|
||||
void copy_config_request(const nfapi_nr_config_request_scf_t *src, nfapi_nr_config_request_scf_t *dst);
|
||||
void copy_config_response(const nfapi_nr_config_response_scf_t *src, nfapi_nr_config_response_scf_t *dst);
|
||||
void copy_start_request(const nfapi_nr_start_request_scf_t *src, nfapi_nr_start_request_scf_t *dst);
|
||||
void copy_start_response(const nfapi_nr_start_response_scf_t *src, nfapi_nr_start_response_scf_t *dst);
|
||||
void copy_stop_request(const nfapi_nr_stop_request_scf_t *src, nfapi_nr_stop_request_scf_t *dst);
|
||||
void copy_stop_indication(const nfapi_nr_stop_indication_scf_t *src, nfapi_nr_stop_indication_scf_t *dst);
|
||||
void copy_error_indication(const nfapi_nr_error_indication_scf_t *src, nfapi_nr_error_indication_scf_t *dst);
|
||||
|
||||
#endif // OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,971 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/open-nFAPI/fapi/src/nr_fapi_p5_utils.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void copy_vendor_extension_value(nfapi_vendor_extension_tlv_t *dst, const nfapi_vendor_extension_tlv_t *src)
|
||||
{
|
||||
nfapi_tl_t *dst_tlv = (nfapi_tl_t *)dst;
|
||||
nfapi_tl_t *src_tlv = (nfapi_tl_t *)src;
|
||||
|
||||
switch (dst_tlv->tag) {
|
||||
case VENDOR_EXT_TLV_2_TAG: {
|
||||
vendor_ext_tlv_2 *dst_ve = (vendor_ext_tlv_2 *)dst_tlv;
|
||||
vendor_ext_tlv_2 *src_ve = (vendor_ext_tlv_2 *)src_tlv;
|
||||
|
||||
dst_ve->dummy = src_ve->dummy;
|
||||
} break;
|
||||
case VENDOR_EXT_TLV_1_TAG: {
|
||||
vendor_ext_tlv_1 *dst_ve = (vendor_ext_tlv_1 *)dst_tlv;
|
||||
vendor_ext_tlv_1 *src_ve = (vendor_ext_tlv_1 *)src_tlv;
|
||||
|
||||
dst_ve->dummy = src_ve->dummy;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
bool eq_param_request(const nfapi_nr_param_request_scf_t *unpacked_req, const nfapi_nr_param_request_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eq_param_response(const nfapi_nr_param_response_scf_t *unpacked_req, const nfapi_nr_param_response_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
EQ(unpacked_req->num_tlv, req->num_tlv);
|
||||
EQ(unpacked_req->error_code, req->error_code);
|
||||
|
||||
EQ_TLV(unpacked_req->cell_param.release_capability, req->cell_param.release_capability);
|
||||
|
||||
EQ_TLV(unpacked_req->cell_param.phy_state, req->cell_param.phy_state);
|
||||
|
||||
EQ_TLV(unpacked_req->cell_param.skip_blank_dl_config, req->cell_param.skip_blank_dl_config);
|
||||
|
||||
EQ_TLV(unpacked_req->cell_param.skip_blank_ul_config, req->cell_param.skip_blank_ul_config);
|
||||
|
||||
EQ_TLV(unpacked_req->cell_param.num_config_tlvs_to_report, req->cell_param.num_config_tlvs_to_report);
|
||||
|
||||
for (int i = 0; i < unpacked_req->cell_param.num_config_tlvs_to_report.value; ++i) {
|
||||
EQ_TLV(unpacked_req->cell_param.config_tlvs_to_report_list[i], req->cell_param.config_tlvs_to_report_list[i]);
|
||||
}
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_param.cyclic_prefix, req->carrier_param.cyclic_prefix);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_param.supported_subcarrier_spacings_dl, req->carrier_param.supported_subcarrier_spacings_dl);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_param.supported_bandwidth_dl, req->carrier_param.supported_bandwidth_dl);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_param.supported_subcarrier_spacings_ul, req->carrier_param.supported_subcarrier_spacings_ul);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_param.supported_bandwidth_ul, req->carrier_param.supported_bandwidth_ul);
|
||||
|
||||
EQ_TLV(unpacked_req->pdcch_param.cce_mapping_type, req->pdcch_param.cce_mapping_type);
|
||||
|
||||
EQ_TLV(unpacked_req->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot,
|
||||
req->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot);
|
||||
|
||||
EQ_TLV(unpacked_req->pdcch_param.coreset_precoder_granularity_coreset, req->pdcch_param.coreset_precoder_granularity_coreset);
|
||||
|
||||
EQ_TLV(unpacked_req->pdcch_param.pdcch_mu_mimo, req->pdcch_param.pdcch_mu_mimo);
|
||||
|
||||
EQ_TLV(unpacked_req->pdcch_param.pdcch_precoder_cycling, req->pdcch_param.pdcch_precoder_cycling);
|
||||
|
||||
EQ_TLV(unpacked_req->pdcch_param.max_pdcch_per_slot, req->pdcch_param.max_pdcch_per_slot);
|
||||
|
||||
EQ_TLV(unpacked_req->pucch_param.pucch_formats, req->pucch_param.pucch_formats);
|
||||
|
||||
EQ_TLV(unpacked_req->pucch_param.max_pucchs_per_slot, req->pucch_param.max_pucchs_per_slot);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_mapping_type, req->pdsch_param.pdsch_mapping_type);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_allocation_types, req->pdsch_param.pdsch_allocation_types);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_vrb_to_prb_mapping, req->pdsch_param.pdsch_vrb_to_prb_mapping);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_cbg, req->pdsch_param.pdsch_cbg);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_dmrs_config_types, req->pdsch_param.pdsch_dmrs_config_types);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_dmrs_max_length, req->pdsch_param.pdsch_dmrs_max_length);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_dmrs_additional_pos, req->pdsch_param.pdsch_dmrs_additional_pos);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.max_pdsch_tbs_per_slot, req->pdsch_param.max_pdsch_tbs_per_slot);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.max_number_mimo_layers_pdsch, req->pdsch_param.max_number_mimo_layers_pdsch);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.supported_max_modulation_order_dl, req->pdsch_param.supported_max_modulation_order_dl);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.max_mu_mimo_users_dl, req->pdsch_param.max_mu_mimo_users_dl);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_data_in_dmrs_symbols, req->pdsch_param.pdsch_data_in_dmrs_symbols);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.premption_support, req->pdsch_param.premption_support);
|
||||
|
||||
EQ_TLV(unpacked_req->pdsch_param.pdsch_non_slot_support, req->pdsch_param.pdsch_non_slot_support);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.uci_mux_ulsch_in_pusch, req->pusch_param.uci_mux_ulsch_in_pusch);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.uci_only_pusch, req->pusch_param.uci_only_pusch);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_frequency_hopping, req->pusch_param.pusch_frequency_hopping);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_dmrs_config_types, req->pusch_param.pusch_dmrs_config_types);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_dmrs_max_len, req->pusch_param.pusch_dmrs_max_len);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_dmrs_additional_pos, req->pusch_param.pusch_dmrs_additional_pos);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_cbg, req->pusch_param.pusch_cbg);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_mapping_type, req->pusch_param.pusch_mapping_type);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_allocation_types, req->pusch_param.pusch_allocation_types);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_vrb_to_prb_mapping, req->pusch_param.pusch_vrb_to_prb_mapping);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_max_ptrs_ports, req->pusch_param.pusch_max_ptrs_ports);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.max_pduschs_tbs_per_slot, req->pusch_param.max_pduschs_tbs_per_slot);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.max_number_mimo_layers_non_cb_pusch, req->pusch_param.max_number_mimo_layers_non_cb_pusch);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.supported_modulation_order_ul, req->pusch_param.supported_modulation_order_ul);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.max_mu_mimo_users_ul, req->pusch_param.max_mu_mimo_users_ul);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.dfts_ofdm_support, req->pusch_param.dfts_ofdm_support);
|
||||
|
||||
EQ_TLV(unpacked_req->pusch_param.pusch_aggregation_factor, req->pusch_param.pusch_aggregation_factor);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_param.prach_long_formats, req->prach_param.prach_long_formats);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_param.prach_short_formats, req->prach_param.prach_short_formats);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_param.prach_restricted_sets, req->prach_param.prach_restricted_sets);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_param.max_prach_fd_occasions_in_a_slot, req->prach_param.max_prach_fd_occasions_in_a_slot);
|
||||
|
||||
EQ_TLV(unpacked_req->measurement_param.rssi_measurement_support, req->measurement_param.rssi_measurement_support);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eq_config_request(const nfapi_nr_config_request_scf_t *unpacked_req, const nfapi_nr_config_request_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
EQ(unpacked_req->num_tlv, req->num_tlv);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.dl_bandwidth, req->carrier_config.dl_bandwidth);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.dl_frequency, req->carrier_config.dl_frequency);
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
EQ_TLV(unpacked_req->carrier_config.dl_k0[i], req->carrier_config.dl_k0[i]);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.dl_grid_size[i], req->carrier_config.dl_grid_size[i]);
|
||||
}
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.num_tx_ant, req->carrier_config.num_tx_ant);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.uplink_bandwidth, req->carrier_config.uplink_bandwidth);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.uplink_frequency, req->carrier_config.uplink_frequency);
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
EQ_TLV(unpacked_req->carrier_config.ul_k0[i], req->carrier_config.ul_k0[i]);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.ul_grid_size[i], req->carrier_config.ul_grid_size[i]);
|
||||
}
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.num_rx_ant, req->carrier_config.num_rx_ant);
|
||||
|
||||
EQ_TLV(unpacked_req->carrier_config.frequency_shift_7p5khz, req->carrier_config.frequency_shift_7p5khz);
|
||||
|
||||
EQ_TLV(unpacked_req->cell_config.phy_cell_id, req->cell_config.phy_cell_id);
|
||||
|
||||
EQ_TLV(unpacked_req->cell_config.frame_duplex_type, req->cell_config.frame_duplex_type);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_config.ss_pbch_power, req->ssb_config.ss_pbch_power);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_config.bch_payload, req->ssb_config.bch_payload);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_config.scs_common, req->ssb_config.scs_common);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_config.prach_sequence_length, req->prach_config.prach_sequence_length);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_config.prach_sub_c_spacing, req->prach_config.prach_sub_c_spacing);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_config.restricted_set_config, req->prach_config.restricted_set_config);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_config.num_prach_fd_occasions, req->prach_config.num_prach_fd_occasions);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_config.prach_ConfigurationIndex, req->prach_config.prach_ConfigurationIndex);
|
||||
|
||||
for (int i = 0; i < unpacked_req->prach_config.num_prach_fd_occasions.value; i++) {
|
||||
nfapi_nr_num_prach_fd_occasions_t unpacked_prach_fd_occasion = unpacked_req->prach_config.num_prach_fd_occasions_list[i];
|
||||
nfapi_nr_num_prach_fd_occasions_t req_prach_fd_occasion = req->prach_config.num_prach_fd_occasions_list[i];
|
||||
|
||||
EQ_TLV(unpacked_prach_fd_occasion.prach_root_sequence_index, req_prach_fd_occasion.prach_root_sequence_index);
|
||||
|
||||
EQ_TLV(unpacked_prach_fd_occasion.num_root_sequences, req_prach_fd_occasion.num_root_sequences);
|
||||
|
||||
EQ_TLV(unpacked_prach_fd_occasion.k1, req_prach_fd_occasion.k1);
|
||||
|
||||
EQ_TLV(unpacked_prach_fd_occasion.prach_zero_corr_conf, req_prach_fd_occasion.prach_zero_corr_conf);
|
||||
|
||||
EQ_TLV(unpacked_prach_fd_occasion.num_unused_root_sequences, req_prach_fd_occasion.num_unused_root_sequences);
|
||||
for (int k = 0; k < unpacked_prach_fd_occasion.num_unused_root_sequences.value; k++) {
|
||||
EQ_TLV(unpacked_prach_fd_occasion.unused_root_sequences_list[k], req_prach_fd_occasion.unused_root_sequences_list[k]);
|
||||
}
|
||||
}
|
||||
|
||||
EQ_TLV(unpacked_req->prach_config.ssb_per_rach, req->prach_config.ssb_per_rach);
|
||||
|
||||
EQ_TLV(unpacked_req->prach_config.prach_multiple_carriers_in_a_band, req->prach_config.prach_multiple_carriers_in_a_band);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_table.ssb_offset_point_a, req->ssb_table.ssb_offset_point_a);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_table.ssb_period, req->ssb_table.ssb_period);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_table.ssb_subcarrier_offset, req->ssb_table.ssb_subcarrier_offset);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_table.MIB, req->ssb_table.MIB);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_table.ssb_mask_list[0].ssb_mask, req->ssb_table.ssb_mask_list[0].ssb_mask);
|
||||
|
||||
EQ_TLV(unpacked_req->ssb_table.ssb_mask_list[1].ssb_mask, req->ssb_table.ssb_mask_list[1].ssb_mask);
|
||||
|
||||
for (int i = 0; i < 64; i++) {
|
||||
EQ_TLV(unpacked_req->ssb_table.ssb_beam_id_list[i].beam_id, req->ssb_table.ssb_beam_id_list[i].beam_id);
|
||||
}
|
||||
|
||||
EQ_TLV(unpacked_req->tdd_table.tdd_period, req->tdd_table.tdd_period);
|
||||
|
||||
const uint8_t slotsperframe[5] = {10, 20, 40, 80, 160};
|
||||
// Assuming always CP_Normal, because Cyclic prefix is not included in CONFIG.request 10.02, but is present in 10.04
|
||||
uint8_t cyclicprefix = 1;
|
||||
bool normal_CP = cyclicprefix ? false : true;
|
||||
// 3GPP 38.211 Table 4.3.2.1 & Table 4.3.2.2
|
||||
uint8_t number_of_symbols_per_slot = normal_CP ? 14 : 12;
|
||||
|
||||
for (int i = 0; i < slotsperframe[unpacked_req->ssb_config.scs_common.value]; i++) {
|
||||
for (int k = 0; k < number_of_symbols_per_slot; k++) {
|
||||
EQ_TLV(unpacked_req->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[k].slot_config,
|
||||
req->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[k].slot_config);
|
||||
}
|
||||
}
|
||||
|
||||
EQ_TLV(unpacked_req->measurement_config.rssi_measurement, req->measurement_config.rssi_measurement);
|
||||
|
||||
EQ(unpacked_req->nfapi_config.p7_vnf_address_ipv4.tl.tag, req->nfapi_config.p7_vnf_address_ipv4.tl.tag);
|
||||
for (int i = 0; i < NFAPI_IPV4_ADDRESS_LENGTH; ++i) {
|
||||
EQ(unpacked_req->nfapi_config.p7_vnf_address_ipv4.address[i], req->nfapi_config.p7_vnf_address_ipv4.address[i]);
|
||||
}
|
||||
|
||||
EQ(unpacked_req->nfapi_config.p7_vnf_address_ipv6.tl.tag, req->nfapi_config.p7_vnf_address_ipv6.tl.tag);
|
||||
for (int i = 0; i < NFAPI_IPV6_ADDRESS_LENGTH; ++i) {
|
||||
EQ(unpacked_req->nfapi_config.p7_vnf_address_ipv6.address[i], req->nfapi_config.p7_vnf_address_ipv6.address[i]);
|
||||
}
|
||||
|
||||
EQ_TLV(unpacked_req->nfapi_config.p7_vnf_port, req->nfapi_config.p7_vnf_port);
|
||||
|
||||
EQ_TLV(unpacked_req->nfapi_config.timing_window, req->nfapi_config.timing_window);
|
||||
|
||||
EQ_TLV(unpacked_req->nfapi_config.timing_info_mode, req->nfapi_config.timing_info_mode);
|
||||
|
||||
EQ_TLV(unpacked_req->nfapi_config.timing_info_period, req->nfapi_config.timing_info_period);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool eq_config_response_tlv_lists(nfapi_nr_generic_tlv_scf_t *unpacked_list,
|
||||
nfapi_nr_generic_tlv_scf_t *req_list,
|
||||
uint8_t size)
|
||||
{
|
||||
for (int i = 0; i < size; ++i) {
|
||||
nfapi_nr_generic_tlv_scf_t *unpacked_element = &(unpacked_list[i]);
|
||||
nfapi_nr_generic_tlv_scf_t *req_element = &(req_list[i]);
|
||||
|
||||
EQ(unpacked_element->tl.tag, req_element->tl.tag);
|
||||
EQ(unpacked_element->tl.length, req_element->tl.length);
|
||||
// check according to value type
|
||||
switch (unpacked_element->tl.length) {
|
||||
case UINT_8:
|
||||
EQ(unpacked_element->value.u8, req_element->value.u8);
|
||||
break;
|
||||
case UINT_16:
|
||||
EQ(unpacked_element->value.u16, req_element->value.u16);
|
||||
break;
|
||||
case UINT_32:
|
||||
EQ(unpacked_element->value.u32, req_element->value.u32);
|
||||
break;
|
||||
case ARRAY_UINT_16:
|
||||
for (int j = 0; j < 5; ++j) {
|
||||
EQ(unpacked_element->value.array_u16[j], req_element->value.array_u16[j]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("unknown length %d\n", unpacked_element->tl.length);
|
||||
DevAssert(1 == 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eq_config_response(const nfapi_nr_config_response_scf_t *unpacked_req, const nfapi_nr_config_response_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
|
||||
EQ(unpacked_req->error_code, req->error_code);
|
||||
EQ(unpacked_req->num_invalid_tlvs, req->num_invalid_tlvs);
|
||||
EQ(unpacked_req->num_invalid_tlvs_configured_in_idle, req->num_invalid_tlvs_configured_in_idle);
|
||||
EQ(unpacked_req->num_invalid_tlvs_configured_in_running, req->num_invalid_tlvs_configured_in_running);
|
||||
EQ(unpacked_req->num_missing_tlvs, req->num_missing_tlvs);
|
||||
// compare the list elements
|
||||
EQ(eq_config_response_tlv_lists(unpacked_req->invalid_tlvs_list, req->invalid_tlvs_list, req->num_invalid_tlvs), true);
|
||||
EQ(eq_config_response_tlv_lists(unpacked_req->invalid_tlvs_configured_in_idle_list,
|
||||
req->invalid_tlvs_configured_in_idle_list,
|
||||
req->num_invalid_tlvs_configured_in_idle),
|
||||
true);
|
||||
EQ(eq_config_response_tlv_lists(unpacked_req->invalid_tlvs_configured_in_running_list,
|
||||
req->invalid_tlvs_configured_in_running_list,
|
||||
req->num_invalid_tlvs_configured_in_running),
|
||||
true);
|
||||
EQ(eq_config_response_tlv_lists(unpacked_req->missing_tlvs_list, req->missing_tlvs_list, req->num_missing_tlvs), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eq_start_request(const nfapi_nr_start_request_scf_t *unpacked_req, const nfapi_nr_start_request_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eq_start_response(const nfapi_nr_start_response_scf_t *unpacked_req, const nfapi_nr_start_response_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
EQ(unpacked_req->error_code, req->error_code);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eq_stop_request(const nfapi_nr_stop_request_scf_t *unpacked_req, const nfapi_nr_stop_request_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eq_stop_indication(const nfapi_nr_stop_indication_scf_t *unpacked_req, const nfapi_nr_stop_indication_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eq_error_indication(const nfapi_nr_error_indication_scf_t *unpacked_req, const nfapi_nr_error_indication_scf_t *req)
|
||||
{
|
||||
EQ(unpacked_req->header.message_id, req->header.message_id);
|
||||
EQ(unpacked_req->header.message_length, req->header.message_length);
|
||||
EQ(unpacked_req->sfn, req->sfn);
|
||||
EQ(unpacked_req->slot, req->slot);
|
||||
EQ(unpacked_req->message_id, req->message_id);
|
||||
EQ(unpacked_req->error_code, req->error_code);
|
||||
return true;
|
||||
}
|
||||
|
||||
void free_param_request(nfapi_nr_param_request_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void free_param_response(nfapi_nr_param_response_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
|
||||
if (msg->cell_param.config_tlvs_to_report_list) {
|
||||
free(msg->cell_param.config_tlvs_to_report_list);
|
||||
}
|
||||
}
|
||||
|
||||
void free_config_request(nfapi_nr_config_request_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
|
||||
if (msg->prach_config.num_prach_fd_occasions_list) {
|
||||
for (int i = 0; i < msg->prach_config.num_prach_fd_occasions.value; i++) {
|
||||
nfapi_nr_num_prach_fd_occasions_t *prach_fd_occasion = &(msg->prach_config.num_prach_fd_occasions_list[i]);
|
||||
if (prach_fd_occasion->unused_root_sequences_list) {
|
||||
free(prach_fd_occasion->unused_root_sequences_list);
|
||||
}
|
||||
}
|
||||
free(msg->prach_config.num_prach_fd_occasions_list);
|
||||
}
|
||||
const uint8_t slotsperframe[5] = {10, 20, 40, 80, 160};
|
||||
if (msg->tdd_table.max_tdd_periodicity_list) {
|
||||
for (int i = 0; i < slotsperframe[msg->ssb_config.scs_common.value]; i++) {
|
||||
free(msg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list);
|
||||
}
|
||||
free(msg->tdd_table.max_tdd_periodicity_list);
|
||||
}
|
||||
|
||||
if (msg->pmi_list.pmi_pdu) {
|
||||
free(msg->pmi_list.pmi_pdu);
|
||||
}
|
||||
}
|
||||
|
||||
void free_config_response(nfapi_nr_config_response_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
|
||||
if (msg->invalid_tlvs_list) {
|
||||
free(msg->invalid_tlvs_list);
|
||||
}
|
||||
|
||||
if (msg->invalid_tlvs_configured_in_idle_list) {
|
||||
free(msg->invalid_tlvs_configured_in_idle_list);
|
||||
}
|
||||
|
||||
if (msg->invalid_tlvs_configured_in_running_list) {
|
||||
free(msg->invalid_tlvs_configured_in_running_list);
|
||||
}
|
||||
|
||||
if (msg->missing_tlvs_list) {
|
||||
free(msg->missing_tlvs_list);
|
||||
}
|
||||
}
|
||||
|
||||
void free_start_request(nfapi_nr_start_request_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void free_start_response(nfapi_nr_start_response_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void free_stop_request(nfapi_nr_stop_request_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void free_stop_indication(nfapi_nr_stop_indication_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void free_error_indication(nfapi_nr_error_indication_scf_t *msg)
|
||||
{
|
||||
if (msg->vendor_extension) {
|
||||
free(msg->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void copy_param_request(const nfapi_nr_param_request_scf_t *src, nfapi_nr_param_request_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void copy_param_response(const nfapi_nr_param_response_scf_t *src, nfapi_nr_param_response_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
|
||||
dst->error_code = src->error_code;
|
||||
dst->num_tlv = src->num_tlv;
|
||||
|
||||
COPY_TLV(dst->cell_param.release_capability, src->cell_param.release_capability);
|
||||
|
||||
COPY_TLV(dst->cell_param.phy_state, src->cell_param.phy_state);
|
||||
|
||||
COPY_TLV(dst->cell_param.skip_blank_dl_config, src->cell_param.skip_blank_dl_config);
|
||||
|
||||
COPY_TLV(dst->cell_param.skip_blank_ul_config, src->cell_param.skip_blank_ul_config);
|
||||
|
||||
COPY_TLV(dst->cell_param.num_config_tlvs_to_report, src->cell_param.num_config_tlvs_to_report);
|
||||
|
||||
if (src->cell_param.config_tlvs_to_report_list) {
|
||||
dst->cell_param.config_tlvs_to_report_list =
|
||||
calloc(src->cell_param.num_config_tlvs_to_report.value, sizeof(nfapi_uint8_tlv_t *));
|
||||
for (int i = 0; i < src->cell_param.num_config_tlvs_to_report.value; ++i) {
|
||||
COPY_TLV(dst->cell_param.config_tlvs_to_report_list[i], src->cell_param.config_tlvs_to_report_list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
COPY_TLV(dst->carrier_param.cyclic_prefix, src->carrier_param.cyclic_prefix);
|
||||
|
||||
COPY_TLV(dst->carrier_param.supported_subcarrier_spacings_dl, src->carrier_param.supported_subcarrier_spacings_dl);
|
||||
|
||||
COPY_TLV(dst->carrier_param.supported_bandwidth_dl, src->carrier_param.supported_bandwidth_dl);
|
||||
|
||||
COPY_TLV(dst->carrier_param.supported_subcarrier_spacings_ul, src->carrier_param.supported_subcarrier_spacings_ul);
|
||||
|
||||
COPY_TLV(dst->carrier_param.supported_bandwidth_ul, src->carrier_param.supported_bandwidth_ul);
|
||||
|
||||
COPY_TLV(dst->pdcch_param.cce_mapping_type, src->pdcch_param.cce_mapping_type);
|
||||
|
||||
COPY_TLV(dst->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot,
|
||||
src->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot);
|
||||
|
||||
COPY_TLV(dst->pdcch_param.coreset_precoder_granularity_coreset, src->pdcch_param.coreset_precoder_granularity_coreset);
|
||||
|
||||
COPY_TLV(dst->pdcch_param.pdcch_mu_mimo, src->pdcch_param.pdcch_mu_mimo);
|
||||
|
||||
COPY_TLV(dst->pdcch_param.pdcch_precoder_cycling, src->pdcch_param.pdcch_precoder_cycling);
|
||||
|
||||
COPY_TLV(dst->pdcch_param.max_pdcch_per_slot, src->pdcch_param.max_pdcch_per_slot);
|
||||
|
||||
COPY_TLV(dst->pucch_param.pucch_formats, src->pucch_param.pucch_formats);
|
||||
|
||||
COPY_TLV(dst->pucch_param.max_pucchs_per_slot, src->pucch_param.max_pucchs_per_slot);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_mapping_type, src->pdsch_param.pdsch_mapping_type);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_allocation_types, src->pdsch_param.pdsch_allocation_types);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_vrb_to_prb_mapping, src->pdsch_param.pdsch_vrb_to_prb_mapping);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_cbg, src->pdsch_param.pdsch_cbg);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_dmrs_config_types, src->pdsch_param.pdsch_dmrs_config_types);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_dmrs_max_length, src->pdsch_param.pdsch_dmrs_max_length);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_dmrs_additional_pos, src->pdsch_param.pdsch_dmrs_additional_pos);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.max_pdsch_tbs_per_slot, src->pdsch_param.max_pdsch_tbs_per_slot);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.max_number_mimo_layers_pdsch, src->pdsch_param.max_number_mimo_layers_pdsch);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.supported_max_modulation_order_dl, src->pdsch_param.supported_max_modulation_order_dl);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.max_mu_mimo_users_dl, src->pdsch_param.max_mu_mimo_users_dl);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_data_in_dmrs_symbols, src->pdsch_param.pdsch_data_in_dmrs_symbols);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.premption_support, src->pdsch_param.premption_support);
|
||||
|
||||
COPY_TLV(dst->pdsch_param.pdsch_non_slot_support, src->pdsch_param.pdsch_non_slot_support);
|
||||
|
||||
COPY_TLV(dst->pusch_param.uci_mux_ulsch_in_pusch, src->pusch_param.uci_mux_ulsch_in_pusch);
|
||||
|
||||
COPY_TLV(dst->pusch_param.uci_only_pusch, src->pusch_param.uci_only_pusch);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_frequency_hopping, src->pusch_param.pusch_frequency_hopping);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_dmrs_config_types, src->pusch_param.pusch_dmrs_config_types);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_dmrs_max_len, src->pusch_param.pusch_dmrs_max_len);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_dmrs_additional_pos, src->pusch_param.pusch_dmrs_additional_pos);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_cbg, src->pusch_param.pusch_cbg);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_mapping_type, src->pusch_param.pusch_mapping_type);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_allocation_types, src->pusch_param.pusch_allocation_types);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_vrb_to_prb_mapping, src->pusch_param.pusch_vrb_to_prb_mapping);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_max_ptrs_ports, src->pusch_param.pusch_max_ptrs_ports);
|
||||
|
||||
COPY_TLV(dst->pusch_param.max_pduschs_tbs_per_slot, src->pusch_param.max_pduschs_tbs_per_slot);
|
||||
|
||||
COPY_TLV(dst->pusch_param.max_number_mimo_layers_non_cb_pusch, src->pusch_param.max_number_mimo_layers_non_cb_pusch);
|
||||
|
||||
COPY_TLV(dst->pusch_param.supported_modulation_order_ul, src->pusch_param.supported_modulation_order_ul);
|
||||
|
||||
COPY_TLV(dst->pusch_param.max_mu_mimo_users_ul, src->pusch_param.max_mu_mimo_users_ul);
|
||||
|
||||
COPY_TLV(dst->pusch_param.dfts_ofdm_support, src->pusch_param.dfts_ofdm_support);
|
||||
|
||||
COPY_TLV(dst->pusch_param.pusch_aggregation_factor, src->pusch_param.pusch_aggregation_factor);
|
||||
|
||||
COPY_TLV(dst->prach_param.prach_long_formats, src->prach_param.prach_long_formats);
|
||||
|
||||
COPY_TLV(dst->prach_param.prach_short_formats, src->prach_param.prach_short_formats);
|
||||
|
||||
COPY_TLV(dst->prach_param.prach_restricted_sets, src->prach_param.prach_restricted_sets);
|
||||
|
||||
COPY_TLV(dst->prach_param.max_prach_fd_occasions_in_a_slot, src->prach_param.max_prach_fd_occasions_in_a_slot);
|
||||
|
||||
COPY_TLV(dst->measurement_param.rssi_measurement_support, src->measurement_param.rssi_measurement_support);
|
||||
|
||||
COPY_TL(dst->nfapi_config.p7_vnf_address_ipv4.tl, src->nfapi_config.p7_vnf_address_ipv4.tl);
|
||||
memcpy(dst->nfapi_config.p7_vnf_address_ipv4.address,
|
||||
src->nfapi_config.p7_vnf_address_ipv4.address,
|
||||
sizeof(dst->nfapi_config.p7_vnf_address_ipv4.address));
|
||||
|
||||
COPY_TL(dst->nfapi_config.p7_vnf_address_ipv6.tl, src->nfapi_config.p7_vnf_address_ipv6.tl);
|
||||
memcpy(dst->nfapi_config.p7_vnf_address_ipv6.address,
|
||||
src->nfapi_config.p7_vnf_address_ipv6.address,
|
||||
sizeof(dst->nfapi_config.p7_vnf_address_ipv6.address));
|
||||
|
||||
COPY_TLV(dst->nfapi_config.p7_vnf_port, src->nfapi_config.p7_vnf_port);
|
||||
|
||||
COPY_TL(dst->nfapi_config.p7_pnf_address_ipv4.tl, src->nfapi_config.p7_pnf_address_ipv4.tl);
|
||||
memcpy(dst->nfapi_config.p7_pnf_address_ipv4.address,
|
||||
src->nfapi_config.p7_pnf_address_ipv4.address,
|
||||
sizeof(dst->nfapi_config.p7_pnf_address_ipv4.address));
|
||||
|
||||
COPY_TL(dst->nfapi_config.p7_pnf_address_ipv6.tl, src->nfapi_config.p7_pnf_address_ipv6.tl);
|
||||
memcpy(dst->nfapi_config.p7_pnf_address_ipv6.address,
|
||||
src->nfapi_config.p7_pnf_address_ipv6.address,
|
||||
sizeof(dst->nfapi_config.p7_pnf_address_ipv6.address));
|
||||
|
||||
COPY_TLV(dst->nfapi_config.p7_pnf_port, src->nfapi_config.p7_pnf_port);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.timing_window, src->nfapi_config.timing_window);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.timing_info_mode, src->nfapi_config.timing_info_mode);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.timing_info_period, src->nfapi_config.timing_info_period);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.dl_tti_timing_offset, src->nfapi_config.dl_tti_timing_offset);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.ul_tti_timing_offset, src->nfapi_config.ul_tti_timing_offset);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.ul_dci_timing_offset, src->nfapi_config.ul_dci_timing_offset);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.tx_data_timing_offset, src->nfapi_config.tx_data_timing_offset);
|
||||
}
|
||||
|
||||
void copy_config_request(const nfapi_nr_config_request_scf_t *src, nfapi_nr_config_request_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
|
||||
dst->num_tlv = src->num_tlv;
|
||||
|
||||
COPY_TLV(dst->carrier_config.dl_bandwidth, src->carrier_config.dl_bandwidth);
|
||||
|
||||
COPY_TLV(dst->carrier_config.dl_frequency, src->carrier_config.dl_frequency);
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
COPY_TLV(dst->carrier_config.dl_k0[i], src->carrier_config.dl_k0[i]);
|
||||
|
||||
COPY_TLV(dst->carrier_config.dl_grid_size[i], src->carrier_config.dl_grid_size[i]);
|
||||
}
|
||||
|
||||
COPY_TLV(dst->carrier_config.num_tx_ant, src->carrier_config.num_tx_ant);
|
||||
|
||||
COPY_TLV(dst->carrier_config.uplink_bandwidth, src->carrier_config.uplink_bandwidth);
|
||||
|
||||
COPY_TLV(dst->carrier_config.uplink_frequency, src->carrier_config.uplink_frequency);
|
||||
|
||||
COPY_TLV(dst->carrier_config.uplink_frequency, src->carrier_config.uplink_frequency);
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
COPY_TLV(dst->carrier_config.ul_k0[i], src->carrier_config.ul_k0[i]);
|
||||
|
||||
COPY_TLV(dst->carrier_config.ul_grid_size[i], src->carrier_config.ul_grid_size[i]);
|
||||
}
|
||||
|
||||
COPY_TLV(dst->carrier_config.num_rx_ant, src->carrier_config.num_rx_ant);
|
||||
|
||||
COPY_TLV(dst->carrier_config.frequency_shift_7p5khz, src->carrier_config.frequency_shift_7p5khz);
|
||||
|
||||
COPY_TLV(dst->cell_config.phy_cell_id, src->cell_config.phy_cell_id);
|
||||
|
||||
COPY_TLV(dst->cell_config.frame_duplex_type, src->cell_config.frame_duplex_type);
|
||||
|
||||
COPY_TLV(dst->ssb_config.ss_pbch_power, src->ssb_config.ss_pbch_power);
|
||||
|
||||
COPY_TLV(dst->ssb_config.bch_payload, src->ssb_config.bch_payload);
|
||||
|
||||
COPY_TLV(dst->ssb_config.scs_common, src->ssb_config.scs_common);
|
||||
|
||||
COPY_TLV(dst->prach_config.prach_sequence_length, src->prach_config.prach_sequence_length);
|
||||
|
||||
COPY_TLV(dst->prach_config.prach_sub_c_spacing, src->prach_config.prach_sub_c_spacing);
|
||||
|
||||
COPY_TLV(dst->prach_config.restricted_set_config, src->prach_config.restricted_set_config);
|
||||
|
||||
COPY_TLV(dst->prach_config.num_prach_fd_occasions, src->prach_config.num_prach_fd_occasions);
|
||||
|
||||
COPY_TLV(dst->prach_config.prach_ConfigurationIndex, src->prach_config.prach_ConfigurationIndex);
|
||||
|
||||
COPY_TLV(dst->prach_config.prach_ConfigurationIndex, src->prach_config.prach_ConfigurationIndex);
|
||||
|
||||
dst->prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *)malloc(
|
||||
dst->prach_config.num_prach_fd_occasions.value * sizeof(nfapi_nr_num_prach_fd_occasions_t));
|
||||
for (int i = 0; i < dst->prach_config.num_prach_fd_occasions.value; i++) {
|
||||
nfapi_nr_num_prach_fd_occasions_t *src_prach_fd_occasion = &(src->prach_config.num_prach_fd_occasions_list[i]);
|
||||
nfapi_nr_num_prach_fd_occasions_t *dst_prach_fd_occasion = &(dst->prach_config.num_prach_fd_occasions_list[i]);
|
||||
|
||||
COPY_TLV(dst_prach_fd_occasion->prach_root_sequence_index, src_prach_fd_occasion->prach_root_sequence_index);
|
||||
|
||||
COPY_TLV(dst_prach_fd_occasion->num_root_sequences, src_prach_fd_occasion->num_root_sequences);
|
||||
|
||||
COPY_TLV(dst_prach_fd_occasion->k1, src_prach_fd_occasion->k1);
|
||||
|
||||
COPY_TLV(dst_prach_fd_occasion->prach_zero_corr_conf, src_prach_fd_occasion->prach_zero_corr_conf);
|
||||
|
||||
COPY_TLV(dst_prach_fd_occasion->num_unused_root_sequences, src_prach_fd_occasion->num_unused_root_sequences);
|
||||
|
||||
dst_prach_fd_occasion->unused_root_sequences_list =
|
||||
(nfapi_uint8_tlv_t *)malloc(dst_prach_fd_occasion->num_unused_root_sequences.value * sizeof(nfapi_uint8_tlv_t));
|
||||
for (int k = 0; k < dst_prach_fd_occasion->num_unused_root_sequences.value; k++) {
|
||||
COPY_TLV(dst_prach_fd_occasion->unused_root_sequences_list[k], src_prach_fd_occasion->unused_root_sequences_list[k]);
|
||||
}
|
||||
}
|
||||
|
||||
COPY_TLV(dst->prach_config.ssb_per_rach, src->prach_config.ssb_per_rach);
|
||||
|
||||
COPY_TLV(dst->prach_config.prach_multiple_carriers_in_a_band, src->prach_config.prach_multiple_carriers_in_a_band);
|
||||
|
||||
COPY_TLV(dst->ssb_table.ssb_offset_point_a, src->ssb_table.ssb_offset_point_a);
|
||||
|
||||
COPY_TLV(dst->ssb_table.ssb_period, src->ssb_table.ssb_period);
|
||||
|
||||
COPY_TLV(dst->ssb_table.ssb_subcarrier_offset, src->ssb_table.ssb_subcarrier_offset);
|
||||
|
||||
COPY_TLV(dst->ssb_table.MIB, src->ssb_table.MIB);
|
||||
|
||||
COPY_TLV(dst->ssb_table.ssb_mask_list[0].ssb_mask, src->ssb_table.ssb_mask_list[0].ssb_mask);
|
||||
|
||||
COPY_TLV(dst->ssb_table.ssb_mask_list[1].ssb_mask, src->ssb_table.ssb_mask_list[1].ssb_mask);
|
||||
|
||||
for (int i = 0; i < 64; i++) {
|
||||
COPY_TLV(dst->ssb_table.ssb_beam_id_list[i].beam_id, src->ssb_table.ssb_beam_id_list[i].beam_id);
|
||||
}
|
||||
|
||||
COPY_TLV(dst->tdd_table.tdd_period, src->tdd_table.tdd_period);
|
||||
|
||||
const uint8_t slotsperframe[5] = {10, 20, 40, 80, 160};
|
||||
// Assuming always CP_Normal, because Cyclic prefix is not included in CONFIG.request 10.02, but is present in 10.04
|
||||
uint8_t cyclicprefix = 1;
|
||||
bool normal_CP = cyclicprefix ? false : true;
|
||||
// 3GPP 38.211 Table 4.3.2.1 & Table 4.3.2.2
|
||||
uint8_t number_of_symbols_per_slot = normal_CP ? 14 : 12;
|
||||
dst->tdd_table.max_tdd_periodicity_list = (nfapi_nr_max_tdd_periodicity_t *)malloc(slotsperframe[dst->ssb_config.scs_common.value]
|
||||
* sizeof(nfapi_nr_max_tdd_periodicity_t));
|
||||
|
||||
for (int i = 0; i < slotsperframe[dst->ssb_config.scs_common.value]; i++) {
|
||||
dst->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list =
|
||||
(nfapi_nr_max_num_of_symbol_per_slot_t *)malloc(number_of_symbols_per_slot * sizeof(nfapi_nr_max_num_of_symbol_per_slot_t));
|
||||
}
|
||||
for (int i = 0; i < slotsperframe[dst->ssb_config.scs_common.value]; i++) { // TODO check right number of slots
|
||||
for (int k = 0; k < number_of_symbols_per_slot; k++) { // TODO can change?
|
||||
COPY_TLV(dst->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[k].slot_config,
|
||||
src->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[k].slot_config);
|
||||
}
|
||||
}
|
||||
|
||||
COPY_TLV(dst->measurement_config.rssi_measurement, src->measurement_config.rssi_measurement);
|
||||
|
||||
COPY_TL(dst->nfapi_config.p7_vnf_address_ipv4.tl, src->nfapi_config.p7_vnf_address_ipv4.tl);
|
||||
memcpy(dst->nfapi_config.p7_vnf_address_ipv4.address,
|
||||
src->nfapi_config.p7_vnf_address_ipv4.address,
|
||||
sizeof(dst->nfapi_config.p7_vnf_address_ipv4.address));
|
||||
|
||||
COPY_TL(dst->nfapi_config.p7_vnf_address_ipv6.tl, src->nfapi_config.p7_vnf_address_ipv6.tl);
|
||||
memcpy(dst->nfapi_config.p7_vnf_address_ipv6.address,
|
||||
src->nfapi_config.p7_vnf_address_ipv6.address,
|
||||
sizeof(dst->nfapi_config.p7_vnf_address_ipv6.address));
|
||||
|
||||
COPY_TLV(dst->nfapi_config.p7_vnf_port, src->nfapi_config.p7_vnf_port);
|
||||
|
||||
COPY_TL(dst->nfapi_config.p7_pnf_address_ipv4.tl, src->nfapi_config.p7_pnf_address_ipv4.tl);
|
||||
memcpy(dst->nfapi_config.p7_pnf_address_ipv4.address,
|
||||
src->nfapi_config.p7_pnf_address_ipv4.address,
|
||||
sizeof(dst->nfapi_config.p7_pnf_address_ipv4.address));
|
||||
|
||||
COPY_TL(dst->nfapi_config.p7_pnf_address_ipv6.tl, src->nfapi_config.p7_pnf_address_ipv6.tl);
|
||||
memcpy(dst->nfapi_config.p7_pnf_address_ipv6.address,
|
||||
src->nfapi_config.p7_pnf_address_ipv6.address,
|
||||
sizeof(dst->nfapi_config.p7_pnf_address_ipv6.address));
|
||||
|
||||
COPY_TLV(dst->nfapi_config.p7_pnf_port, src->nfapi_config.p7_pnf_port);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.timing_window, src->nfapi_config.timing_window);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.timing_info_mode, src->nfapi_config.timing_info_mode);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.timing_info_period, src->nfapi_config.timing_info_period);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.dl_tti_timing_offset, src->nfapi_config.dl_tti_timing_offset);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.ul_tti_timing_offset, src->nfapi_config.ul_tti_timing_offset);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.ul_dci_timing_offset, src->nfapi_config.ul_dci_timing_offset);
|
||||
|
||||
COPY_TLV(dst->nfapi_config.tx_data_timing_offset, src->nfapi_config.tx_data_timing_offset);
|
||||
}
|
||||
|
||||
void copy_config_response(const nfapi_nr_config_response_scf_t *src, nfapi_nr_config_response_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
|
||||
dst->error_code = src->error_code;
|
||||
dst->num_invalid_tlvs = src->num_invalid_tlvs;
|
||||
dst->num_invalid_tlvs_configured_in_idle = src->num_invalid_tlvs_configured_in_idle;
|
||||
dst->num_invalid_tlvs_configured_in_running = src->num_invalid_tlvs_configured_in_running;
|
||||
dst->num_missing_tlvs = src->num_missing_tlvs;
|
||||
|
||||
dst->invalid_tlvs_list = (nfapi_nr_generic_tlv_scf_t *)malloc(dst->num_invalid_tlvs * sizeof(nfapi_nr_generic_tlv_scf_t));
|
||||
dst->invalid_tlvs_configured_in_idle_list =
|
||||
(nfapi_nr_generic_tlv_scf_t *)malloc(dst->num_invalid_tlvs_configured_in_idle * sizeof(nfapi_nr_generic_tlv_scf_t));
|
||||
dst->invalid_tlvs_configured_in_running_list =
|
||||
(nfapi_nr_generic_tlv_scf_t *)malloc(dst->num_invalid_tlvs_configured_in_running * sizeof(nfapi_nr_generic_tlv_scf_t));
|
||||
dst->missing_tlvs_list = (nfapi_nr_generic_tlv_scf_t *)malloc(dst->num_missing_tlvs * sizeof(nfapi_nr_generic_tlv_scf_t));
|
||||
|
||||
for (int i = 0; i < dst->num_invalid_tlvs; ++i) {
|
||||
COPY_TLV(dst->invalid_tlvs_list[i], src->invalid_tlvs_list[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dst->num_invalid_tlvs_configured_in_idle; ++i) {
|
||||
COPY_TLV(dst->invalid_tlvs_configured_in_idle_list[i], src->invalid_tlvs_configured_in_idle_list[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dst->num_invalid_tlvs_configured_in_running; ++i) {
|
||||
COPY_TLV(dst->invalid_tlvs_configured_in_running_list[i], src->invalid_tlvs_configured_in_running_list[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dst->num_missing_tlvs; ++i) {
|
||||
COPY_TLV(dst->missing_tlvs_list[i], src->missing_tlvs_list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void copy_start_request(const nfapi_nr_start_request_scf_t *src, nfapi_nr_start_request_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void copy_start_response(const nfapi_nr_start_response_scf_t *src, nfapi_nr_start_response_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
dst->error_code = src->error_code;
|
||||
}
|
||||
|
||||
void copy_stop_request(const nfapi_nr_stop_request_scf_t *src, nfapi_nr_stop_request_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void copy_stop_indication(const nfapi_nr_stop_indication_scf_t *src, nfapi_nr_stop_indication_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void copy_error_indication(const nfapi_nr_error_indication_scf_t *src, nfapi_nr_error_indication_scf_t *dst)
|
||||
{
|
||||
dst->header.message_id = src->header.message_id;
|
||||
dst->header.message_length = src->header.message_length;
|
||||
if (src->vendor_extension) {
|
||||
dst->vendor_extension = calloc(1, sizeof(nfapi_vendor_extension_tlv_t));
|
||||
dst->vendor_extension->tag = src->vendor_extension->tag;
|
||||
dst->vendor_extension->length = src->vendor_extension->length;
|
||||
copy_vendor_extension_value(&dst->vendor_extension, &src->vendor_extension);
|
||||
}
|
||||
|
||||
dst->sfn = src->sfn;
|
||||
dst->slot = src->slot;
|
||||
dst->message_id = src->message_id;
|
||||
dst->error_code = src->error_code;
|
||||
}
|
||||
@@ -3981,6 +3981,20 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
int nfapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
|
||||
/*! \brief Packs a NFAPI P5 message body
|
||||
* \param header A pointer to the header of the P5 message
|
||||
* \param ppWritePackedMsg A pointer to the buffer where to pack the P5 message
|
||||
* \param end Pointer to the end of the packing buffer
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return 0 means success, -1 means failure.
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf
|
||||
*/
|
||||
uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t* header,
|
||||
uint8_t** ppWritePackedMsg,
|
||||
uint8_t* end,
|
||||
nfapi_p4_p5_codec_config_t* config);
|
||||
|
||||
/*! \brief Decodes an NFAPI P5 message header
|
||||
* \param pMessageBuf A pointer to an encoded P5 message header
|
||||
* \param messageBufLen The size of the encoded P5 message header
|
||||
|
||||
@@ -44,36 +44,36 @@ typedef struct {
|
||||
//PHY API message types
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST= 0x00,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE= 0x01,
|
||||
NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST= 0x02,
|
||||
NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE=0X03,
|
||||
NFAPI_NR_PHY_MSG_TYPE_START_REQUEST= 0X04,
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST= 0X05,
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION=0X06,
|
||||
NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION=0X07,
|
||||
NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE=0X010D,
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE=0X010F,
|
||||
//RESERVED 0X08 ~ 0X7F
|
||||
NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST= 0X80,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST= 0X81,
|
||||
NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION=0X82,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST= 0X83,
|
||||
NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST=0X84, // CHANGED TO 0X84
|
||||
NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION=0X85,
|
||||
NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION= 0X86,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION= 0X87,
|
||||
NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION= 0X88,
|
||||
NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89,
|
||||
//RESERVED 0X8a ~ 0xff
|
||||
NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST = 0x00,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE = 0x01,
|
||||
NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST = 0x02,
|
||||
NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE = 0X03,
|
||||
NFAPI_NR_PHY_MSG_TYPE_START_REQUEST = 0X04,
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST = 0X05,
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION = 0X06,
|
||||
NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION = 0X07,
|
||||
NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE = 0X0108, // SCF 222.10.04 Section 3.2 Start.Response - 0x108, as of nFAPIv2
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE = 0X010F,
|
||||
// RESERVED 0X08 ~ 0X7F
|
||||
NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST = 0X80,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST = 0X81,
|
||||
NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION = 0X82,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST = 0X83,
|
||||
NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST = 0X84, // CHANGED TO 0X84
|
||||
NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION = 0X85,
|
||||
NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION = 0X86,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION = 0X87,
|
||||
NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION = 0X88,
|
||||
NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION = 0X89,
|
||||
// RESERVED 0X8a ~ 0xff
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST = 0x0100,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE = 0x0101,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST= 0x0102,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE= 0x0103,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST= 0x0104,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE= 0x0105,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST= 0x0106,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE= 0x0107,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST = 0x0102,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE = 0x0103,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST = 0x0104,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE = 0x0105,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST = 0x0106,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE = 0x0107,
|
||||
|
||||
NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC = 0x0180,
|
||||
NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC,
|
||||
@@ -129,7 +129,7 @@ typedef enum {
|
||||
#define NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG 0x0017
|
||||
#define NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG 0x0018
|
||||
#define NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG 0x0019
|
||||
#define NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_YBS_PER_SLOT_TAG 0x001A
|
||||
#define NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_TBS_PER_SLOT_TAG 0x001A
|
||||
#define NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG 0x001B
|
||||
#define NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG 0x001C
|
||||
#define NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG 0x001D
|
||||
@@ -577,6 +577,23 @@ typedef struct {
|
||||
nfapi_nr_pm_list_t pmi_list;
|
||||
} nfapi_nr_config_request_scf_t;
|
||||
|
||||
typedef enum {
|
||||
UINT_8 = sizeof(uint8_t),
|
||||
UINT_16 = sizeof(uint16_t),
|
||||
UINT_32 = sizeof(uint32_t),
|
||||
ARRAY_UINT_16 = 5 * sizeof(uint16_t),
|
||||
UNKNOWN = 0xffff
|
||||
} nfapi_nr_config_response_tlv_value_type_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
union {
|
||||
uint8_t u8;
|
||||
uint16_t u16;
|
||||
uint32_t u32;
|
||||
uint16_t array_u16[5]; // 4 TLVs defined as array ( dlK0, dlGridSize, ulK0, ulGridSize )
|
||||
} value;
|
||||
} nfapi_nr_generic_tlv_scf_t;
|
||||
|
||||
/* CONFIG.RESPONSE */
|
||||
typedef struct {
|
||||
@@ -586,8 +603,11 @@ typedef struct {
|
||||
uint8_t num_invalid_tlvs_configured_in_idle;
|
||||
uint8_t num_invalid_tlvs_configured_in_running;
|
||||
uint8_t num_missing_tlvs;
|
||||
// TODO: add list of invalid/unsupported TLVs (see Table 3.18)
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
nfapi_nr_generic_tlv_scf_t* invalid_tlvs_list;
|
||||
nfapi_nr_generic_tlv_scf_t* invalid_tlvs_configured_in_idle_list;
|
||||
nfapi_nr_generic_tlv_scf_t* invalid_tlvs_configured_in_running_list;
|
||||
nfapi_nr_generic_tlv_scf_t* missing_tlvs_list;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_config_response_scf_t;
|
||||
|
||||
//------------------------------//
|
||||
@@ -609,13 +629,21 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_stop_request_t;
|
||||
|
||||
} nfapi_nr_stop_request_scf_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_stop_indication_t;
|
||||
} nfapi_nr_stop_indication_scf_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint8_t message_id; // Which message received on the PNF has an error
|
||||
uint8_t error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_error_indication_scf_t;
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_STOP_MSG_INVALID_STATE
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/open-nFAPI/nfapi/public_inc/nr_nfapi_p7.h
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef OPENAIRINTERFACE_NR_NFAPI_P7_H
|
||||
#define OPENAIRINTERFACE_NR_NFAPI_P7_H
|
||||
#include "nfapi_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
|
||||
uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_slot_indication_scf_t *msg,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
|
||||
void *nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_srs_indication_t *pNfapiMsg,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_crc_indication_t *msg,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_rach_indication_t *msg,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
|
||||
#endif // OPENAIRINTERFACE_NR_NFAPI_P7_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,15 +27,6 @@
|
||||
#include <nfapi.h>
|
||||
#include <debug.h>
|
||||
|
||||
static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd) {
|
||||
if (msgEnd < msgHead) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %lu, %lu\n", msgHead, msgEnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (msgEnd - msgHead);
|
||||
}
|
||||
|
||||
static uint8_t pack_opaque_data_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
nfapi_opaqaue_data_t *value = (nfapi_opaqaue_data_t *)tlv;
|
||||
return pusharray8(value->value, NFAPI_MAX_OPAQUE_DATA, value->length, ppWritePackedMsg, end);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,7 @@
|
||||
#include <nfapi.h>
|
||||
#include <debug.h>
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "nr_nfapi_p7.h"
|
||||
|
||||
extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMsg, void *user_data);
|
||||
extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, void *user_data);
|
||||
@@ -829,7 +830,7 @@ static uint8_t pack_dl_config_request_body_value(void *tlv, uint8_t **ppWritePac
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t *)msg;
|
||||
|
||||
@@ -1658,7 +1659,7 @@ static uint8_t pack_ul_config_request_body_value(void *tlv, uint8_t **ppWritePac
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t *)msg;
|
||||
pNfapiMsg->n_ulcch = 0;
|
||||
@@ -1987,25 +1988,22 @@ static uint8_t pack_ul_dci_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg,
|
||||
return push16(value->PDUSize, &pPackedLengthField, end);
|
||||
}
|
||||
|
||||
static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t *)msg;
|
||||
|
||||
if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->numPdus, ppWritePackedMsg, end)
|
||||
))
|
||||
if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && push16(pNfapiMsg->Slot, ppWritePackedMsg, end)
|
||||
&& push8(pNfapiMsg->numPdus, ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->numPdus; i++) {
|
||||
if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end))
|
||||
for (int i = 0; i < pNfapiMsg->numPdus; i++) {
|
||||
if (!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t *)msg;
|
||||
return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
|
||||
@@ -2159,10 +2157,15 @@ static uint8_t pack_release_request_body_value(void *tlv, uint8_t **ppWritePacke
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t *)msg;
|
||||
int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
|
||||
int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
|
||||
int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG,
|
||||
&pNfapiMsg->ue_release_request_body,
|
||||
ppWritePackedMsg,
|
||||
end,
|
||||
&pack_release_request_body_value);
|
||||
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
|
||||
return x && y && z;
|
||||
}
|
||||
@@ -2179,7 +2182,8 @@ static uint8_t pack_nr_ue_release_request(void *msg, uint8_t **ppWritePackedMsg,
|
||||
&& pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
|
||||
}
|
||||
|
||||
static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t *)msg;
|
||||
int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
|
||||
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
|
||||
@@ -3087,11 +3091,11 @@ static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint
|
||||
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t *)msg;
|
||||
return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) &&
|
||||
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end)
|
||||
&& pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
}
|
||||
|
||||
static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
@@ -3101,12 +3105,12 @@ static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t
|
||||
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t *)msg;
|
||||
return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
|
||||
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && push32(pNfapiMsg->t2, ppWritePackedMsg, end)
|
||||
&& push32(pNfapiMsg->t3, ppWritePackedMsg, end)
|
||||
&& pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
}
|
||||
|
||||
static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
@@ -3136,40 +3140,37 @@ static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *
|
||||
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t *)msg;
|
||||
return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) && push32(pNfapiMsg->last_slot, ppWritePackedMsg, end)
|
||||
&& push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end)
|
||||
&& push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end)
|
||||
&& push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end)
|
||||
&& push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) && push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end)
|
||||
&& pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end)
|
||||
&& pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end)
|
||||
&& pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end)
|
||||
&& pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end)
|
||||
&& pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end)
|
||||
&& pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end)
|
||||
&& pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end)
|
||||
&& pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end)
|
||||
&& pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
}
|
||||
|
||||
//NR UPLINK indication function packing
|
||||
|
||||
//SLOT INDICATION
|
||||
|
||||
static uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
|
||||
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t *)msg;
|
||||
|
||||
if (!(push16((uint16_t)pNfapiMsg->sfn , ppWritePackedMsg, end) &&
|
||||
push16((uint16_t)pNfapiMsg->slot , ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
if (!(push16((uint16_t)pNfapiMsg->sfn, ppWritePackedMsg, end) && push16((uint16_t)pNfapiMsg->slot, ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//RX DATA INDICATION
|
||||
@@ -3193,20 +3194,16 @@ static uint8_t pack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t *value, ui
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
|
||||
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t *)msg;
|
||||
|
||||
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
|
||||
))
|
||||
if (!(push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
|
||||
&& push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
|
||||
{
|
||||
if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
|
||||
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
|
||||
if (!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3238,19 +3235,16 @@ static uint8_t pack_nr_crc_indication_body(nfapi_nr_crc_t *value, uint8_t **ppWr
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
|
||||
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t *)msg;
|
||||
|
||||
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->number_crcs, ppWritePackedMsg, end)
|
||||
))
|
||||
if (!(push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
|
||||
&& push16(pNfapiMsg->number_crcs, ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < pNfapiMsg->number_crcs; i++)
|
||||
{
|
||||
if(!pack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppWritePackedMsg, end))
|
||||
for (int i = 0; i < pNfapiMsg->number_crcs; i++) {
|
||||
if (!pack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3366,19 +3360,17 @@ static uint8_t pack_nr_srs_indication_body(nfapi_nr_srs_indication_pdu_t *value,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) {
|
||||
uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t *)msg;
|
||||
|
||||
nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
|
||||
|
||||
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->control_length , ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end))) {
|
||||
if (!(push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
|
||||
&& push16(pNfapiMsg->control_length, ppWritePackedMsg, end) && push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_of_pdus;i++) {
|
||||
if(!pack_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg, end)) {
|
||||
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
|
||||
if (!pack_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -3412,26 +3404,22 @@ static uint8_t pack_nr_rach_indication_body(void* tlv, uint8_t **ppWritePackedMs
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
|
||||
nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t *)msg;
|
||||
|
||||
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
if (!(push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
|
||||
&& push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
|
||||
{
|
||||
if(!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
|
||||
return 0;
|
||||
}
|
||||
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
|
||||
if (!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
//UCI INDICATION
|
||||
|
||||
static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
@@ -3637,28 +3625,25 @@ static uint8_t pack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppWr
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
|
||||
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t *)msg;
|
||||
|
||||
if (!push16(pNfapiMsg->sfn , ppWritePackedMsg, end))
|
||||
if (!push16(pNfapiMsg->sfn, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(pNfapiMsg->slot , ppWritePackedMsg, end))
|
||||
if (!push16(pNfapiMsg->slot, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(pNfapiMsg->num_ucis, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < pNfapiMsg->num_ucis; i++)
|
||||
{
|
||||
for (int i = 0; i < pNfapiMsg->num_ucis; i++) {
|
||||
if (!pack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Main pack function - public
|
||||
|
||||
int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t *config)
|
||||
@@ -6061,16 +6046,17 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
|
||||
|
||||
//SLOT INDICATION
|
||||
|
||||
static uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_slot_indication_scf_t *msg, nfapi_p7_codec_config_t* config)
|
||||
uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_slot_indication_scf_t *msg,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
|
||||
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t *)msg;
|
||||
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end)
|
||||
))
|
||||
return 0;
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//RX DATA INDICATION
|
||||
@@ -6121,7 +6107,7 @@ static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *
|
||||
|
||||
//NR CRC INDICATION
|
||||
|
||||
static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t *value, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t *value, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
{
|
||||
if (!(pull32(ppReadPackedMsg, &value->handle, end) && pull16(ppReadPackedMsg, &value->rnti, end)
|
||||
&& pull8(ppReadPackedMsg, &value->harq_id, end) && pull8(ppReadPackedMsg, &value->tb_crc_status, end)
|
||||
@@ -6147,24 +6133,23 @@ static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t *value, uint8_t **pp
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_crc_indication_t *msg, nfapi_p7_codec_config_t* config)
|
||||
uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_crc_indication_t *msg,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
|
||||
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t *)msg;
|
||||
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
|
||||
))
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end)
|
||||
&& pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)))
|
||||
return 0;
|
||||
|
||||
if (pNfapiMsg->number_crcs > 0)
|
||||
{
|
||||
if (pNfapiMsg->number_crcs > 0) {
|
||||
pNfapiMsg->crc_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->crc_list) * pNfapiMsg->number_crcs, config);
|
||||
}
|
||||
|
||||
for (int i = 0; i < pNfapiMsg->number_crcs; i++)
|
||||
{
|
||||
if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppReadPackedMsg, end))
|
||||
for (int i = 0; i < pNfapiMsg->number_crcs; i++) {
|
||||
if (!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppReadPackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6276,16 +6261,17 @@ static uint8_t unpack_nr_srs_indication_body(nfapi_nr_srs_indication_pdu_t *valu
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_srs_indication_t *pNfapiMsg, nfapi_p7_codec_config_t* config) {
|
||||
|
||||
if (!(pull16(ppReadPackedMsg,&pNfapiMsg->sfn, end) &&
|
||||
pull16(ppReadPackedMsg,&pNfapiMsg->slot, end) &&
|
||||
pull16(ppReadPackedMsg,&pNfapiMsg->control_length, end) &&
|
||||
pull8(ppReadPackedMsg,&pNfapiMsg->number_of_pdus, end))) {
|
||||
uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_srs_indication_t *pNfapiMsg,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end)
|
||||
&& pull16(ppReadPackedMsg, &pNfapiMsg->control_length, end) && pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_of_pdus; i++) {
|
||||
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
|
||||
if (!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -6318,10 +6304,10 @@ static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t *v
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_rach_indication_t *msg,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_rach_indication_t *msg,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t *)msg;
|
||||
|
||||
@@ -6609,7 +6595,7 @@ static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t *value,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config)
|
||||
uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t *)msg;
|
||||
|
||||
|
||||
@@ -214,21 +214,21 @@ typedef struct nfapi_pnf_config
|
||||
* STOP.request. This can be done in the call back.
|
||||
*/
|
||||
int (*stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_stop_request_t* req);
|
||||
int (*nr_stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_stop_request_t* req);
|
||||
int (*nr_stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_stop_request_scf_t* req);
|
||||
|
||||
/*! A callback for the MEASUREMENT.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
* \param phy A pointer to the pnf phy configuration
|
||||
* \param req A data structure for the decoded MEASUREMENT.request. This will have
|
||||
* been allocated on the stack
|
||||
* \return not currently used
|
||||
*
|
||||
* The client is expected to send the MEASUREMENT.response after receiving the
|
||||
* MEASUREMENT.request. This can be done in the call back.
|
||||
*/
|
||||
int (*measurement_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_measurement_request_t* req);
|
||||
|
||||
/*! A callback for the RSSI.request
|
||||
/*! A callback for the MEASUREMENT.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
* \param phy A pointer to the pnf phy configuration
|
||||
* \param req A data structure for the decoded MEASUREMENT.request. This will have
|
||||
* been allocated on the stack
|
||||
* \return not currently used
|
||||
*
|
||||
* The client is expected to send the MEASUREMENT.response after receiving the
|
||||
* MEASUREMENT.request. This can be done in the call back.
|
||||
*/
|
||||
int (*measurement_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_measurement_request_t* req);
|
||||
|
||||
/*! A callback for the RSSI.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
* \param phy A pointer to the pnf phy configuration
|
||||
* \param req A data structure for the decoded RSSI.request. This will have
|
||||
|
||||
@@ -937,75 +937,58 @@ void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
void pnf_nr_handle_stop_request(pnf_t* pnf, void* pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_stop_request_t req;
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
} else {
|
||||
nfapi_nr_stop_request_scf_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
{
|
||||
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||
if(phy)
|
||||
{
|
||||
if(phy->state != NFAPI_PNF_PHY_RUNNING)
|
||||
{
|
||||
if(config->nr_stop_req)
|
||||
{
|
||||
(config->nr_stop_req)(config, phy, &req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) {
|
||||
if (config->state == NFAPI_PNF_RUNNING) {
|
||||
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||
if (phy) {
|
||||
if (phy->state != NFAPI_PNF_PHY_RUNNING) {
|
||||
if (config->nr_stop_req) {
|
||||
(config->nr_stop_req)(config, phy, &req);
|
||||
}
|
||||
} else {
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
} else {
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
} else {
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
}
|
||||
if (req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#ifdef ENABLE_AERIAL
|
||||
#include "nfapi/oai_integration/aerial/fapi_nvIPC.h"
|
||||
#include "nfapi/oai_integration/aerial/fapi_vnf_p5.h"
|
||||
#include "nr_fapi.h"
|
||||
#endif
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(p5)
|
||||
add_subdirectory(p7)
|
||||
endif ()
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_test.h
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef OPENAIRINTERFACE_NR_FAPI_TEST_H
|
||||
#define OPENAIRINTERFACE_NR_FAPI_TEST_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef _STANDALONE_TESTING_
|
||||
#include "common/utils/LOG/log.h"
|
||||
#endif
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
|
||||
#define FILL_TLV(TlV, TaG, VaL) \
|
||||
do { \
|
||||
TlV.tl.tag = TaG; \
|
||||
TlV.value = VaL; \
|
||||
} while (0)
|
||||
|
||||
uint8_t rand8()
|
||||
{
|
||||
return (rand() & 0xff);
|
||||
}
|
||||
uint16_t rand16()
|
||||
{
|
||||
return rand8() << 8 | rand8();
|
||||
}
|
||||
uint32_t rand24()
|
||||
{
|
||||
return rand16() << 8 | rand8();
|
||||
}
|
||||
uint32_t rand32()
|
||||
{
|
||||
return rand24() << 8 | rand8();
|
||||
}
|
||||
uint64_t rand64()
|
||||
{
|
||||
return (uint64_t)rand32() << 32 | rand32();
|
||||
}
|
||||
|
||||
uint8_t rand8_range(uint8_t lower, uint8_t upper)
|
||||
{
|
||||
return (rand() % (upper - lower + 1)) + lower;
|
||||
}
|
||||
|
||||
uint16_t rand16_range(uint16_t lower, uint16_t upper)
|
||||
{
|
||||
return (rand() % (upper - lower + 1)) + lower;
|
||||
}
|
||||
|
||||
int main(int n, char *v[]);
|
||||
|
||||
static inline void fapi_test_init_seeded(time_t seed)
|
||||
{
|
||||
srand(seed);
|
||||
printf("srand seed is %ld\n", seed);
|
||||
logInit();
|
||||
set_glog(OAILOG_DISABLE);
|
||||
}
|
||||
|
||||
static inline void fapi_test_init()
|
||||
{
|
||||
fapi_test_init_seeded(time(NULL));
|
||||
}
|
||||
#endif // OPENAIRINTERFACE_NR_FAPI_TEST_H
|
||||
@@ -0,0 +1,12 @@
|
||||
set(Test_Labels fapi p5)
|
||||
set(_fapi_p5_messages "param_request;param_response;config_request;config_response;start_request;start_response;stop_request;stop_indication;error_indication")
|
||||
|
||||
foreach (fapi_p5_message IN LISTS _fapi_p5_messages)
|
||||
add_executable(nr_fapi_${fapi_p5_message}_test nr_fapi_${fapi_p5_message}_test.c)
|
||||
target_link_libraries(nr_fapi_${fapi_p5_message}_test PUBLIC nr_fapi_p5)
|
||||
target_link_libraries(nr_fapi_${fapi_p5_message}_test PRIVATE pthread UTIL ${T_LIB} minimal_lib)
|
||||
add_dependencies(tests nr_fapi_${fapi_p5_message}_test)
|
||||
|
||||
add_test(nr_fapi_${fapi_p5_message}_test nr_fapi_${fapi_p5_message}_test)
|
||||
set_tests_properties(nr_fapi_${fapi_p5_message}_test PROPERTIES LABELS "${Test_Labels}")
|
||||
endforeach ()
|
||||
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_config_request_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void fill_config_request_tlv(nfapi_nr_config_request_scf_t *nfapi_resp)
|
||||
{
|
||||
FILL_TLV(nfapi_resp->carrier_config.dl_bandwidth, NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_config.dl_frequency, NFAPI_NR_CONFIG_DL_FREQUENCY_TAG, rand32());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
FILL_TLV(nfapi_resp->carrier_config.dl_k0[i], NFAPI_NR_CONFIG_DL_K0_TAG, rand16());
|
||||
}
|
||||
// these 5 are 1 tlv
|
||||
nfapi_resp->num_tlv++;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
FILL_TLV(nfapi_resp->carrier_config.dl_grid_size[i], NFAPI_NR_CONFIG_DL_GRID_SIZE_TAG, rand16());
|
||||
}
|
||||
// these 5 are 1 tlv
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_config.num_tx_ant, NFAPI_NR_CONFIG_NUM_TX_ANT_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_config.uplink_bandwidth, NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_config.uplink_frequency, NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
FILL_TLV(nfapi_resp->carrier_config.ul_k0[i], NFAPI_NR_CONFIG_UL_K0_TAG, rand16());
|
||||
}
|
||||
// these 5 are 1 tlv
|
||||
nfapi_resp->num_tlv++;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
FILL_TLV(nfapi_resp->carrier_config.ul_grid_size[i], NFAPI_NR_CONFIG_UL_GRID_SIZE_TAG, rand16());
|
||||
}
|
||||
// these 5 are 1 tlv
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_config.num_rx_ant, NFAPI_NR_CONFIG_NUM_RX_ANT_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_config.frequency_shift_7p5khz, NFAPI_NR_CONFIG_FREQUENCY_SHIFT_7P5KHZ_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->cell_config.phy_cell_id, NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->cell_config.frame_duplex_type, NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->ssb_config.ss_pbch_power, NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG, (int32_t)rand32());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->ssb_config.bch_payload, NFAPI_NR_CONFIG_BCH_PAYLOAD_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
// NOTE: MUST be between 0 & 4 ( inclusive ) , since this value is used as index to obtain slots per frame
|
||||
FILL_TLV(nfapi_resp->ssb_config.scs_common, NFAPI_NR_CONFIG_SCS_COMMON_TAG, rand8_range(0, 4));
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_config.prach_sequence_length, NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_config.prach_sub_c_spacing, NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_config.restricted_set_config, NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
/*Number of RACH frequency domain
|
||||
occasions. Corresponds to the
|
||||
parameter 𝑀𝑀 in [38.211, sec 6.3.3.2]
|
||||
which equals the higher layer
|
||||
parameter msg1FDM
|
||||
Value: 1,2,4,8*/
|
||||
const uint8_t num_prach_fd_ocasions[] = {1, 2, 4, 8};
|
||||
FILL_TLV(nfapi_resp->prach_config.num_prach_fd_occasions,
|
||||
NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG,
|
||||
num_prach_fd_ocasions[rand8_range(0, sizeof(num_prach_fd_ocasions) - 1)]);
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_config.prach_ConfigurationIndex, NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
nfapi_resp->prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *)malloc(
|
||||
nfapi_resp->prach_config.num_prach_fd_occasions.value * sizeof(nfapi_nr_num_prach_fd_occasions_t));
|
||||
for (int i = 0; i < nfapi_resp->prach_config.num_prach_fd_occasions.value; i++) {
|
||||
nfapi_nr_num_prach_fd_occasions_t *prach_fd_occasion = &(nfapi_resp->prach_config.num_prach_fd_occasions_list[i]);
|
||||
|
||||
FILL_TLV(prach_fd_occasion->prach_root_sequence_index, NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(prach_fd_occasion->num_root_sequences, NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(prach_fd_occasion->k1, NFAPI_NR_CONFIG_K1_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(prach_fd_occasion->prach_zero_corr_conf, NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
// This doesn't make sense to be more than the total num_root_sequences
|
||||
/* SCF 222.10.02 : Number of unused sequences available
|
||||
for noise estimation per FD occasion. At
|
||||
least one unused root sequence is
|
||||
required per FD occasion. */
|
||||
if (prach_fd_occasion->num_root_sequences.value != 0) {
|
||||
FILL_TLV(prach_fd_occasion->num_unused_root_sequences,
|
||||
NFAPI_NR_CONFIG_NUM_UNUSED_ROOT_SEQUENCES_TAG,
|
||||
rand8_range(1, prach_fd_occasion->num_root_sequences.value));
|
||||
} else {
|
||||
FILL_TLV(prach_fd_occasion->num_unused_root_sequences, NFAPI_NR_CONFIG_NUM_UNUSED_ROOT_SEQUENCES_TAG, 1);
|
||||
}
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
prach_fd_occasion->unused_root_sequences_list =
|
||||
(nfapi_uint8_tlv_t *)malloc(prach_fd_occasion->num_unused_root_sequences.value * sizeof(nfapi_uint8_tlv_t));
|
||||
for (int k = 0; k < prach_fd_occasion->num_unused_root_sequences.value; k++) {
|
||||
FILL_TLV(prach_fd_occasion->unused_root_sequences_list[k], NFAPI_NR_CONFIG_UNUSED_ROOT_SEQUENCES_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
}
|
||||
}
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_config.ssb_per_rach, NFAPI_NR_CONFIG_SSB_PER_RACH_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_config.prach_multiple_carriers_in_a_band,
|
||||
NFAPI_NR_CONFIG_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG,
|
||||
rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->ssb_table.ssb_offset_point_a, NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->ssb_table.ssb_period, NFAPI_NR_CONFIG_SSB_PERIOD_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->ssb_table.ssb_subcarrier_offset, NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->ssb_table.MIB, NFAPI_NR_CONFIG_MIB_TAG, rand32());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->ssb_table.ssb_mask_list[0].ssb_mask, NFAPI_NR_CONFIG_SSB_MASK_TAG, rand32());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->ssb_table.ssb_mask_list[1].ssb_mask, NFAPI_NR_CONFIG_SSB_MASK_TAG, rand32());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
for (int i = 0; i < 64; i++) {
|
||||
FILL_TLV(nfapi_resp->ssb_table.ssb_beam_id_list[i].beam_id, NFAPI_NR_CONFIG_BEAM_ID_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
}
|
||||
|
||||
FILL_TLV(nfapi_resp->tdd_table.tdd_period, NFAPI_NR_CONFIG_TDD_PERIOD_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
const uint8_t slotsperframe[5] = {10, 20, 40, 80, 160};
|
||||
// Assuming always CP_Normal, because Cyclic prefix is not included in CONFIG.request 10.02, but is present in 10.04
|
||||
uint8_t cyclicprefix = 1;
|
||||
bool normal_CP = cyclicprefix ? false : true;
|
||||
// 3GPP 38.211 Table 4.3.2.1 & Table 4.3.2.2
|
||||
uint8_t number_of_symbols_per_slot = normal_CP ? 14 : 12;
|
||||
|
||||
nfapi_resp->tdd_table.max_tdd_periodicity_list = (nfapi_nr_max_tdd_periodicity_t *)malloc(
|
||||
slotsperframe[nfapi_resp->ssb_config.scs_common.value] * sizeof(nfapi_nr_max_tdd_periodicity_t));
|
||||
|
||||
for (int i = 0; i < slotsperframe[nfapi_resp->ssb_config.scs_common.value]; i++) {
|
||||
nfapi_resp->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list =
|
||||
(nfapi_nr_max_num_of_symbol_per_slot_t *)malloc(number_of_symbols_per_slot * sizeof(nfapi_nr_max_num_of_symbol_per_slot_t));
|
||||
}
|
||||
|
||||
for (int i = 0; i < slotsperframe[nfapi_resp->ssb_config.scs_common.value]; i++) { // TODO check right number of slots
|
||||
for (int k = 0; k < number_of_symbols_per_slot; k++) { // TODO can change?
|
||||
FILL_TLV(nfapi_resp->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[k].slot_config,
|
||||
NFAPI_NR_CONFIG_SLOT_CONFIG_TAG,
|
||||
rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
}
|
||||
}
|
||||
|
||||
FILL_TLV(nfapi_resp->measurement_config.rssi_measurement, NFAPI_NR_CONFIG_RSSI_MEASUREMENT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
nfapi_resp->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
|
||||
for (int i = 0; i < NFAPI_IPV4_ADDRESS_LENGTH; ++i) {
|
||||
nfapi_resp->nfapi_config.p7_vnf_address_ipv4.address[i] = rand8();
|
||||
}
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
nfapi_resp->nfapi_config.p7_vnf_address_ipv6.tl.tag = NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG;
|
||||
for (int i = 0; i < NFAPI_IPV6_ADDRESS_LENGTH; ++i) {
|
||||
nfapi_resp->nfapi_config.p7_vnf_address_ipv6.address[i] = rand8();
|
||||
}
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->nfapi_config.p7_vnf_port, NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->nfapi_config.timing_window, NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->nfapi_config.timing_info_mode, NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->nfapi_config.timing_info_period, NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
}
|
||||
|
||||
void test_pack_unpack(nfapi_nr_config_request_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(*req);
|
||||
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
// PARAM.request message body length is 0
|
||||
DevAssert(pack_result >= 0 + NFAPI_HEADER_LENGTH);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
fapi_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpacking and compare with initial message
|
||||
nfapi_nr_config_request_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_config_request(&unpacked_req, req));
|
||||
free_config_request(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_config_request_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_config_request_scf_t copy = {0};
|
||||
copy_config_request(msg, ©);
|
||||
DevAssert(eq_config_request(msg, ©));
|
||||
free_config_request(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
nfapi_nr_config_request_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST};
|
||||
// Fill CONFIG.request TVLs
|
||||
fill_config_request_tlv(&req);
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_config_request(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_config_response_test.c
|
||||
* \brief Defines a unitary test for the FAPI CONFIG.response message ( 0x03 )
|
||||
* The test consists of filling a message with randomized data, filling each lists as well with random TLVs
|
||||
* After the message is created, is is packed into a byte buffer
|
||||
* After packing, the header is unpacked to mimic SCTP PEEK and the values unpacked checked against the original message
|
||||
* After the header is checked, the whole message is unpacked.
|
||||
* The test ends by checking all of the unpacked message contents against the original message
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void fill_config_response_tlv_list(nfapi_nr_generic_tlv_scf_t *list, uint8_t size)
|
||||
{
|
||||
uint8_t const TLVtypes[] = {UINT_8, UINT_16, UINT_32, ARRAY_UINT_16};
|
||||
for (int i = 0; i < size; ++i) {
|
||||
nfapi_nr_generic_tlv_scf_t *element = &(list[i]);
|
||||
element->tl.tag = rand16_range(NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, NFAPI_NR_CONFIG_RSSI_MEASUREMENT_TAG);
|
||||
element->tl.length = TLVtypes[rand8_range(0, sizeof(TLVtypes) - 1)];
|
||||
switch (element->tl.length) {
|
||||
case UINT_8:
|
||||
element->value.u8 = rand8();
|
||||
break;
|
||||
case UINT_16:
|
||||
element->value.u16 = rand16();
|
||||
break;
|
||||
case UINT_32:
|
||||
element->value.u32 = rand32();
|
||||
break;
|
||||
case ARRAY_UINT_16:
|
||||
for (int j = 0; j < 5; ++j) {
|
||||
element->value.array_u16[j] = rand16();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fill_config_response_tlv(nfapi_nr_config_response_scf_t *nfapi_resp)
|
||||
{
|
||||
nfapi_resp->error_code = rand8();
|
||||
nfapi_resp->num_invalid_tlvs = rand8();
|
||||
nfapi_resp->num_invalid_tlvs_configured_in_idle = rand8();
|
||||
nfapi_resp->num_invalid_tlvs_configured_in_running = rand8();
|
||||
nfapi_resp->num_missing_tlvs = rand8();
|
||||
// Lists
|
||||
nfapi_resp->invalid_tlvs_list =
|
||||
(nfapi_nr_generic_tlv_scf_t *)malloc(nfapi_resp->num_invalid_tlvs * sizeof(nfapi_nr_generic_tlv_scf_t));
|
||||
nfapi_resp->invalid_tlvs_configured_in_idle_list =
|
||||
(nfapi_nr_generic_tlv_scf_t *)malloc(nfapi_resp->num_invalid_tlvs_configured_in_idle * sizeof(nfapi_nr_generic_tlv_scf_t));
|
||||
nfapi_resp->invalid_tlvs_configured_in_running_list =
|
||||
(nfapi_nr_generic_tlv_scf_t *)malloc(nfapi_resp->num_invalid_tlvs_configured_in_running * sizeof(nfapi_nr_generic_tlv_scf_t));
|
||||
nfapi_resp->missing_tlvs_list =
|
||||
(nfapi_nr_generic_tlv_scf_t *)malloc(nfapi_resp->num_missing_tlvs * sizeof(nfapi_nr_generic_tlv_scf_t));
|
||||
|
||||
fill_config_response_tlv_list(nfapi_resp->invalid_tlvs_list, nfapi_resp->num_invalid_tlvs);
|
||||
fill_config_response_tlv_list(nfapi_resp->invalid_tlvs_configured_in_idle_list, nfapi_resp->num_invalid_tlvs_configured_in_idle);
|
||||
fill_config_response_tlv_list(nfapi_resp->invalid_tlvs_configured_in_running_list,
|
||||
nfapi_resp->num_invalid_tlvs_configured_in_running);
|
||||
fill_config_response_tlv_list(nfapi_resp->missing_tlvs_list, nfapi_resp->num_missing_tlvs);
|
||||
}
|
||||
|
||||
void test_pack_unpack(nfapi_nr_config_response_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(*req);
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
DevAssert(pack_result >= 0 + NFAPI_HEADER_LENGTH);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
fapi_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpacking and compare with initial message
|
||||
nfapi_nr_config_response_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), 0);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_config_response(&unpacked_req, req));
|
||||
free_config_response(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_config_response_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_config_response_scf_t copy = {0};
|
||||
copy_config_response(msg, ©);
|
||||
DevAssert(eq_config_response(msg, ©));
|
||||
free_config_response(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
|
||||
nfapi_nr_config_response_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE};
|
||||
// Fill Config response TVLs
|
||||
fill_config_response_tlv(&req);
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_config_response(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_error_indication_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void test_pack_unpack(nfapi_nr_error_indication_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(*req);
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
DevAssert(pack_result >= 0 + NFAPI_HEADER_LENGTH);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
fapi_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpacking and compare with initial message
|
||||
nfapi_nr_error_indication_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_error_indication(&unpacked_req, req));
|
||||
free_error_indication(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_error_indication_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_error_indication_scf_t copy = {0};
|
||||
copy_error_indication(msg, ©);
|
||||
DevAssert(eq_error_indication(msg, ©));
|
||||
free_error_indication(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
|
||||
nfapi_nr_error_indication_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION};
|
||||
// Fill the message with randomized data
|
||||
req.sfn = rand16_range(0, 1023);
|
||||
req.slot = rand16_range(0, 159);
|
||||
req.message_id = rand8_range(0x00, 0xFF);
|
||||
req.error_code = rand8_range(0x00, 0x08);
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_error_indication(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_param_request_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void test_pack_unpack(nfapi_nr_param_request_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(*req);
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
// PARAM.request message body length is 0
|
||||
DevAssert(pack_result == 0 + NFAPI_HEADER_LENGTH);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
fapi_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpacking and compare with initial message
|
||||
nfapi_nr_param_request_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_param_request(&unpacked_req, req));
|
||||
free_param_request(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_param_request_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_param_request_scf_t copy = {0};
|
||||
copy_param_request(msg, ©);
|
||||
DevAssert(eq_param_request(msg, ©));
|
||||
free_param_request(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
|
||||
nfapi_nr_param_request_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST};
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_param_request(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_param_response_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void fill_param_response_tlv(nfapi_nr_param_response_scf_t *nfapi_resp)
|
||||
{
|
||||
nfapi_resp->error_code = rand8_range(NFAPI_MSG_OK, NFAPI_MSG_INVALID_STATE);
|
||||
|
||||
FILL_TLV(nfapi_resp->cell_param.release_capability, NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->cell_param.phy_state, NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->cell_param.skip_blank_dl_config, NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->cell_param.skip_blank_ul_config, NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->cell_param.num_config_tlvs_to_report,
|
||||
NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG,
|
||||
rand16_range(0, NFAPI_NR_CONFIG_RSSI_MEASUREMENT_TAG - NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG));
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
nfapi_resp->cell_param.config_tlvs_to_report_list =
|
||||
calloc(nfapi_resp->cell_param.num_config_tlvs_to_report.value, sizeof(nfapi_uint8_tlv_t *));
|
||||
for (int i = 0; i < nfapi_resp->cell_param.num_config_tlvs_to_report.value; ++i) {
|
||||
FILL_TLV(nfapi_resp->cell_param.config_tlvs_to_report_list[i],
|
||||
rand16_range(NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, NFAPI_NR_CONFIG_RSSI_MEASUREMENT_TAG),
|
||||
rand8_range(0, 5));
|
||||
nfapi_resp->cell_param.config_tlvs_to_report_list[i].tl.length = 1;
|
||||
}
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_param.cyclic_prefix, NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_param.supported_subcarrier_spacings_dl,
|
||||
NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG,
|
||||
rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_param.supported_bandwidth_dl, NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_param.supported_subcarrier_spacings_ul,
|
||||
NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG,
|
||||
rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->carrier_param.supported_bandwidth_ul, NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdcch_param.cce_mapping_type, NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot,
|
||||
NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG,
|
||||
rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdcch_param.coreset_precoder_granularity_coreset,
|
||||
NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG,
|
||||
rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdcch_param.pdcch_mu_mimo, NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdcch_param.pdcch_precoder_cycling, NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdcch_param.max_pdcch_per_slot, NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pucch_param.pucch_formats, NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pucch_param.max_pucchs_per_slot, NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_mapping_type, NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_allocation_types, NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_vrb_to_prb_mapping, NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_cbg, NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_dmrs_config_types, NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_dmrs_max_length, NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_dmrs_additional_pos, NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.max_pdsch_tbs_per_slot, NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_TBS_PER_SLOT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.max_number_mimo_layers_pdsch, NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.supported_max_modulation_order_dl,
|
||||
NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG,
|
||||
rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.max_mu_mimo_users_dl, NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_data_in_dmrs_symbols, NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.premption_support, NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pdsch_param.pdsch_non_slot_support, NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.uci_mux_ulsch_in_pusch, NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.uci_only_pusch, NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_frequency_hopping, NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_dmrs_config_types, NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_dmrs_max_len, NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_dmrs_additional_pos, NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_cbg, NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_mapping_type, NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_allocation_types, NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_vrb_to_prb_mapping, NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_max_ptrs_ports, NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.max_pduschs_tbs_per_slot, NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.max_number_mimo_layers_non_cb_pusch,
|
||||
NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG,
|
||||
rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.supported_modulation_order_ul, NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.max_mu_mimo_users_ul, NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.dfts_ofdm_support, NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->pusch_param.pusch_aggregation_factor, NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_param.prach_long_formats, NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_param.prach_short_formats, NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, rand16());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_param.prach_restricted_sets, NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->prach_param.max_prach_fd_occasions_in_a_slot,
|
||||
NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG,
|
||||
rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
|
||||
FILL_TLV(nfapi_resp->measurement_param.rssi_measurement_support, NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, rand8());
|
||||
nfapi_resp->num_tlv++;
|
||||
}
|
||||
|
||||
void test_pack_unpack(nfapi_nr_param_response_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(*req);
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
// PARAM.response message body length is AT LEAST 10 (NFAPI_HEADER_LENGTH + 1 byte error_code + 1 byte num_tlv)
|
||||
DevAssert(pack_result >= NFAPI_HEADER_LENGTH + 1 + 1);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpaking and compare with initial message
|
||||
nfapi_nr_param_response_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_param_response(&unpacked_req, req));
|
||||
free_param_response(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_param_response_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_param_response_scf_t copy = {0};
|
||||
copy_param_response(msg, ©);
|
||||
DevAssert(eq_param_response(msg, ©));
|
||||
free_param_response(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
nfapi_nr_param_response_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE};
|
||||
// Fill Param response TVLs
|
||||
fill_param_response_tlv(&req);
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_param_response(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_start_request_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void test_pack_unpack(nfapi_nr_start_request_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(*req);
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
// START.request message body length is 0
|
||||
DevAssert(pack_result == 0 + NFAPI_HEADER_LENGTH);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
fapi_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpacking and compare with initial message
|
||||
nfapi_nr_start_request_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_start_request(&unpacked_req, req));
|
||||
free_start_request(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_start_request_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_start_request_scf_t copy = {0};
|
||||
copy_start_request(msg, ©);
|
||||
DevAssert(eq_start_request(msg, ©));
|
||||
free_start_request(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
|
||||
nfapi_nr_start_request_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_REQUEST};
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_start_request(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_start_response_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void test_pack_unpack(nfapi_nr_start_response_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(req);
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
// START.response message body length is 1
|
||||
DevAssert(pack_result == 1 + NFAPI_HEADER_LENGTH);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
fapi_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpacking and compare with initial message
|
||||
nfapi_nr_start_response_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_start_response(&unpacked_req, req));
|
||||
free_start_response(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_start_response_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_start_response_scf_t copy = {0};
|
||||
copy_start_response(msg, ©);
|
||||
DevAssert(eq_start_response(msg, ©));
|
||||
free_start_response(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
|
||||
nfapi_nr_start_response_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE};
|
||||
// Fill the message with randomized data
|
||||
req.error_code = rand8_range(0x00, 0x01);
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_start_response(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_stop_indication_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void test_pack_unpack(nfapi_nr_stop_indication_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(*req);
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
// STOP.indication message body length is 0
|
||||
DevAssert(pack_result == 0 + NFAPI_HEADER_LENGTH);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
fapi_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpacking and compare with initial message
|
||||
nfapi_nr_stop_indication_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_stop_indication(&unpacked_req, req));
|
||||
free_stop_indication(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_stop_indication_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_stop_indication_scf_t copy = {0};
|
||||
copy_stop_indication(msg, ©);
|
||||
DevAssert(eq_stop_indication(msg, ©));
|
||||
free_stop_indication(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
|
||||
nfapi_nr_stop_indication_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION};
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_stop_indication(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_stop_request_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
|
||||
void test_pack_unpack(nfapi_nr_stop_request_scf_t *req)
|
||||
{
|
||||
uint8_t msg_buf[65535];
|
||||
uint16_t msg_len = sizeof(*req);
|
||||
// first test the packing procedure
|
||||
int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL);
|
||||
// STOP.request message body length is 0
|
||||
DevAssert(pack_result == 0 + NFAPI_HEADER_LENGTH);
|
||||
// update req message_length value with value calculated in message_pack procedure
|
||||
req->header.message_length = pack_result - NFAPI_HEADER_LENGTH;
|
||||
// test the unpacking of the header
|
||||
// copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK
|
||||
fapi_message_header_t header;
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
for (int idx = 0; idx < header_buffer_size; idx++) {
|
||||
header_buffer[idx] = msg_buf[idx];
|
||||
}
|
||||
uint8_t *pReadPackedMessage = header_buffer;
|
||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||
DevAssert(unpack_header_result >= 0);
|
||||
DevAssert(header.message_id == req->header.message_id);
|
||||
DevAssert(header.message_length == req->header.message_length);
|
||||
// test the unpacking and compare with initial message
|
||||
nfapi_nr_stop_request_scf_t unpacked_req = {0};
|
||||
int unpack_result =
|
||||
fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL);
|
||||
DevAssert(unpack_result >= 0);
|
||||
DevAssert(eq_stop_request(&unpacked_req, req));
|
||||
free_stop_request(&unpacked_req);
|
||||
}
|
||||
|
||||
void test_copy(const nfapi_nr_stop_request_scf_t *msg)
|
||||
{
|
||||
// Test copy function
|
||||
nfapi_nr_stop_request_scf_t copy = {0};
|
||||
copy_stop_request(msg, ©);
|
||||
DevAssert(eq_stop_request(msg, ©));
|
||||
free_stop_request(©);
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
|
||||
nfapi_nr_stop_request_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST};
|
||||
// Perform tests
|
||||
test_pack_unpack(&req);
|
||||
test_copy(&req);
|
||||
// All tests successful!
|
||||
free_stop_request(&req);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
set(Test_Labels fapi p7)
|
||||
set(_fapi_p7_messages "dci_inversion")
|
||||
foreach (fapi_p7_message IN LISTS _fapi_p7_messages)
|
||||
add_executable(nr_fapi_${fapi_p7_message}_test nr_fapi_${fapi_p7_message}_test.c)
|
||||
target_link_libraries(nr_fapi_${fapi_p7_message}_test PUBLIC nr_fapi_p5)
|
||||
target_link_libraries(nr_fapi_${fapi_p7_message}_test PRIVATE pthread UTIL ${T_LIB} minimal_lib)
|
||||
add_dependencies(tests nr_fapi_${fapi_p7_message}_test)
|
||||
|
||||
add_test(nr_fapi_${fapi_p7_message}_test nr_fapi_${fapi_p7_message}_test)
|
||||
set_tests_properties(nr_fapi_${fapi_p7_message}_test PROPERTIES LABELS "${Test_Labels}")
|
||||
endforeach ()
|
||||
# Add the dci label for the dci payload test
|
||||
set(dci_labels dci ${Test_Labels})
|
||||
set_tests_properties(nr_fapi_dci_inversion_test PROPERTIES LABELS "dci ${Test_Labels}")
|
||||
# Add the FAPI_BYTE_ORDERING_BIG_ENDIAN preprocessor define in order to test the invert/uninvert dci payload functions
|
||||
target_compile_definitions(nfapi_common PRIVATE FAPI_BYTE_ORDERING_BIG_ENDIAN)
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
|
||||
*
|
||||
* 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.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
/*! \file nfapi/tests/p5/nr_fapi_param_request_test.c
|
||||
* \brief
|
||||
* \author Ruben S. Silva
|
||||
* \date 2024
|
||||
* \version 0.1
|
||||
* \company OpenAirInterface Software Alliance
|
||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "nfapi/tests/nr_fapi_test.h"
|
||||
#include "nr_fapi_p5.h"
|
||||
#include "nr_fapi.h"
|
||||
void printbits(uint64_t n, uint8_t numBytesToPrint)
|
||||
{
|
||||
uint64_t i;
|
||||
uint8_t counter = 0;
|
||||
if (numBytesToPrint == 0) {
|
||||
i = 1UL << (sizeof(n) * 8 - 1);
|
||||
} else {
|
||||
i = 1UL << (numBytesToPrint * 8 - 1);
|
||||
}
|
||||
while (i > 0) {
|
||||
if (n & i)
|
||||
printf("1");
|
||||
else
|
||||
printf("0");
|
||||
i >>= 1;
|
||||
counter++;
|
||||
if (counter % 8 == 0) {
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Drops unwanted bits from a byte array, leaving only a specified number of payload bits
|
||||
*
|
||||
* \param payloadSizeBits How many bits the payload is to have, from 1 to 64 (8 * DCI_PAYLOAD_BYTE_LEN)
|
||||
* \param payload[] A uint8_t array containing the payload bytes with random data
|
||||
* \details This function creates a bitmask of payloadSizeBits width to truncate the data in payload[] to only have the specified
|
||||
* number of payload bits\n
|
||||
* For example, a payload of 39 bits needs 5 bytes, but on the last byte, the last bit is unused, this function makes sure that
|
||||
* last bit is set to 0, allowing the payload to be then packed and unpacked and successfully compared with the original payload
|
||||
*/
|
||||
void truncate_unwanted_bits(uint8_t payloadSizeBits, uint8_t payload[])
|
||||
{
|
||||
uint8_t payloadSizeBytes = (payloadSizeBits + 7) / 8;
|
||||
printf("Original Value:\t");
|
||||
uint64_t t = 0;
|
||||
memcpy(&t, payload, payloadSizeBytes);
|
||||
printbits(t, payloadSizeBytes);
|
||||
printf("\n");
|
||||
uint64_t bitmask = 1;
|
||||
for (int i = 0; i < payloadSizeBits - 1; i++) {
|
||||
bitmask = bitmask << 1 | 1;
|
||||
}
|
||||
printf("Calculated Bitmask:\t");
|
||||
printbits(bitmask, payloadSizeBytes);
|
||||
printf("\n");
|
||||
t = t & bitmask;
|
||||
printf("Truncated Value:\t");
|
||||
printbits(t, payloadSizeBytes);
|
||||
printf("\n");
|
||||
memcpy(payload, &t, payloadSizeBytes);
|
||||
}
|
||||
|
||||
/*! \brief Generates a random payload payloadSizeBits long into payload[]
|
||||
*
|
||||
* \param payloadSizeBits How many bits the payload is to have, from 1 to 64 (8 * DCI_PAYLOAD_BYTE_LEN)
|
||||
* \param payload[] A uint8_t array to contain the generated payload
|
||||
* \details This function fills a uint8_t array with payloadSizeBits of random data, by first filling however many bytes are needed
|
||||
* to contain payloadSizeBits with random data, and then truncating the excess bits
|
||||
*/
|
||||
void generate_payload(uint8_t payloadSizeBits, uint8_t payload[])
|
||||
{
|
||||
for (int i = 0; i < (payloadSizeBits + 7) / 8; ++i) {
|
||||
payload[i] = rand8();
|
||||
}
|
||||
truncate_unwanted_bits(payloadSizeBits, payload);
|
||||
}
|
||||
|
||||
void test_pack_payload(uint8_t payloadSizeBits, uint8_t payload[])
|
||||
{
|
||||
uint8_t msg_buf[8192] = {0};
|
||||
uint8_t payloadSizeBytes = (payloadSizeBits + 7) / 8;
|
||||
uint8_t *pWritePackedMessage = msg_buf;
|
||||
uint8_t *pPackMessageEnd = msg_buf + sizeof(msg_buf);
|
||||
|
||||
pack_dci_payload(payload, payloadSizeBits, &pWritePackedMessage, pPackMessageEnd);
|
||||
|
||||
uint8_t unpack_buf[payloadSizeBytes];
|
||||
pWritePackedMessage = msg_buf;
|
||||
unpack_dci_payload(unpack_buf, payloadSizeBits, &pWritePackedMessage, pPackMessageEnd);
|
||||
|
||||
printf("\nOriginal:\t");
|
||||
for (int j = payloadSizeBytes - 1; j >= 0; j--) {
|
||||
printbits(payload[j], 1);
|
||||
printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("Unpacked:\t");
|
||||
for (int j = payloadSizeBytes - 1; j >= 0; j--) {
|
||||
printbits(unpack_buf[j], 1);
|
||||
printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
DevAssert(memcmp(payload, unpack_buf, payloadSizeBytes) == 0);
|
||||
// All tests successful!
|
||||
}
|
||||
|
||||
int main(int n, char *v[])
|
||||
{
|
||||
fapi_test_init();
|
||||
uint8_t upper = 8 * DCI_PAYLOAD_BYTE_LEN;
|
||||
uint8_t lower = 1;
|
||||
uint8_t payloadSizeBits = (rand() % (upper - lower + 1)) + lower; // from 1 bit to DCI_PAYLOAD_BYTE_LEN, in bits
|
||||
printf("payloadSizeBits:%d\n", payloadSizeBits);
|
||||
uint8_t payload[(payloadSizeBits + 7) / 8];
|
||||
|
||||
generate_payload(payloadSizeBits, payload);
|
||||
test_pack_payload(payloadSizeBits, payload);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user