Commit 4d4eb6c8 authored by Rúben Soares da Silva's avatar Rúben Soares da Silva Committed by Rúben Soares Silva

Move nFAPI functions that are used by both NR and LTE into nfapi.c

Co-authored-by: default avatarRobert Schmidt <robert.schmidt@openairinterface.org>
parent 69962ef9
...@@ -136,6 +136,50 @@ int unpack_nr_p7_tlv_list(unpack_p7_tlv_t unpack_fns[], ...@@ -136,6 +136,50 @@ int unpack_nr_p7_tlv_list(unpack_p7_tlv_t unpack_fns[],
nfapi_p7_codec_config_t *config, nfapi_p7_codec_config_t *config,
nfapi_tl_t **ve); 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) #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -1176,3 +1176,327 @@ uint8_t get_tlv_padding(uint16_t tlv_length) ...@@ -1176,3 +1176,327 @@ uint8_t get_tlv_padding(uint16_t tlv_length)
{ {
return (4 - (tlv_length % 4)) % 4; return (4 - (tlv_length % 4)) % 4;
} }
uint8_t pack_pnf_param_general_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_pnf_param_general_t *value = (nfapi_pnf_param_general_t *)tlv;
return push8(value->nfapi_sync_mode, ppWritePackedMsg, end)
&& push8(value->location_mode, ppWritePackedMsg, end)
&& push16(value->location_coordinates_length, ppWritePackedMsg, end)
&& pusharray8(value->location_coordinates,
NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH,
value->location_coordinates_length,
ppWritePackedMsg,
end)
&& push32(value->dl_config_timing, ppWritePackedMsg, end)
&& push32(value->tx_timing, ppWritePackedMsg, end)
&& push32(value->ul_config_timing, ppWritePackedMsg, end)
&& push32(value->hi_dci0_timing, ppWritePackedMsg, end)
&& push16(value->maximum_number_phys, ppWritePackedMsg, end)
&& push16(value->maximum_total_bandwidth, ppWritePackedMsg, end)
&& push8(value->maximum_total_number_dl_layers, ppWritePackedMsg, end)
&& push8(value->maximum_total_number_ul_layers, ppWritePackedMsg, end)
&& push8(value->shared_bands, ppWritePackedMsg, end)
&& push8(value->shared_pa, ppWritePackedMsg, end)
&& pushs16(value->maximum_total_power, ppWritePackedMsg, end)
&& pusharray8(value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, ppWritePackedMsg, end);
}
uint8_t unpack_pnf_param_general_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_pnf_param_general_t *value = (nfapi_pnf_param_general_t *)tlv;
return pull8(ppReadPackedMsg, &value->nfapi_sync_mode, end)
&& pull8(ppReadPackedMsg, &value->location_mode, end)
&& pull16(ppReadPackedMsg, &value->location_coordinates_length, end)
&& pullarray8(ppReadPackedMsg,
value->location_coordinates,
NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH,
value->location_coordinates_length,
end)
&& pull32(ppReadPackedMsg, &value->dl_config_timing, end)
&& pull32(ppReadPackedMsg, &value->tx_timing, end)
&& pull32(ppReadPackedMsg, &value->ul_config_timing, end)
&& pull32(ppReadPackedMsg, &value->hi_dci0_timing, end)
&& pull16(ppReadPackedMsg, &value->maximum_number_phys, end)
&& pull16(ppReadPackedMsg, &value->maximum_total_bandwidth, end)
&& pull8(ppReadPackedMsg, &value->maximum_total_number_dl_layers, end)
&& pull8(ppReadPackedMsg, &value->maximum_total_number_ul_layers, end)
&& pull8(ppReadPackedMsg, &value->shared_bands, end)
&& pull8(ppReadPackedMsg, &value->shared_pa, end)
&& pulls16(ppReadPackedMsg, &value->maximum_total_power, end)
&& pullarray8(ppReadPackedMsg, value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, end);
}
uint8_t pack_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_rf_config_info_t *rf = (nfapi_rf_config_info_t *)elem;
return push16(rf->rf_config_index, ppWritePackedMsg, end);
}
uint8_t unpack_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_rf_config_info_t *info = (nfapi_rf_config_info_t *)elem;
return pull16(ppReadPackedMsg, &info->rf_config_index, end);
}
uint8_t pack_pnf_phy_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_pnf_phy_info_t *phy = (nfapi_pnf_phy_info_t *)elem;
return push16(phy->phy_config_index, ppWritePackedMsg, end)
&& push16(phy->number_of_rfs, ppWritePackedMsg, end)
&& packarray(phy->rf_config,
sizeof(nfapi_rf_config_info_t),
NFAPI_MAX_PNF_PHY_RF_CONFIG,
phy->number_of_rfs,
ppWritePackedMsg,
end,
&pack_rf_config_info)
&& push16(phy->number_of_rf_exclusions, ppWritePackedMsg, end)
&& packarray(phy->excluded_rf_config,
sizeof(nfapi_rf_config_info_t),
NFAPI_MAX_PNF_PHY_RF_CONFIG,
phy->number_of_rf_exclusions,
ppWritePackedMsg,
end,
&pack_rf_config_info)
&& push16(phy->downlink_channel_bandwidth_supported, ppWritePackedMsg, end)
&& push16(phy->uplink_channel_bandwidth_supported, ppWritePackedMsg, end)
&& push8(phy->number_of_dl_layers_supported, ppWritePackedMsg, end)
&& push8(phy->number_of_ul_layers_supported, ppWritePackedMsg, end)
&& push16(phy->maximum_3gpp_release_supported, ppWritePackedMsg, end)
&& push8(phy->nmm_modes_supported, ppWritePackedMsg, end);
}
uint8_t unpack_pnf_phy_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_pnf_phy_info_t *phy = (nfapi_pnf_phy_info_t *)elem;
return pull16(ppReadPackedMsg, &phy->phy_config_index, end)
&& pull16(ppReadPackedMsg, &phy->number_of_rfs, end)
&& unpackarray(ppReadPackedMsg,
phy->rf_config,
sizeof(nfapi_rf_config_info_t),
NFAPI_MAX_PNF_PHY_RF_CONFIG,
phy->number_of_rfs,
end,
&unpack_rf_config_info)
&& pull16(ppReadPackedMsg, &phy->number_of_rf_exclusions, end)
&& unpackarray(ppReadPackedMsg,
phy->excluded_rf_config,
sizeof(nfapi_rf_config_info_t),
NFAPI_MAX_PNF_PHY_RF_CONFIG,
phy->number_of_rf_exclusions,
end,
&unpack_rf_config_info)
&& pull16(ppReadPackedMsg, &phy->downlink_channel_bandwidth_supported, end)
&& pull16(ppReadPackedMsg, &phy->uplink_channel_bandwidth_supported, end)
&& pull8(ppReadPackedMsg, &phy->number_of_dl_layers_supported, end)
&& pull8(ppReadPackedMsg, &phy->number_of_ul_layers_supported, end)
&& pull16(ppReadPackedMsg, &phy->maximum_3gpp_release_supported, end)
&& pull8(ppReadPackedMsg, &phy->nmm_modes_supported, end);
}
uint8_t pack_pnf_phy_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_pnf_phy_t *value = (nfapi_pnf_phy_t *)tlv;
return push16(value->number_of_phys, ppWritePackedMsg, end)
&& packarray(value->phy,
sizeof(nfapi_pnf_phy_info_t),
NFAPI_MAX_PNF_PHY,
value->number_of_phys,
ppWritePackedMsg,
end,
&pack_pnf_phy_info);
}
uint8_t unpack_pnf_phy_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_pnf_phy_t *value = (nfapi_pnf_phy_t *)tlv;
return pull16(ppReadPackedMsg, &value->number_of_phys, end)
&& unpackarray(ppReadPackedMsg,
value->phy,
sizeof(nfapi_pnf_phy_info_t),
NFAPI_MAX_PNF_PHY,
value->number_of_phys,
end,
&unpack_pnf_phy_info);
}
uint8_t pack_phy_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_phy_rf_config_info_t *rf = (nfapi_phy_rf_config_info_t *)elem;
return push16(rf->phy_id, ppWritePackedMsg, end)
&& push16(rf->phy_config_index, ppWritePackedMsg, end)
&& push16(rf->rf_config_index, ppWritePackedMsg, end);
}
uint8_t unpack_phy_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_phy_rf_config_info_t *rf = (nfapi_phy_rf_config_info_t *)elem;
return pull16(ppReadPackedMsg, &rf->phy_id, end)
&& pull16(ppReadPackedMsg, &rf->phy_config_index, end)
&& pull16(ppReadPackedMsg, &rf->rf_config_index, end);
}
uint8_t pack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t *)tlv;
return push16(value->number_phy_rf_config_info, ppWritePackedMsg, end)
&& packarray(value->phy_rf_config,
sizeof(nfapi_phy_rf_config_info_t),
NFAPI_MAX_PHY_RF_INSTANCES,
value->number_phy_rf_config_info,
ppWritePackedMsg,
end,
&pack_phy_rf_config_info);
}
uint8_t unpack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t *)tlv;
return pull16(ppReadPackedMsg, &value->number_phy_rf_config_info, end)
&& unpackarray(ppReadPackedMsg,
value->phy_rf_config,
sizeof(nfapi_phy_rf_config_info_t),
NFAPI_MAX_PHY_RF_INSTANCES,
value->number_phy_rf_config_info,
end,
&unpack_phy_rf_config_info);
}
uint8_t pack_ipv4_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
return pusharray8(value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, ppWritePackedMsg, end);
}
uint8_t unpack_ipv4_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, end);
}
uint8_t pack_ipv6_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_ipv6_address_t *value = (nfapi_ipv6_address_t *)tlv;
return pusharray8(value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, ppWritePackedMsg, end);
}
uint8_t unpack_ipv6_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, end);
}
uint8_t pack_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
{
nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t *)msg;
return push32(pNfapiMsg->error_code, ppWritePackedMsg, end)
&& pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
}
uint8_t unpack_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{
nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t *)msg;
return pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end)
&& unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
}
uint8_t pack_measurement_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
{
nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t *)msg;
return pack_tlv(NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG,
&(pNfapiMsg->dl_rs_tx_power),
ppWritePackedMsg,
end,
&pack_uint16_tlv_value)
&& pack_tlv(NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG,
&(pNfapiMsg->received_interference_power),
ppWritePackedMsg,
end,
&pack_uint16_tlv_value)
&& pack_tlv(NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG,
&(pNfapiMsg->thermal_noise_power),
ppWritePackedMsg,
end,
&pack_uint16_tlv_value)
&& pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
}
uint8_t unpack_measurement_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{
nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t *)msg;
unpack_tlv_t unpack_fns[] = {
{NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &pNfapiMsg->dl_rs_tx_power, &unpack_uint16_tlv_value},
{NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG,
&pNfapiMsg->received_interference_power,
&unpack_uint16_tlv_value},
{NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &pNfapiMsg->thermal_noise_power, &unpack_uint16_tlv_value},
};
return unpack_tlv_list(unpack_fns,
sizeof(unpack_fns) / sizeof(unpack_tlv_t),
ppReadPackedMsg,
end,
config,
&(pNfapiMsg->vendor_extension));
}
uint8_t pack_uint32_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_uint32_tlv_t *value = (nfapi_uint32_tlv_t *)tlv;
return push32(value->value, ppWritePackedMsg, end);
}
uint8_t unpack_uint32_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_uint32_tlv_t *value = (nfapi_uint32_tlv_t *)tlv;
return pull32(ppReadPackedMsg, &value->value, end);
}
uint8_t pack_uint16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_uint16_tlv_t *value = (nfapi_uint16_tlv_t *)tlv;
return push16(value->value, ppWritePackedMsg, end);
}
uint8_t unpack_uint16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_uint16_tlv_t *value = (nfapi_uint16_tlv_t *)tlv;
return pull16(ppReadPackedMsg, &value->value, end);
}
uint8_t pack_int16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_int16_tlv_t *value = (nfapi_int16_tlv_t *)tlv;
return pushs16(value->value, ppWritePackedMsg, end);
}
uint8_t unpack_int16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_int16_tlv_t *value = (nfapi_int16_tlv_t *)tlv;
return pulls16(ppReadPackedMsg, &value->value, end);
}
uint8_t pack_uint8_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_uint8_tlv_t *value = (nfapi_uint8_tlv_t *)tlv;
return push8(value->value, ppWritePackedMsg, end);
}
uint8_t unpack_uint8_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_uint8_tlv_t *value = (nfapi_uint8_tlv_t *)tlv;
return pull8(ppReadPackedMsg, &value->value, end);
}
// helper function for message length calculation -
// takes the pointers to the start of message to end of message
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 %p, %p\n", &msgHead, &msgEnd);
return 0;
}
return msgEnd - msgHead;
}
...@@ -27,15 +27,6 @@ ...@@ -27,15 +27,6 @@
#include <nfapi.h> #include <nfapi.h>
#include <debug.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) { 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; nfapi_opaqaue_data_t *value = (nfapi_opaqaue_data_t *)tlv;
return pusharray8(value->value, NFAPI_MAX_OPAQUE_DATA, value->length, ppWritePackedMsg, end); return pusharray8(value->value, NFAPI_MAX_OPAQUE_DATA, value->length, ppWritePackedMsg, end);
......
...@@ -51,53 +51,6 @@ static uint8_t pack_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uin ...@@ -51,53 +51,6 @@ static uint8_t pack_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uin
return pack_vendor_extension_tlv(request->vendor_extension, ppWritePackedMsg, end, config); return pack_vendor_extension_tlv(request->vendor_extension, ppWritePackedMsg, end, config);
} }
static uint8_t pack_pnf_param_general_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_pnf_param_general_t *value = (nfapi_pnf_param_general_t *)tlv;
return ( push8(value->nfapi_sync_mode, ppWritePackedMsg, end) &&
push8(value->location_mode, ppWritePackedMsg, end) &&
push16(value->location_coordinates_length, ppWritePackedMsg, end) &&
pusharray8(value->location_coordinates, NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH, value->location_coordinates_length, ppWritePackedMsg, end) &&
push32(value->dl_config_timing, ppWritePackedMsg, end) &&
push32(value->tx_timing, ppWritePackedMsg, end) &&
push32(value->ul_config_timing, ppWritePackedMsg, end) &&
push32(value->hi_dci0_timing, ppWritePackedMsg, end) &&
push16(value->maximum_number_phys, ppWritePackedMsg, end) &&
push16(value->maximum_total_bandwidth, ppWritePackedMsg, end) &&
push8(value->maximum_total_number_dl_layers, ppWritePackedMsg, end) &&
push8(value->maximum_total_number_ul_layers, ppWritePackedMsg, end) &&
push8(value->shared_bands, ppWritePackedMsg, end) &&
push8(value->shared_pa, ppWritePackedMsg, end) &&
pushs16(value->maximum_total_power, ppWritePackedMsg, end) &&
pusharray8(value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, ppWritePackedMsg, end));
}
static uint8_t pack_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_rf_config_info_t *rf = (nfapi_rf_config_info_t *)elem;
return (push16(rf->rf_config_index, ppWritePackedMsg, end));
}
static uint8_t pack_pnf_phy_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_pnf_phy_info_t *phy = (nfapi_pnf_phy_info_t *)elem;
return ( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
push16(phy->number_of_rfs, ppWritePackedMsg, end) &&
packarray(phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, ppWritePackedMsg, end, &pack_rf_config_info) &&
push16(phy->number_of_rf_exclusions, ppWritePackedMsg, end) &&
packarray(phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, ppWritePackedMsg, end, &pack_rf_config_info) &&
push16(phy->downlink_channel_bandwidth_supported, ppWritePackedMsg, end) &&
push16(phy->uplink_channel_bandwidth_supported, ppWritePackedMsg, end) &&
push8(phy->number_of_dl_layers_supported, ppWritePackedMsg, end) &&
push8(phy->number_of_ul_layers_supported, ppWritePackedMsg, end) &&
push16(phy->maximum_3gpp_release_supported, ppWritePackedMsg, end) &&
push8(phy->nmm_modes_supported, ppWritePackedMsg, end));
}
static uint8_t pack_pnf_phy_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_pnf_phy_t *value = (nfapi_pnf_phy_t *)tlv;
return ( push16(value->number_of_phys, ppWritePackedMsg, end) &&
packarray(value->phy, sizeof(nfapi_pnf_phy_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_info));
}
static uint8_t pack_pnf_rf_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) { static uint8_t pack_pnf_rf_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_pnf_rf_t *value = (nfapi_pnf_rf_t *)tlv; nfapi_pnf_rf_t *value = (nfapi_pnf_rf_t *)tlv;
uint16_t rf_index = 0; uint16_t rf_index = 0;
...@@ -241,21 +194,6 @@ static uint8_t pack_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, ui ...@@ -241,21 +194,6 @@ static uint8_t pack_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, ui
pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
} }
static uint8_t pack_phy_rf_config_info(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_phy_rf_config_info_t *rf = (nfapi_phy_rf_config_info_t *)elem;
return (push16(rf->phy_id, ppWritePackedMsg, end) &&
push16(rf->phy_config_index, ppWritePackedMsg, end) &&
push16(rf->rf_config_index, ppWritePackedMsg, end));
}
static uint8_t pack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t *)tlv;
return(push16(value->number_phy_rf_config_info, ppWritePackedMsg, end) &&
packarray(value->phy_rf_config, sizeof(nfapi_phy_rf_config_info_t), NFAPI_MAX_PHY_RF_INSTANCES, value->number_phy_rf_config_info, ppWritePackedMsg, end, &pack_phy_rf_config_info));
}
static uint8_t pack_nr_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) static uint8_t pack_nr_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
{ {
nfapi_nr_pnf_config_request_t *pNfapiMsg = (nfapi_nr_pnf_config_request_t *)msg; nfapi_nr_pnf_config_request_t *pNfapiMsg = (nfapi_nr_pnf_config_request_t *)msg;
...@@ -345,68 +283,12 @@ static uint8_t pack_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t ...@@ -345,68 +283,12 @@ static uint8_t pack_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t
return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
} }
static uint8_t pack_uint32_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_uint32_tlv_t *value = (nfapi_uint32_tlv_t *)tlv;
return push32(value->value, ppWritePackedMsg, end);
}
static uint8_t unpack_uint32_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_uint32_tlv_t *value = (nfapi_uint32_tlv_t *)tlv;
return pull32(ppReadPackedMsg, &value->value, end);
}
static uint8_t pack_uint16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_uint16_tlv_t *value = (nfapi_uint16_tlv_t *)tlv;
return push16(value->value, ppWritePackedMsg, end);
}
static uint8_t unpack_uint16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_uint16_tlv_t *value = (nfapi_uint16_tlv_t *)tlv;
return pull16(ppReadPackedMsg, &value->value, end);
}
static uint8_t pack_int16_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_int16_tlv_t *value = (nfapi_int16_tlv_t *)tlv;
return pushs16(value->value, ppWritePackedMsg, end);
}
static uint8_t unpack_int16_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_int16_tlv_t *value = (nfapi_int16_tlv_t *)tlv;
return pulls16(ppReadPackedMsg, &value->value, end);
}
static uint8_t pack_uint8_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_uint8_tlv_t *value = (nfapi_uint8_tlv_t *)tlv;
return push8(value->value, ppWritePackedMsg, end);
}
static uint8_t unpack_uint8_tlv_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_uint8_tlv_t *value = (nfapi_uint8_tlv_t *)tlv;
return pull8(ppReadPackedMsg, &value->value, end);
}
static uint8_t pack_ipv4_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
return pusharray8(value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, ppWritePackedMsg, end);
}
static uint8_t unpack_ipv4_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, end);
}
static uint8_t pack_ipv6_address_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_ipv6_address_t *value = (nfapi_ipv6_address_t *)tlv;
return pusharray8(value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, ppWritePackedMsg, end);
}
static uint8_t unpack_ipv6_address_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_ipv4_address_t *value = (nfapi_ipv4_address_t *)tlv;
return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, end);
}
static uint8_t pack_rf_bands_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) { static uint8_t pack_rf_bands_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_rf_bands_t *value = (nfapi_rf_bands_t *)tlv; nfapi_rf_bands_t *value = (nfapi_rf_bands_t *)tlv;
return ( push16(value->number_rf_bands, ppWritePackedMsg, end) && return ( push16(value->number_rf_bands, ppWritePackedMsg, end) &&
pusharray16(value->rf_band, NFAPI_MAX_NUM_RF_BANDS, value->number_rf_bands, ppWritePackedMsg, end)); pusharray16(value->rf_band, NFAPI_MAX_NUM_RF_BANDS, value->number_rf_bands, ppWritePackedMsg, end));
} }
static uint8_t unpack_rf_bands_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_rf_bands_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_rf_bands_t *value = (nfapi_rf_bands_t *)tlv; nfapi_rf_bands_t *value = (nfapi_rf_bands_t *)tlv;
return ( pull16(ppReadPackedMsg, &value->number_rf_bands, end) && return ( pull16(ppReadPackedMsg, &value->number_rf_bands, end) &&
...@@ -418,11 +300,13 @@ static uint8_t pack_nmm_frequency_bands_value(void *tlv, uint8_t **ppWritePacked ...@@ -418,11 +300,13 @@ static uint8_t pack_nmm_frequency_bands_value(void *tlv, uint8_t **ppWritePacked
return( push16(value->number_of_rf_bands, ppWritePackedMsg, end) && return( push16(value->number_of_rf_bands, ppWritePackedMsg, end) &&
pusharray16(value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, ppWritePackedMsg, end)); pusharray16(value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, ppWritePackedMsg, end));
} }
static uint8_t unpack_nmm_frequency_bands_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_nmm_frequency_bands_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_nmm_frequency_bands_t *value = (nfapi_nmm_frequency_bands_t *)tlv; nfapi_nmm_frequency_bands_t *value = (nfapi_nmm_frequency_bands_t *)tlv;
return ( pull16(ppReadPackedMsg, &value->number_of_rf_bands, end) && return ( pull16(ppReadPackedMsg, &value->number_of_rf_bands, end) &&
pullarray16(ppReadPackedMsg, value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, end)); pullarray16(ppReadPackedMsg, value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, end));
} }
static uint8_t pack_embms_mbsfn_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) { static uint8_t pack_embms_mbsfn_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_embms_mbsfn_config_t *value = (nfapi_embms_mbsfn_config_t *)tlv; nfapi_embms_mbsfn_config_t *value = (nfapi_embms_mbsfn_config_t *)tlv;
return ( push16(value->num_mbsfn_config, ppWritePackedMsg, end) && return ( push16(value->num_mbsfn_config, ppWritePackedMsg, end) &&
...@@ -2003,26 +1887,11 @@ static uint8_t pack_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_ ...@@ -2003,26 +1887,11 @@ static uint8_t pack_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_
pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) ); pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
} }
static uint8_t pack_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) { static uint8_t pack_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
nfapi_stop_request_t *pNfapiMsg = (nfapi_stop_request_t *)msg; nfapi_stop_request_t *pNfapiMsg = (nfapi_stop_request_t *)msg;
return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
} }
static uint8_t pack_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t *)msg;
return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
}
static uint8_t pack_measurement_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t *)msg;
return( pack_tlv(NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &(pNfapiMsg->dl_rs_tx_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
pack_tlv(NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, &(pNfapiMsg->received_interference_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
pack_tlv(NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &(pNfapiMsg->thermal_noise_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
}
static uint8_t pack_recevied_interference_power_measurement_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) { static uint8_t pack_recevied_interference_power_measurement_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
nfapi_received_interference_power_measurement_t *value = (nfapi_received_interference_power_measurement_t *)tlv; nfapi_received_interference_power_measurement_t *value = (nfapi_received_interference_power_measurement_t *)tlv;
return ( push16(value->number_of_resource_blocks, ppWritePackedMsg, end) && return ( push16(value->number_of_resource_blocks, ppWritePackedMsg, end) &&
...@@ -2126,7 +1995,6 @@ static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uin ...@@ -2126,7 +1995,6 @@ static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uin
return result; return result;
} }
static uint8_t pack_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) { static uint8_t pack_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
uint8_t result = 0; uint8_t result = 0;
...@@ -2222,19 +2090,6 @@ static uint8_t pack_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_ ...@@ -2222,19 +2090,6 @@ static uint8_t pack_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_
return result; return result;
} }
// helper function for message length calculation -
// takes the pointers to the start of message to end of message
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 %p, %p\n", &msgHead, &msgEnd);
return 0;
}
return (msgEnd - msgHead);
}
// Main pack function - public // Main pack function - public
int nfapi_nr_p5_message_pack(void *pMessageBuf, int nfapi_nr_p5_message_pack(void *pMessageBuf,
...@@ -2332,8 +2187,6 @@ int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPack ...@@ -2332,8 +2187,6 @@ int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPack
} }
} }
// Unpack routines // Unpack routines
static uint8_t unpack_nr_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) static uint8_t unpack_nr_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
...@@ -2347,53 +2200,6 @@ static uint8_t unpack_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end ...@@ -2347,53 +2200,6 @@ static uint8_t unpack_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end
return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)); return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
} }
static uint8_t unpack_pnf_param_general_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_pnf_param_general_t *value = (nfapi_pnf_param_general_t *)tlv;
return( pull8(ppReadPackedMsg, &value->nfapi_sync_mode, end) &&
pull8(ppReadPackedMsg, &value->location_mode, end) &&
pull16(ppReadPackedMsg, &value->location_coordinates_length, end) &&
pullarray8(ppReadPackedMsg, value->location_coordinates, NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH, value->location_coordinates_length, end) &&
pull32(ppReadPackedMsg, &value->dl_config_timing, end) &&
pull32(ppReadPackedMsg, &value->tx_timing, end) &&
pull32(ppReadPackedMsg, &value->ul_config_timing, end) &&
pull32(ppReadPackedMsg, &value->hi_dci0_timing, end) &&
pull16(ppReadPackedMsg, &value->maximum_number_phys, end) &&
pull16(ppReadPackedMsg, &value->maximum_total_bandwidth, end) &&
pull8(ppReadPackedMsg, &value->maximum_total_number_dl_layers, end) &&
pull8(ppReadPackedMsg, &value->maximum_total_number_ul_layers, end) &&
pull8(ppReadPackedMsg, &value->shared_bands, end) &&
pull8(ppReadPackedMsg, &value->shared_pa, end) &&
pulls16(ppReadPackedMsg, &value->maximum_total_power, end) &&
pullarray8(ppReadPackedMsg, value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, end));
}
static uint8_t unpack_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_rf_config_info_t *info = (nfapi_rf_config_info_t *)elem;
return pull16(ppReadPackedMsg, &info->rf_config_index, end);
}
static uint8_t unpack_pnf_phy_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_pnf_phy_info_t *phy = (nfapi_pnf_phy_info_t *)elem;
return ( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
pull16(ppReadPackedMsg, &phy->number_of_rfs, end) &&
unpackarray(ppReadPackedMsg, phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, end, &unpack_rf_config_info) &&
pull16(ppReadPackedMsg, &phy->number_of_rf_exclusions, end) &&
unpackarray(ppReadPackedMsg, phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, end, &unpack_rf_config_info) &&
pull16(ppReadPackedMsg, &phy->downlink_channel_bandwidth_supported, end) &&
pull16(ppReadPackedMsg, &phy->uplink_channel_bandwidth_supported, end) &&
pull8(ppReadPackedMsg, &phy->number_of_dl_layers_supported, end) &&
pull8(ppReadPackedMsg, &phy->number_of_ul_layers_supported, end) &&
pull16(ppReadPackedMsg, &phy->maximum_3gpp_release_supported, end) &&
pull8(ppReadPackedMsg, &phy->nmm_modes_supported, end));
}
static uint8_t unpack_pnf_phy_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_pnf_phy_t *value = (nfapi_pnf_phy_t *)tlv;
return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_info));
}
static uint8_t unpack_pnf_rf_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_pnf_rf_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_pnf_rf_info_t *rf = (nfapi_pnf_rf_info_t *)elem; nfapi_pnf_rf_info_t *rf = (nfapi_pnf_rf_info_t *)elem;
return( pull16(ppReadPackedMsg, &rf->rf_config_index, end) && return( pull16(ppReadPackedMsg, &rf->rf_config_index, end) &&
...@@ -2406,6 +2212,7 @@ static uint8_t unpack_pnf_rf_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t ...@@ -2406,6 +2212,7 @@ static uint8_t unpack_pnf_rf_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t
pull32(ppReadPackedMsg, &rf->minimum_uplink_frequency, end) && pull32(ppReadPackedMsg, &rf->minimum_uplink_frequency, end) &&
pull32(ppReadPackedMsg, &rf->maximum_uplink_frequency, end)); pull32(ppReadPackedMsg, &rf->maximum_uplink_frequency, end));
} }
static uint8_t unpack_pnf_rf_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_pnf_rf_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_pnf_rf_t *value = (nfapi_pnf_rf_t *)tlv; nfapi_pnf_rf_t *value = (nfapi_pnf_rf_t *)tlv;
return ( pull16(ppReadPackedMsg, &value->number_of_rfs, end) && return ( pull16(ppReadPackedMsg, &value->number_of_rfs, end) &&
...@@ -2422,13 +2229,13 @@ static uint8_t unpack_pnf_phy_rel10_info(void *elem, uint8_t **ppReadPackedMsg, ...@@ -2422,13 +2229,13 @@ static uint8_t unpack_pnf_phy_rel10_info(void *elem, uint8_t **ppReadPackedMsg,
pull16(ppReadPackedMsg, &phy->simultaneous_pucch_pusch, end) && pull16(ppReadPackedMsg, &phy->simultaneous_pucch_pusch, end) &&
pull16(ppReadPackedMsg, &phy->four_layer_tx_with_tm3_and_tm4, end)); pull16(ppReadPackedMsg, &phy->four_layer_tx_with_tm3_and_tm4, end));
} }
static uint8_t unpack_pnf_phy_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_pnf_phy_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_pnf_phy_rel10_t *value = (nfapi_pnf_phy_rel10_t *)tlv; nfapi_pnf_phy_rel10_t *value = (nfapi_pnf_phy_rel10_t *)tlv;
return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) && return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel10_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel10_info)); unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel10_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel10_info));
} }
static uint8_t unpack_pnf_phy_rel11_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_pnf_phy_rel11_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_pnf_phy_rel11_info_t *phy = (nfapi_pnf_phy_rel11_info_t *)elem; nfapi_pnf_phy_rel11_info_t *phy = (nfapi_pnf_phy_rel11_info_t *)elem;
return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) && return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
...@@ -2536,20 +2343,6 @@ static uint8_t unpack_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t *end ...@@ -2536,20 +2343,6 @@ static uint8_t unpack_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t *end
unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
} }
static uint8_t unpack_phy_rf_config_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_phy_rf_config_info_t *rf = (nfapi_phy_rf_config_info_t *)elem;
return( pull16(ppReadPackedMsg, &rf->phy_id, end) &&
pull16(ppReadPackedMsg, &rf->phy_config_index, end) &&
pull16(ppReadPackedMsg, &rf->rf_config_index, end));
}
static uint8_t unpack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t *)tlv;
return ( pull16(ppReadPackedMsg, &value->number_phy_rf_config_info, end) &&
unpackarray(ppReadPackedMsg, value->phy_rf_config, sizeof(nfapi_phy_rf_config_info_t), NFAPI_MAX_PHY_RF_INSTANCES, value->number_phy_rf_config_info, end, &unpack_phy_rf_config_info));
}
static uint8_t unpack_nr_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) static uint8_t unpack_nr_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{ {
nfapi_nr_pnf_config_request_t *pNfapiMsg = (nfapi_nr_pnf_config_request_t *)msg; nfapi_nr_pnf_config_request_t *pNfapiMsg = (nfapi_nr_pnf_config_request_t *)msg;
...@@ -2598,7 +2391,6 @@ static uint8_t unpack_pnf_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, ...@@ -2598,7 +2391,6 @@ static uint8_t unpack_pnf_start_request(uint8_t **ppReadPackedMsg, uint8_t *end,
return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)); return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
} }
static uint8_t unpack_pnf_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) { static uint8_t unpack_pnf_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
nfapi_pnf_start_response_t *pNfapiMsg = (nfapi_pnf_start_response_t *)msg; nfapi_pnf_start_response_t *pNfapiMsg = (nfapi_pnf_start_response_t *)msg;
return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end ) && return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end ) &&
...@@ -3464,28 +3256,12 @@ static uint8_t unpack_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void ...@@ -3464,28 +3256,12 @@ static uint8_t unpack_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void
return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)); return unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
} }
static uint8_t unpack_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t *)msg;
return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
}
static uint8_t unpack_measurement_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t *)msg;
unpack_tlv_t unpack_fns[] = {
{ NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &pNfapiMsg->dl_rs_tx_power, &unpack_uint16_tlv_value},
{ NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, &pNfapiMsg->received_interference_power, &unpack_uint16_tlv_value},
{ NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &pNfapiMsg->thermal_noise_power, &unpack_uint16_tlv_value},
};
return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
}
static uint8_t unpack_received_interference_power_measurement_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_received_interference_power_measurement_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_received_interference_power_measurement_t *value = (nfapi_received_interference_power_measurement_t *)tlv; nfapi_received_interference_power_measurement_t *value = (nfapi_received_interference_power_measurement_t *)tlv;
return ( pull16(ppReadPackedMsg, &value->number_of_resource_blocks, end) && return ( pull16(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
pullarrays16(ppReadPackedMsg, value->received_interference_power, NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS, value->number_of_resource_blocks, end)); pullarrays16(ppReadPackedMsg, value->received_interference_power, NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS, value->number_of_resource_blocks, end));
} }
static uint8_t unpack_measurement_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) { static uint8_t unpack_measurement_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
nfapi_measurement_response_t *pNfapiMsg = (nfapi_measurement_response_t *)msg; nfapi_measurement_response_t *pNfapiMsg = (nfapi_measurement_response_t *)msg;
unpack_tlv_t unpack_fns[] = { unpack_tlv_t unpack_fns[] = {
...@@ -3607,7 +3383,6 @@ static int check_nr_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpack ...@@ -3607,7 +3383,6 @@ static int check_nr_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpack
return retLen; return retLen;
} }
static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) { static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) {
int retLen = 0; int retLen = 0;
...@@ -3728,7 +3503,6 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen ...@@ -3728,7 +3503,6 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
return retLen; return retLen;
} }
// Main unpack functions - public // Main unpack functions - public
int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) { int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment