Commit 643fc632 authored by Mahesh's avatar Mahesh

PBCH working

parent 6f4e8943
...@@ -142,10 +142,13 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); ...@@ -142,10 +142,13 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, char *thread_name) { static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, char *thread_name) {
struct timespec current;
clock_gettime(CLOCK_MONOTONIC, &current);
//LOG_I(PHY,"%sCurrent time %d.%d,frame_rx %d,slot_rx %d,frame_tx %d,slot_tx %d\n", __FUNCTION__, current.tv_sec,current.tv_nsec,frame_rx,slot_rx,frame_tx,slot_tx);
sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe; sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
start_meas(&softmodem_stats_rxtx_sf); start_meas(&softmodem_stats_rxtx_sf);
// ******************************************************************* // *******************************************************************
...@@ -157,6 +160,7 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t ...@@ -157,6 +160,7 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
//LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe); //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
start_meas(&nfapi_meas); start_meas(&nfapi_meas);
// oai_subframe_ind(frame_rx, slot_rx); // oai_subframe_ind(frame_rx, slot_rx);
oai_slot_ind(frame_rx, slot_rx); oai_slot_ind(frame_rx, slot_rx);
stop_meas(&nfapi_meas); stop_meas(&nfapi_meas);
...@@ -340,15 +344,21 @@ static void *gNB_L1_thread( void *param ) { ...@@ -340,15 +344,21 @@ static void *gNB_L1_thread( void *param ) {
while (!oai_exit) { while (!oai_exit) {
struct timespec t;
clock_gettime(CLOCK_MONOTONIC,&t);
//printf("\nbefore time %d.%d\n",t.tv_sec,t.tv_nsec);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 );
if (wait_on_condition(&L1_proc->mutex,&L1_proc->cond,&L1_proc->instance_cnt,thread_name)<0) break; if (wait_on_condition(&L1_proc->mutex,&L1_proc->cond,&L1_proc->instance_cnt,thread_name)<0) break;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 1 );
clock_gettime(CLOCK_MONOTONIC,&t);
int frame_rx = L1_proc->frame_rx; int frame_rx = L1_proc->frame_rx;
int slot_rx = L1_proc->slot_rx; int slot_rx = L1_proc->slot_rx;
int frame_tx = L1_proc->frame_tx; int frame_tx = L1_proc->frame_tx;
int slot_tx = L1_proc->slot_tx; int slot_tx = L1_proc->slot_tx;
uint64_t timestamp_tx = L1_proc->timestamp_tx; uint64_t timestamp_tx = L1_proc->timestamp_tx;
//printf("\nframe %d slot %d after wait time %d.%d\n",frame_rx,slot_rx,t.tv_sec,t.tv_nsec);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX0_GNB,slot_tx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX0_GNB,slot_tx);
......
...@@ -97,7 +97,8 @@ static int DEFBFW[] = {0x00007fff}; ...@@ -97,7 +97,8 @@ static int DEFBFW[] = {0x00007fff};
extern volatile int oai_exit; extern volatile int oai_exit;
extern struct timespec timespec_sub(struct timespec lhs, struct timespec rhs);
extern struct timespec timespec_add(struct timespec lhs, struct timespec rhs);
extern void nr_phy_free_RU(RU_t *); extern void nr_phy_free_RU(RU_t *);
extern void nr_phy_config_request(NR_PHY_Config_t *gNB); extern void nr_phy_config_request(NR_PHY_Config_t *gNB);
#include "executables/thread-common.h" #include "executables/thread-common.h"
...@@ -709,6 +710,7 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { ...@@ -709,6 +710,7 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
nfapi_nr_config_request_scf_t *cfg = &ru->config; nfapi_nr_config_request_scf_t *cfg = &ru->config;
...@@ -1541,9 +1543,35 @@ void *ru_thread( void *param ) { ...@@ -1541,9 +1543,35 @@ void *ru_thread( void *param ) {
pthread_cond_signal(&proc->cond_FH1); pthread_cond_signal(&proc->cond_FH1);
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
struct timespec slot_start;
clock_gettime(CLOCK_MONOTONIC, &slot_start);
struct timespec slot_duration;
slot_duration.tv_sec = 0;
//slot_duration.tv_nsec = 0.5e6;
slot_duration.tv_nsec = 0.5e6;
while (!oai_exit) { while (!oai_exit) {
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing. // these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
// They are set on the first rx/tx in the underly FH routines. // They are set on the first rx/tx in the underly FH routines.
slot_start = timespec_add(slot_start,slot_duration);
struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC, &curr_time);
struct timespec sleep_time;
if((slot_start.tv_sec > curr_time.tv_sec) || (slot_start.tv_sec == curr_time.tv_sec && slot_start.tv_nsec > curr_time.tv_nsec)){
sleep_time = timespec_sub(slot_start,curr_time);
usleep(sleep_time.tv_nsec * 1e-3);
}
else{//continue
}
// clock_gettime(CLOCK_MONOTONIC, &curr_time);
//printf("sfn:%d, slot:%d, start time %d.%d slot start %d.%d \n",frame,slot,curr_time.tv_sec,curr_time.tv_nsec,slot_start.tv_sec,slot_start.tv_nsec);
if (slot==(fp->slots_per_frame-1)) { if (slot==(fp->slots_per_frame-1)) {
slot=0; slot=0;
frame++; frame++;
......
This diff is collapsed.
This diff is collapsed.
...@@ -1125,15 +1125,13 @@ typedef struct { ...@@ -1125,15 +1125,13 @@ typedef struct {
uint32_t error_code; uint32_t error_code;
nfapi_pnf_param_general_t pnf_param_general; nfapi_pnf_param_general_t pnf_param_general;
nfapi_pnf_phy_t pnf_phy; nfapi_pnf_phy_t pnf_phy;
/* // nfapi_pnf_rf_t pnf_rf;
nfapi_pnf_rf_t pnf_rf; // nfapi_pnf_phy_rel10_t pnf_phy_rel10;
nfapi_pnf_phy_rel10_t pnf_phy_rel10; // nfapi_pnf_phy_rel11_t pnf_phy_rel11;
nfapi_pnf_phy_rel11_t pnf_phy_rel11; // nfapi_pnf_phy_rel12_t pnf_phy_rel12;
nfapi_pnf_phy_rel12_t pnf_phy_rel12; // nfapi_pnf_phy_rel13_t pnf_phy_rel13;
nfapi_pnf_phy_rel13_t pnf_phy_rel13; // nfapi_pnf_phy_rel13_nb_iot_t pnf_phy_rel13_nb_iot;
nfapi_pnf_phy_rel13_nb_iot_t pnf_phy_rel13_nb_iot;
nfapi_pnf_phy_rel15_t pnf_phy_rel15; nfapi_pnf_phy_rel15_t pnf_phy_rel15;
*/
nfapi_vendor_extension_tlv_t vendor_extension; nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_pnf_param_response_t; } nfapi_pnf_param_response_t;
...@@ -3957,6 +3955,7 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -3957,6 +3955,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_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 Decodes an NFAPI P5 message header /*! \brief Decodes an NFAPI P5 message header
* \param pMessageBuf A pointer to an encoded P5 message header * \param pMessageBuf A pointer to an encoded P5 message header
...@@ -3980,6 +3979,7 @@ int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo ...@@ -3980,6 +3979,7 @@ 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 * 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); 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 /*! \brief Encodes an NFAPI P7 message to a buffer
......
...@@ -69,8 +69,16 @@ typedef enum { ...@@ -69,8 +69,16 @@ typedef enum {
NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION= 0X86, NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION= 0X86,
NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION= 0X87, NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION= 0X87,
NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION= 0X88, NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION= 0X88,
NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89 NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89,
//RESERVED 0X8a ~ 0xff //RESERVED 0X8a ~ 0xff
NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST = 0x0100,
NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE = 0x0101,
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST= 0x0102,
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE= 0x0103,
NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST= 0x0104,
NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE= 0x0105,
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST= 0x0106,
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE= 0x0107
} nfapi_nr_phy_msg_type_e; } nfapi_nr_phy_msg_type_e;
// SCF222_5G-FAPI_PHY_SPI_Specificayion.pdf Section 3.3 // SCF222_5G-FAPI_PHY_SPI_Specificayion.pdf Section 3.3
...@@ -454,6 +462,54 @@ typedef enum { // Table 2-27 ...@@ -454,6 +462,54 @@ typedef enum { // Table 2-27
NFAPI_NR_START_MSG_INVALID_STATE NFAPI_NR_START_MSG_INVALID_STATE
} nfapi_nr_start_errors_e; } nfapi_nr_start_errors_e;
//PNF P5 NR
typedef struct {
nfapi_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;
uint32_t error_code;
nfapi_pnf_param_general_t pnf_param_general;
nfapi_pnf_phy_t pnf_phy;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_pnf_param_response_t;
typedef struct {
nfapi_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;
uint32_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_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_pnf_start_request_t;
typedef struct {
nfapi_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_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_pnf_stop_request_t;
typedef struct {
nfapi_p4_p5_message_header_t header;
uint32_t error_code;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_pnf_stop_response_t;
/* PARAM.REQUEST */ /* PARAM.REQUEST */
......
This diff is collapsed.
This diff is collapsed.
...@@ -39,6 +39,7 @@ typedef struct { ...@@ -39,6 +39,7 @@ typedef struct {
int pnf_connect(pnf_t *pnf); int pnf_connect(pnf_t *pnf);
int pnf_message_pump(pnf_t *pnf); int pnf_message_pump(pnf_t *pnf);
//int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len); int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len); int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
int pnf_send_message(pnf_t* pnf, uint8_t* msg, uint32_t msg_len, uint16_t stream_id); int pnf_send_message(pnf_t* pnf, uint8_t* msg, uint32_t msg_len, uint16_t stream_id);
......
...@@ -127,6 +127,7 @@ typedef struct nfapi_pnf_config ...@@ -127,6 +127,7 @@ typedef struct nfapi_pnf_config
* The client is expected to send the PNF_PARAM.response after receiving the * The client is expected to send the PNF_PARAM.response after receiving the
* PNF_PARAM.request. This can be done in the call back. * PNF_PARAM.request. This can be done in the call back.
*/ */
//int (*pnf_nr_param_req)(nfapi_pnf_config_t* config, nfapi_nr_pnf_param_request_t* req);
int (*pnf_param_req)(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req); int (*pnf_param_req)(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req);
/*! A callback for the PNF_CONFIG.request /*! A callback for the PNF_CONFIG.request
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include "SCHED_NR/phy_frame_config_nr.h" #include "SCHED_NR/phy_frame_config_nr.h"
#include "NR_MIB.h" #include "NR_MIB.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_common.h" #include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#endif #endif
...@@ -82,7 +82,51 @@ nfapi_pnf_phy_config_t* nfapi_pnf_phy_config_find(nfapi_pnf_config_t* config, ui ...@@ -82,7 +82,51 @@ nfapi_pnf_phy_config_t* nfapi_pnf_phy_config_find(nfapi_pnf_config_t* config, ui
} }
return 0; return 0;
} }
/*
void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{
// ensure it's valid
if (pRecvMsg == NULL || pnf == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
}
else
{
nfapi_nr_pnf_param_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n");
// unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_nr_pnf_param_request_t), &pnf->_public.codec_config) >= 0)
{
if(pnf->_public.state == NFAPI_PNF_IDLE)
{
if(pnf->_public.pnf_nr_param_req)
{
(pnf->_public.pnf_nr_param_req)(&pnf->_public, &req);
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__);
nfapi_pnf_param_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
resp.error_code = NFAPI_MSG_INVALID_STATE;
nfapi_pnf_pnf_param_resp(&pnf->_public, &resp);
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
}
if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension);
}
}
*/
void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
// ensure it's valid // ensure it's valid
...@@ -1098,8 +1142,103 @@ void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uin ...@@ -1098,8 +1142,103 @@ void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uin
} }
} }
/*
void pnf_nr_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{
nfapi_p4_p5_message_header_t messageHeader;
// validate the input params
if(pRecvMsg == NULL || recvMsgLen < NFAPI_HEADER_LENGTH)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return;
}
// unpack the message header
if (nfapi_p5_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p4_p5_message_header_t), &pnf->_public.codec_config) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
return;
}
switch (messageHeader.message_id)
{
case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
pnf_nr_handle_pnf_param_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_PNF_CONFIG_REQUEST:
pnf_handle_pnf_config_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_PNF_START_REQUEST:
pnf_handle_pnf_start_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_PNF_STOP_REQUEST:
pnf_handle_pnf_stop_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_PARAM_REQUEST:
pnf_handle_param_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_CONFIG_REQUEST:
pnf_handle_config_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_START_REQUEST:
pnf_handle_start_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_STOP_REQUEST:
pnf_handle_stop_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_MEASUREMENT_REQUEST:
pnf_handle_measurement_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_RSSI_REQUEST:
pnf_handle_rssi_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_CELL_SEARCH_REQUEST:
pnf_handle_cell_search_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_BROADCAST_DETECT_REQUEST:
pnf_handle_broadcast_detect_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST:
pnf_handle_system_information_schedule_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_SYSTEM_INFORMATION_REQUEST:
pnf_handle_system_information_request(pnf, pRecvMsg, recvMsgLen);
break;
case NFAPI_NMM_STOP_REQUEST:
pnf_handle_nmm_stop_request(pnf, pRecvMsg, recvMsgLen);
break;
default:
{
if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
messageHeader.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
{
pnf_handle_vendor_extension(pRecvMsg, recvMsgLen, pnf, messageHeader.message_id);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, messageHeader.message_id);
}
}
break;
}
}
*/
void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
nfapi_p4_p5_message_header_t messageHeader; nfapi_p4_p5_message_header_t messageHeader;
...@@ -1196,6 +1335,24 @@ void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) ...@@ -1196,6 +1335,24 @@ void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
} }
} }
// int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
// {
// int packed_len = nfapi_nr_p5_message_pack(msg, msg_len,
// pnf->tx_message_buffer,
// sizeof(pnf->tx_message_buffer),
// &pnf->_public.codec_config);
// if (packed_len < 0)
// {
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p5_message_pack failed (%d)\n", packed_len);
// return -1;
// }
// return pnf_send_message(pnf, pnf->tx_message_buffer, packed_len, 0/*msg->stream_id*/);
// }
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len) int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
{ {
int packed_len = nfapi_p5_message_pack(msg, msg_len, int packed_len = nfapi_p5_message_pack(msg, msg_len,
......
...@@ -98,6 +98,21 @@ int nfapi_pnf_stop(nfapi_pnf_config_t* config) ...@@ -98,6 +98,21 @@ int nfapi_pnf_stop(nfapi_pnf_config_t* config)
return 0; return 0;
} }
/*
int nfapi_nr_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_param_response_t* resp)
{
// ensure it's valid
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1;
}
pnf_t* _this = (pnf_t*)(config);
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_pnf_param_response_t));
}
*/
int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp) int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp)
{ {
// ensure it's valid // ensure it's valid
......
This diff is collapsed.
...@@ -35,6 +35,8 @@ typedef struct ...@@ -35,6 +35,8 @@ typedef struct
int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len); int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
int vnf_pack_and_send_p4_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len); int vnf_pack_and_send_p4_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf); int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf);
......
...@@ -121,6 +121,7 @@ typedef struct nfapi_vnf_config ...@@ -121,6 +121,7 @@ typedef struct nfapi_vnf_config
* *
* \todo Do we need to send the address information of the PNF? * \todo Do we need to send the address information of the PNF?
*/ */
int (*pnf_nr_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx); int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
/*! \brief Callback indicating that a pnf has lost connection /*! \brief Callback indicating that a pnf has lost connection
...@@ -161,6 +162,7 @@ typedef struct nfapi_vnf_config ...@@ -161,6 +162,7 @@ typedef struct nfapi_vnf_config
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*pnf_nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_response_t* resp);
int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp); int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp);
/*! A callback for the PNF_CONFIG.resp /*! A callback for the PNF_CONFIG.resp
...@@ -471,6 +473,8 @@ void nfapi_vnf_config_destory(nfapi_vnf_config_t* config); ...@@ -471,6 +473,8 @@ void nfapi_vnf_config_destory(nfapi_vnf_config_t* config);
* *
* This function will not return untill nfapi_vnf_stop is called * This function will not return untill nfapi_vnf_stop is called
*/ */
//int nfapi_nr_vnf_start(nfapi_vnf_config_t* config);
int nfapi_vnf_start(nfapi_vnf_config_t* config); int nfapi_vnf_start(nfapi_vnf_config_t* config);
/*! Stop the VNF library. /*! Stop the VNF library.
...@@ -502,6 +506,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy ...@@ -502,6 +506,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
* \return 0 means success, -1 failure * \return 0 means success, -1 failure
*/ */
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req); int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req);
//int nfapi_nr_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_request_t* req);
/*! Send the PNF_CONFIG.request /*! Send the PNF_CONFIG.request
* \param config A pointer to a vnf config * \param config A pointer to a vnf config
...@@ -953,7 +958,7 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti ...@@ -953,7 +958,7 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req); int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req);
int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req);
/*! Send the HI_DCI0.request /*! Send the HI_DCI0.request
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded HI_DCI0.request. * \param req A data structure for the decoded HI_DCI0.request.
...@@ -963,7 +968,7 @@ int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_re ...@@ -963,7 +968,7 @@ int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_re
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req); int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
int nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req);
/*! Send the TX.req /*! Send the TX.req
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded HI_DCI0.request. * \param req A data structure for the decoded HI_DCI0.request.
...@@ -973,7 +978,7 @@ int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_reques ...@@ -973,7 +978,7 @@ int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_reques
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req); int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req);
int nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req);
/*! Send the LBT_DL_CONFIG.requst /*! Send the LBT_DL_CONFIG.requst
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded LBT_DL_CONFIG.request. * \param req A data structure for the decoded LBT_DL_CONFIG.request.
......
...@@ -102,7 +102,40 @@ nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5 ...@@ -102,7 +102,40 @@ nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5
return 0; return 0;
} }
/*
void vnf_nr_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
{
// ensure it's valid
if (pRecvMsg == NULL || config == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : NULL parameters\n", __FUNCTION__);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_PARAM.reponse\n");
nfapi_nr_pnf_param_response_t msg;
// unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
{
// Invoke the call back
if(config->pnf_nr_param_resp)
{
(config->pnf_nr_param_resp)(config, p5_idx, &msg);
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
}
// make sure to release any dyanmic part of the message
if(msg.vendor_extension)
config->codec_config.deallocate(msg.vendor_extension);
}
}
*/
void vnf_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx) void vnf_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
{ {
// ensure it's valid // ensure it's valid
...@@ -820,6 +853,123 @@ void vnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, nfapi_vnf_confi ...@@ -820,6 +853,123 @@ void vnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, nfapi_vnf_confi
} }
} }
#if 0
void vnf_nr_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config)
{
nfapi_p4_p5_message_header_t messageHeader;
// validate the input params
if(pRecvMsg == NULL || recvMsgLen < NFAPI_HEADER_LENGTH || config == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p4_p5_message: invalid input params\n");
return;
}
// unpack the message header
if (nfapi_p5_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p4_p5_message_header_t), &config->codec_config) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
return;
}
switch (messageHeader.message_id)
{
case NFAPI_PNF_PARAM_RESPONSE:
vnf_nr_handle_pnf_param_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_PNF_CONFIG_RESPONSE:
vnf_handle_pnf_config_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_PNF_START_RESPONSE:
vnf_handle_pnf_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_PNF_STOP_RESPONSE:
vnf_handle_pnf_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_PARAM_RESPONSE:
vnf_handle_param_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_CONFIG_RESPONSE:
vnf_handle_config_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_START_RESPONSE:
vnf_handle_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_STOP_RESPONSE:
vnf_handle_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_MEASUREMENT_RESPONSE:
vnf_handle_measurement_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_RSSI_RESPONSE:
vnf_handle_rssi_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_RSSI_INDICATION:
vnf_handle_rssi_indication(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_CELL_SEARCH_RESPONSE:
vnf_handle_cell_search_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_CELL_SEARCH_INDICATION:
vnf_handle_cell_search_indication(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_BROADCAST_DETECT_RESPONSE:
vnf_handle_broadcast_detect_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_BROADCAST_DETECT_INDICATION:
vnf_handle_broadcast_detect_indication(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE:
vnf_handle_system_information_schedule_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION:
vnf_handle_system_information_schedule_indication(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_SYSTEM_INFORMATION_RESPONSE:
vnf_handle_system_information_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_SYSTEM_INFORMATION_INDICATION:
vnf_handle_system_information_indication(pRecvMsg, recvMsgLen, config, p5_idx);
break;
case NFAPI_NMM_STOP_RESPONSE:
vnf_handle_nmm_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
break;
default:
{
if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
messageHeader.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
{
vnf_handle_vendor_extension(pRecvMsg, recvMsgLen, config, p5_idx, messageHeader.message_id);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, messageHeader.message_id);
}
}
break;
}
}
#endif
void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config) void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config)
{ {
nfapi_p4_p5_message_header_t messageHeader; nfapi_p4_p5_message_header_t messageHeader;
...@@ -935,6 +1085,7 @@ void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_ ...@@ -935,6 +1085,7 @@ void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_
break; break;
} }
} }
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf) int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
{ {
if(1) if(1)
...@@ -1092,6 +1243,31 @@ static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len, ...@@ -1092,6 +1243,31 @@ static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len,
return 0; return 0;
} }
/*
int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
{
nfapi_vnf_pnf_info_t* pnf = nfapi_vnf_pnf_list_find(&(vnf->_public), p5_idx);
if(pnf)
{
// pack the message for transmission
int packedMessageLength = nfapi_nr_p5_message_pack(msg, msg_len, vnf->tx_message_buffer, sizeof(vnf->tx_message_buffer), &vnf->_public.codec_config);
if (packedMessageLength < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p5_message_pack failed with return %d\n", packedMessageLength);
return -1;
}
return vnf_send_p5_msg(pnf, vnf->tx_message_buffer, packedMessageLength, 0);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find pnf info for p5_idx:%d\n", __FUNCTION__, p5_idx);
return -1;
}
}
*/
int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len) int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
{ {
......
This diff is collapsed.
...@@ -361,7 +361,7 @@ uint32_t calculate_t1(uint16_t sfn, uint16_t slot, uint32_t slot_start_time_hr) ...@@ -361,7 +361,7 @@ uint32_t calculate_t1(uint16_t sfn, uint16_t slot, uint32_t slot_start_time_hr)
uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr); uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr);
uint32_t t1 = (NFAPI_SFNSLOT2DEC(sfn,slot) * 500) + slot_time_us; uint32_t t1 = (NFAPI_SFNSLOT2DEC(sfn,slot) * 500) + slot_time_us;
return t1; return t1;
} }
...@@ -381,7 +381,7 @@ uint32_t calculate_t4(uint32_t now_time_hr, uint16_t sfn, uint16_t slot, uint32_ ...@@ -381,7 +381,7 @@ uint32_t calculate_t4(uint32_t now_time_hr, uint16_t sfn, uint16_t slot, uint32_
uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr); uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr);
uint32_t t4 = (NFAPI_SFNSLOT2DEC(sfn,slot) * 500) + slot_time_us; uint32_t t4 = (NFAPI_SFNSLOT2DEC(sfn,slot) * 500) + slot_time_us;
return t4; return t4;
} }
...@@ -394,7 +394,7 @@ uint32_t calculate_transmit_timestamp(uint16_t sfn, uint16_t slot, uint32_t slot ...@@ -394,7 +394,7 @@ uint32_t calculate_transmit_timestamp(uint16_t sfn, uint16_t slot, uint32_t slot
uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr); uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr);
uint32_t tt = (NFAPI_SFNSLOT2DEC(sfn, slot) * 500) + slot_time_us; uint32_t tt = (NFAPI_SFNSLOT2DEC(sfn, slot) * 500) + slot_time_us;
return tt; return tt;
} }
...@@ -982,9 +982,9 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -982,9 +982,9 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{ {
phy->latency[phy->min_sync_cycle_count] = latency; phy->latency[phy->min_sync_cycle_count] = latency;
NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) PNF to VNF !sync phy_id:%d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d\n", //NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) PNF to VNF !sync phy_id:%d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d\n",
phy->sfn, phy->slot, ind.header.phy_id, ind.t1, ind.t2, ind.t3, t4, // phy->sfn, phy->slot, ind.header.phy_id, ind.t1, ind.t2, ind.t3, t4,
tx_2_rx, pnf_proc_time, latency); // tx_2_rx, pnf_proc_time, latency);
} }
else else
{ {
...@@ -1027,11 +1027,11 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1027,11 +1027,11 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
struct timespec ts; struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); clock_gettime(CLOCK_MONOTONIC, &ts);
NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n", //NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id, // phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
ind.t1, ind.t2, ind.t3, t4, // ind.t1, ind.t2, ind.t3, t4,
tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered, // tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
(ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2)); // (ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
} }
} }
...@@ -1068,10 +1068,15 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1068,10 +1068,15 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
phy->slot_offset = ind.t2 - (ind.t1 - phy->average_latency); phy->slot_offset = ind.t2 - (ind.t1 - phy->average_latency);
sfn_slot_dec += (phy->slot_offset / 500); sfn_slot_dec += (phy->slot_offset / 500);
NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF slot offset:%d sfn :%d slot:%d \n",phy->slot_offset,NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec),NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec) );
} }
else else
{ {
sfn_slot_dec += ((phy->slot_offset_filtered + 250) / 500); //Round up to go from microsecond to slot sfn_slot_dec += ((phy->slot_offset_filtered + 250) / 500); //Round up to go from microsecond to slot
} }
if(sfn_slot_dec < 0) if(sfn_slot_dec < 0)
...@@ -1090,7 +1095,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1090,7 +1095,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{ {
phy->adjustment = NFAPI_SFNSLOT2DEC(new_sfn, new_slot) - NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot); phy->adjustment = NFAPI_SFNSLOT2DEC(new_sfn, new_slot) - NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot);
NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d phy->previous_slot_offset_filtered:%d phy->previous_slot_offset_filtered:%d phy->slot_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_slot_offset_filtered, phy->previous_slot_offset_filtered, phy->slot_offset_trend); //NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d phy->previous_slot_offset_filtered:%d phy->previous_slot_offset_filtered:%d phy->slot_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_slot_offset_filtered, phy->previous_slot_offset_filtered, phy->slot_offset_trend);
phy->previous_t1 = 0; phy->previous_t1 = 0;
phy->previous_t2 = 0; phy->previous_t2 = 0;
...@@ -1196,14 +1201,14 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1196,14 +1201,14 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
if(phy->insync_minor_adjustment != 0) if(phy->insync_minor_adjustment != 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (slot_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adjustment:%d\n", // NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (slot_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adjustment:%d\n",
phy->sfn, phy->slot, ind.header.phy_id, // phy->sfn, phy->slot, ind.header.phy_id,
phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, // phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration,
phy->slot_offset_filtered, // phy->slot_offset_filtered,
insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend, // insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend,
NFAPI_SFNSLOT2DEC(new_sfn, new_slot), // NFAPI_SFNSLOT2DEC(new_sfn, new_slot),
NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot), // NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot),
phy->adjustment); // phy->adjustment);
} }
} }
} }
...@@ -1239,13 +1244,13 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1239,13 +1244,13 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
// out of sync? // out of sync?
} }
NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (adjustment:%d slot_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adj:%d\n", // NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (adjustment:%d slot_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adj:%d\n",
phy->sfn, phy->slot, ind.header.phy_id, // phy->sfn, phy->slot, ind.header.phy_id,
phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->slot_offset_filtered, // phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->slot_offset_filtered,
insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend, // insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend,
NFAPI_SFNSLOT2DEC(new_sfn, new_slot), // NFAPI_SFNSLOT2DEC(new_sfn, new_slot),
NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot), // NFAPI_SFNSLOT2DEC(curr_sfn, curr_slot),
phy->adjustment); // phy->adjustment);
} }
else if(phy->adjustment < 0) else if(phy->adjustment < 0)
...@@ -1272,10 +1277,10 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1272,10 +1277,10 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
// out of sync? // out of sync?
} }
NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (adjustment:%d slot_offset_filtered:%d) %d %d %d\n", // NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d slots (adjustment:%d slot_offset_filtered:%d) %d %d %d\n",
phy->sfn, phy->slot, ind.header.phy_id, // phy->sfn, phy->slot, ind.header.phy_id,
phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->slot_offset_filtered, // phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->slot_offset_filtered,
insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend); // insync_minor_adjustment_1, insync_minor_adjustment_2, phy->slot_offset_trend);
} }
/* /*
...@@ -1349,12 +1354,13 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1349,12 +1354,13 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
// Panos: Careful here!!! Modification of the original nfapi-code // Panos: Careful here!!! Modification of the original nfapi-code
//if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1) //if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
//printf("VNF-PNF delta - %d", vnf_pnf_sfnslot_delta);
if (vnf_pnf_sfnslot_delta>0 || vnf_pnf_sfnslot_delta < 0) if (vnf_pnf_sfnslot_delta>0 || vnf_pnf_sfnslot_delta < 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnslot_delta,NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot),NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot)) ; NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnslot_delta,NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot),NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot)) ;
// Panos: Careful here!!! Modification of the original nfapi-code // Panos: Careful here!!! Modification of the original nfapi-code
vnf_p7->p7_connections[0].sfn = ind.last_sfn; // vnf_p7->p7_connections[0].sfn = ind.last_sfn;
vnf_p7->p7_connections[0].slot = ind.last_slot; // vnf_p7->p7_connections[0].slot = ind.last_slot;
} }
} }
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define FAPI2_IP_DSCP 0 #define FAPI2_IP_DSCP 0
nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create() nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
{ {
vnf_p7_t* _this = (vnf_p7_t*)calloc(1, sizeof(vnf_p7_t)); vnf_p7_t* _this = (vnf_p7_t*)calloc(1, sizeof(vnf_p7_t));
...@@ -145,7 +146,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -145,7 +146,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
//struct timespec original_pselect_timeout; //struct timespec original_pselect_timeout;
struct timespec pselect_timeout; struct timespec pselect_timeout;
pselect_timeout.tv_sec = 0; pselect_timeout.tv_sec = 0;
pselect_timeout.tv_nsec = 500000; // ns in a 1 ms (Change?) pselect_timeout.tv_nsec = 500000; // ns in a 0.5 ms
//pselect_timeout.tv_nsec = 500000; //pselect_timeout.tv_nsec = 500000;
struct timespec pselect_start; struct timespec pselect_start;
...@@ -161,21 +162,21 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -161,21 +162,21 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
// sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR // sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR
struct timespec slot_duration; struct timespec slot_duration;
slot_duration.tv_sec = 0; slot_duration.tv_sec = 0;
//slot_duration.tv_nsec = 0.5e6;
slot_duration.tv_nsec = 0.5e6; slot_duration.tv_nsec = 0.5e6;
// struct timespec sf_start; //Change to slot_start? // struct timespec sf_start; //Change to slot_start?
struct timespec slot_start; struct timespec slot_start;
// clock_gettime(CLOCK_MONOTONIC, &sf_start); // clock_gettime(CLOCK_MONOTONIC, &sf_start);
clock_gettime(CLOCK_MONOTONIC, &slot_start); clock_gettime(CLOCK_MONOTONIC, &slot_start);
// long millisecond = sf_start.tv_nsec / 1e6; //Check if we have to change long millisecond = slot_start.tv_nsec / 1e6; //Check if we have to change
long millisecond = slot_start.tv_nsec / 1e6; //long millisecond = slot_start.tv_nsec / 0.5e6;
// sf_start = timespec_add(sf_start, sf_duration); // sf_start = timespec_add(sf_start, sf_duration);
slot_start = timespec_add(slot_start, slot_duration); slot_start = timespec_add(slot_start, slot_duration);
NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", slot_start.tv_sec, slot_start.tv_nsec); NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", slot_start.tv_sec, slot_start.tv_nsec);
//printf("next slot will start at %d.%d\n",slot_start.tv_sec, slot_start.tv_nsec);
while(vnf_p7->terminate == 0) while(vnf_p7->terminate == 0)
{ {
fd_set rfds; fd_set rfds;
...@@ -346,8 +347,8 @@ NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d] ...@@ -346,8 +347,8 @@ NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d]
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n", // NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
// phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration); // phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Slot minor adjustment %dus slot_start.tv_nsec:%d duration:%u\n", // NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Slot minor adjustment %dus slot_start.tv_nsec:%d duration:%u\n",
phy->insync_minor_adjustment, slot_start.tv_nsec, phy->insync_minor_adjustment_duration); // phy->insync_minor_adjustment, slot_start.tv_nsec, phy->insync_minor_adjustment_duration);
if (phy->insync_minor_adjustment_duration==0) if (phy->insync_minor_adjustment_duration==0)
{ {
...@@ -391,37 +392,31 @@ NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d] ...@@ -391,37 +392,31 @@ NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d]
{ {
//vnf_p7->sf_start_time_hr = vnf_get_current_time_hr(); //vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
vnf_p7->slot_start_time_hr = vnf_get_current_time_hr(); vnf_p7->slot_start_time_hr = vnf_get_current_time_hr();
struct timespec current_time;
clock_gettime(CLOCK_MONOTONIC, &current_time);
// pselect timed out // pselect timed out
nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections; nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
while(curr != 0) while(curr != 0)
{ {
if (curr->slot == 19) if (curr->slot == 19)
{ { //curr->slot = 0;
curr->sfn++; if(curr->sfn == 1023)
curr->slot = 0; //Correct? - gokul curr->sfn=0;
} else
else if(curr->slot > 19) curr->sfn++;
{ curr->slot=0;
//error
} }
else else
{ {
curr->slot++; curr->slot++;
} }
//curr->sfn_sf = increment_sfn_sf(curr->sfn_sf); vnf_sync(vnf_p7, curr);
//printf("\nsfn:%d, slot:%d\n current time:%d.%d",curr->sfn,curr->slot,current_time.tv_sec, current_time.tv_nsec); //remove later - gokul
vnf_sync(vnf_p7, curr); //printf("next slot will start at %d.%d\n",current_time.tv_sec, current_time.tv_nsec);
//printf("sfn:%d, slot:%d",curr->sfn,curr->slot); //remove later - gokul curr = curr->next;
curr = curr->next;
} }
//send_mac_subframe_indications(vnf_p7); //send_mac_subframe_indications(vnf_p7);
send_mac_slot_indications(vnf_p7); send_mac_slot_indications(vnf_p7);
} }
else if(selectRetval > 0) else if(selectRetval > 0)
{ {
......
...@@ -478,7 +478,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -478,7 +478,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value); uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value);
fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ; fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ;
printf("\n%d\t%d\t%d\n", fp->ul_CarrierFreq, fp->dl_CarrierFreq, dlul_offset ); //printf("\n%d\t%d\t%d\n", fp->ul_CarrierFreq, fp->dl_CarrierFreq, dlul_offset );
AssertFatal(fp->ul_CarrierFreq==(fp->dl_CarrierFreq+dlul_offset), "Disagreement in uplink frequency for band %d\n", fp->nr_band); AssertFatal(fp->ul_CarrierFreq==(fp->dl_CarrierFreq+dlul_offset), "Disagreement in uplink frequency for band %d\n", fp->nr_band);
fp->threequarter_fs = openair0_cfg[0].threequarter_fs; fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
......
...@@ -333,180 +333,7 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB, ...@@ -333,180 +333,7 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB,
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) } // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
return 0; return 0;
} }
*/
uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu,
uint32_t **gold_pdcch_dmrs,
int32_t *txdataF,
int16_t amp,
NR_DL_FRAME_PARMS frame_parms) {
int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1]; // 3 for the max coreset duration
uint16_t cset_start_sc;
uint8_t cset_start_symb, cset_nsymb;
int k,l,k_prime,dci_idx, dmrs_idx;
/*First iteration: single DCI*/
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15=NULL;
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *temp;
temp = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t *)malloc(sizeof(nfapi_nr_dl_tti_pdcch_pdu_rel15_t));
int s = sizeof(nfapi_nr_dl_tti_pdcch_pdu_rel15_t);
// find coreset descriptor
int rb_offset;
int n_rb;
AssertFatal(pdcch_pdu!=NULL || ul_dci_pdu!=NULL,"At least one pointer has to be !NULL\n");
AssertFatal(pdcch_pdu==NULL || ul_dci_pdu==NULL,"Can't handle both DL and UL DCI in same slot\n");
if (pdcch_pdu) pdcch_pdu_rel15 = &pdcch_pdu->pdcch_pdu_rel15;
else if (ul_dci_pdu) pdcch_pdu_rel15 = &ul_dci_pdu->pdcch_pdu.pdcch_pdu_rel15;
get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset);
// compute rb_offset and n_prb based on frequency allocation
if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) {
cset_start_sc = frame_parms.first_carrier_offset + (frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB +
rb_offset)*NR_NB_SC_PER_RB;
} else
cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB;
memcpy(temp, pdcch_pdu_rel15,sizeof(nfapi_nr_dl_tti_pdcch_pdu_rel15_t));
for (volatile int d=0;d < temp->numDlDci;d++) {
/*The coreset is initialised
* in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset for coreset 0
* or the rb_offset for other coresets
* in time: by its first slot and its first symbol*/
cset_start_symb = temp->StartSymbolIndex;
cset_nsymb = temp->DurationSymbols;
dci_idx = 0;
LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb);
LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
// DMRS length is per OFDM symbol
AssertFatal(temp->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED,
"Interleaved CCE REG MAPPING not supported\n");
uint32_t dmrs_length = (temp->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED)?
(n_rb*6) : (temp->AggregationLevel[d]*36/cset_nsymb); //2(QPSK)*3(per RB)*6(REG per CCE)
uint32_t encoded_length = temp->AggregationLevel[d]*108; //2(QPSK)*9(per RB)*6(REG per CCE)
LOG_D(PHY, "DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d,reg_mapping %d)\n", dmrs_length, encoded_length,temp->precoderGranularity,temp->CceRegMappingType);
dmrs_length += rb_offset*6; // To accommodate more DMRS symbols in case of rb offset
/// DMRS QPSK modulation
for (int symb=cset_start_symb; symb<cset_start_symb + temp->DurationSymbols; symb++) {
nr_modulation(gold_pdcch_dmrs[symb], dmrs_length, DMRS_MOD_ORDER, mod_dmrs[symb]); //Qm = 2 as DMRS is QPSK modulated
#ifdef DEBUG_PDCCH_DMRS
for (int i=0; i<dmrs_length>>1; i++)
printf("symb %d i %d gold seq 0x%08x mod_dmrs %d %d\n", symb, i,
gold_pdcch_dmrs[symb][i>>5], mod_dmrs[symb][i<<1], mod_dmrs[symb][(i<<1)+1] );
#endif
}
/// DCI payload processing
// CRC attachment + Scrambling + Channel coding + Rate matching
uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD];
uint16_t n_RNTI = temp->RNTI[d];
uint16_t Nid = temp->ScramblingId[d];
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE,
temp->PayloadSizeBits[d],
temp->AggregationLevel[d],
0,NULL);
polar_encoder_fast((uint64_t*)temp->Payload[d], encoder_output, n_RNTI,1,currentPtr);
#ifdef DEBUG_CHANNEL_CODING
printf("polar rnti %x,length %d, L %d\n",n_RNTI, temp->PayloadSizeBits[d],temp->AggregationLevel[d]);
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
((uint64_t*)temp->Payload[d])[0], ((uint64_t*)temp->Payload[d])[1]);
printf("Encoded Payload (length:%d dwords):\n", encoded_length>>5);
for (int i=0; i<encoded_length>>5; i++)
printf("[%d]->0x%08x \t", i,encoder_output[i]);
printf("\n");
#endif
/// Scrambling
uint32_t scrambled_output[NR_MAX_DCI_SIZE_DWORD]= {0};
nr_pdcch_scrambling(encoder_output, encoded_length, Nid, n_RNTI, scrambled_output);
#ifdef DEBUG_CHANNEL_CODING
printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\t [4]->0x%08x\t [5]->0x%08x\t \
[6]->0x%08x \t [7]->0x%08x \t [8]->0x%08x \t [9]->0x%08x\t [10]->0x%08x\t [11]->0x%08x\n",
scrambled_output[0], scrambled_output[1], scrambled_output[2], scrambled_output[3], scrambled_output[4],scrambled_output[5],
scrambled_output[6], scrambled_output[7], scrambled_output[8], scrambled_output[9], scrambled_output[10],scrambled_output[11] );
#endif
/// QPSK modulation
int16_t mod_dci[NR_MAX_DCI_SIZE>>1];
nr_modulation(scrambled_output, encoded_length, DMRS_MOD_ORDER, mod_dci); //Qm = 2 as DMRS is QPSK modulated
#ifdef DEBUG_DCI
for (int i=0; i<encoded_length>>1; i++)
printf("i %d mod_dci %d %d\n", i, mod_dci[i<<1], mod_dci[(i<<1)+1] );
#endif
/// Resource mapping
if (cset_start_sc >= frame_parms.ofdm_symbol_size)
cset_start_sc -= frame_parms.ofdm_symbol_size;
/*Reorder REG list for a freq first mapping*/
uint8_t nb_regs = temp->AggregationLevel[d]*NR_NB_REG_PER_CCE;
uint8_t reg_idx0 = temp->CceIndex[d]*NR_NB_REG_PER_CCE;
/*Mapping the encoded DCI along with the DMRS */
for (int reg_idx=reg_idx0; reg_idx<(nb_regs+reg_idx0); reg_idx++) {
k = cset_start_sc + (12*reg_idx/cset_nsymb);
if (k >= frame_parms.ofdm_symbol_size)
k -= frame_parms.ofdm_symbol_size;
l = cset_start_symb + ((reg_idx/cset_nsymb)%cset_nsymb);
// dmrs index depends on reference point for k according to 38.211 7.4.1.3.2
if (temp->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG)
dmrs_idx = (reg_idx/cset_nsymb)*3;
else
dmrs_idx = ((reg_idx/cset_nsymb)+rb_offset)*3;
k_prime = 0;
for (int m=0; m<NR_NB_SC_PER_RB; m++) {
if ( m == (k_prime<<2)+1) { // DMRS if not already mapped
if (temp->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED) {
((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (2*amp * mod_dmrs[l][dmrs_idx<<1]) >> 15;
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (2*amp * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15;
#ifdef DEBUG_PDCCH_DMRS
printf("PDCCH DMRS: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1],
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]);
#endif
dmrs_idx++;
}
k_prime++;
} else { // DCI payload
((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dci[dci_idx<<1]) >> 15;
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dci[(dci_idx<<1) + 1]) >> 15;
#ifdef DEBUG_DCI
printf("PDCCH: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1],
((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]);
#endif
dci_idx++;
}
k++;
if (k >= frame_parms.ofdm_symbol_size)
k -= frame_parms.ofdm_symbol_size;
} // m
} // reg_idx
} // for (int d=0;d<temp->numDlDci;d++)
return 0;
}
...@@ -203,7 +203,8 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r ...@@ -203,7 +203,8 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r
return ret; return ret;
}*/ }*/
int16_t find_nr_pdcch(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type) { int16_t find_nr_pdcch(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type) {
// if(slot==2)
//LOG_I(PHY,"\nFRAME %d SLOT %d gNB pdcch pdu frame %d,slot %d",frame,slot,gNB->pdcch_pdu[0].frame,gNB->pdcch_pdu[0].slot);
uint16_t i; uint16_t i;
int16_t first_free_index=-1; int16_t first_free_index=-1;
...@@ -227,11 +228,14 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -227,11 +228,14 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &pdcch_pdu->pdcch_pdu_rel15; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &pdcch_pdu->pdcch_pdu_rel15;
NR_gNB_DLSCH_t *dlsch; NR_gNB_DLSCH_t *dlsch;
for(int i=0;i<NUMBER_OF_NR_PDCCH_MAX;i++)
{
gNB->pdcch_pdu[i].frame=-1;
}
int pdcch_id = find_nr_pdcch(frame,slot,gNB,SEARCH_EXIST_OR_FREE); int pdcch_id = find_nr_pdcch(frame,slot,gNB,SEARCH_EXIST_OR_FREE);
AssertFatal(pdcch_id>=0 && pdcch_id<NUMBER_OF_NR_PDCCH_MAX,"Cannot find space for PDCCH, exiting\n"); AssertFatal(pdcch_id>=0 && pdcch_id<NUMBER_OF_NR_PDCCH_MAX,"Cannot find space for PDCCH, exiting\n");
memcpy((void*)&gNB->pdcch_pdu[pdcch_id].pdcch_pdu,(void*)pdcch_pdu,sizeof(*pdcch_pdu)); memcpy((void*)&gNB->pdcch_pdu[pdcch_id].pdcch_pdu,(void*)pdcch_pdu,sizeof(*pdcch_pdu));
gNB->pdcch_pdu[pdcch_id].frame = frame; gNB->pdcch_pdu[pdcch_id].frame = frame+2;
gNB->pdcch_pdu[pdcch_id].slot = slot; gNB->pdcch_pdu[pdcch_id].slot = slot;
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) { for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
......
...@@ -285,7 +285,7 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB, ...@@ -285,7 +285,7 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &pdsch_pdu->pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &pdsch_pdu->pdsch_pdu_rel15;
int dlsch_id = find_nr_dlsch(rel15->rnti,gNB,SEARCH_EXIST); int dlsch_id = find_nr_dlsch(pdsch_pdu->pdsch_pdu_rel15.rnti,gNB,SEARCH_EXIST);
AssertFatal( (dlsch_id>=0) && (dlsch_id<NUMBER_OF_NR_DLSCH_MAX), AssertFatal( (dlsch_id>=0) && (dlsch_id<NUMBER_OF_NR_DLSCH_MAX),
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id); "illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id);
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[dlsch_id][0]; NR_gNB_DLSCH_t *dlsch = gNB->dlsch[dlsch_id][0];
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_tti_request_t *dl_config_req); int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_tti_request_t *dl_config_req);
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req); int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req); int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
extern uint8_t nfapi_mode; extern uint8_t nfapi_mode;
...@@ -49,7 +50,7 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot, ...@@ -49,7 +50,7 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
AssertFatal(dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag== 1, "bchPayloadFlat %d != 1\n", AssertFatal(dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag== 1, "bchPayloadFlat %d != 1\n",
dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag); dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag);
LOG_D(PHY,"%d.%d : pbch_pdu: %x\n",frame,slot,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload); LOG_I(PHY,"%d.%d : pbch_pdu: %x\n",frame,slot,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload);
memcpy((void*)&gNB->ssb_pdu,&dl_tti_pdu->ssb_pdu,sizeof(dl_tti_pdu->ssb_pdu)); memcpy((void*)&gNB->ssb_pdu,&dl_tti_pdu->ssb_pdu,sizeof(dl_tti_pdu->ssb_pdu));
} }
...@@ -142,7 +143,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -142,7 +143,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
frame_t frame = Sched_INFO->frame; frame_t frame = Sched_INFO->frame;
sub_frame_t slot = Sched_INFO->slot; sub_frame_t slot = Sched_INFO->slot;
//LOG_I(PHY,"NFAPI: Sched_INFO:SFN/SLOT:%04d/%d\n",frame,slot);
AssertFatal(RC.gNB!=NULL,"RC.gNB is null\n"); AssertFatal(RC.gNB!=NULL,"RC.gNB is null\n");
AssertFatal(RC.gNB[Mod_id]!=NULL,"RC.gNB[%d] is null\n",Mod_id); AssertFatal(RC.gNB[Mod_id]!=NULL,"RC.gNB[%d] is null\n",Mod_id);
...@@ -171,7 +173,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -171,7 +173,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
gNB->pbch_configured=0; gNB->pbch_configured=0;
for (int i=0;i<number_dl_pdu;i++) { for (int i=0;i<number_dl_pdu;i++) {
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu = &DL_req->dl_tti_pdu_list[i]; volatile nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu = &DL_req->dl_tti_pdu_list[i];
LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_tti_pdu->PDUType); LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_tti_pdu->PDUType);
switch (dl_tti_pdu->PDUType) { switch (dl_tti_pdu->PDUType) {
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
...@@ -208,31 +210,53 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -208,31 +210,53 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
} }
// if (UL_tti_req!=NULL) memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t)); // if (UL_tti_req!=NULL) memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t));
if(nfapi_mode != 2)
if(nfapi_mode != 2) for (int i=0;i<number_ul_dci_pdu;i++) {
for (int i=0;i<number_ul_dci_pdu;i++) {
handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]); handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]);
} }
if (nfapi_mode != 0 )
{ if(nfapi_mode != 2)
if (Sched_INFO->TX_req->Number_of_PDUs > 0) for (int i = 0; i < number_ul_tti_pdu; i++) {
{ switch (UL_tti_req->pdus_list[i].pdu_type) {
Sched_INFO->TX_req->SFN = frame; case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
Sched_INFO->TX_req->Slot = slot; LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUSCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
oai_nfapi_tx_data_req(Sched_INFO->TX_req); nr_fill_ulsch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pusch_pdu);
break;
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUCCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
nr_fill_pucch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pucch_pdu);
break;
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
if (gNB->RU_list[0]->if_south == LOCAL_RF) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
break;
} }
//if(Sched_INFO->DL_req->nPDUs > 0) }
{
// if(nfapi_mode != 0 && number_ul_tti_pdu>0)
// {
// oai_nfapi_ul_tti_req(UL_tti_req);
// } Test only DL
if (nfapi_mode != 0)
{ if(Sched_INFO->DL_req->nPDUs > 0)
{
Sched_INFO->DL_req->SFN = frame; Sched_INFO->DL_req->SFN = frame;
Sched_INFO->DL_req->Slot = slot; Sched_INFO->DL_req->Slot = slot;
oai_nfapi_nr_dl_config_req(Sched_INFO->DL_req); oai_nfapi_nr_dl_config_req(Sched_INFO->DL_req);
} }
if (Sched_INFO->TX_req->Number_of_PDUs > 0)
{
oai_nfapi_tx_data_req(Sched_INFO->TX_req);
}
} }
if (nfapi_mode != 0 && Sched_INFO->UL_dci_req->numPdus!=0) if (nfapi_mode != 0 && Sched_INFO->UL_dci_req->numPdus!=0)
{ {
Sched_INFO->UL_dci_req->SFN=frame;
Sched_INFO->UL_dci_req->Slot=slot;
oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req); oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req);
} }
} }
...@@ -130,6 +130,9 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { ...@@ -130,6 +130,9 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
int frame,int slot, int frame,int slot,
int do_meas) { int do_meas) {
// struct timespec time;
// clock_gettime(CLOCK_MONOTONIC, &time);
// LOG_I(PHY,"\nphy_procedures_gNB_TX frame tx %d slot tx %d time %d.%d\n",frame,slot,time.tv_sec,time.tv_nsec);
int aa; int aa;
NR_DL_FRAME_PARMS *fp=&gNB->frame_parms; NR_DL_FRAME_PARMS *fp=&gNB->frame_parms;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
...@@ -168,7 +171,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -168,7 +171,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
gNB->Mod_id,frame,slot,pdcch_pdu_id,ul_pdcch_pdu_id); gNB->Mod_id,frame,slot,pdcch_pdu_id,ul_pdcch_pdu_id);
if (pdcch_pdu_id >= 0 || ul_pdcch_pdu_id >= 0) { if (pdcch_pdu_id >= 0 || ul_pdcch_pdu_id >= 0) {
LOG_D(PHY, "[gNB %d] Frame %d slot %d Calling nr_generate_dci_top (number of UL/DL DCI %d/%d)\n", LOG_I(PHY, "[gNB %d] Frame %d slot %d Calling nr_generate_dci_top (number of UL/DL DCI %d/%d)\n",
gNB->Mod_id, frame, slot, gNB->Mod_id, frame, slot,
gNB->ul_pdcch_pdu[ul_pdcch_pdu_id].pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci, gNB->ul_pdcch_pdu[ul_pdcch_pdu_id].pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci,
gNB->pdcch_pdu[pdcch_pdu_id].pdcch_pdu.pdcch_pdu_rel15.numDlDci); gNB->pdcch_pdu[pdcch_pdu_id].pdcch_pdu.pdcch_pdu_rel15.numDlDci);
...@@ -193,7 +196,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -193,7 +196,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
for (int i=0; i<gNB->num_pdsch_rnti[slot]; i++) { for (int i=0; i<gNB->num_pdsch_rnti[slot]; i++) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot); LOG_I(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot);
nr_generate_pdsch(gNB,frame, slot); nr_generate_pdsch(gNB,frame, slot);
if ((frame&127) == 0) dump_pdsch_stats(gNB); if ((frame&127) == 0) dump_pdsch_stats(gNB);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
......
...@@ -3870,7 +3870,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -3870,7 +3870,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
uint8_t eNB_id, uint8_t eNB_id,
uint8_t do_pdcch_flag, uint8_t do_pdcch_flag,
runmode_t mode) runmode_t mode)
{ { struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC,&curr_time);
//printf("Current time: %d.%d",curr_time.tv_sec,curr_time.tv_nsec);
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_tti_rx = proc->nr_tti_rx; int nr_tti_rx = proc->nr_tti_rx;
int slot_pbch; int slot_pbch;
...@@ -3974,7 +3976,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -3974,7 +3976,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if (dci_cnt > 0) { if (dci_cnt > 0) {
LOG_D(PHY,"[UE %d] Frame %d, nr_tti_rx %d: found %d DCIs\n", ue->Mod_id, frame_rx, nr_tti_rx, dci_cnt); LOG_I(PHY,"[UE %d] Frame %d, nr_tti_rx %d: found %d DCIs\n", ue->Mod_id, frame_rx, nr_tti_rx, dci_cnt);
NR_UE_DLSCH_t *dlsch = NULL; NR_UE_DLSCH_t *dlsch = NULL;
if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active == 1){ if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active == 1){
......
...@@ -291,18 +291,19 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -291,18 +291,19 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
} }
} }
#ifdef DEBUG_MIB //#ifdef DEBUG_MIB
LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]); LOG_I(MAC,"system frame number(6 MSB bits): %d\n", frame);
LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame); LOG_I(MAC,"Unused bits: %d\n", mac->mib->systemFrameNumber.bits_unused);
LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); // LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame);
LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); // LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon);
LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); // LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset);
LOG_I(MAC,"pdcch config sib1: %d\n", (int)mac->mib->pdcch_ConfigSIB1); // LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position);
LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); // LOG_I(MAC,"pdcch config sib1: %d\n", (int)mac->mib->pdcch_ConfigSIB1);
LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); // LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred);
LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); // LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection);
LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); // LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit);
#endif // LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index);
// //#endif
subcarrier_spacing_t scs_ssb = scs_30kHz; // default for subcarrier_spacing_t scs_ssb = scs_30kHz; // default for
//const uint32_t scs_index = 0; //const uint32_t scs_index = 0;
......
...@@ -449,7 +449,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -449,7 +449,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// hardcoding dlsch to be in slot 1 // hardcoding dlsch to be in slot 1
if (!(slot%num_slots_per_tdd)) { if (!(slot%num_slots_per_tdd)) {
if(slot==0) { if(slot==0) {
*dlsch_in_slot_bitmap = 0x02; *dlsch_in_slot_bitmap = 0x04;
*ulsch_in_slot_bitmap = 0x100; *ulsch_in_slot_bitmap = 0x100;
} }
else { else {
...@@ -508,7 +508,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -508,7 +508,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
nr_schedule_reception_msg3(module_idP, 0, frame, slot); nr_schedule_reception_msg3(module_idP, 0, frame, slot);
} else } else
UE_list->fiveG_connected[UE_id] = true; UE_list->fiveG_connected[UE_id] = true;
//printf("UE connected %d \n",UE_list->fiveG_connected[UE_id]);
if (get_softmodem_params()->phy_test) { if (get_softmodem_params()->phy_test) {
// TbD once RACH is available, start ta_timer when UE is connected // TbD once RACH is available, start ta_timer when UE is connected
...@@ -526,12 +526,12 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -526,12 +526,12 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
} }
} }
// This schedules the DCI for Uplink and subsequently PUSCH //This schedules the DCI for Uplink and subsequently PUSCH
if (UE_list->fiveG_connected[UE_id]) { if (UE_list->fiveG_connected[UE_id]) {
int tda = 1; // time domain assignment hardcoded for now int tda = 1; // time domain assignment hardcoded for now
schedule_fapi_ul_pdu(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, tda); schedule_fapi_ul_pdu(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, tda);
nr_schedule_pusch(module_idP, UE_id, num_slots_per_tdd, nr_ulmix_slots, frame, slot); nr_schedule_pusch(module_idP, UE_id, num_slots_per_tdd, nr_ulmix_slots, frame, slot);
} } //Testing DL only
if (UE_list->fiveG_connected[UE_id] && (is_xlsch_in_slot(*dlsch_in_slot_bitmap,slot%num_slots_per_tdd))) { if (UE_list->fiveG_connected[UE_id] && (is_xlsch_in_slot(*dlsch_in_slot_bitmap,slot%num_slots_per_tdd))) {
ue_sched_ctl->current_harq_pid = slot % num_slots_per_tdd; ue_sched_ctl->current_harq_pid = slot % num_slots_per_tdd;
......
...@@ -570,7 +570,7 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -570,7 +570,7 @@ void nr_generate_Msg2(module_id_t module_idP,
if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) { if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) {
nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body; nfapi_nr_dl_tti_request_t *dl_req = &nr_mac->DL_req[CC_id];
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
......
...@@ -251,7 +251,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -251,7 +251,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
int configure_fapi_dl_pdu(int Mod_idP, int configure_fapi_dl_pdu(int Mod_idP,
int *CCEIndex,
nfapi_nr_dl_tti_request_t *dl_tti_req, nfapi_nr_dl_tti_request_t *dl_tti_req,
NR_sched_pucch *pucch_sched, NR_sched_pucch *pucch_sched,
uint8_t *mcsIndex, uint8_t *mcsIndex,
...@@ -592,12 +591,12 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, ...@@ -592,12 +591,12 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
NR_sched_pucch *pucch_sched, NR_sched_pucch *pucch_sched,
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *dlsch_config){ nfapi_nr_dl_tti_pdsch_pdu_rel15_t *dlsch_config){
LOG_D(MAC, "In nr_schedule_uss_dlsch_phytest frame %d slot %d\n",frameP,slotP);
int post_padding = 0, ta_len = 0, header_length_total = 0, sdu_length_total = 0, num_sdus = 0; int post_padding = 0, ta_len = 0, header_length_total = 0, sdu_length_total = 0, num_sdus = 0;
int lcid, offset, i, header_length_last, TBS_bytes = 0; int lcid, offset, i, header_length_last, TBS_bytes = 0;
int UE_id = 0, CC_id = 0; int UE_id = 0,CC_id = 0;
LOG_I(MAC, "In nr_schedule_uss_dlsch_phytest frame %d slot %d DL req sfn %d slot %d\n",frameP,slotP,RC.nrmac[module_idP]->DL_req[CC_id].SFN,RC.nrmac[module_idP]->DL_req[CC_id].Slot);
gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP];
//NR_COMMON_channels_t *cc = nr_mac->common_channels; //NR_COMMON_channels_t *cc = nr_mac->common_channels;
//NR_ServingCellConfigCommon_t *scc=cc->ServingCellConfigCommon; //NR_ServingCellConfigCommon_t *scc=cc->ServingCellConfigCommon;
...@@ -621,7 +620,6 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, ...@@ -621,7 +620,6 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
ta_len = gNB_mac->ta_len; ta_len = gNB_mac->ta_len;
TBS_bytes = configure_fapi_dl_pdu(module_idP, TBS_bytes = configure_fapi_dl_pdu(module_idP,
CCEIndices,
dl_tti_req, dl_tti_req,
pucch_sched, pucch_sched,
dlsch_config!=NULL ? dlsch_config->mcsIndex : NULL, dlsch_config!=NULL ? dlsch_config->mcsIndex : NULL,
...@@ -690,7 +688,8 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, ...@@ -690,7 +688,8 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
// fill dlsch_buffer with random data // fill dlsch_buffer with random data
for (i = 0; i < TBS_bytes; i++){ for (i = 0; i < TBS_bytes; i++){
mac_sdus[i] = (unsigned char) (lrand48()&0xff); //mac_sdus[i] = (unsigned char) (lrand48()&0xff);
mac_sdus[i] = (unsigned char) (0x01);//for testing
//((uint8_t *)gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0])[i] = (unsigned char) (lrand48()&0xff); //((uint8_t *)gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0])[i] = (unsigned char) (lrand48()&0xff);
} }
//Sending SDUs with size 1 //Sending SDUs with size 1
......
...@@ -127,7 +127,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -127,7 +127,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
sub_frame_t subframeP); sub_frame_t subframeP);
int configure_fapi_dl_pdu(int Mod_id, int configure_fapi_dl_pdu(int Mod_id,
int *CCEIndeces,
nfapi_nr_dl_tti_request_t *dl_tti_req, nfapi_nr_dl_tti_request_t *dl_tti_req,
NR_sched_pucch *pucch_sched, NR_sched_pucch *pucch_sched,
uint8_t *mcsIndex, uint8_t *mcsIndex,
......
...@@ -1096,6 +1096,14 @@ void handle_nfapi_hi_dci0_hi_pdu( ...@@ -1096,6 +1096,14 @@ void handle_nfapi_hi_dci0_hi_pdu(
nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu) { nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu) {
} }
void rrc_pdcp_config_req (
const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const uint32_t actionP,
const rb_id_t rb_idP,
const uint8_t security_modeP){
}
void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB, void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,
int frame, int frame,
int subframe, int subframe,
......
...@@ -78,10 +78,11 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -78,10 +78,11 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
carrier->MIB, carrier->MIB,
24); 24);
LOG_D(NR_RRC,"Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n",frameP,sfn_msb,carrier->MIB,enc_rval.encoded); LOG_D(NR_RRC,"Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n",frameP,sfn_msb,carrier->MIB,enc_rval.encoded);
buffer_pP[0]=carrier->MIB[0]; buffer_pP[0]=carrier->MIB[0];
buffer_pP[1]=carrier->MIB[1]; buffer_pP[1]=carrier->MIB[1];
buffer_pP[2]=carrier->MIB[2]; buffer_pP[2]=carrier->MIB[2];
LOG_D(NR_RRC,"MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n",buffer_pP[0],buffer_pP[1],buffer_pP[2]); LOG_I(NR_RRC,"MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n",buffer_pP[0],buffer_pP[1],buffer_pP[2]);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
return(3); return(3);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment