Separate LTE and NR (n)FAPI headers
Update NR P5 and P7 nFAPI headers to have 32-bit message_length In the NR functions, this causes the header parameters following message_length to have their position shifted by 2 bytes, due to the increase in message_length size. Change needed to accommodate SCF222.10.02 Table 3-3 Separates nfapi_p4_p5_message_header_t and nfapi_nr_p4_p5_message_header_t Change the callbacks signature to accept/return void* intead of expecting a particular header type, being the NR/LTE distinction done inside the callback functions. Create NR related functions for nFAPI transmit timestamp and checksum calculation. Move nfapi_p7_codec_config_t and nfapi_p4_p5_codec_config_t to separate header to be shared between LTE and NR VNF/PNF Move nfapi_nr_timing_info_t into NR header. Move NR specific function declarations to NR header.
This commit is contained in:
committed by
Robert Schmidt
parent
434a6b5e84
commit
4e5b841a16
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef NFAPI_COMMON_INTERFACE_H
|
||||
#define NFAPI_COMMON_INTERFACE_H
|
||||
|
||||
typedef struct {
|
||||
uint16_t tag;
|
||||
uint16_t length;
|
||||
} nfapi_tl_t;
|
||||
|
||||
/*! Configuration options for the p7 pack unpack functions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct nfapi_p7_codec_config {
|
||||
/*! Optional call back to allow the user to define the memory allocator.
|
||||
* \param size The size of the memory to allocate
|
||||
* \return a pointer to a valid memory block or 0 if it has failed.
|
||||
*
|
||||
* If not set the nfapi unpack functions will use malloc
|
||||
*/
|
||||
void* (*allocate)(size_t size);
|
||||
|
||||
/*! Optional call back to allow the user to define the memory deallocator.
|
||||
* \param ptr A poiner to a memory block allocated by the allocate callback
|
||||
*
|
||||
* If not set the client should use free
|
||||
*/
|
||||
void (*deallocate)(void* ptr);
|
||||
|
||||
/*! Optional call back function to handle unpacking vendor extension tlv.
|
||||
* \param tl A pointer to a decoded tag length structure
|
||||
* \param ppReadPackedMsg A handle to the read buffer.
|
||||
* \param end The end of the read buffer
|
||||
* \param ve A handle to a vendor extention structure that the call back should allocate if the structure can be decoded
|
||||
* \param config A pointer to the p7 codec configuration
|
||||
* \return return 0 if packed successfully, -1 if failed.
|
||||
*
|
||||
* If not set the tlv will be skipped
|
||||
*
|
||||
* Client should use the help methods in nfapi.h to decode the vendor extention.
|
||||
*
|
||||
* \todo Add code example
|
||||
*/
|
||||
int (*unpack_vendor_extension_tlv)(nfapi_tl_t* tl,
|
||||
uint8_t** ppReadPackedMsg,
|
||||
uint8_t* end,
|
||||
void** ve,
|
||||
struct nfapi_p7_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle packing vendor extension tlv.
|
||||
* \param ve A pointer to a vendor extention structure.
|
||||
* \param ppWritePackedMsg A handle to the write buffer
|
||||
* \param end The end of the write buffer. The callee should make sure not to write beyond the end
|
||||
* \param config A pointer to the p7 codec configuration
|
||||
* \return return 0 if packed successfully, -1 if failed.
|
||||
*
|
||||
* If not set the the tlv will be skipped
|
||||
*
|
||||
* Client should use the help methods in nfapi.h to encode the vendor extention
|
||||
*
|
||||
* \todo Add code example
|
||||
*/
|
||||
int (*pack_vendor_extension_tlv)(void* ve, uint8_t** ppWritePackedMsg, uint8_t* end, struct nfapi_p7_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle unpacking vendor extension messages.
|
||||
* \param header A pointer to a decode P7 message header for the vendor extention message
|
||||
* \param ppReadPackedMsg A handle to the encoded data buffer
|
||||
* \param end A pointer to the end of the encoded data buffer
|
||||
* \param config A pointer to the p7 codec configuration
|
||||
* \return 0 if unpacked successfully, -1 if failed
|
||||
*
|
||||
* If not set the message will be ignored
|
||||
*
|
||||
* If the message if is unknown the function should return -1
|
||||
*/
|
||||
int (*unpack_p7_vendor_extension)(void* header, uint8_t** ppReadPackedMsg, uint8_t* end, struct nfapi_p7_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle packing vendor extension messages.
|
||||
* \param header A poiner to a P7 message structure for the venfor extention message
|
||||
* \param ppWritePackedmsg A handle to the buffer to write the encoded message into
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param cofig A pointer to the p7 codec configuration
|
||||
* \return 0 if packed successfully, -1 if failed
|
||||
*
|
||||
* If not set the the message will be ingored
|
||||
*
|
||||
* If the message if is unknown the function should return -1
|
||||
*/
|
||||
int (*pack_p7_vendor_extension)(void* header, uint8_t** ppWritePackedmsg, uint8_t* end, struct nfapi_p7_codec_config* config);
|
||||
|
||||
/*! Optional user data that will be passed back with callbacks
|
||||
*/
|
||||
void* user_data;
|
||||
|
||||
} nfapi_p7_codec_config_t;
|
||||
|
||||
/*! Configuration options for the p4 & p5 pack unpack functions
|
||||
*
|
||||
*/
|
||||
typedef struct nfapi_p4_p5_codec_config {
|
||||
/*! Optional call back to allow the user to define the memory allocator.
|
||||
* \param size The size of the memory to allocate
|
||||
* \return a pointer to a valid memory block or 0 if it has failed.
|
||||
*
|
||||
* If not set the nfapi unpack functions will use malloc
|
||||
*/
|
||||
void* (*allocate)(size_t size);
|
||||
|
||||
/*! Optional call back to allow the user to define the memory deallocator.
|
||||
* \param ptr A poiner to a memory block allocated by the allocate callback
|
||||
*
|
||||
* If not set free will be used
|
||||
*/
|
||||
void (*deallocate)(void* ptr);
|
||||
|
||||
/*! Optional call back function to handle unpacking vendor extension tlv.
|
||||
* \param tl A pointer to a decoded tag length structure
|
||||
* \param ppReadPackedMsg A handle to the data buffer to decode
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param ve A handle to a vendor extention structure that will be allocated by this callback
|
||||
* \param config A pointer to the P4/P5 codec configuration
|
||||
* \return 0 if unpacked successfully, -1 if failed
|
||||
*
|
||||
* If not set the tlv will be skipped
|
||||
*/
|
||||
int (*unpack_vendor_extension_tlv)(nfapi_tl_t* tl,
|
||||
uint8_t** ppReadPackedMsg,
|
||||
uint8_t* end,
|
||||
void** ve,
|
||||
struct nfapi_p4_p5_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle packing vendor extension tlv.
|
||||
* \param ve
|
||||
* \param ppWritePackedMsg A handle to the data buffer pack the tlv into
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param config A pointer to the P4/P5 codec configuration
|
||||
* \return 0 if packed successfully, -1 if failed
|
||||
*
|
||||
* If not set the the tlv will be skipped
|
||||
*/
|
||||
int (*pack_vendor_extension_tlv)(void* ve, uint8_t** ppWritePackedMsg, uint8_t* end, struct nfapi_p4_p5_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle unpacking vendor extension messages.
|
||||
* \param header A pointer to a decode P4/P5 message header
|
||||
* \param ppReadPackgedMsg A handle to the data buffer to decode
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param config A pointer to the P4/P5 codec configuration
|
||||
* \return 0 if packed successfully, -1 if failed
|
||||
*
|
||||
* If not set the message will be ignored
|
||||
*/
|
||||
int (*unpack_p4_p5_vendor_extension)(void* header,
|
||||
uint8_t** ppReadPackedMsg,
|
||||
uint8_t* end,
|
||||
struct nfapi_p4_p5_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle packing vendor extension messages.
|
||||
* \param header A pointer to the P4/P5 message header to be encoded
|
||||
* \param ppWritePackedMsg A handle to the data buffer pack the message into
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param config A pointer to the P4/P5 codec configuration
|
||||
* \return 0 if packed successfully, -1 if failed
|
||||
*
|
||||
* If not set the the message will be ingored
|
||||
*/
|
||||
int (*pack_p4_p5_vendor_extension)(void* header,
|
||||
uint8_t** ppwritepackedmsg,
|
||||
uint8_t* end,
|
||||
struct nfapi_p4_p5_codec_config* config);
|
||||
|
||||
/*! Optional user data that will be passed back with callbacks
|
||||
*/
|
||||
void* user_data;
|
||||
|
||||
} nfapi_p4_p5_codec_config_t;
|
||||
|
||||
#endif // NFAPI_COMMON_INTERFACE_H
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "stddef.h"
|
||||
#include <stdint.h>
|
||||
#include "nfapi_common_interface.h"
|
||||
|
||||
// Constants - update based on implementation
|
||||
#define NFAPI_MAX_PHY_RF_INSTANCES 2
|
||||
@@ -116,10 +117,6 @@ typedef struct {
|
||||
#define NFAPI_P7_GET_SEQUENCE(_mss) ( (_mss) & 0x00FF )
|
||||
#define NFAPI_P7_SET_MSS(_more, _segm, _sequ) ( (((_more) & 0x1) << 7) | (((_segm) & 0x7) << 4) | ((_sequ) & 0xF) )
|
||||
|
||||
typedef struct {
|
||||
uint16_t tag;
|
||||
uint16_t length;
|
||||
} nfapi_tl_t;
|
||||
#define NFAPI_TAG_LENGTH_PACKED_LEN 4
|
||||
|
||||
// Convenience methods to convert between SFN/SLOT formats
|
||||
@@ -2537,29 +2534,6 @@ typedef struct {
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_timing_info_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
|
||||
uint32_t last_sfn;
|
||||
uint32_t last_slot;
|
||||
uint32_t time_since_last_timing_info;
|
||||
|
||||
uint32_t dl_tti_jitter;
|
||||
uint32_t tx_data_request_jitter;
|
||||
uint32_t ul_tti_jitter;
|
||||
uint32_t ul_dci_jitter;
|
||||
|
||||
int32_t dl_tti_latest_delay;
|
||||
int32_t tx_data_request_latest_delay;
|
||||
int32_t ul_tti_latest_delay;
|
||||
int32_t ul_dci_latest_delay;
|
||||
|
||||
int32_t dl_tti_earliest_arrival;
|
||||
int32_t tx_data_request_earliest_arrival;
|
||||
int32_t ul_tti_earliest_arrival;
|
||||
int32_t ul_dci_earliest_arrival;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_timing_info_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
@@ -3772,160 +3746,6 @@ typedef struct
|
||||
// Configuration options for the encode decode functions
|
||||
//
|
||||
|
||||
/*! Configuration options for the p7 pack unpack functions
|
||||
*
|
||||
*/
|
||||
typedef struct nfapi_p7_codec_config {
|
||||
|
||||
/*! Optional call back to allow the user to define the memory allocator.
|
||||
* \param size The size of the memory to allocate
|
||||
* \return a pointer to a valid memory block or 0 if it has failed.
|
||||
*
|
||||
* If not set the nfapi unpack functions will use malloc
|
||||
*/
|
||||
void* (*allocate)(size_t size);
|
||||
|
||||
/*! Optional call back to allow the user to define the memory deallocator.
|
||||
* \param ptr A poiner to a memory block allocated by the allocate callback
|
||||
*
|
||||
* If not set the client should use free
|
||||
*/
|
||||
void (*deallocate)(void* ptr);
|
||||
|
||||
/*! Optional call back function to handle unpacking vendor extension tlv.
|
||||
* \param tl A pointer to a decoded tag length structure
|
||||
* \param ppReadPackedMsg A handle to the read buffer.
|
||||
* \param end The end of the read buffer
|
||||
* \param ve A handle to a vendor extention structure that the call back should allocate if the structure can be decoded
|
||||
* \param config A pointer to the p7 codec configuration
|
||||
* \return return 0 if packed successfully, -1 if failed.
|
||||
*
|
||||
* If not set the tlv will be skipped
|
||||
*
|
||||
* Client should use the help methods in nfapi.h to decode the vendor extention.
|
||||
*
|
||||
* \todo Add code example
|
||||
*/
|
||||
int (*unpack_vendor_extension_tlv)(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, void** ve, struct nfapi_p7_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle packing vendor extension tlv.
|
||||
* \param ve A pointer to a vendor extention structure.
|
||||
* \param ppWritePackedMsg A handle to the write buffer
|
||||
* \param end The end of the write buffer. The callee should make sure not to write beyond the end
|
||||
* \param config A pointer to the p7 codec configuration
|
||||
* \return return 0 if packed successfully, -1 if failed.
|
||||
*
|
||||
* If not set the the tlv will be skipped
|
||||
*
|
||||
* Client should use the help methods in nfapi.h to encode the vendor extention
|
||||
*
|
||||
* \todo Add code example
|
||||
*/
|
||||
int (*pack_vendor_extension_tlv)(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, struct nfapi_p7_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle unpacking vendor extension messages.
|
||||
* \param header A pointer to a decode P7 message header for the vendor extention message
|
||||
* \param ppReadPackedMsg A handle to the encoded data buffer
|
||||
* \param end A pointer to the end of the encoded data buffer
|
||||
* \param config A pointer to the p7 codec configuration
|
||||
* \return 0 if unpacked successfully, -1 if failed
|
||||
*
|
||||
* If not set the message will be ignored
|
||||
*
|
||||
* If the message if is unknown the function should return -1
|
||||
*/
|
||||
int (*unpack_p7_vendor_extension)(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, uint8_t *end, struct nfapi_p7_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle packing vendor extension messages.
|
||||
* \param header A poiner to a P7 message structure for the venfor extention message
|
||||
* \param ppWritePackedmsg A handle to the buffer to write the encoded message into
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param cofig A pointer to the p7 codec configuration
|
||||
* \return 0 if packed successfully, -1 if failed
|
||||
*
|
||||
* If not set the the message will be ingored
|
||||
*
|
||||
* If the message if is unknown the function should return -1
|
||||
*/
|
||||
int (*pack_p7_vendor_extension)(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedmsg, uint8_t *end, struct nfapi_p7_codec_config* config);
|
||||
|
||||
/*! Optional user data that will be passed back with callbacks
|
||||
*/
|
||||
void* user_data;
|
||||
|
||||
} nfapi_p7_codec_config_t;
|
||||
|
||||
/*! Configuration options for the p4 & p5 pack unpack functions
|
||||
*
|
||||
*/
|
||||
typedef struct nfapi_p4_p5_codec_config {
|
||||
|
||||
/*! Optional call back to allow the user to define the memory allocator.
|
||||
* \param size The size of the memory to allocate
|
||||
* \return a pointer to a valid memory block or 0 if it has failed.
|
||||
*
|
||||
* If not set the nfapi unpack functions will use malloc
|
||||
*/
|
||||
void* (*allocate)(size_t size);
|
||||
|
||||
/*! Optional call back to allow the user to define the memory deallocator.
|
||||
* \param ptr A poiner to a memory block allocated by the allocate callback
|
||||
*
|
||||
* If not set free will be used
|
||||
*/
|
||||
void (*deallocate)(void* ptr);
|
||||
|
||||
/*! Optional call back function to handle unpacking vendor extension tlv.
|
||||
* \param tl A pointer to a decoded tag length structure
|
||||
* \param ppReadPackedMsg A handle to the data buffer to decode
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param ve A handle to a vendor extention structure that will be allocated by this callback
|
||||
* \param config A pointer to the P4/P5 codec configuration
|
||||
* \return 0 if unpacked successfully, -1 if failed
|
||||
*
|
||||
* If not set the tlv will be skipped
|
||||
*/
|
||||
int (*unpack_vendor_extension_tlv)(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, void** ve, struct nfapi_p4_p5_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle packing vendor extension tlv.
|
||||
* \param ve
|
||||
* \param ppWritePackedMsg A handle to the data buffer pack the tlv into
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param config A pointer to the P4/P5 codec configuration
|
||||
* \return 0 if packed successfully, -1 if failed
|
||||
*
|
||||
* If not set the the tlv will be skipped
|
||||
*/
|
||||
int (*pack_vendor_extension_tlv)(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle unpacking vendor extension messages.
|
||||
* \param header A pointer to a decode P4/P5 message header
|
||||
* \param ppReadPackgedMsg A handle to the data buffer to decode
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param config A pointer to the P4/P5 codec configuration
|
||||
* \return 0 if packed successfully, -1 if failed
|
||||
*
|
||||
* If not set the message will be ignored
|
||||
*/
|
||||
int (*unpack_p4_p5_vendor_extension)(nfapi_p4_p5_message_header_t* header, uint8_t **ppReadPackedMsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config);
|
||||
|
||||
/*! Optional call back function to handle packing vendor extension messages.
|
||||
* \param header A pointer to the P4/P5 message header to be encoded
|
||||
* \param ppWritePackedMsg A handle to the data buffer pack the message into
|
||||
* \param end A pointer to the end of the buffer
|
||||
* \param config A pointer to the P4/P5 codec configuration
|
||||
* \return 0 if packed successfully, -1 if failed
|
||||
*
|
||||
* If not set the the message will be ingored
|
||||
*/
|
||||
int (*pack_p4_p5_vendor_extension)(nfapi_p4_p5_message_header_t* header, uint8_t **ppwritepackedmsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config);
|
||||
|
||||
/*! Optional user data that will be passed back with callbacks
|
||||
*/
|
||||
void* user_data;
|
||||
|
||||
} nfapi_p4_p5_codec_config_t;
|
||||
|
||||
//
|
||||
// Functions
|
||||
//
|
||||
@@ -3979,21 +3799,7 @@ 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
|
||||
@@ -4017,7 +3823,6 @@ int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_nr_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
|
||||
/*! \brief Encodes an NFAPI P7 message to a buffer
|
||||
@@ -4031,7 +3836,6 @@ int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
*
|
||||
*/
|
||||
int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
||||
int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
||||
|
||||
/*! \brief Decodes an NFAPI P7 message header
|
||||
* \param pMessageBuf A pointer to an encoded P7 message header
|
||||
@@ -4057,7 +3861,6 @@ int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p7 message structure pointer to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config);
|
||||
int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config);
|
||||
|
||||
/*! \brief Calculates the checksum of a message
|
||||
*
|
||||
@@ -4083,42 +3886,4 @@ int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len);
|
||||
*/
|
||||
int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp);
|
||||
|
||||
/*! \brief Encodes a nfapi_nr_srs_normalized_channel_iq_matrix_t to a buffer
|
||||
*
|
||||
* \param pMessageBuf A pointer to a nfapi_nr_srs_normalized_channel_iq_matrix_t structure
|
||||
* \param pPackedBuf A pointer to the buffer that the nfapi_nr_srs_normalized_channel_iq_matrix_t will be packed into
|
||||
* \param packedBufLen The size of the buffer
|
||||
* \return number of bytes written to the buffer
|
||||
*/
|
||||
int pack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen);
|
||||
|
||||
/*! \brief Decodes a nfapi_nr_srs_normalized_channel_iq_matrix_t from a buffer
|
||||
*
|
||||
* \param pMessageBuf A pointer to an encoded nfapi_nr_srs_normalized_channel_iq_matrix_t
|
||||
* \param messageBufLen The size of the encoded nfapi_nr_srs_normalized_channel_iq_matrix_t
|
||||
* \param pUnpackedBuf A pointer to the nfapi_nr_srs_normalized_channel_iq_matrix_t
|
||||
* \param unpackedBufLen The size of nfapi_nr_srs_normalized_channel_iq_matrix_t structure.
|
||||
* \return 0 means success, -1 means failure.
|
||||
*/
|
||||
int unpack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen);
|
||||
|
||||
/*! \brief Encodes a nfapi_nr_srs_beamforming_report_t to a buffer
|
||||
*
|
||||
* \param pMessageBuf A pointer to a nfapi_nr_srs_beamforming_report_t structure
|
||||
* \param pPackedBuf A pointer to the buffer that the nfapi_nr_srs_beamforming_report_t will be packed into
|
||||
* \param packedBufLen The size of the buffer
|
||||
* \return number of bytes written to the buffer
|
||||
*/
|
||||
int pack_nr_srs_beamforming_report(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen);
|
||||
|
||||
/*! \brief Decodes a nfapi_nr_srs_beamforming_report_t from a buffer
|
||||
*
|
||||
* \param pMessageBuf A pointer to an encoded nfapi_nr_srs_beamforming_report_t
|
||||
* \param messageBufLen The size of the encoded nfapi_nr_srs_beamforming_report_t
|
||||
* \param pUnpackedBuf A pointer to the nfapi_nr_srs_beamforming_report_t
|
||||
* \param unpackedBufLen The size of nfapi_nr_srs_beamforming_report_t structure.
|
||||
* \return 0 means success, -1 means failure.
|
||||
*/
|
||||
int unpack_nr_srs_beamforming_report(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen);
|
||||
|
||||
#endif /* _NFAPI_INTERFACE_H_ */
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#ifndef _NFAPI_NR_INTERFACE_H_
|
||||
#define _NFAPI_NR_INTERFACE_H_
|
||||
#include "nfapi_common_interface.h"
|
||||
|
||||
#define NFAPI_NR_P5_HEADER_LENGTH 10
|
||||
#define NFAPI_NR_P7_HEADER_LENGTH 18
|
||||
|
||||
//These TLVs are used exclusively by nFAPI
|
||||
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x0100
|
||||
@@ -26,6 +30,22 @@
|
||||
#define NFAPI_NR_FAPI_NUM_BEAMS_PERIOD_VENDOR_EXTENSION_TAG 0xA000
|
||||
#define NFAPI_NR_FAPI_ANALOG_BF_VENDOR_EXTENSION_TAG 0xA001
|
||||
|
||||
typedef struct {
|
||||
uint16_t phy_id;
|
||||
uint16_t message_id;
|
||||
uint32_t message_length;
|
||||
uint16_t spare;
|
||||
} nfapi_nr_p4_p5_message_header_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t phy_id;
|
||||
uint16_t message_id;
|
||||
uint32_t message_length;
|
||||
uint16_t m_segment_sequence; /* This consists of 3 fields - namely, M, Segement & Sequence number*/
|
||||
uint32_t checksum;
|
||||
uint32_t transmit_timestamp;
|
||||
} nfapi_nr_p7_message_header_t;
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED=1,
|
||||
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED=0
|
||||
@@ -48,4 +68,178 @@ typedef enum {
|
||||
NFAPI_NR_SRS_ANTENNASWITCH = 3
|
||||
} nfapi_nr_srs_usage_e;
|
||||
|
||||
/*! \brief Encodes an NFAPI P5 message to a buffer
|
||||
* \param pMessageBuf A pointer to a nfapi p5 message structure
|
||||
* \param messageBufLen The size of the p5 message structure
|
||||
* \param pPackedBuf A pointer to the buffer that the p5 message will be packed into
|
||||
* \param packedBufLen The size of the buffer
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return != 0 means success, -1 means failure.
|
||||
*
|
||||
* The function will encode a nFAPI P5 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf.
|
||||
* The function returns the message length that was packed
|
||||
*/
|
||||
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 1 means success, 0 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_nr_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
|
||||
* \param pUnpackedBuf A pointer to the nfapi_message_header
|
||||
* \param unpackedBufLen The size of nfapi_message_header structure.
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return 10 ( size of the unpacked header ) on success, -1 on failure.
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 header structure pointed to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_nr_p5_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config);
|
||||
|
||||
/*! \brief Decodes a NFAPI P5 message
|
||||
* \param pMessageBuf A pointer to an encoded P5 message
|
||||
* \param messageBufLen The size of the encoded P5 message
|
||||
* \param pUnpackedBuf A pointer to the nfapi_message_header
|
||||
* \param unpackedBufLen The size of nfapi_message_header structure.
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return != -1 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
|
||||
*/
|
||||
int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config);
|
||||
|
||||
/*! \brief Encodes an NFAPI P7 message to a buffer
|
||||
* \param pMessageBuf A pointer to a nfapi p7 message structure
|
||||
* \param pPackedBuf A pointer to the buffer that the p7 message will be packed into
|
||||
* \param packedBufLen The size of the buffer
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return != -1 means success, -1 means failure.
|
||||
*
|
||||
* The function will encode a nFAPI P7 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf.
|
||||
* The function returns the message length packed
|
||||
*/
|
||||
int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t *config);
|
||||
|
||||
/*! \brief Decodes an NFAPI P7 message header
|
||||
* \param pMessageBuf A pointer to an encoded P7 message header
|
||||
* \param messageBufLen The size of the encoded P7 message header
|
||||
* \param pUnpackedBuf A pointer to the nfapi_message_header
|
||||
* \param unpackedBufLen The size of nfapi_message_header structure.
|
||||
* \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_p7_message_header structure pointer to by
|
||||
pUnpackedBuf
|
||||
|
||||
*/
|
||||
int nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
|
||||
/*! \brief Decodes a NFAPI P7 message
|
||||
* \param pMessageBuf A pointer to an encoded P7 message
|
||||
* \param messageBufLen The size of the encoded P7 message
|
||||
* \param pUnpackedBuf A pointer to the nfapi_message_header
|
||||
* \param unpackedBufLen The size of nfapi_message_header structure.
|
||||
* \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 p7 message structure pointer to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
|
||||
/*! \brief Calculates the checksum of a message
|
||||
*
|
||||
* \param buffer Pointer to the packed message
|
||||
* \param len The length of the message
|
||||
* \return The checksum. If there is an error the function with return -1
|
||||
*/
|
||||
uint32_t nfapi_nr_p7_calculate_checksum(uint8_t *buffer, uint32_t len);
|
||||
|
||||
/*! \brief Calculates & updates the checksum in the message
|
||||
*
|
||||
* \param buffer Pointer to the packed message
|
||||
* \param len The length of the message
|
||||
* \return 0 means success, -1 means failure.
|
||||
*/
|
||||
int nfapi_nr_p7_update_checksum(uint8_t *buffer, uint32_t len);
|
||||
|
||||
/*! \brief Updates the transmition time stamp in the p7 message header
|
||||
*
|
||||
* \param buffer Pointer to the packed message
|
||||
* \param timestamp The time stamp value
|
||||
* \return 0 means success, -1 means failure.
|
||||
*/
|
||||
int nfapi_nr_p7_update_transmit_timestamp(uint8_t *buffer, uint32_t timestamp);
|
||||
|
||||
/*! \brief Encodes a nfapi_nr_srs_normalized_channel_iq_matrix_t to a buffer
|
||||
*
|
||||
* \param pMessageBuf A pointer to a nfapi_nr_srs_normalized_channel_iq_matrix_t structure
|
||||
* \param pPackedBuf A pointer to the buffer that the nfapi_nr_srs_normalized_channel_iq_matrix_t will be packed into
|
||||
* \param packedBufLen The size of the buffer
|
||||
* \return number of bytes written to the buffer
|
||||
*/
|
||||
int pack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen);
|
||||
|
||||
/*! \brief Decodes a nfapi_nr_srs_normalized_channel_iq_matrix_t from a buffer
|
||||
*
|
||||
* \param pMessageBuf A pointer to an encoded nfapi_nr_srs_normalized_channel_iq_matrix_t
|
||||
* \param messageBufLen The size of the encoded nfapi_nr_srs_normalized_channel_iq_matrix_t
|
||||
* \param pUnpackedBuf A pointer to the nfapi_nr_srs_normalized_channel_iq_matrix_t
|
||||
* \param unpackedBufLen The size of nfapi_nr_srs_normalized_channel_iq_matrix_t structure.
|
||||
* \return 0 means success, -1 means failure.
|
||||
*/
|
||||
int unpack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen);
|
||||
|
||||
/*! \brief Encodes a nfapi_nr_srs_beamforming_report_t to a buffer
|
||||
*
|
||||
* \param pMessageBuf A pointer to a nfapi_nr_srs_beamforming_report_t structure
|
||||
* \param pPackedBuf A pointer to the buffer that the nfapi_nr_srs_beamforming_report_t will be packed into
|
||||
* \param packedBufLen The size of the buffer
|
||||
* \return number of bytes written to the buffer
|
||||
*/
|
||||
int pack_nr_srs_beamforming_report(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen);
|
||||
|
||||
/*! \brief Decodes a nfapi_nr_srs_beamforming_report_t from a buffer
|
||||
*
|
||||
* \param pMessageBuf A pointer to an encoded nfapi_nr_srs_beamforming_report_t
|
||||
* \param messageBufLen The size of the encoded nfapi_nr_srs_beamforming_report_t
|
||||
* \param pUnpackedBuf A pointer to the nfapi_nr_srs_beamforming_report_t
|
||||
* \param unpackedBufLen The size of nfapi_nr_srs_beamforming_report_t structure.
|
||||
* \return 0 means success, -1 means failure.
|
||||
*/
|
||||
int unpack_nr_srs_beamforming_report(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "stddef.h"
|
||||
#include "nfapi_interface.h"
|
||||
#include "nfapi_nr_interface.h"
|
||||
|
||||
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
|
||||
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
|
||||
@@ -510,12 +511,12 @@ typedef enum { // Table 2-27
|
||||
|
||||
//PNF P5 NR
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_param_request_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
uint8_t error_code;
|
||||
uint8_t num_tlvs;
|
||||
nfapi_pnf_param_general_t pnf_param_general;
|
||||
@@ -524,36 +525,36 @@ typedef struct {
|
||||
} nfapi_nr_pnf_param_response_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
uint8_t num_tlvs;
|
||||
nfapi_pnf_phy_rf_config_t pnf_phy_rf_config;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_config_request_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
uint8_t error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_config_response_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_start_request_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
uint32_t error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_start_response_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_stop_request_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
uint32_t error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_stop_response_t;
|
||||
@@ -561,13 +562,13 @@ typedef struct {
|
||||
|
||||
/* PARAM.REQUEST */
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_param_request_scf_t;
|
||||
|
||||
/* PARAM.RESPONSE */
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
uint8_t error_code;
|
||||
|
||||
uint8_t num_tlv;
|
||||
@@ -589,7 +590,7 @@ typedef struct {
|
||||
|
||||
/* CONFIG.REQUEST */
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
|
||||
uint8_t num_tlv;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
@@ -627,7 +628,7 @@ typedef struct {
|
||||
|
||||
/* CONFIG.RESPONSE */
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
uint8_t error_code;
|
||||
uint8_t num_invalid_tlvs;
|
||||
uint8_t num_invalid_tlvs_configured_in_idle;
|
||||
@@ -644,12 +645,12 @@ typedef struct {
|
||||
//3.3.3 START
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_start_request_scf_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
nfapi_nr_start_errors_e error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_start_response_scf_t;
|
||||
@@ -657,17 +658,17 @@ typedef struct {
|
||||
//3.3.4 STOP
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_stop_request_scf_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_stop_indication_scf_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_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
|
||||
@@ -708,7 +709,7 @@ typedef struct {
|
||||
#define NFAPI_NR_SLOT_INDICATION_PERIOD_NUMEROLOGY_3 125 //us
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t sfn; //0->1023
|
||||
uint16_t slot;//0->319
|
||||
|
||||
@@ -1070,23 +1071,46 @@ typedef struct {
|
||||
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint32_t t1;
|
||||
int32_t delta_sfn_slot;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_dl_node_sync_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint32_t t1;
|
||||
uint32_t t2;
|
||||
uint32_t t3;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_ul_node_sync_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
|
||||
uint32_t last_sfn;
|
||||
uint32_t last_slot;
|
||||
uint32_t time_since_last_timing_info;
|
||||
|
||||
uint32_t dl_tti_jitter;
|
||||
uint32_t tx_data_request_jitter;
|
||||
uint32_t ul_tti_jitter;
|
||||
uint32_t ul_dci_jitter;
|
||||
|
||||
int32_t dl_tti_latest_delay;
|
||||
int32_t tx_data_request_latest_delay;
|
||||
int32_t ul_tti_latest_delay;
|
||||
int32_t ul_dci_latest_delay;
|
||||
|
||||
int32_t dl_tti_earliest_arrival;
|
||||
int32_t tx_data_request_earliest_arrival;
|
||||
int32_t ul_tti_earliest_arrival;
|
||||
int32_t ul_dci_earliest_arrival;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_timing_info_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
/// System Frame Number (0-1023)
|
||||
uint16_t SFN;
|
||||
/// Slot number (0-19)
|
||||
@@ -1420,7 +1444,7 @@ typedef struct
|
||||
} nfapi_nr_ul_tti_request_number_of_groups_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t SFN; //0->1023
|
||||
uint16_t Slot;//0->319
|
||||
uint8_t n_pdus;//Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
|
||||
@@ -1464,7 +1488,7 @@ typedef struct {
|
||||
} nfapi_nr_ul_dci_request_pdus_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t SFN;
|
||||
uint16_t Slot;
|
||||
uint8_t numPdus;
|
||||
@@ -1510,7 +1534,7 @@ typedef struct
|
||||
#define NFAPI_NR_MAX_TX_REQUEST_PDUS 16
|
||||
typedef struct
|
||||
{
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t SFN;
|
||||
uint16_t Slot;
|
||||
uint16_t Number_of_PDUs;
|
||||
@@ -1545,7 +1569,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint16_t number_of_pdus;
|
||||
@@ -1573,7 +1597,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint16_t number_crcs;
|
||||
@@ -1710,7 +1734,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint16_t num_ucis;
|
||||
@@ -1770,7 +1794,7 @@ typedef struct {
|
||||
} nfapi_nr_srs_indication_pdu_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t sfn; // SFN. Value: 0 -> 1023
|
||||
uint16_t slot; // Slot. Value: 0 -> 159
|
||||
uint16_t control_length; // Size of control portion of SRS indication. 0 if reports are included inline; >0 if reports are concatenated to the end of the message.
|
||||
@@ -1803,7 +1827,7 @@ typedef struct{
|
||||
|
||||
typedef struct
|
||||
{
|
||||
nfapi_p7_message_header_t header;
|
||||
nfapi_nr_p7_message_header_t header;
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint8_t number_of_pdus;
|
||||
|
||||
@@ -1616,7 +1616,12 @@ int nfapi_p4_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPack
|
||||
|
||||
// Main unpack functions - public
|
||||
|
||||
int nfapi_p4_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
|
||||
int nfapi_p4_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
|
||||
@@ -1632,17 +1637,21 @@ int nfapi_p4_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
||||
return -1;
|
||||
}
|
||||
|
||||
// process the headei
|
||||
if (pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->spare, end))
|
||||
// process the header
|
||||
if (pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->spare, end))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config) {
|
||||
int nfapi_p4_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
int result = 0;
|
||||
nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
@@ -1661,12 +1670,10 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
// clean the supplied buffer for - tag value blanking
|
||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||
|
||||
// process the header
|
||||
if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->spare, end)))
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->spare, end)))
|
||||
return -1;
|
||||
|
||||
// look for the specific message
|
||||
@@ -1779,7 +1786,7 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
if (check_unpack_length(NFAPI_SYSTEM_INFORMATION_RESPONSE, unpackedBufLen))
|
||||
result = unpack_system_information_response(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
result = -1;
|
||||
result = -1;
|
||||
|
||||
break;
|
||||
|
||||
@@ -1787,7 +1794,7 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
if (check_unpack_length(NFAPI_SYSTEM_INFORMATION_INDICATION, unpackedBufLen))
|
||||
result = unpack_system_information_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
result = -1;
|
||||
result = -1;
|
||||
|
||||
break;
|
||||
|
||||
@@ -1808,12 +1815,14 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
break;
|
||||
|
||||
default:
|
||||
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||
pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
|
||||
if(config && config->unpack_p4_p5_vendor_extension) {
|
||||
if (pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
|
||||
if (config && config->unpack_p4_p5_vendor_extension) {
|
||||
result = (config->unpack_p4_p5_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR,
|
||||
"%s VE NFAPI message ID %d. No ve decoder provided\n",
|
||||
__FUNCTION__,
|
||||
pMessageHeader->message_id);
|
||||
}
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown P4 message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
|
||||
@@ -1822,7 +1831,7 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
break;
|
||||
}
|
||||
|
||||
if(result == 0)
|
||||
if (result == 0)
|
||||
return -1;
|
||||
|
||||
return result;
|
||||
|
||||
@@ -1184,7 +1184,7 @@ static uint8_t pack_measurement_response(void *msg, uint8_t **ppWritePackedMsg,
|
||||
pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
}
|
||||
|
||||
uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header,
|
||||
uint8_t pack_nr_p5_message_body(nfapi_nr_p4_p5_message_header_t *header,
|
||||
uint8_t **ppWritePackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
@@ -1376,11 +1376,8 @@ int nfapi_nr_p5_message_pack(void *pMessageBuf,
|
||||
uint32_t packedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
|
||||
nfapi_nr_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
|
||||
uint8_t *pWritePackedMessage = pPackedBuf;
|
||||
uint32_t packedMsgLen;
|
||||
uint32_t packedBodyLen;
|
||||
uint16_t packedMsgLen16;
|
||||
|
||||
if (pMessageBuf == NULL || pPackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Pack supplied pointers are null\n");
|
||||
@@ -1389,28 +1386,26 @@ int nfapi_nr_p5_message_pack(void *pMessageBuf,
|
||||
|
||||
uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
|
||||
uint8_t *pPackedLengthField = &pWritePackedMessage[4];
|
||||
uint8_t *pPacketBodyFieldStart = &pWritePackedMessage[8];
|
||||
uint8_t *pPacketBodyField = &pWritePackedMessage[8];
|
||||
uint8_t *pPacketBodyFieldStart = &pWritePackedMessage[10];
|
||||
uint8_t *pPacketBodyField = &pWritePackedMessage[10];
|
||||
|
||||
// pack the message
|
||||
if (push16(pMessageHeader->phy_id, &pWritePackedMessage, pPackMessageEnd)
|
||||
&& push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd)
|
||||
&& push16(0, &pWritePackedMessage, pPackMessageEnd) && push16(pMessageHeader->spare, &pWritePackedMessage, pPackMessageEnd)
|
||||
&& push32(0, &pWritePackedMessage, pPackMessageEnd) && push16(pMessageHeader->spare, &pWritePackedMessage, pPackMessageEnd)
|
||||
&& pack_nr_p5_message_body(pMessageHeader, &pPacketBodyField, pPackMessageEnd, config)) {
|
||||
// to check if whole message is bigger than the buffer provided
|
||||
packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pPacketBodyField);
|
||||
uint32_t packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pPacketBodyField);
|
||||
// obtain the length of the message body to pack
|
||||
packedBodyLen = get_packed_msg_len((uintptr_t)pPacketBodyFieldStart, (uintptr_t)pPacketBodyField);
|
||||
uint32_t packedBodyLen = get_packed_msg_len((uintptr_t)pPacketBodyFieldStart, (uintptr_t)pPacketBodyField);
|
||||
|
||||
if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) {
|
||||
if (packedMsgLen > packedBufLen) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
|
||||
return -1;
|
||||
} else {
|
||||
packedMsgLen16 = (uint16_t)packedBodyLen;
|
||||
}
|
||||
|
||||
// Update the message length in the header
|
||||
if (!push16(packedMsgLen16, &pPackedLengthField, pPackMessageEnd))
|
||||
if (!push32(packedBodyLen, &pPackedLengthField, pPackMessageEnd))
|
||||
return -1;
|
||||
|
||||
// return the packed length
|
||||
@@ -2298,7 +2293,12 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
|
||||
|
||||
// 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)
|
||||
{
|
||||
nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
|
||||
@@ -2315,10 +2315,42 @@ int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
||||
}
|
||||
|
||||
// process the header
|
||||
return ( pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->spare, end) );
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->spare, end))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
int nfapi_nr_p5_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t *end = pMessageBuf + messageBufLen;
|
||||
|
||||
if (messageBufLen < NFAPI_NR_P5_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_nr_p4_p5_message_header_t)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
}
|
||||
// process the header
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->spare, end))) {
|
||||
return -1;
|
||||
}
|
||||
return NFAPI_NR_P5_HEADER_LENGTH;
|
||||
}
|
||||
|
||||
int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
@@ -2327,41 +2359,24 @@ int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
|
||||
if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t)) {
|
||||
if (messageBufLen < NFAPI_NR_P5_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_nr_p4_p5_message_header_t)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t *ptr = pReadPackedMessage;
|
||||
printf("\n Read NR message unpack: ");
|
||||
|
||||
while (ptr < end) {
|
||||
printf(" %02x ", *ptr);
|
||||
ptr++;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
nfapi_nr_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
// clean the supplied buffer for - tag value blanking
|
||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||
|
||||
// process the header
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->spare, end))) {
|
||||
// failed to read the header
|
||||
if (!nfapi_nr_p5_message_header_unpack(pMessageBuf, messageBufLen, pMessageHeader, unpackedBufLen, config)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t *pReadPackedMessage = pMessageBuf + NFAPI_NR_P5_HEADER_LENGTH;
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
int result = -1;
|
||||
|
||||
if (check_nr_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) {
|
||||
|
||||
@@ -62,15 +62,50 @@ int nfapi_p7_update_checksum(uint8_t *buffer, uint32_t len) {
|
||||
return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1);
|
||||
}
|
||||
|
||||
int nfapi_p7_update_transmit_timestamp(uint8_t *buffer, uint32_t timestamp) {
|
||||
int nfapi_p7_update_transmit_timestamp(uint8_t *buffer, uint32_t timestamp)
|
||||
{
|
||||
uint8_t *p_write = &buffer[12];
|
||||
return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1);
|
||||
return (push32(timestamp, &p_write, buffer + NFAPI_P7_HEADER_LENGTH) > 0 ? 0 : -1);
|
||||
}
|
||||
|
||||
uint32_t nfapi_p7_calculate_checksum(uint8_t *buffer, uint32_t len) {
|
||||
return nfapi_calculate_checksum(buffer, len);
|
||||
}
|
||||
|
||||
uint32_t nfapi_nr_calculate_checksum(uint8_t *buffer, uint16_t len)
|
||||
{
|
||||
uint32_t chksum = 0;
|
||||
// calcaulte upto the checksum
|
||||
chksum = crc32(chksum, buffer, 10);
|
||||
// skip the checksum
|
||||
uint8_t zeros[4] = {0, 0, 0, 0};
|
||||
chksum = crc32(chksum, zeros, 4);
|
||||
// continu with the rest of the mesage
|
||||
chksum = crc32(chksum, &buffer[NFAPI_NR_P7_HEADER_LENGTH], len - NFAPI_NR_P7_HEADER_LENGTH);
|
||||
// return the inverse
|
||||
return ~(chksum);
|
||||
}
|
||||
|
||||
int nfapi_nr_p7_update_checksum(uint8_t *buffer, uint32_t len)
|
||||
{
|
||||
uint32_t checksum = nfapi_nr_calculate_checksum(buffer, len);
|
||||
// 10 is the beginning position of checksum
|
||||
uint8_t *p_write = &buffer[10];
|
||||
return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1);
|
||||
}
|
||||
|
||||
int nfapi_nr_p7_update_transmit_timestamp(uint8_t *buffer, uint32_t timestamp)
|
||||
{
|
||||
// 14 is the beginning position of transmit_timestamp
|
||||
uint8_t *p_write = &buffer[14];
|
||||
return (push32(timestamp, &p_write, buffer + NFAPI_NR_P7_HEADER_LENGTH) > 0 ? 0 : -1);
|
||||
}
|
||||
|
||||
uint32_t nfapi_nr_p7_calculate_checksum(uint8_t *buffer, uint32_t len)
|
||||
{
|
||||
return nfapi_nr_calculate_checksum(buffer, len);
|
||||
}
|
||||
|
||||
void *nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t *config) {
|
||||
if(size == 0)
|
||||
return 0;
|
||||
@@ -3632,7 +3667,7 @@ uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
|
||||
|
||||
int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
|
||||
nfapi_nr_p7_message_header_t *pMessageHeader = pMessageBuf;
|
||||
uint8_t *pWritePackedMessage = pPackedBuf;
|
||||
uint8_t *pPackedLengthField = &pWritePackedMessage[4];
|
||||
|
||||
@@ -3645,7 +3680,7 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
|
||||
|
||||
// process the header
|
||||
if (!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && push16(pMessageHeader->message_id, &pWritePackedMessage, end)
|
||||
&& push16(0 /*pMessageHeader->message_length*/, &pWritePackedMessage, end)
|
||||
&& push32(0 /*pMessageHeader->message_length*/, &pWritePackedMessage, end)
|
||||
&& push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end)
|
||||
&& push32(0 /*pMessageHeader->checksum*/, &pWritePackedMessage, end)
|
||||
&& push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) {
|
||||
@@ -3744,18 +3779,15 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
|
||||
uintptr_t msgHead = (uintptr_t)pPackedBuf;
|
||||
uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
|
||||
uint32_t packedMsgLen = msgEnd - msgHead;
|
||||
uint16_t packedMsgLen16;
|
||||
if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) {
|
||||
if (packedMsgLen > packedBufLen) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
|
||||
return -1;
|
||||
} else {
|
||||
packedMsgLen16 = (uint16_t)packedMsgLen;
|
||||
}
|
||||
|
||||
// Update the message length in the header
|
||||
pMessageHeader->message_length = packedMsgLen16;
|
||||
pMessageHeader->message_length = packedMsgLen;
|
||||
|
||||
if (!push16(packedMsgLen16, &pPackedLengthField, end))
|
||||
if (!push32(pMessageHeader->message_length, &pPackedLengthField, end))
|
||||
return -1;
|
||||
|
||||
if (1) {
|
||||
@@ -8097,7 +8129,12 @@ static int check_nr_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpack
|
||||
|
||||
// Main unpack functions - public
|
||||
|
||||
int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t *config) {
|
||||
int nfapi_p7_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
|
||||
@@ -8112,20 +8149,53 @@ int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// process the header
|
||||
if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
|
||||
pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
|
||||
pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->checksum, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_p7_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
|
||||
if (messageBufLen < NFAPI_NR_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_nr_p7_message_header_t)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
}
|
||||
// process the header
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->checksum, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t *config) {
|
||||
int nfapi_p7_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
int result = 0;
|
||||
nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t *)pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
@@ -8153,19 +8223,16 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
*/
|
||||
// clean the supplied buffer for - tag value blanking
|
||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||
|
||||
// process the header
|
||||
if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
|
||||
pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
|
||||
pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) {
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->checksum, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((uint8_t *)(pMessageBuf + pMessageHeader->message_length) > end) {
|
||||
if ((uint8_t *)(pMessageBuf + pMessageHeader->message_length) > end) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
|
||||
return -1;
|
||||
}
|
||||
@@ -8182,7 +8249,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
switch (pMessageHeader->message_id) {
|
||||
case NFAPI_DL_CONFIG_REQUEST:
|
||||
if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen))
|
||||
result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8198,7 +8265,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_TX_REQUEST:
|
||||
if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen))
|
||||
result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8206,7 +8273,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_HI_DCI0_REQUEST:
|
||||
if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen))
|
||||
result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8214,7 +8281,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
|
||||
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8222,7 +8289,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_HARQ_INDICATION:
|
||||
if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
|
||||
result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8230,7 +8297,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_CRC_INDICATION:
|
||||
if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
|
||||
result = unpack_crc_indication(&pReadPackedMessage,end, pMessageHeader, config);
|
||||
result = unpack_crc_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8238,7 +8305,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_RX_ULSCH_INDICATION:
|
||||
if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
|
||||
result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8246,7 +8313,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_RACH_INDICATION:
|
||||
if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
|
||||
result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8254,7 +8321,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_SRS_INDICATION:
|
||||
if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen))
|
||||
result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8262,7 +8329,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_RX_SR_INDICATION:
|
||||
if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen))
|
||||
result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8270,7 +8337,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_RX_CQI_INDICATION:
|
||||
if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen))
|
||||
result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8278,7 +8345,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_LBT_DL_CONFIG_REQUEST:
|
||||
if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen))
|
||||
result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8286,7 +8353,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_LBT_DL_INDICATION:
|
||||
if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
|
||||
result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8294,7 +8361,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_NB_HARQ_INDICATION:
|
||||
if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
|
||||
result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8302,7 +8369,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_NRACH_INDICATION:
|
||||
if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
|
||||
result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8310,7 +8377,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_DL_NODE_SYNC:
|
||||
if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen))
|
||||
result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -8334,19 +8401,21 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
case NFAPI_UE_RELEASE_RESPONSE:
|
||||
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
|
||||
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||
pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
|
||||
if(config && config->unpack_p7_vendor_extension) {
|
||||
if (pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
|
||||
if (config && config->unpack_p7_vendor_extension) {
|
||||
result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR,
|
||||
"%s VE NFAPI message ID %d. No ve decoder provided\n",
|
||||
__FUNCTION__,
|
||||
pMessageHeader->message_id);
|
||||
}
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
|
||||
@@ -8355,173 +8424,162 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
break;
|
||||
}
|
||||
|
||||
if(result == 0)
|
||||
if (result == 0)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
|
||||
int nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
int result = 0;
|
||||
nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
int result = 0;
|
||||
nfapi_nr_p7_message_header_t *pMessageHeader = (nfapi_nr_p7_message_header_t *)pUnpackedBuf;
|
||||
uint8_t *pReadPackedMessage = pMessageBuf;
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
}
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t *end = (uint8_t*)pMessageBuf + messageBufLen;
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
|
||||
if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
}
|
||||
if (messageBufLen < NFAPI_NR_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_nr_p7_message_header_t)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// clean the supplied buffer for - tag value blanking
|
||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||
// process the header
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->checksum, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
|
||||
return -1;
|
||||
}
|
||||
if ((uint8_t *)(pMessageBuf + pMessageHeader->message_length) > end) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// process the header
|
||||
if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
|
||||
pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
|
||||
pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
|
||||
pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
|
||||
return -1;
|
||||
}
|
||||
// look for the specific message
|
||||
switch (pMessageHeader->message_id) {
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen))
|
||||
result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
|
||||
/*
|
||||
if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen))
|
||||
result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen))
|
||||
result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen))
|
||||
result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
|
||||
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION, unpackedBufLen)) {
|
||||
nfapi_nr_slot_indication_scf_t *msg = (nfapi_nr_slot_indication_scf_t *)pMessageHeader;
|
||||
result = unpack_nr_slot_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
|
||||
// look for the specific message
|
||||
switch (pMessageHeader->message_id)
|
||||
{
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen))
|
||||
result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen)) {
|
||||
nfapi_nr_rx_data_indication_t *msg = (nfapi_nr_rx_data_indication_t *)pMessageHeader;
|
||||
msg->pdu_list = (nfapi_nr_rx_data_pdu_t *)malloc(sizeof(nfapi_nr_rx_data_pdu_t));
|
||||
msg->pdu_list->pdu = (uint8_t *)malloc(sizeof(uint8_t));
|
||||
result = unpack_nr_rx_data_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen))
|
||||
result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen))
|
||||
result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen))
|
||||
result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
|
||||
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION, unpackedBufLen)){
|
||||
nfapi_nr_slot_indication_scf_t* msg = (nfapi_nr_slot_indication_scf_t*) pMessageHeader;
|
||||
result = unpack_nr_slot_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION, unpackedBufLen)) {
|
||||
nfapi_nr_crc_indication_t *msg = (nfapi_nr_crc_indication_t *)pMessageHeader;
|
||||
msg->crc_list = (nfapi_nr_crc_t *)malloc(sizeof(nfapi_nr_crc_t));
|
||||
result = unpack_nr_crc_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen)){
|
||||
nfapi_nr_rx_data_indication_t* msg = (nfapi_nr_rx_data_indication_t*) pMessageHeader;
|
||||
msg->pdu_list = (nfapi_nr_rx_data_pdu_t*) malloc(sizeof(nfapi_nr_rx_data_pdu_t));
|
||||
msg->pdu_list->pdu = (uint8_t *) malloc(sizeof(uint8_t));
|
||||
result = unpack_nr_rx_data_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION, unpackedBufLen)) {
|
||||
nfapi_nr_uci_indication_t *msg = (nfapi_nr_uci_indication_t *)pMessageHeader;
|
||||
msg->uci_list = (nfapi_nr_uci_t *)malloc(sizeof(nfapi_nr_uci_t));
|
||||
result = unpack_nr_uci_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION, unpackedBufLen)){
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION, unpackedBufLen)) {
|
||||
nfapi_nr_srs_indication_t *msg = (nfapi_nr_srs_indication_t *)pMessageHeader;
|
||||
msg->pdu_list = (nfapi_nr_srs_indication_pdu_t *)malloc(sizeof(nfapi_nr_srs_indication_pdu_t));
|
||||
result = unpack_nr_srs_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
|
||||
nfapi_nr_crc_indication_t* msg = (nfapi_nr_crc_indication_t*) pMessageHeader;
|
||||
msg->crc_list = (nfapi_nr_crc_t*) malloc(sizeof(nfapi_nr_crc_t));
|
||||
result = unpack_nr_crc_indication(&pReadPackedMessage,end , msg, config);
|
||||
}
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION, unpackedBufLen)) {
|
||||
nfapi_nr_rach_indication_t *msg = (nfapi_nr_rach_indication_t *)pMessageHeader;
|
||||
result = unpack_nr_rach_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION, unpackedBufLen)){
|
||||
nfapi_nr_uci_indication_t* msg = (nfapi_nr_uci_indication_t*) pMessageHeader;
|
||||
msg->uci_list = (nfapi_nr_uci_t*) malloc(sizeof(nfapi_nr_uci_t));
|
||||
result = unpack_nr_uci_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen))
|
||||
result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION, unpackedBufLen)){
|
||||
nfapi_nr_srs_indication_t* msg = (nfapi_nr_srs_indication_t*) pMessageHeader;
|
||||
msg->pdu_list = (nfapi_nr_srs_indication_pdu_t*) malloc(sizeof(nfapi_nr_srs_indication_pdu_t));
|
||||
result = unpack_nr_srs_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen))
|
||||
result = unpack_nr_ul_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION, unpackedBufLen)){
|
||||
nfapi_nr_rach_indication_t* msg = (nfapi_nr_rach_indication_t*) pMessageHeader;
|
||||
result = unpack_nr_rach_indication(&pReadPackedMessage, end, msg, config);
|
||||
}
|
||||
break;
|
||||
case NFAPI_TIMING_INFO:
|
||||
if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
|
||||
result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen))
|
||||
result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
case NFAPI_UE_RELEASE_RESPONSE:
|
||||
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
|
||||
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
|
||||
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen))
|
||||
result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
|
||||
break;
|
||||
default:
|
||||
|
||||
case NFAPI_TIMING_INFO:
|
||||
if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
|
||||
result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
|
||||
case NFAPI_UE_RELEASE_RESPONSE:
|
||||
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
|
||||
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||
pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
|
||||
{
|
||||
if(config && config->unpack_p7_vendor_extension)
|
||||
{
|
||||
result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
|
||||
if (config && config->unpack_p7_vendor_extension) {
|
||||
result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR,
|
||||
"%s VE NFAPI message ID %d. No ve decoder provided\n",
|
||||
__FUNCTION__,
|
||||
pMessageHeader->message_id);
|
||||
}
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == 0) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
|
||||
|
||||
Reference in New Issue
Block a user