Expose TX_DATA.request functions
Expose pack/unpack functions for TX_DATA.request for usage in P7 FAPI library
This commit is contained in:
committed by
Robert Schmidt
parent
91279388b8
commit
37ace26f83
@@ -1,16 +1,22 @@
|
||||
add_library(nr_fapi_common
|
||||
src/nr_fapi.c
|
||||
)
|
||||
target_include_directories(nr_fapi_common PUBLIC inc)
|
||||
target_link_libraries(nr_fapi_common PUBLIC nfapi_common)
|
||||
|
||||
add_library(nr_fapi_p5
|
||||
src/nr_fapi_p5.c
|
||||
src/nr_fapi_p5_utils.c
|
||||
)
|
||||
target_include_directories(nr_fapi_p5 PUBLIC inc)
|
||||
target_link_libraries(nr_fapi_p5 PUBLIC nfapi_common)
|
||||
target_link_libraries(nr_fapi_p5 PUBLIC nr_fapi_common)
|
||||
|
||||
add_library(nr_fapi_p7
|
||||
src/nr_fapi_p7.c
|
||||
)
|
||||
target_include_directories(nr_fapi_p7 PUBLIC inc)
|
||||
# Note: Dependencies with NFAPI_LIB NFAPI_USER_LIB only necessary until last FAPI function is moved into new library, to be removed at a later stage
|
||||
target_link_libraries(nr_fapi_p7 PUBLIC nfapi_common NFAPI_LIB NFAPI_USER_LIB)
|
||||
target_link_libraries(nr_fapi_p7 PUBLIC nr_fapi_common NFAPI_LIB NFAPI_USER_LIB)
|
||||
|
||||
if (OAI_AERIAL)
|
||||
target_compile_definitions(nr_fapi_p5 PRIVATE ENABLE_AERIAL)
|
||||
|
||||
@@ -40,6 +40,8 @@ typedef struct {
|
||||
uint32_t message_length;
|
||||
} fapi_message_header_t;
|
||||
|
||||
bool isFAPIMessageIDValid(uint16_t id);
|
||||
|
||||
int fapi_nr_message_header_unpack(uint8_t **pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#include "nr_fapi.h"
|
||||
|
||||
bool isFAPIMessageIDValid(const uint16_t id)
|
||||
{
|
||||
// SCF 222.10.04 Table 3-5 PHY API message types
|
||||
return (id >= NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST && id <= 0xFF) || id == NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE
|
||||
|| id == NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC || id == NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC
|
||||
|| id == NFAPI_NR_PHY_MSG_TYPE_TIMING_INFO;
|
||||
}
|
||||
|
||||
int fapi_nr_message_header_unpack(uint8_t **pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
uint8_t **pReadPackedMessage = pMessageBuf;
|
||||
nfapi_p4_p5_message_header_t *header = pUnpackedBuf;
|
||||
fapi_message_header_t fapi_msg = {0};
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL || messageBufLen < NFAPI_HEADER_LENGTH
|
||||
|| unpackedBufLen < sizeof(fapi_message_header_t)) {
|
||||
return -1;
|
||||
}
|
||||
uint8_t *end = *pMessageBuf + messageBufLen;
|
||||
// process the header
|
||||
int result =
|
||||
(pull8(pReadPackedMessage, &fapi_msg.num_msg, end) && pull8(pReadPackedMessage, &fapi_msg.opaque_handle, end)
|
||||
&& pull16(pReadPackedMessage, &header->message_id, end) && pull32(pReadPackedMessage, &fapi_msg.message_length, end));
|
||||
header->message_length = fapi_msg.message_length;
|
||||
return (result);
|
||||
}
|
||||
@@ -22,37 +22,6 @@
|
||||
#include "nr_fapi_p5.h"
|
||||
#include "debug.h"
|
||||
|
||||
bool isFAPIMessageIDValid(uint16_t id)
|
||||
{
|
||||
// SCF 222.10.04 Table 3-5 PHY API message types
|
||||
return (id >= NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST && id <= 0xFF) || id == NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE
|
||||
|| id == NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC || id == NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC
|
||||
|| id == NFAPI_NR_PHY_MSG_TYPE_TIMING_INFO;
|
||||
}
|
||||
|
||||
int fapi_nr_message_header_unpack(uint8_t **pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
uint8_t **pReadPackedMessage = pMessageBuf;
|
||||
nfapi_p4_p5_message_header_t *header = pUnpackedBuf;
|
||||
fapi_message_header_t fapi_msg;
|
||||
|
||||
if(pMessageBuf == NULL || pUnpackedBuf == NULL || messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t)){
|
||||
return -1;
|
||||
}
|
||||
uint8_t *end = *pMessageBuf + messageBufLen;
|
||||
// process the header
|
||||
int result =
|
||||
(pull8(pReadPackedMessage, &fapi_msg.num_msg, end) && pull8(pReadPackedMessage, &fapi_msg.opaque_handle, end)
|
||||
&& pull16(pReadPackedMessage, &header->message_id, end) && pull32(pReadPackedMessage, &fapi_msg.message_length, end));
|
||||
DevAssert(fapi_msg.message_length <= 0xFFFF);
|
||||
header->message_length = fapi_msg.message_length;
|
||||
return (result);
|
||||
}
|
||||
|
||||
uint8_t fapi_nr_p5_message_body_pack(nfapi_p4_p5_message_header_t *header,
|
||||
uint8_t **ppWritePackedMsg,
|
||||
uint8_t *end,
|
||||
|
||||
@@ -64,6 +64,8 @@ uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
|
||||
|
||||
uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
@@ -86,4 +88,6 @@ uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
|
||||
nfapi_nr_rach_indication_t *msg,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config);
|
||||
|
||||
#endif // OPENAIRINTERFACE_NR_NFAPI_P7_H
|
||||
|
||||
@@ -2091,7 +2091,7 @@ static uint8_t pack_tx_request_body_value(void *tlv, uint8_t **ppWritePackedMsg,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t *)msg;
|
||||
|
||||
@@ -5916,7 +5916,7 @@ static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config)
|
||||
uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t *)msg;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user