Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pasolini/openairinterface5g
  • odukan/openairinterface5g
  • ewa/openairinterface5g
  • deksprime/openairinterface5g
  • jackokie/openairinterface5g
  • Srushti16/openairinterface5g
  • BRodolphe/openairinterface5g
  • kramantas/openairinterface5g
  • suraj_4g5g/openairinterface5g
  • turletti/openairinterface5g
  • anandriisc/openairinterface5g
  • lvguorong/openairinterface5g
  • dast/openairinterface5g
  • yashwanthr/openairinterface5g
  • ajiti2tb/openairinterface5g
  • qzhou/openairinterface5g
  • nickmxxx/openairinterface5g
  • bin_he4/openairinterface5g
  • delarco/openairinterface5g
  • limx1980/openairinterface5g
  • Aniq/openairinterface5g
  • yassir63/openairinterface5g
  • orc318/openairinterface5g
  • vader/openairinterface5g
  • limx59/openairinterface5g
  • nadavaati_12345/openairinterface5g
  • jenshz/openairinterface5g
  • kuldeep/openairinterface5g
  • lurker/openairinterface5g
  • shariat/openairinterface5g
  • Alireza.najafzadeh/openairinterface5g
  • Ling/openairinterface5g
  • EvanKrall/openairinterface5g
  • youyih/openairinterface5g
  • anindya/openairinterface5g
  • ahan/openairinterface5g
  • beraoud/openairinterface5g
  • obejarano/openairinterface5g
  • Monti/openairinterface5g
  • akhamsi/openairinterface5g
  • Worker.N/openairinterface5g
  • zhangtu/openairinterface5g
  • desouza/openairinterface5g
  • zhijun/openairinterface5g
  • sureshkumar/openairinterface5g
  • milan/openairinterface5g
  • bigbangbingo/openairinterface5g
  • platini/openairinterface5g
  • muralir-nv/openairinterface5g
  • Joshua_Zhang/openairinterface5g
  • siddharthmurali1/openairinterface5g
  • sorinros/openairinterface5g
  • elainecao/openairinterface5g
  • sneltved/openairinterface5g
  • aikaterini.trilyraki/openairinterface5g
  • wujunning11/openairinterface5g
  • magounak/openairinterface5g
  • ycl1729020039/openairinterface5g
  • mayukhweb/openairinterface5g
  • wataru/openairinterface5g
  • afonsoli/openairinterface5g
  • ppokar/openairinterface5g
  • emest/openairinterface5g
  • Najib/openairinterface5g
  • liqing/openairinterface5g
  • gprshome/openairinterface5g
  • Dvevgedveccc/openairinterface5g
  • Elena_Lukashova/openairinterface5g
  • imaneouss/openairinterface5g
  • yangyuan/openairinterface5g
  • ycliang/openairinterface5g
  • rohanfds/openairinterface5g
  • cong2008abc/openairinterface5g
  • Giovanni/openairinterface5g
  • willvegapunk/openairinterface5g
  • Chen/openairinterface5g
  • Ella/openairinterface5g
  • kollabalu/openairinterface5g
  • tsaichanglan/openairinterface5g
  • Artifice/openairinterface5g
  • HJR0129/openairinterface5g
  • alextp/openairinterface5g
  • Changron/openairinterface5g
  • pedosb/openairinterface5g
  • Flozzen/openairinterface5g
  • hobei/openairinterface5g
  • WP_Jing/openairinterface5g
  • reset4/openairinterface5g
  • alexjoseph/openairinterface5g
  • latuan1710/openairinterface5g
  • wynter-wang/openairinterface5g
  • stt12706/openairinterface5g
  • sy/openairinterface5g
  • dzxu/openairinterface5g
  • ptizoom/openairinterface5g
  • Thierry/openairinterface5g
  • tjamc80/openairinterface5g
  • yenmuse/openairinterface5g
  • archerling/openairinterface5g
  • grahul/openairinterface5g
  • ashish.shri/openairinterface5g
  • TianyuChen/openairinterface5g
  • cuixf1/openairinterface5g
  • Jan/openairinterface5g
  • jboatenng/openairinterface5g_gpio
  • geokal/openairinterface5g
  • johannhg/openairinterface5g
  • TofunmiA/openairinterface5g
  • razvanursu/openairinterface5g-mac-scheduling
  • Julio/openairinterface5g
  • fredrichx/openairinterface5g
  • nems/openairinterface5g
  • wb_li/openairinterface5g
  • ferrieux/openairinterface5g
  • prajna_g/openairinterface-5-g-xnap-ho
  • mtinasc/openairinterface5g
  • Hofschroeer/openairinterface5g
  • buptxiaofeng/openairinterface5g
  • fjgh_759/openairinterface5g
  • calcel/openairinterface5g
  • Reem/openairinterface5g
  • havar_mind/openairinterface5g
  • shrinish/openairinterface5g
  • YANGHELINDE/openairinterface5g
  • lool/openairinterface5g
  • raghav1900/openairinterface5g
  • allan1201/openairinterface5g
  • ferris/openairinterface5g
  • seanzw/openairinterface5g
  • emad72/openairinterface5g
  • guojilong123/openairinterface5g
  • Rony99/openairinterface5g
  • lity/openairinterface5g
  • sshrivastava/openairinterface5g
  • zhihengzhang/openairinterface5g
  • Rakesh_B_B/openairinterface5g
  • baleeiro/openairinterface5g
  • 19125064/openairinterface5g
  • linlin/openairinterface5g
  • NA1VE/openairinterface5g
  • oai1B/openairinterface5g
  • daveprice/openairinterface5g
  • mo/openairinterface5g
  • dhanmeet/openairinterface5g
  • mv2290/openairinterface-5-g-test
  • pagmatt/openairinterface5g
  • mmTestNYU/openairinterface5g
  • mmezzavilla/openairinterface5g
  • sudhakarb/openairinterface5g
  • mekki/openairinterface5g
  • virtanen/openairinterface5g
  • dyyu/openairinterface5g
  • mohammed_safwan/openairinterface5g
  • venkat/openairinterface5g
  • rupadhya/openairinterface5g
  • adjou/openairinterface5g
  • samiemostafavi/openairinterface5g-edaf
  • Sreeram/openairinterface5g
  • oliverxsch/openairinterface5g
  • oai/openairinterface5g
160 results
Show changes
Commits on Source (20)
Showing
with 5379 additions and 352 deletions
cscope.files
cscope.files2
cscope.in.out
cscope.out
cscope.po.out
targets/bin/
cmake_targets/log/
cmake_targets/lte_build_oai/
......@@ -27,8 +27,8 @@ cmake_minimum_required (VERSION 2.8)
# Base directories, compatible with legacy OAI building
################################################
set (OPENAIR_DIR $ENV{OPENAIR_DIR})
#set (NFAPI_DIR $ENV{NFAPI_DIR})
set (NFAPI_DIR ${OPENAIR_DIR}/nfapi)
set (NFAPI_DIR $ENV{NFAPI_DIR})
set (NFAPI_USER_DIR ${OPENAIR_DIR}/nfapi)
set (OPENAIR1_DIR ${OPENAIR_DIR}/openair1)
set (OPENAIR2_DIR ${OPENAIR_DIR}/openair2)
set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3)
......@@ -768,7 +768,12 @@ else()
include_directories("${OPENAIR2_DIR}/UTIL")
include_directories("${OPENAIR2_DIR}/UTIL/LOG")
endif()
include_directories("${NFAPI_DIR}")
include_directories("${NFAPI_DIR}/nfapi/public_inc")
include_directories("${NFAPI_DIR}/common/public_inc")
include_directories("${NFAPI_DIR}/pnf/public_inc")
include_directories("${NFAPI_DIR}/nfapi/inc")
include_directories("${NFAPI_DIR}/sim_common/inc")
include_directories("${NFAPI_DIR}/pnf_sim/inc")
include_directories("${OPENAIR1_DIR}")
include_directories("${OPENAIR2_DIR}/NAS")
include_directories("${OPENAIR2_DIR}")
......@@ -1010,6 +1015,58 @@ set(SCHED_SRC
)
add_library(SCHED_LIB ${SCHED_SRC})
# nFAPI
#################################
set(NFAPI_COMMON_SRC
${NFAPI_DIR}/common/src/debug.c
)
add_library(NFAPI_COMMON_LIB ${NFAPI_COMMON_SRC})
include_directories(${NFAPI_DIR}/common/public_inc)
set(NFAPI_SRC
${NFAPI_DIR}/nfapi/src/nfapi.c
${NFAPI_DIR}/nfapi/src/nfapi_p4.c
${NFAPI_DIR}/nfapi/src/nfapi_p5.c
${NFAPI_DIR}/nfapi/src/nfapi_p7.c
)
add_library(NFAPI_LIB ${NFAPI_SRC})
include_directories(${NFAPI_DIR}/nfapi/public_inc)
include_directories(${NFAPI_DIR}/nfapi/inc)
set(NFAPI_PNF_SRC
${NFAPI_DIR}/pnf/src/pnf.c
${NFAPI_DIR}/pnf/src/pnf_interface.c
${NFAPI_DIR}/pnf/src/pnf_p7.c
${NFAPI_DIR}/pnf/src/pnf_p7_interface.c
)
add_library(NFAPI_PNF_LIB ${NFAPI_PNF_SRC})
include_directories(${NFAPI_DIR}/pnf/public_inc)
include_directories(${NFAPI_DIR}/pnf/inc)
set(NFAPI_VNF_SRC
${NFAPI_DIR}/vnf/src/vnf.c
${NFAPI_DIR}/vnf/src/vnf_interface.c
${NFAPI_DIR}/vnf/src/vnf_p7.c
${NFAPI_DIR}/vnf/src/vnf_p7_interface.c
)
add_library(NFAPI_VNF_LIB ${NFAPI_VNF_SRC})
include_directories(${NFAPI_DIR}/vnf/public_inc)
include_directories(${NFAPI_DIR}/vnf/inc)
# nFAPI user defined code
#############################
set(NFAPI_USER_SRC
${NFAPI_USER_DIR}/nfapi.c
${NFAPI_USER_DIR}/nfapi_pnf.c
${NFAPI_USER_DIR}/nfapi_vnf.c
)
add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC})
include_directories(${NFAPI_USER_DIR})
# Layer 1
#############################
set(PHY_SRC
......@@ -1205,6 +1262,8 @@ add_library(L2
${ENB_APP_SRC})
# ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c)
include_directories(${NFAPI_USER_DIR})
if (FLEXRAN_AGENT_SB_IF)
#Test for adding a shared library
......@@ -1618,6 +1677,13 @@ add_library(OPENAIR0_LIB
${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
)
include_directories("${NFAPI_DIR}/nfapi/public_inc")
include_directories("${NFAPI_DIR}/common/public_inc")
include_directories("${NFAPI_DIR}/pnf/public_inc")
include_directories("${NFAPI_DIR}/nfapi/inc")
include_directories("${NFAPI_DIR}/sim_common/inc")
include_directories("${NFAPI_DIR}/pnf_sim/inc")
# System packages that are required
# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
# or cmake provide a generic interface to pkg-config that widely used
......@@ -1673,6 +1739,26 @@ endif()
add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}")
add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}")
#pkg_search_module(NFAPI nfapi)
#if(NOT ${NFAPI_FOUND})
#message( FATAL_ERROR "PACKAGE nfapi not found: some targets will fail. Run build_oai -I again!")
#else()
#include_directories(${NFAPI_INCLUDE_DIRS})
#message( "PACKAGE nfapi!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
#message( "${NFAPI_INCLUDE_DIR}")
#message( "${NFAPI_COMMON_INCLUDE_DIR}")
#message( "${NFAPI_VNF_INCLUDE_DIR}")
#message( "${NFAPI_PNF_INCLUDE_DIR}")
#message( "XXX")
#message( "${NFAPI_LIBRARY}")
#message( "${NFAPI_COMMON_LIBRARY}")
#message( "${NFAPI_PNF_LIBRARY}")
#message( "XXX")
#message( "${NFAPI_LIBRARIES}")
#message( "XXX")
#endif()
pkg_search_module(XPM xpm)
if(NOT ${XPM_FOUND})
message("PACKAGE xpm not found: some targets will fail")
......@@ -1728,6 +1814,12 @@ if (${T_TRACER})
set (T_LIB "rt")
endif (${T_TRACER})
#if (${NFAPI_DIR})
#set (NFAPI_PNF_LIB "nfapi_pnf")
#set (NFAPI_LIB "nfapi")
#set (NFAPI_COMMON_LIB "nfapi_common")
#endif (${NFAPI_DIR})
#
#Some files in the T directory are generated.
#This rule and the following deal with it.
add_custom_command (
......@@ -1784,10 +1876,12 @@ add_executable(lte-softmodem
${SHLIB_LOADER_SOURCES}
)
target_link_libraries (lte-softmodem -ldl
target_link_libraries (lte-softmodem
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-Wl,--end-group )
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB
-Wl,--end-group z dl)
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
......@@ -1909,22 +2003,44 @@ add_executable(oaisim
${SHLIB_LOADER_SOURCES}
)
#add_library( imp_nfapi STATIC IMPORTED)
#set_property(TARGET imp_nfapi PROPERTY IMPORTED_LOCATION ${NFAPI_DIR}/libnfapi.a)
#set_property(TARGET imp_nfapi PROPERTY IMPORTED_IMPLIB ${NFAPI_DIR}/libnfapi.a)
#target_link_libraries(oaisim imp_nfapi)
#add_library( imp_nfapi_common STATIC IMPORTED)
#set_property(TARGET imp_nfapi_common PROPERTY IMPORTED_LOCATION ${NFAPI_DIR}/common/libnfapi_common.a)
#set_property(TARGET imp_nfapi_common PROPERTY IMPORTED_IMPLIB ${NFAPI_DIR}/common/libnfapi_common.a)
#target_link_libraries(oaisim imp_nfapi_common)
#add_library( imp_nfapi_pnf STATIC IMPORTED)
#set_property(TARGET imp_nfapi_pnf PROPERTY IMPORTED_LOCATION ${NFAPI_DIR}/pnf/libnfapi_pnf.a)
#set_property(TARGET imp_nfapi_pnf PROPERTY IMPORTED_IMPLIB ${NFAPI_DIR}/pnf/libnfapi_pnf.a)
#target_link_libraries(oaisim imp_nfapi_pnf)
#
#add_library (imp_nfapi_common STATIC IMPORTED)
#set_target_properties(imp_nfapi_common PROPERTIES IMPORTED_LOCATION ${NFAPI_DIR}/common/libnfapi_common.a
#set_target_properties(oaisim PROPERTIES LINK_FLAGS ${NFAPI_DIR}/nfapi/libnfapi.a ${NFAPI_DIR}/pnf/libnfapi_pnf.a ${NFAPI_DIR}/common/libnfapi_common.a)
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim
-Wl,-ldl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB}
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB
-Wl,--end-group )
target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES})
target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp z
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} )
#Force link with forms, regardless XFORMS option
target_link_libraries (oaisim forms)
target_link_libraries (oaisim ${T_LIB})
# A all in one network simulator
################
add_executable(oaisim_nos1
......
......@@ -196,7 +196,7 @@ function main() {
GDB=1
CMAKE_BUILD_TYPE="Debug"
echo_info "Will Compile with gdb symbols and disable compiler optimization"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug --trace-expand"
shift;;
--eNB)
eNB=1
......
......@@ -230,6 +230,7 @@ install_protobuf_c_from_source(){
rm -rf /tmp/protobuf-c
git clone https://github.com/protobuf-c/protobuf-c.git
cd protobuf-c
git checkout 2a46af42784abf86804d536f6e0122d47cfeea45
./autogen.sh
./configure
echo "Compiling protobuf-c"
......
......@@ -124,6 +124,7 @@ int config_get(paramdef_t *params,int numparams, char *prefix)
{
int ret= -1;
printf("numparams:%d prefix:%s\n", numparams, prefix);
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n");
return ret;
......
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
#if 0
#if 0
//DJP
#include <mutex>
#include <queue>
#include <list>
#endif
//DJP struct phy_pdu
typedef struct
{
#if 0
phy_pdu() : buffer_len(1500), buffer(0), len(0)
{
buffer = (char*) malloc(buffer_len);
}
virtual ~phy_pdu()
{
free(buffer);
}
#endif
unsigned buffer_len;
char* buffer;
unsigned len;
} phy_pdu;
// DJP class fapi_private
typedef struct
{
//std::mutex mutex;
//std::queue<phy_pdu*> rx_buffer;
//std::queue<phy_pdu*> free_store;
#if 0
public:
fapi_private()
: byte_count(0), tick(0), first_dl_config(false)
{
}
phy_pdu* allocate_phy_pdu()
{
phy_pdu* pdu = 0;
mutex.lock();
if(free_store.empty())
{
pdu = new phy_pdu();
}
else
{
pdu = free_store.front();
free_store.pop();
}
mutex.unlock();
return pdu;
}
void release_phy_pdu(phy_pdu* pdu)
{
mutex.lock();
free_store.push(pdu);
mutex.unlock();
}
bool rx_buffer_empty()
{
bool empty;
mutex.lock();
empty = rx_buffer.empty();
mutex.unlock();
return empty;
}
void push_rx_buffer(phy_pdu* buff)
{
mutex.lock();
rx_buffer.push(buff);
mutex.unlock();
}
phy_pdu* pop_rx_buffer()
{
phy_pdu* buff = 0;
mutex.lock();
if(!rx_buffer.empty())
{
buff = rx_buffer.front();
rx_buffer.pop();
}
mutex.unlock();
return buff;
}
#endif
uint32_t byte_count;
uint32_t tick;
uint8_t first_dl_config;
} fapi_private ;
#if defined(__cplusplus)
extern "C"
{
#endif
typedef struct fapi_internal
{
fapi_t _public;
fapi_cb_t callbacks;
uint8_t state;
fapi_config_t config;
int rx_sock;
int tx_sock;
struct sockaddr_in tx_addr;
uint32_t tx_byte_count;
uint32_t tick;
fapi_private* fapi;
} fapi_internal_t;
#if defined(__cplusplus)
}
#endif
#endif
void set_thread_priority(int priority)
{
//printf("%s(priority:%d)\n", __FUNCTION__, priority);
pthread_attr_t ptAttr;
struct sched_param schedParam;
schedParam.__sched_priority = priority; //79;
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0)
{
printf("Failed to set scheduler to SCHED_RR\n");
}
if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0)
{
printf("Failed to set pthread sched policy SCHED_RR\n");
}
pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
struct sched_param thread_params;
thread_params.sched_priority = 20;
if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0)
{
printf("failed to set sched param\n");
}
}
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include "debug.h"
#include "nfapi_pnf_interface.h"
#include "nfapi.h"
#include "nfapi_pnf.h"
#include "common/ran_context.h"
//#include "openair1/PHY/vars.h"
extern RAN_CONTEXT_t RC;
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <assert.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <errno.h>
#include <vendor_ext.h>
#include "fapi_stub.h"
//#include "fapi_l1.h"
#include "UTIL/LOG/log.h"
#define NUM_P5_PHY 2
extern void phy_init_RU(RU_t*);
extern int config_sync_var;
extern pthread_cond_t nfapi_sync_cond;
extern pthread_mutex_t nfapi_sync_mutex;
extern int nfapi_sync_var;
extern int sync_var;
extern void init_eNB_afterRU(void);
extern void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu);
extern void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, nfapi_ul_config_request_pdu_t *ul_config_pdu, uint16_t frame,uint8_t subframe,uint8_t srs_present);
extern void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu, uint8_t codeword_index, uint8_t *sdu);
extern void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu);
extern void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu);
extern uint8_t nfapi_mode;
nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; // [frame][subframe][max_num_pdus]
uint16_t phy_antenna_capability_values[] = { 1, 2, 4, 8, 16 };
nfapi_pnf_param_response_t g_pnf_param_resp;
nfapi_pnf_p7_config_t *p7_config_g = NULL;
void* pnf_allocate(size_t size)
{
//DJP
//return (void*)memory_pool::allocate(size);
return malloc(size);
}
void pnf_deallocate(void* ptr)
{
//DJP
//memory_pool::deallocate((uint8_t*)ptr);
free(ptr);
}
//class udp_data
//DJP
typedef struct
{
//public:
uint8_t enabled;
uint32_t rx_port;
uint32_t tx_port;
//std::string tx_addr;
char tx_addr[80];
}udp_data;
//class phy_info
//DJP
typedef struct
{
#if 0
public:
phy_info()
: first_subframe_ind(0), fapi(0),
dl_ues_per_subframe(0), ul_ues_per_subframe(0),
timing_window(0), timing_info_mode(0), timing_info_period(0)
{
index = 0;
id = 0;
local_port = 0;
remote_addr = 0;
remote_port = 0;
duplex_mode = 0;
dl_channel_bw_support = 0;
ul_channel_bw_support = 0;
num_dl_layers_supported = 0;
num_ul_layers_supported = 0;
release_supported = 0;
nmm_modes_supported = 0;
}
#endif
uint16_t index;
uint16_t id;
//std::vector<uint8_t> rfs;
//std::vector<uint8_t> excluded_rfs;
uint8_t rfs[2];
uint8_t excluded_rfs[2];
udp_data udp;
//std::string local_addr;
char local_addr[80];
int local_port;
char* remote_addr;
int remote_port;
uint8_t duplex_mode;
uint16_t dl_channel_bw_support;
uint16_t ul_channel_bw_support;
uint8_t num_dl_layers_supported;
uint8_t num_ul_layers_supported;
uint16_t release_supported;
uint8_t nmm_modes_supported;
uint8_t dl_ues_per_subframe;
uint8_t ul_ues_per_subframe;
uint8_t first_subframe_ind;
// timing information recevied from the vnf
uint8_t timing_window;
uint8_t timing_info_mode;
uint8_t timing_info_period;
//fapi_t* fapi;
}phy_info;
//class rf_info
//DJP
typedef struct
{
//public:
uint16_t index;
uint16_t band;
int16_t max_transmit_power;
int16_t min_transmit_power;
uint8_t num_antennas_supported;
uint32_t min_downlink_frequency;
uint32_t max_downlink_frequency;
uint32_t max_uplink_frequency;
uint32_t min_uplink_frequency;
}rf_info;
//class pnf_info
//DJP
typedef struct
{
#if 0
public:
pnf_info()
: release(13), wireshark_test_mode(0),
max_total_power(0), oui(0)
{
release = 0;
sync_mode = 0;
location_mode = 0;
dl_config_timing = 0;
ul_config_timing = 0;
tx_timing = 0;
hi_dci0_timing = 0;
max_phys = 0;
max_total_bw = 0;
max_total_dl_layers = 0;
max_total_ul_layers = 0;
shared_bands = 0;
shared_pa = 0;
}
#endif
int release;
//DJPstd::vector<phy_info> phys;
//std::vector<rf_info> rfs;
phy_info phys[2];
rf_info rfs[2];
uint8_t sync_mode;
uint8_t location_mode;
uint8_t location_coordinates[6];
uint32_t dl_config_timing;
uint32_t ul_config_timing;
uint32_t tx_timing;
uint32_t hi_dci0_timing;
uint16_t max_phys;
uint16_t max_total_bw;
uint16_t max_total_dl_layers;
uint16_t max_total_ul_layers;
uint8_t shared_bands;
uint8_t shared_pa;
int16_t max_total_power;
uint8_t oui;
uint8_t wireshark_test_mode;
}pnf_info;
// DJP struct pnf_phy_user_data_t
typedef struct
{
uint16_t phy_id;
nfapi_pnf_config_t* config;
phy_info* phy;
nfapi_pnf_p7_config_t* p7_config;
}pnf_phy_user_data_t;
static pnf_info pnf;
static pthread_t pnf_start_pthread;
extern void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args);
void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char* message, ...)
{
#if 0
va_list args;
int oai_level;
if (nfapi_level==NFAPI_TRACE_ERROR)
{
oai_level = LOG_ERR;
}
else if (nfapi_level==NFAPI_TRACE_WARN)
{
oai_level = LOG_WARNING;
}
else if (nfapi_level==NFAPI_TRACE_NOTE)
{
oai_level = LOG_INFO;
}
else if (nfapi_level==NFAPI_TRACE_INFO)
{
oai_level = LOG_INFO;
}
else
{
oai_level = LOG_INFO;
}
va_start(args, message);
nfapi_log("FILE>", "FUNC", 999, PHY, oai_level, message, args);
va_end(args);
#else
va_list args;
va_start(args, message);
vprintf(message, args);
va_end(args);
#endif
}
void pnf_set_thread_priority(int priority)
{
//printf("%s(priority:%d)\n", __FUNCTION__, priority);
pthread_attr_t ptAttr;
struct sched_param schedParam;
schedParam.__sched_priority = priority; //79;
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0)
{
printf("failed to set SCHED_RR\n");
}
if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0)
{
printf("failed to set pthread SCHED_RR %d\n", errno);
}
pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
struct sched_param thread_params;
thread_params.sched_priority = 20;
if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0)
{
printf("failed to set sched param\n");
}
}
void* pnf_p7_thread_start(void* ptr)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P7 THREAD %s\n", __FUNCTION__);
pnf_set_thread_priority(79);
nfapi_pnf_p7_config_t* config = (nfapi_pnf_p7_config_t*)ptr;
nfapi_pnf_p7_start(config);
return 0;
}
int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req)
{
printf("[PNF] pnf param request\n");
nfapi_pnf_param_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
resp.error_code = NFAPI_MSG_OK;
pnf_info* pnf = (pnf_info*)(config->user_data);
resp.pnf_param_general.tl.tag = NFAPI_PNF_PARAM_GENERAL_TAG;
resp.pnf_param_general.nfapi_sync_mode = pnf->sync_mode;
resp.pnf_param_general.location_mode = pnf->location_mode;
//uint8_t location_coordinates[NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH];
resp.pnf_param_general.dl_config_timing = pnf->dl_config_timing;
resp.pnf_param_general.tx_timing = pnf->tx_timing;
resp.pnf_param_general.ul_config_timing = pnf->ul_config_timing;
resp.pnf_param_general.hi_dci0_timing = pnf->hi_dci0_timing;
resp.pnf_param_general.maximum_number_phys = pnf->max_phys;
resp.pnf_param_general.maximum_total_bandwidth = pnf->max_total_bw;
resp.pnf_param_general.maximum_total_number_dl_layers = pnf->max_total_dl_layers;
resp.pnf_param_general.maximum_total_number_ul_layers = pnf->max_total_ul_layers;
resp.pnf_param_general.shared_bands = pnf->shared_bands;
resp.pnf_param_general.shared_pa = pnf->shared_pa;
resp.pnf_param_general.maximum_total_power = pnf->max_total_power;
//uint8_t oui[NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH];
resp.pnf_phy.tl.tag = NFAPI_PNF_PHY_TAG;
//DJP resp.pnf_phy.number_of_phys = pnf->phys.size();
resp.pnf_phy.number_of_phys = 1;
//for(int i = 0; i < pnf->phys.size(); ++i)
for(int i = 0; i < 1; ++i)
{
resp.pnf_phy.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy.phy[i].downlink_channel_bandwidth_supported = pnf->phys[i].dl_channel_bw_support;
resp.pnf_phy.phy[i].uplink_channel_bandwidth_supported = pnf->phys[i].ul_channel_bw_support;
resp.pnf_phy.phy[i].number_of_dl_layers_supported = pnf->phys[i].num_dl_layers_supported;
resp.pnf_phy.phy[i].number_of_ul_layers_supported = pnf->phys[i].num_ul_layers_supported;
resp.pnf_phy.phy[i].maximum_3gpp_release_supported = pnf->phys[i].release_supported;
resp.pnf_phy.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
//DJP resp.pnf_phy.phy[i].number_of_rfs = pnf->phys[i].rfs.size();
resp.pnf_phy.phy[i].number_of_rfs = 2;
//for(int j = 0; j < pnf->phys[i].rfs.size(); ++j)
for(int j = 0; j < 1; ++j)
{
resp.pnf_phy.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
}
//DJP resp.pnf_phy.phy[i].number_of_rf_exclusions = pnf->phys[i].excluded_rfs.size();
resp.pnf_phy.phy[i].number_of_rf_exclusions = 0;
//DJP for(int j = 0; j < pnf->phys[i].excluded_rfs.size(); ++j)
for(int j = 0; j < 0; ++j)
{
resp.pnf_phy.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
}
}
resp.pnf_rf.tl.tag = NFAPI_PNF_RF_TAG;
//DJPresp.pnf_rf.number_of_rfs = pnf->rfs.size();
resp.pnf_rf.number_of_rfs = 2;
//for(int i = 0; i < pnf->rfs.size(); ++i)
for(int i = 0; i < 2; ++i)
{
resp.pnf_rf.rf[i].rf_config_index = pnf->rfs[i].index;
resp.pnf_rf.rf[i].band = pnf->rfs[i].band;
resp.pnf_rf.rf[i].maximum_transmit_power = pnf->rfs[i].max_transmit_power;
resp.pnf_rf.rf[i].minimum_transmit_power = pnf->rfs[i].min_transmit_power;
resp.pnf_rf.rf[i].number_of_antennas_suppported = pnf->rfs[i].num_antennas_supported;
resp.pnf_rf.rf[i].minimum_downlink_frequency = pnf->rfs[i].min_downlink_frequency;
resp.pnf_rf.rf[i].maximum_downlink_frequency = pnf->rfs[i].max_downlink_frequency;
resp.pnf_rf.rf[i].minimum_uplink_frequency = pnf->rfs[i].min_uplink_frequency;
resp.pnf_rf.rf[i].maximum_uplink_frequency = pnf->rfs[i].max_uplink_frequency;
}
if(pnf->release >= 10)
{
resp.pnf_phy_rel10.tl.tag = NFAPI_PNF_PHY_REL10_TAG;
//DJPresp.pnf_phy_rel10.number_of_phys = pnf->phys.size();
resp.pnf_phy_rel10.number_of_phys = 1;
//for(int i = 0; i < pnf->phys.size(); ++i)
for(int i = 0; i < 1; ++i)
{
resp.pnf_phy_rel10.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel10.phy[i].transmission_mode_7_supported = 0;
resp.pnf_phy_rel10.phy[i].transmission_mode_8_supported = 1;
resp.pnf_phy_rel10.phy[i].two_antenna_ports_for_pucch = 0;
resp.pnf_phy_rel10.phy[i].transmission_mode_9_supported = 1;
resp.pnf_phy_rel10.phy[i].simultaneous_pucch_pusch = 0;
resp.pnf_phy_rel10.phy[i].four_layer_tx_with_tm3_and_tm4 = 1;
}
}
if(pnf->release >= 11)
{
resp.pnf_phy_rel11.tl.tag = NFAPI_PNF_PHY_REL11_TAG;
//DJP resp.pnf_phy_rel11.number_of_phys = pnf->phys.size();
resp.pnf_phy_rel11.number_of_phys = 1;
//DJP for(int i = 0; i < pnf->phys.size(); ++i)
for(int i = 0; i < 1; ++i)
{
resp.pnf_phy_rel11.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel11.phy[i].edpcch_supported = 0;
resp.pnf_phy_rel11.phy[i].multi_ack_csi_reporting = 1;
resp.pnf_phy_rel11.phy[i].pucch_tx_diversity = 0;
resp.pnf_phy_rel11.phy[i].ul_comp_supported = 1;
resp.pnf_phy_rel11.phy[i].transmission_mode_5_supported = 0;
}
}
if(pnf->release >= 12)
{
resp.pnf_phy_rel12.tl.tag = NFAPI_PNF_PHY_REL12_TAG;
//DJP resp.pnf_phy_rel12.number_of_phys = pnf->phys.size();
resp.pnf_phy_rel12.number_of_phys = 1;
//DJP for(int i = 0; i < pnf->phys.size(); ++i)
for(int i = 0; i < 1; ++i)
{
resp.pnf_phy_rel12.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel12.phy[i].csi_subframe_set = 0;
resp.pnf_phy_rel12.phy[i].enhanced_4tx_codebook = 2; // yes this is invalid
resp.pnf_phy_rel12.phy[i].drs_supported = 0;
resp.pnf_phy_rel12.phy[i].ul_64qam_supported = 1;
resp.pnf_phy_rel12.phy[i].transmission_mode_10_supported = 0;
resp.pnf_phy_rel12.phy[i].alternative_bts_indices = 1;
}
}
if(pnf->release >= 13)
{
resp.pnf_phy_rel13.tl.tag = NFAPI_PNF_PHY_REL13_TAG;
//DJP resp.pnf_phy_rel13.number_of_phys = pnf->phys.size();
resp.pnf_phy_rel13.number_of_phys = 1;
//for(int i = 0; i < pnf->phys.size(); ++i)
for(int i = 0; i < 1; ++i)
{
resp.pnf_phy_rel13.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel13.phy[i].pucch_format4_supported = 0;
resp.pnf_phy_rel13.phy[i].pucch_format5_supported = 1;
resp.pnf_phy_rel13.phy[i].more_than_5_ca_support = 0;
resp.pnf_phy_rel13.phy[i].laa_supported = 1;
resp.pnf_phy_rel13.phy[i].laa_ending_in_dwpts_supported = 0;
resp.pnf_phy_rel13.phy[i].laa_starting_in_second_slot_supported = 1;
resp.pnf_phy_rel13.phy[i].beamforming_supported = 0;
resp.pnf_phy_rel13.phy[i].csi_rs_enhancement_supported = 1;
resp.pnf_phy_rel13.phy[i].drms_enhancement_supported = 0;
resp.pnf_phy_rel13.phy[i].srs_enhancement_supported = 1;
}
resp.pnf_phy_rel13_nb_iot.tl.tag = NFAPI_PNF_PHY_REL13_NB_IOT_TAG;
//DJP resp.pnf_phy_rel13_nb_iot.number_of_phys = pnf->phys.size();
resp.pnf_phy_rel13_nb_iot.number_of_phys = 1;
//for(int i = 0; i < pnf->phys.size(); ++i)
for(int i = 0; i < 1; ++i)
{
resp.pnf_phy_rel13_nb_iot.phy[i].phy_config_index = pnf->phys[i].index;
//DJP resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rfs = pnf->phys[i].rfs.size();
resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rfs = 1;
//DJP for(int j = 0; j < pnf->phys[i].rfs.size(); ++j)
for(int j = 0; j < 1; ++j)
{
resp.pnf_phy_rel13_nb_iot.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
}
//DJP resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rf_exclusions = pnf->phys[i].excluded_rfs.size();
resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rf_exclusions = 1;
//DJP for(int j = 0; j < pnf->phys[i].excluded_rfs.size(); ++j)
for(int j = 0; j < 1; ++j)
{
resp.pnf_phy_rel13_nb_iot.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
}
resp.pnf_phy_rel13_nb_iot.phy[i].number_of_dl_layers_supported = pnf->phys[i].num_dl_layers_supported;
resp.pnf_phy_rel13_nb_iot.phy[i].number_of_ul_layers_supported = pnf->phys[i].num_ul_layers_supported;
resp.pnf_phy_rel13_nb_iot.phy[i].maximum_3gpp_release_supported = pnf->phys[i].release_supported;
resp.pnf_phy_rel13_nb_iot.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
}
}
nfapi_pnf_pnf_param_resp(config, &resp);
return 0;
}
int pnf_config_request(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req)
{
printf("[PNF] pnf config request\n");
pnf_info* pnf = (pnf_info*)(config->user_data);
#if 0
for(int i = 0; i < req->pnf_phy_rf_config.number_phy_rf_config_info; ++i)
{
auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
{ return item.index == req->pnf_phy_rf_config.phy_rf_config[i].phy_config_index; });
if(found != pnf->phys.end())
{
phy_info& phy = (*found);
phy.id = req->pnf_phy_rf_config.phy_rf_config[i].phy_id;
printf("[PNF] pnf config request assigned phy_id %d to phy_config_index %d\n", phy.id, req->pnf_phy_rf_config.phy_rf_config[i].phy_config_index);
}
else
{
// did not find the phy
printf("[PNF] pnf config request did not find phy_config_index %d\n", req->pnf_phy_rf_config.phy_rf_config[i].phy_config_index);
}
}
#endif
//DJP
phy_info *phy = pnf->phys;
phy->id = req->pnf_phy_rf_config.phy_rf_config[0].phy_id;
printf("[PNF] pnf config request assigned phy_id %d to phy_config_index %d\n", phy->id, req->pnf_phy_rf_config.phy_rf_config[0].phy_config_index);
//DJP
nfapi_pnf_config_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
resp.error_code = NFAPI_MSG_OK;
nfapi_pnf_pnf_config_resp(config, &resp);
printf("[PNF] Sent pnf_config_resp\n");
return 0;
}
void nfapi_send_pnf_start_resp(nfapi_pnf_config_t* config, uint16_t phy_id)
{
printf("Sending NFAPI_START_RESPONSE config:%p phy_id:%d\n", config, phy_id);
nfapi_start_response_t start_resp;
memset(&start_resp, 0, sizeof(start_resp));
start_resp.header.message_id = NFAPI_START_RESPONSE;
start_resp.header.phy_id = phy_id;
start_resp.error_code = NFAPI_MSG_OK;
nfapi_pnf_start_resp(config, &start_resp);
}
int pnf_start_request(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req)
{
printf("Received NFAPI_PNF_START_REQUEST\n");
pnf_info* pnf = (pnf_info*)(config->user_data);
// start all phys that have been configured
//for(phy_info& phy : pnf->phys)
phy_info* phy = pnf->phys;
if(phy->id != 0)
{
//auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
// { return item.id == req->header.phy_id; });
//
// if(found != pnf->phys.end())
// {
// phy_info& phy = (*found);
//}
nfapi_pnf_start_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_START_RESPONSE;
resp.error_code = NFAPI_MSG_OK;
nfapi_pnf_pnf_start_resp(config, &resp);
printf("[PNF] Sent NFAPI_PNF_START_RESP\n");
}
return 0;
}
int pnf_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_stop_request_t* req)
{
printf("[PNF] Received NFAPI_PNF_STOP_REQ\n");
nfapi_pnf_stop_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_STOP_RESPONSE;
resp.error_code = NFAPI_MSG_OK;
nfapi_pnf_pnf_stop_resp(config, &resp);
printf("[PNF] Sent NFAPI_PNF_STOP_REQ\n");
return 0;
}
int param_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req)
{
printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id);
//pnf_info* pnf = (pnf_info*)(config->user_data);
nfapi_param_response_t nfapi_resp;
pnf_info* pnf = (pnf_info*)(config->user_data);
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_PARAM_RESPONSE;
nfapi_resp.header.phy_id = req->header.phy_id;
nfapi_resp.error_code = 0; // DJP - what value???
struct sockaddr_in pnf_p7_sockaddr;
pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
memcpy(nfapi_resp.nfapi_config.p7_pnf_address_ipv4.address, &pnf_p7_sockaddr.sin_addr.s_addr, 4);
nfapi_resp.num_tlv++;
// P7 PNF Port
nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; // DJP - hard code alert!!!! FIXME TODO
nfapi_resp.num_tlv++;
nfapi_pnf_param_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv);
#if 0
//DJP
auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
{ return item.id == req->header.phy_id; });
if(found != pnf->phys.end())
#endif
{
//DJP phy_info& phy_info = (*found);
//phy_info *phy_info = pnf->phys;
}
#if 0
else
{
// did not find the phy
}
#endif
printf("[PNF] param request .. exit\n");
return 0;
}
// From MAC config.c
extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
extern int32_t get_uldl_offset(int eutra_bandP);
int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req)
{
printf("[PNF] Received NFAPI_CONFIG_REQ phy_id:%d\n", req->header.phy_id);
pnf_info* pnf = (pnf_info*)(config->user_data);
uint8_t num_tlv = 0;
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
#if 0
//DJP
auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
{ return item.id == req->header.phy_id; });
if(found != pnf->phys.end())
{
phy_info& phy_info = (*found);
}
#endif
//DJP
phy_info* phy_info = pnf->phys;
if(req->nfapi_config.timing_window.tl.tag == NFAPI_NFAPI_TIMING_WINDOW_TAG)
{
phy_info->timing_window = req->nfapi_config.timing_window.value;
printf("Phy_info:Timing window:%u NFAPI_CONFIG:timing_window:%u\n", phy_info->timing_window, req->nfapi_config.timing_window.value);
num_tlv++;
}
if(req->nfapi_config.timing_info_mode.tl.tag == NFAPI_NFAPI_TIMING_INFO_MODE_TAG)
{
printf("timing info mode:%d\n", req->nfapi_config.timing_info_mode.value);
phy_info->timing_info_mode = req->nfapi_config.timing_info_mode.value;
num_tlv++;
}
else
{
phy_info->timing_info_mode = 0;
printf("NO timing info mode provided\n");
}
if(req->nfapi_config.timing_info_period.tl.tag == NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG)
{
printf("timing info period provided value:%d\n", req->nfapi_config.timing_info_period.value);
phy_info->timing_info_period = req->nfapi_config.timing_info_period.value;
num_tlv++;
}
else
{
phy_info->timing_info_period = 0;
}
if(req->rf_config.dl_channel_bandwidth.tl.tag == NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG)
{
phy_info->dl_channel_bw_support = req->rf_config.dl_channel_bandwidth.value;
fp->N_RB_DL = req->rf_config.dl_channel_bandwidth.value;
num_tlv++;
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG N_RB_DL:%u\n", __FUNCTION__, fp->N_RB_DL);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Missing NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG\n", __FUNCTION__);
}
if(req->rf_config.ul_channel_bandwidth.tl.tag == NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG)
{
phy_info->ul_channel_bw_support = req->rf_config.ul_channel_bandwidth.value;
fp->N_RB_UL = req->rf_config.ul_channel_bandwidth.value;
num_tlv++;
}
if(req->nfapi_config.rf_bands.tl.tag == NFAPI_NFAPI_RF_BANDS_TAG)
{
pnf->rfs[0].band = req->nfapi_config.rf_bands.rf_band[0];
fp->eutra_band = req->nfapi_config.rf_bands.rf_band[0];
num_tlv++;
}
if(req->nfapi_config.earfcn.tl.tag == NFAPI_NFAPI_EARFCN_TAG)
{
fp->dl_CarrierFreq = from_earfcn(fp->eutra_band, req->nfapi_config.earfcn.value); // DJP - TODO FIXME - hard coded to first rf
fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(fp->eutra_band) * 1e5);
num_tlv++;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() earfcn:%u dl_carrierFreq:%u ul_CarrierFreq:%u band:%u N_RB_DL:%u\n",
__FUNCTION__, req->nfapi_config.earfcn.value, fp->dl_CarrierFreq, fp->ul_CarrierFreq, pnf->rfs[0].band, fp->N_RB_DL);
}
if (req->subframe_config.duplex_mode.tl.tag == NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG)
{
fp->frame_type = req->subframe_config.duplex_mode.value==0 ? TDD : FDD;
num_tlv++;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() frame_type:%d\n", __FUNCTION__, fp->frame_type);
}
if (req->subframe_config.dl_cyclic_prefix_type.tl.tag == NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG)
{
fp->Ncp = req->subframe_config.dl_cyclic_prefix_type.value;
num_tlv++;
}
if (req->subframe_config.ul_cyclic_prefix_type.tl.tag == NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG)
{
fp->Ncp_UL = req->subframe_config.ul_cyclic_prefix_type.value;
num_tlv++;
}
fp->num_MBSFN_config = 0; // DJP - hard code alert
if (req->sch_config.physical_cell_id.tl.tag == NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG)
{
fp->Nid_cell = req->sch_config.physical_cell_id.value;
fp->nushift = fp->Nid_cell%6;
num_tlv++;
}
if (req->rf_config.tx_antenna_ports.tl.tag == NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG)
{
fp->nb_antennas_tx = req->rf_config.tx_antenna_ports.value;
fp->nb_antenna_ports_eNB = 1;
num_tlv++;
}
if (req->rf_config.rx_antenna_ports.tl.tag == NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG)
{
fp->nb_antennas_rx = req->rf_config.rx_antenna_ports.value;
num_tlv++;
}
if (req->phich_config.phich_resource.tl.tag == NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG)
{
fp->phich_config_common.phich_resource = req->phich_config.phich_resource.value;
num_tlv++;
}
if (req->phich_config.phich_duration.tl.tag == NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG)
{
fp->phich_config_common.phich_duration = req->phich_config.phich_duration.value;
num_tlv++;
}
if (req->phich_config.phich_power_offset.tl.tag == NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG)
{
LOG_E(PHY, "%s() NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG tag:%d not supported\n", __FUNCTION__, req->phich_config.phich_power_offset.tl.tag);
//fp->phich_config_common.phich_power_offset = req->phich_config.
num_tlv++;
}
// UL RS Config
if (req->uplink_reference_signal_config.cyclic_shift_1_for_drms.tl.tag == NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG)
{
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = req->uplink_reference_signal_config.cyclic_shift_1_for_drms.value;
num_tlv++;
}
if (req->uplink_reference_signal_config.uplink_rs_hopping.tl.tag == NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG)
{
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = req->uplink_reference_signal_config.uplink_rs_hopping.value;
num_tlv++;
}
if (req->uplink_reference_signal_config.group_assignment.tl.tag == NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG)
{
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = req->uplink_reference_signal_config.group_assignment.value;
num_tlv++;
}
if (req->pusch_config.hopping_mode.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG) { } // DJP - not being handled?
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0; // DJP - not being handled
if (req->prach_config.configuration_index.tl.tag == NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG)
{
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=req->prach_config.configuration_index.value;
num_tlv++;
}
if (req->prach_config.root_sequence_index.tl.tag == NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG)
{
fp->prach_config_common.rootSequenceIndex=req->prach_config.root_sequence_index.value;
num_tlv++;
}
if (req->prach_config.zero_correlation_zone_configuration.tl.tag == NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG)
{
fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=req->prach_config.zero_correlation_zone_configuration.value;
num_tlv++;
}
if (req->prach_config.high_speed_flag.tl.tag == NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG)
{
fp->prach_config_common.prach_ConfigInfo.highSpeedFlag=req->prach_config.high_speed_flag.value;
num_tlv++;
}
if (req->prach_config.frequency_offset.tl.tag == NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG)
{
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset=req->prach_config.frequency_offset.value;
num_tlv++;
}
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
printf("[PNF] Simulating PHY CONFIG - DJP\n");
PHY_Config_t phy_config;
phy_config.Mod_id = 0;
phy_config.CC_id=0;
phy_config.cfg = req;
phy_config_request(&phy_config);
dump_frame_parms(fp);
phy_info->remote_port = req->nfapi_config.p7_vnf_port.value;
struct sockaddr_in vnf_p7_sockaddr;
memcpy(&vnf_p7_sockaddr.sin_addr.s_addr, &(req->nfapi_config.p7_vnf_address_ipv4.address[0]), 4);
phy_info->remote_addr = inet_ntoa(vnf_p7_sockaddr.sin_addr);
printf("[PNF] %d vnf p7 %s:%d timing %d %d %d\n", phy_info->id, phy_info->remote_addr, phy_info->remote_port,
phy_info->timing_window, phy_info->timing_info_mode, phy_info->timing_info_period);
nfapi_config_response_t nfapi_resp;
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_CONFIG_RESPONSE;
nfapi_resp.header.phy_id = phy_info->id;
nfapi_resp.error_code = 0; // DJP - some value resp->error_code;
nfapi_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
return 0;
}
nfapi_p7_message_header_t* pnf_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size)
{
if(message_id == P7_VENDOR_EXT_REQ)
{
(*msg_size) = sizeof(vendor_ext_p7_req);
return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_req));
}
return 0;
}
void pnf_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header)
{
free(header);
}
int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req)
{
LOG_D(PHY,"[PNF] hi dci0 request sfn_sf:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), req->hi_dci0_request_body.number_of_dci, req->hi_dci0_request_body.number_of_hi);
//phy_info* phy = (phy_info*)(pnf_p7->user_data);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
for (int i=0; i<req->hi_dci0_request_body.number_of_dci + req->hi_dci0_request_body.number_of_hi; i++)
{
LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d]\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE)
{
LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_DCI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu = &req->hi_dci0_request_body.hi_dci0_pdu_list[i];
handle_nfapi_hi_dci0_dci_pdu(eNB,proc,hi_dci0_req_pdu);
eNB->pdcch_vars[NFAPI_SFNSF2SF(req->sfn_sf)&1].num_dci++;
}
else if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type == NFAPI_HI_DCI0_HI_PDU_TYPE)
{
LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_HI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu = &req->hi_dci0_request_body.hi_dci0_pdu_list[i];
handle_nfapi_hi_dci0_hi_pdu(eNB, proc, hi_dci0_req_pdu);
eNB->pdcch_vars[NFAPI_SFNSF2SF(req->sfn_sf)&1].num_dci++;
}
else
{
LOG_E(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - unknown pdu type:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), i, req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type);
}
}
return 0;
}
int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req)
{
#if 1
if (0)//NFAPI_SFNSF2SF(req->sfn_sf)==5)
LOG_D(PHY,"[PNF] dl config request sfn_sf:%d pdcch:%u dci:%u pdu:%d pdsch_rnti:%d pcfich:%u RC.ru:%p RC.eNB:%p sync_var:%d\n",
NFAPI_SFNSF2DEC(req->sfn_sf),
req->dl_config_request_body.number_pdcch_ofdm_symbols,
req->dl_config_request_body.number_dci,
req->dl_config_request_body.number_pdu,
req->dl_config_request_body.number_pdsch_rnti,
req->dl_config_request_body.transmission_power_pcfich,
RC.ru,
RC.eNB,
sync_var
);
#endif
if (RC.ru == 0)
{
return -1;
}
if (RC.eNB == 0)
{
return -2;
}
if (RC.eNB[0][0] == 0)
{
return -3;
}
if (sync_var != 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() Main system not up - is this a dummy subframe?\n", __FUNCTION__);
return -4;
}
int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
int sf = NFAPI_SFNSF2SF(req->sfn_sf);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
nfapi_dl_config_request_pdu_t* dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list;
LTE_eNB_PDCCH *pdcch_vars = &eNB->pdcch_vars[sf&1];
pdcch_vars->num_pdcch_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols;
pdcch_vars->num_dci = 0;
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d sfn_sf:%d DCI:%d PDU:%d\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, NFAPI_SFNSF2DEC(req->sfn_sf), req->dl_config_request_body.number_dci, req->dl_config_request_body.number_pdu);
for (int i=0;i<req->dl_config_request_body.number_pdu;i++)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size);
if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
{
handle_nfapi_dci_dl_pdu(eNB,proc,&dl_config_pdu_list[i]);
pdcch_vars->num_dci++; // Is actually number of DCI PDUs
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() pdcch_vars->num_dci:%d\n", __FUNCTION__, pdcch_vars->num_dci);
}
else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE)
{
nfapi_dl_config_bch_pdu *bch_pdu = &dl_config_pdu_list[i].bch_pdu;
uint16_t pdu_index = bch_pdu->bch_pdu_rel8.pdu_index;
uint8_t *sdu = tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_data;
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]);
#if 0
handle_nfapi_bch_pdu(eNB, proc, dl_config_pdu_list[i], sdu);
#else
eNB->pbch_pdu[0] = sdu[2];
eNB->pbch_pdu[1] = sdu[1];
eNB->pbch_pdu[2] = sdu[0];
#endif
eNB->pbch_configured=1;
if (0 && NFAPI_SFNSF2DEC(req->sfn_sf) % 500 == 0)
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() [PDU:%u] len:%u pdu_index:%u segment[0]_length:%u pbch_sdu:%x %x %x\n",
__FUNCTION__, i,
bch_pdu->bch_pdu_rel8.length,
bch_pdu->bch_pdu_rel8.pdu_index,
tx_request_pdu[sfn][sf][bch_pdu->bch_pdu_rel8.pdu_index]->segments[0].segment_length,
sdu[0],
sdu[1],
sdu[2]);
}
else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)
{
nfapi_dl_config_dlsch_pdu *dlsch_pdu = &dl_config_pdu_list[i].dlsch_pdu;
nfapi_dl_config_dlsch_pdu_rel8_t *rel8_pdu = &dlsch_pdu->dlsch_pdu_rel8;
uint8_t *dlsch_sdu = malloc(tx_request_pdu[sfn][sf][rel8_pdu->pdu_index]->segments[0].segment_length);
// **********************************************************************
// THIS IS CREATING AN INTENTIONAL LEAK - I think...
//
// nFAPI won't be managing dlsch_sdu
//
// not sure about the stack, but it does seem to allow it to stay up!!!
//
// I THINK I NEED TO FIX THIS - unless it IS getting freed by the stack
//
// **********************************************************************
memcpy(dlsch_sdu, tx_request_pdu[sfn][sf][rel8_pdu->pdu_index]->segments[0].segment_data, tx_request_pdu[sfn][sf][rel8_pdu->pdu_index]->segments[0].segment_length);
if (0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n",
__FUNCTION__,
rel8_pdu->pdu_index,
rel8_pdu->transport_blocks,
dlsch_sdu,
eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols
);
}
handle_nfapi_dlsch_pdu(
eNB,
&eNB->proc.proc_rxtx[0],
&dl_config_pdu_list[i],
rel8_pdu->transport_blocks-1,
dlsch_sdu);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_config_pdu_list[i].pdu_type);
}
}
if(req->vendor_extension)
free(req->vendor_extension);
return 0;
}
int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req)
{
uint16_t sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
uint16_t sf = NFAPI_SFNSF2SF(req->sfn_sf);
LOG_D(PHY,"%s() SFN/SF:%d/%d PDUs:%d\n", __FUNCTION__, sfn, sf, req->tx_request_body.number_of_pdus);
if (req->tx_request_body.tl.tag==NFAPI_TX_REQUEST_BODY_TAG)
{
for (int i=0; i<req->tx_request_body.number_of_pdus; i++)
{
LOG_D(PHY,"%s() SFN/SF:%d/%d [PDU:%d] pdu_length:%d pdu_index:%d num_segments:%d\n",
__FUNCTION__,
sfn, sf,
i,
req->tx_request_body.tx_pdu_list[i].pdu_length,
req->tx_request_body.tx_pdu_list[i].pdu_index,
req->tx_request_body.tx_pdu_list[i].num_segments
);
tx_request_pdu[sfn][sf][i] = &req->tx_request_body.tx_pdu_list[i];
}
}
return 0;
}
extern void subtract_subframe(int *frameP, int *subframeP, int offset);
int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req)
{
LOG_D(PHY,"[PNF] UL_CONFIG_REQ %s() sfn_sf:%d pdu:%d rach_prach_frequency_resources:%d srs_present:%u\n",
__FUNCTION__,
NFAPI_SFNSF2DEC(req->sfn_sf),
req->ul_config_request_body.number_of_pdus,
req->ul_config_request_body.rach_prach_frequency_resources,
req->ul_config_request_body.srs_present
);
if (RC.ru == 0)
{
return -1;
}
if (RC.eNB == 0)
{
return -2;
}
if (RC.eNB[0][0] == 0)
{
return -3;
}
if (sync_var != 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() Main system not up - is this a dummy subframe?\n", __FUNCTION__);
return -4;
}
int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
int sf = NFAPI_SFNSF2SF(req->sfn_sf);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
nfapi_ul_config_request_pdu_t* ul_config_pdu_list = req->ul_config_request_body.ul_config_pdu_list;
// subframe works off TX SFN/SF which is 4 ahead, need to put it back to RX SFN/SF
// probably could just use proc->frame_rx
subtract_subframe(&sfn, &sf, 4);
for (int i=0;i<req->ul_config_request_body.number_of_pdus;i++)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, ul_config_pdu_list[i].pdu_size);
if (
ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE ||
ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE ||
ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE ||
ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE ||
ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE ||
ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE ||
ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE
)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() handle_nfapi_ul_pdu() for PDU:%d\n", __FUNCTION__, i);
handle_nfapi_ul_pdu(eNB,proc,&ul_config_pdu_list[i],sfn,sf,req->ul_config_request_body.srs_present);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() PDU:%i UNKNOWN type :%d\n", __FUNCTION__, i, ul_config_pdu_list[i].pdu_type);
}
}
return 0;
}
int pnf_phy_lbt_dl_config_req(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req)
{
//printf("[PNF] lbt dl config request\n");
return 0;
}
int pnf_phy_vendor_ext(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg)
{
if(msg->message_id == P7_VENDOR_EXT_REQ)
{
//vendor_ext_p7_req* req = (vendor_ext_p7_req*)msg;
//printf("[PNF] vendor request (1:%d 2:%d)\n", req->dummy1, req->dummy2);
}
else
{
printf("[PNF] unknown vendor ext\n");
}
return 0;
}
int pnf_phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codex)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P7_VENDOR_EXT_IND)
{
vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)(header);
if(!push16(ind->error_code, ppWritePackedMsg, end))
return 0;
return 1;
}
return -1;
}
int pnf_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* codec)
{
if(header->message_id == P7_VENDOR_EXT_REQ)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
if(!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
pull16(ppReadPackedMessage, &req->dummy2, end)))
return 0;
return 1;
}
return -1;
}
int pnf_phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t* end, void** ve, nfapi_p7_codec_config_t* config)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_phy_unpack_vendor_extension_tlv\n");
switch(tl->tag)
{
case VENDOR_EXT_TLV_1_TAG:
*ve = malloc(sizeof(vendor_ext_tlv_1));
if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_1*)(*ve))->dummy, end))
return 0;
return 1;
break;
}
return -1;
}
int pnf_phy_pack_vendor_extention_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p7_codec_config_t* config)
{
//printf("%s\n", __FUNCTION__);
(void)ve;
(void)ppWritePackedMsg;
return -1;
}
int pnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* config)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_unpack_vendor_extension_tlv\n");
switch(tl->tag)
{
case VENDOR_EXT_TLV_2_TAG:
*ve = malloc(sizeof(vendor_ext_tlv_2));
if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_2*)(*ve))->dummy, end))
return 0;
return 1;
break;
}
return -1;
}
int pnf_sim_pack_vendor_extention_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
{
//printf("%s\n", __FUNCTION__);
(void)ve;
(void)ppWritePackedMsg;
return -1;
}
nfapi_dl_config_request_t dummy_dl_config_req;
nfapi_tx_request_t dummy_tx_req;
nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req)
{
printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
nfapi_set_trace_level(NFAPI_TRACE_INFO);
pnf_info* pnf = (pnf_info*)(config->user_data);
#if 0
//DJP
auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
{ return item.id == req->header.phy_id; });
if(found != pnf->phys.end())
#endif
{
//DJP phy_info& phy_info = (*found);
phy_info* phy_info = pnf->phys;
nfapi_pnf_p7_config_t* p7_config = nfapi_pnf_p7_config_create();
p7_config->phy_id = phy->phy_id;
p7_config->remote_p7_port = phy_info->remote_port;
p7_config->remote_p7_addr = phy_info->remote_addr;
p7_config->local_p7_port = 32123; // DJP - good grief cannot seem to get the right answer phy_info->local_port;
//DJP p7_config->local_p7_addr = (char*)phy_info->local_addr.c_str();
p7_config->local_p7_addr = phy_info->local_addr;
printf("[PNF] P7 remote:%s:%d local:%s:%d\n", p7_config->remote_p7_addr, p7_config->remote_p7_port, p7_config->local_p7_addr, p7_config->local_p7_port);
p7_config->user_data = phy_info;
p7_config->malloc = &pnf_allocate;
p7_config->free = &pnf_deallocate;
p7_config->codec_config.allocate = &pnf_allocate;
p7_config->codec_config.deallocate = &pnf_deallocate;
p7_config->trace = &pnf_nfapi_trace;
phy->user_data = p7_config;
p7_config->subframe_buffer_size = phy_info->timing_window;
printf("subframe_buffer_size configured using phy_info->timing_window:%d\n", phy_info->timing_window);
if(phy_info->timing_info_mode & 0x1)
{
p7_config->timing_info_mode_periodic = 1;
p7_config->timing_info_period = phy_info->timing_info_period;
}
if(phy_info->timing_info_mode & 0x2)
{
p7_config->timing_info_mode_aperiodic = 1;
}
p7_config->dl_config_req = &pnf_phy_dl_config_req;
p7_config->ul_config_req = &pnf_phy_ul_config_req;
p7_config->hi_dci0_req = &pnf_phy_hi_dci0_req;
p7_config->tx_req = &pnf_phy_tx_req;
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
memset(&dummy_dl_config_req, 0, sizeof(dummy_dl_config_req));
dummy_dl_config_req.dl_config_request_body.tl.tag=NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
dummy_dl_config_req.dl_config_request_body.number_pdcch_ofdm_symbols=1;
dummy_dl_config_req.dl_config_request_body.number_dci=0;
dummy_dl_config_req.dl_config_request_body.number_pdu=0;
dummy_dl_config_req.dl_config_request_body.number_pdsch_rnti=0;
dummy_dl_config_req.dl_config_request_body.transmission_power_pcfich=6000;
dummy_dl_config_req.dl_config_request_body.dl_config_pdu_list=0;
memset(&dummy_tx_req, 0, sizeof(dummy_tx_req));
dummy_tx_req.tx_request_body.number_of_pdus=0;
dummy_tx_req.tx_request_body.tl.tag=NFAPI_TX_REQUEST_BODY_TAG;
dummy_subframe.dl_config_req = &dummy_dl_config_req;
dummy_subframe.tx_req = 0;//&dummy_tx_req;
dummy_subframe.ul_config_req=0;
dummy_subframe.hi_dci0_req=0;
dummy_subframe.lbt_dl_config_req=0;
p7_config->dummy_subframe = dummy_subframe;
p7_config->vendor_ext = &pnf_phy_vendor_ext;
p7_config->allocate_p7_vendor_ext = &pnf_phy_allocate_p7_vendor_ext;
p7_config->deallocate_p7_vendor_ext = &pnf_phy_deallocate_p7_vendor_ext;
p7_config->codec_config.unpack_p7_vendor_extension = &pnf_phy_unpack_p7_vendor_extension;
p7_config->codec_config.pack_p7_vendor_extension = &pnf_phy_pack_p7_vendor_extension;
p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_phy_unpack_vendor_extension_tlv;
p7_config->codec_config.pack_vendor_extension_tlv = &pnf_phy_pack_vendor_extention_tlv;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
pthread_t p7_thread;
pthread_create(&p7_thread, NULL, &pnf_p7_thread_start, p7_config);
//((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
l1_north_init_eNB();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
p7_config_g = p7_config;
// Need to wait for main thread to create RU structures
while(config_sync_var<0)
{
usleep(5000000);
printf("[PNF] waiting for OAI to be configured (eNB/RU)\n");
}
printf("[PNF] OAI eNB/RU configured\n");
//printf("[PNF] About to call phy_init_RU() for RC.ru[0]:%p\n", RC.ru[0]);
//phy_init_RU(RC.ru[0]);
printf("[PNF] About to call init_eNB_afterRU()\n");
init_eNB_afterRU();
// Signal to main thread that it can carry on - otherwise RU will startup too quickly and it is not initialised
{
pthread_mutex_lock(&nfapi_sync_mutex);
nfapi_sync_var=0;
pthread_cond_broadcast(&nfapi_sync_cond);
pthread_mutex_unlock(&nfapi_sync_mutex);
}
while(sync_var<0)
{
usleep(5000000);
printf("[PNF] waiting for OAI to be started\n");
}
printf("[PNF] Sending PNF_START_RESP\n");
nfapi_send_pnf_start_resp(config, p7_config->phy_id);
printf("[PNF] Sending first P7 subframe ind\n");
nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct???
printf("[PNF] Sent first P7 subframe ind\n");
}
return 0;
}
int measurement_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_measurement_request_t* req)
{
nfapi_measurement_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_MEASUREMENT_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_MSG_OK;
nfapi_pnf_measurement_resp(config, &resp);
return 0;
}
int rssi_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_rssi_request_t* req)
{
nfapi_rssi_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_RSSI_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_rssi_resp(config, &resp);
nfapi_rssi_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_RSSI_INDICATION;
ind.header.phy_id = req->header.phy_id;
ind.error_code = NFAPI_P4_MSG_OK;
ind.rssi_indication_body.tl.tag = NFAPI_RSSI_INDICATION_TAG;
ind.rssi_indication_body.number_of_rssi = 1;
ind.rssi_indication_body.rssi[0] = -42;
nfapi_pnf_rssi_ind(config, &ind);
return 0;
}
int cell_search_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_cell_search_request_t* req)
{
nfapi_cell_search_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_CELL_SEARCH_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_cell_search_resp(config, &resp);
nfapi_cell_search_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_CELL_SEARCH_INDICATION;
ind.header.phy_id = req->header.phy_id;
ind.error_code = NFAPI_P4_MSG_OK;
switch(req->rat_type)
{
case NFAPI_RAT_TYPE_LTE:
{
ind.lte_cell_search_indication.tl.tag = NFAPI_LTE_CELL_SEARCH_INDICATION_TAG;
ind.lte_cell_search_indication.number_of_lte_cells_found = 1;
ind.lte_cell_search_indication.lte_found_cells[0].pci = 123;
ind.lte_cell_search_indication.lte_found_cells[0].rsrp = 123;
ind.lte_cell_search_indication.lte_found_cells[0].rsrq = 123;
ind.lte_cell_search_indication.lte_found_cells[0].frequency_offset = 123;
}
break;
case NFAPI_RAT_TYPE_UTRAN:
{
ind.utran_cell_search_indication.tl.tag = NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG;
ind.utran_cell_search_indication.number_of_utran_cells_found = 1;
ind.utran_cell_search_indication.utran_found_cells[0].psc = 89;
ind.utran_cell_search_indication.utran_found_cells[0].rscp = 89;
ind.utran_cell_search_indication.utran_found_cells[0].ecno = 89;
ind.utran_cell_search_indication.utran_found_cells[0].frequency_offset = -89;
}
break;
case NFAPI_RAT_TYPE_GERAN:
{
ind.geran_cell_search_indication.tl.tag = NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG;
ind.geran_cell_search_indication.number_of_gsm_cells_found = 1;
ind.geran_cell_search_indication.gsm_found_cells[0].bsic = 23;
ind.geran_cell_search_indication.gsm_found_cells[0].rxlev = 23;
ind.geran_cell_search_indication.gsm_found_cells[0].rxqual = 23;
ind.geran_cell_search_indication.gsm_found_cells[0].frequency_offset = -23;
ind.geran_cell_search_indication.gsm_found_cells[0].sfn_offset = 230;
}
break;
}
ind.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
ind.pnf_cell_search_state.length = 3;
nfapi_pnf_cell_search_ind(config, &ind);
return 0;
}
int broadcast_detect_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_broadcast_detect_request_t* req)
{
nfapi_broadcast_detect_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_BROADCAST_DETECT_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_broadcast_detect_resp(config, &resp);
nfapi_broadcast_detect_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_BROADCAST_DETECT_INDICATION;
ind.header.phy_id = req->header.phy_id;
ind.error_code = NFAPI_P4_MSG_OK;
switch(req->rat_type)
{
case NFAPI_RAT_TYPE_LTE:
{
ind.lte_broadcast_detect_indication.tl.tag = NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG;
ind.lte_broadcast_detect_indication.number_of_tx_antenna = 1;
ind.lte_broadcast_detect_indication.mib_length = 4;
//ind.lte_broadcast_detect_indication.mib...
ind.lte_broadcast_detect_indication.sfn_offset = 77;
}
break;
case NFAPI_RAT_TYPE_UTRAN:
{
ind.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG;
ind.utran_broadcast_detect_indication.mib_length = 4;
//ind.utran_broadcast_detect_indication.mib...
// ind.utran_broadcast_detect_indication.sfn_offset; DJP - nonsense line
}
break;
}
ind.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
ind.pnf_cell_broadcast_state.length = 3;
nfapi_pnf_broadcast_detect_ind(config, &ind);
return 0;
}
int system_information_schedule_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_schedule_request_t* req)
{
nfapi_system_information_schedule_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_system_information_schedule_resp(config, &resp);
nfapi_system_information_schedule_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION;
ind.header.phy_id = req->header.phy_id;
ind.error_code = NFAPI_P4_MSG_OK;
ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
ind.lte_system_information_indication.sib_type = 3;
ind.lte_system_information_indication.sib_length = 5;
//ind.lte_system_information_indication.sib...
nfapi_pnf_system_information_schedule_ind(config, &ind);
return 0;
}
int system_information_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_request_t* req)
{
nfapi_system_information_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_SYSTEM_INFORMATION_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_system_information_resp(config, &resp);
nfapi_system_information_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_SYSTEM_INFORMATION_INDICATION;
ind.header.phy_id = req->header.phy_id;
ind.error_code = NFAPI_P4_MSG_OK;
switch(req->rat_type)
{
case NFAPI_RAT_TYPE_LTE:
{
ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
ind.lte_system_information_indication.sib_type = 1;
ind.lte_system_information_indication.sib_length = 3;
//ind.lte_system_information_indication.sib...
}
break;
case NFAPI_RAT_TYPE_UTRAN:
{
ind.utran_system_information_indication.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG;
ind.utran_system_information_indication.sib_length = 3;
//ind.utran_system_information_indication.sib...
}
break;
case NFAPI_RAT_TYPE_GERAN:
{
ind.geran_system_information_indication.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG;
ind.geran_system_information_indication.si_length = 3;
//ind.geran_system_information_indication.si...
}
break;
}
nfapi_pnf_system_information_ind(config, &ind);
return 0;
}
int nmm_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nmm_stop_request_t* req)
{
nfapi_nmm_stop_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_NMM_STOP_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_nmm_stop_resp(config, &resp);
return 0;
}
int vendor_ext(nfapi_pnf_config_t* config, nfapi_p4_p5_message_header_t* msg)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 %s %p\n", __FUNCTION__, msg);
switch(msg->message_id)
{
case P5_VENDOR_EXT_REQ:
{
vendor_ext_p5_req* req = (vendor_ext_p5_req*)msg;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 Vendor Ext Req (%d %d)\n", req->dummy1, req->dummy2);
// send back the P5_VENDOR_EXT_RSP
vendor_ext_p5_rsp rsp;
memset(&rsp, 0, sizeof(rsp));
rsp.header.message_id = P5_VENDOR_EXT_RSP;
rsp.error_code = NFAPI_MSG_OK;
nfapi_pnf_vendor_extension(config, &rsp.header, sizeof(vendor_ext_p5_rsp));
}
break;
}
return 0;
}
nfapi_p4_p5_message_header_t* pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size)
{
if(message_id == P5_VENDOR_EXT_REQ)
{
(*msg_size) = sizeof(vendor_ext_p5_req);
return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_req));
}
return 0;
}
void pnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header)
{
free(header);
}
int pnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P5_VENDOR_EXT_RSP)
{
vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)(header);
return (!push16(rsp->error_code, ppWritePackedMsg, end));
}
return 0;
}
int pnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P5_VENDOR_EXT_REQ)
{
vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
return (!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
pull16(ppReadPackedMessage, &req->dummy2, end)));
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s (%d %d)\n", __FUNCTION__, req->dummy1, req->dummy2);
}
return 0;
}
/*------------------------------------------------------------------------------*/
void* pnf_start_thread(void* ptr)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__);
nfapi_pnf_config_t *config = (nfapi_pnf_config_t*)ptr;
nfapi_pnf_start(config);
return (void*)0;
}
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port)
{
nfapi_mode = 1; // PNF!
nfapi_pnf_config_t* config = nfapi_pnf_config_create();
config->vnf_ip_addr = vnf_ip_addr;
config->vnf_p5_port = vnf_p5_port;
pnf.phys[0].udp.enabled = 1;
pnf.phys[0].udp.rx_port = pnf_p7_port;
pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
__FUNCTION__,
config->vnf_ip_addr, config->vnf_p5_port,
pnf.phys[0].local_addr,
pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
pnf.phys[0].udp.rx_port);
config->pnf_param_req = &pnf_param_request;
config->pnf_config_req = &pnf_config_request;
config->pnf_start_req = &pnf_start_request;
config->pnf_stop_req = &pnf_stop_request;
config->param_req = &param_request;
config->config_req = &config_request;
config->start_req = &start_request;
config->measurement_req = &measurement_request;
config->rssi_req = &rssi_request;
config->cell_search_req = &cell_search_request;
config->broadcast_detect_req = &broadcast_detect_request;
config->system_information_schedule_req = &system_information_schedule_request;
config->system_information_req = &system_information_request;
config->nmm_stop_req = &nmm_stop_request;
config->vendor_ext = &vendor_ext;
config->trace = &pnf_nfapi_trace;
config->user_data = &pnf;
// To allow custom vendor extentions to be added to nfapi
config->codec_config.unpack_vendor_extension_tlv = &pnf_sim_unpack_vendor_extension_tlv;
config->codec_config.pack_vendor_extension_tlv = &pnf_sim_pack_vendor_extention_tlv;
config->allocate_p4_p5_vendor_ext = &pnf_sim_allocate_p4_p5_vendor_ext;
config->deallocate_p4_p5_vendor_ext = &pnf_sim_deallocate_p4_p5_vendor_ext;
config->codec_config.unpack_p4_p5_vendor_extension = &pnf_sim_unpack_p4_p5_vendor_extension;
config->codec_config.pack_p4_p5_vendor_extension = &pnf_sim_pack_p4_p5_vendor_extension;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating PNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&pnf_start_pthread, NULL, &pnf_start_thread, config);
}
void oai_subframe_ind(eNB_rxtx_proc_t *proc)
{
//LOG_D(PHY,"%s(frame:%d, subframe:%d)\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx);
//TODO FIXME - HACK - DJP - using a global to bodge it in
if (p7_config_g != NULL && sync_var==0)
{
//PHY_VARS_eNB *eNB = RC.eNB[0][0];
//int even_frame_thread = eNB->proc.proc_rxtx[0] == proc ? 0 : 1;
int pnf = nfapi_mode==1 ? 1 : 0;
uint16_t sfn = pnf ? proc->frame_tx : proc->frame_rx;
uint16_t sf = pnf ? proc->subframe_tx : proc->frame_rx;
uint16_t sfn_sf_tx = sfn<<4 | sf;
if ((sfn % 100 == 0) && sf==0)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s %d.%d (frame:%u subframe:%u) SFN/SF(TX):%u\n", __FUNCTION__, ts.tv_sec, ts.tv_nsec, sfn, sf, NFAPI_SFNSF2DEC(sfn_sf_tx));
}
int subframe_ret = nfapi_pnf_p7_subframe_ind(p7_config_g, p7_config_g->phy_id, sfn_sf_tx);
if (subframe_ret)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s(frame:%u subframe:%u) SFN/SF(TX):%u - PROBLEM with pnf_p7_subframe_ind()\n", __FUNCTION__, sfn, sf, sfn_sf_tx, NFAPI_SFNSF2DEC(sfn_sf_tx));
}
else
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "***NFAPI subframe handler finished *** \n");
}
}
else
{
}
}
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind)
{
rach_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
LOG_E(PHY, "%s() sfn_sf:%d preambles:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(rach_ind->sfn_sf), rach_ind->rach_indication_body.number_of_preambles);
return nfapi_pnf_p7_rach_ind(p7_config_g, rach_ind);
}
int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind)
{
harq_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
harq_ind->header.message_id = NFAPI_HARQ_INDICATION;
LOG_E(PHY, "%s() sfn_sf:%d number_of_harqs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(harq_ind->sfn_sf), harq_ind->harq_indication_body.number_of_harqs);
return nfapi_pnf_p7_harq_ind(p7_config_g, harq_ind);
}
int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind)
{
crc_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
crc_ind->header.message_id = NFAPI_CRC_INDICATION;
LOG_E(PHY, "%s() sfn_sf:%d number_of_crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(crc_ind->sfn_sf), crc_ind->crc_indication_body.number_of_crcs);
return nfapi_pnf_p7_crc_ind(p7_config_g, crc_ind);
}
int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *ind)
{
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_RX_CQI_INDICATION;
LOG_E(PHY, "%s() sfn_sf:%d number_of_cqis:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
return nfapi_pnf_p7_cqi_ind(p7_config_g, ind);
}
int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind)
{
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_RX_ULSCH_INDICATION;
#if 0
//ind.rx_indication_body.rx_pdu_list = malloc(sizeof(nfapi_rx_indication_pdu_t)*body->number_of_pdus);
nfapi_rx_indication_pdu_t pdu[ind->rx_indication_body.number_of_pdus];
memset(pdu, 0, sizeof(pdu));
ind->rx_indication_body.rx_pdu_list = pdu;
LOG_E(PHY, "%s() sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.sfn_sf), ind.rx_indication_body.number_of_pdus);
for(int i=0; i<ind.rx_indication_body.number_of_pdus; i++)
{
//nfapi_rx_indication_pdu_t *pdu = &ind.rx_indication_body.rx_pdu_list[i];
pdu[i].rx_ue_information.tl.tag = body->rx_pdu_list[i].rx_ue_information.tl.tag;
pdu[i].rx_ue_information.handle = body->rx_pdu_list[i].rx_ue_information.handle;
pdu[i].rx_ue_information.rnti = body->rx_pdu_list[i].rx_ue_information.rnti;
pdu[i].rx_indication_rel8.tl.tag = body->rx_pdu_list[i].rx_indication_rel8.tl.tag;
pdu[i].rx_indication_rel8.length = body->rx_pdu_list[i].rx_indication_rel8.length;
pdu[i].rx_indication_rel8.offset = body->rx_pdu_list[i].rx_indication_rel8.offset;
pdu[i].rx_indication_rel8.ul_cqi = body->rx_pdu_list[i].rx_indication_rel8.ul_cqi;
pdu[i].rx_indication_rel8.timing_advance = body->rx_pdu_list[i].rx_indication_rel8.timing_advance;
pdu[i].rx_indication_rel9.tl.tag = 0; // Clear it
pdu[i].data = body->rx_pdu_list[i].data;
LOG_E(PHY, "%s() handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p body->rx_pdu_list[0].data:%p\n",
__FUNCTION__,
pdu->rx_ue_information.handle,
pdu->rx_ue_information.rnti,
pdu->rx_indication_rel8.length,
pdu->rx_indication_rel8.offset,
pdu->rx_indication_rel8.ul_cqi,
pdu->rx_indication_rel8.timing_advance,
pdu->data,
body->rx_pdu_list[0].data
);
}
#endif
int retval = nfapi_pnf_p7_rx_ind(p7_config_g, ind);
LOG_E(PHY,"%s() retval:%d\n", __FUNCTION__, retval);
//free(ind.rx_indication_body.rx_pdu_list);
return retval;
}
#if !defined(NFAPI_PNF_H__)
#define NFAPI_PNF_H__
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
#endif
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "nfapi_interface.h"
#include "nfapi_vnf_interface.h"
#include "nfapi.h"
#include "vendor_ext.h"
#include "nfapi_vnf.h"
#include "common/ran_context.h"
//#include "openair1/PHY/vars.h"
extern RAN_CONTEXT_t RC;
typedef struct
{
//public:
uint8_t enabled;
uint32_t rx_port;
uint32_t tx_port;
//std::string tx_addr;
char tx_addr[80];
} udp_data;
//class phy_info
//DJP
typedef struct
{
#if 0
public:
phy_info()
: first_subframe_ind(0), fapi(0),
dl_ues_per_subframe(0), ul_ues_per_subframe(0),
timing_window(0), timing_info_mode(0), timing_info_period(0)
{
index = 0;
id = 0;
local_port = 0;
remote_addr = 0;
remote_port = 0;
duplex_mode = 0;
dl_channel_bw_support = 0;
ul_channel_bw_support = 0;
num_dl_layers_supported = 0;
num_ul_layers_supported = 0;
release_supported = 0;
nmm_modes_supported = 0;
}
#endif
uint16_t index;
uint16_t id;
//std::vector<uint8_t> rfs;
//std::vector<uint8_t> excluded_rfs;
uint8_t rfs[2];
uint8_t excluded_rfs[2];
udp_data udp;
//std::string local_addr;
char local_addr[80];
int local_port;
char* remote_addr;
int remote_port;
uint8_t duplex_mode;
uint16_t dl_channel_bw_support;
uint16_t ul_channel_bw_support;
uint8_t num_dl_layers_supported;
uint8_t num_ul_layers_supported;
uint16_t release_supported;
uint8_t nmm_modes_supported;
uint8_t dl_ues_per_subframe;
uint8_t ul_ues_per_subframe;
uint8_t first_subframe_ind;
// timing information recevied from the vnf
uint8_t timing_window;
uint8_t timing_info_mode;
uint8_t timing_info_period;
// DJP
//fapi_t* fapi;
} phy_info;
//class rf_info
//DJP
typedef struct
{
//public:
uint16_t index;
uint16_t band;
int16_t max_transmit_power;
int16_t min_transmit_power;
uint8_t num_antennas_supported;
uint32_t min_downlink_frequency;
uint32_t max_downlink_frequency;
uint32_t max_uplink_frequency;
uint32_t min_uplink_frequency;
} rf_info;
//class pnf_info
//DJP
typedef struct
{
#if 0
public:
pnf_info()
: release(13), wireshark_test_mode(0),
max_total_power(0), oui(0)
{
release = 0;
sync_mode = 0;
location_mode = 0;
dl_config_timing = 0;
ul_config_timing = 0;
tx_timing = 0;
hi_dci0_timing = 0;
max_phys = 0;
max_total_bw = 0;
max_total_dl_layers = 0;
max_total_ul_layers = 0;
shared_bands = 0;
shared_pa = 0;
}
#endif
int release;
//DJPstd::vector<phy_info> phys;
//std::vector<rf_info> rfs;
phy_info phys[2];
rf_info rfs[2];
uint8_t sync_mode;
uint8_t location_mode;
uint8_t location_coordinates[6];
uint32_t dl_config_timing;
uint32_t ul_config_timing;
uint32_t tx_timing;
uint32_t hi_dci0_timing;
uint16_t max_phys;
uint16_t max_total_bw;
uint16_t max_total_dl_layers;
uint16_t max_total_ul_layers;
uint8_t shared_bands;
uint8_t shared_pa;
int16_t max_total_power;
uint8_t oui;
uint8_t wireshark_test_mode;
} pnf_info;
typedef struct mac mac_t;
typedef struct mac
{
void* user_data;
void (*dl_config_req)(mac_t* mac, nfapi_dl_config_request_t* req);
void (*ul_config_req)(mac_t* mac, nfapi_ul_config_request_t* req);
void (*hi_dci0_req)(mac_t* mac, nfapi_hi_dci0_request_t* req);
void (*tx_req)(mac_t* mac, nfapi_tx_request_t* req);
} mac_t;
//class vnf_p7_info
typedef struct
{
//public:
#if 0
vnf_p7_info()
: thread_started(false),
config(nfapi_vnf_p7_config_create(),
[] (nfapi_vnf_p7_config_t* f) { nfapi_vnf_p7_config_destory(f); }),
mac(0)
{
local_port = 0;
timing_window = 0;
periodic_timing_enabled = 0;
aperiodic_timing_enabled = 0;
periodic_timing_period = 0;
//config = nfapi_vnf_p7_config_create();
}
vnf_p7_info(const vnf_p7_info& other) = default;
vnf_p7_info(vnf_p7_info&& other) = default;
vnf_p7_info& operator=(const vnf_p7_info&) = default;
vnf_p7_info& operator=(vnf_p7_info&&) = default;
virtual ~vnf_p7_info()
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "*** vnf_p7_info delete ***\n");
//nfapi_vnf_p7_config_destory(config);
// should we delete the mac?
}
#endif
int local_port;
//DJP std::string local_addr;
char local_addr[80];
unsigned timing_window;
unsigned periodic_timing_enabled;
unsigned aperiodic_timing_enabled;
unsigned periodic_timing_period;
// This is not really the right place if we have multiple PHY,
// should be part of the phy struct
udp_data udp;
uint8_t thread_started;
nfapi_vnf_p7_config_t* config;
//std::shared_ptr<nfapi_vnf_p7_config_t> config;
mac_t* mac;
} vnf_p7_info;
//class vnf_info
typedef struct
{
//public:
uint8_t wireshark_test_mode;
//std::map<uint16_t, pnf_info> pnfs;
pnf_info pnfs[2];
//std::vector<vnf_p7_info> p7_vnfs;
vnf_p7_info p7_vnfs[2];
} vnf_info;
int vnf_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "vnf_pack_vendor_extension_tlv\n");
nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
switch(tlv->tag)
{
case VENDOR_EXT_TLV_2_TAG:
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_2\n");
vendor_ext_tlv_2* ve = (vendor_ext_tlv_2*)tlv;
if(!push32(ve->dummy, ppWritePackedMsg, end))
return 0;
return 1;
}
break;
}
return -1;
}
int vnf_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* codec)
{
return -1;
}
void install_schedule_handlers(IF_Module_t *if_inst);
extern int single_thread_flag;
extern void init_eNB_afterRU(void);
void oai_create_enb(void)
{
int bodge_counter=0;
PHY_VARS_eNB *eNB = RC.eNB[0][0];
printf("[VNF] RC.eNB[0][0]. Mod_id:%d CC_id:%d nb_CC[0]:%d abstraction_flag:%d single_thread_flag:%d td:%p te:%p if_inst:%p\n", eNB->Mod_id, eNB->CC_id, RC.nb_CC[0], eNB->abstraction_flag, eNB->single_thread_flag, eNB->td, eNB->te, eNB->if_inst);
eNB->Mod_id = bodge_counter;
eNB->CC_id = bodge_counter;
eNB->abstraction_flag = 0;
eNB->single_thread_flag = 0;//single_thread_flag;
eNB->td = ulsch_decoding_data;//(single_thread_flag==1) ? ulsch_decoding_data_2thread : ulsch_decoding_data;
eNB->te = dlsch_encoding;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding;
RC.nb_CC[bodge_counter] = 1;
if (eNB->if_inst==0) {
eNB->if_inst = IF_Module_init(bodge_counter);
}
// This will cause phy_config_request to be installed. That will result in RRC configuring the PHY
// that will result in eNB->configured being set to TRUE.
// See we need to wait for that to happen otherwise the NFAPI message exchanges won't contain the right parameter values
if (RC.eNB[0][0]->if_inst==0 || RC.eNB[0][0]->if_inst->PHY_config_req==0 || RC.eNB[0][0]->if_inst->schedule_response==0)
{
printf("RC.eNB[0][0]->if_inst->PHY_config_req is not installed - install it\n");
install_schedule_handlers(RC.eNB[0][0]->if_inst);
}
do {
printf("%s() Waiting for eNB to become configured (by RRC/PHY) - need to wait otherwise NFAPI messages won't contain correct values\n", __FUNCTION__);
usleep(50000);
} while(eNB->configured != 1);
}
void oai_enb_init(void)
{
init_eNB_afterRU();
}
int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx)
{
printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
//pnf_info pnf;
//vnf_info* vnf = (vnf_info*)(config->user_data);
//vnf->pnfs.insert(std::pair<uint16_t, pnf_info>(p5_idx, pnf));
oai_create_enb();
nfapi_pnf_param_request_t req;
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
nfapi_vnf_pnf_param_req(config, p5_idx, &req);
return 0;
}
int pnf_disconnection_indication_cb(nfapi_vnf_config_t* config, int p5_idx)
{
printf("[VNF] pnf disconnection indication idx:%d\n", p5_idx);
vnf_info* vnf = (vnf_info*)(config->user_data);
#if 0
auto find_result = vnf->pnfs.find(p5_idx);
if(find_result != vnf->pnfs.end())
{
pnf_info& pnf = find_result->second;
for(phy_info& phy : pnf.phys)
{
vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
nfapi_vnf_p7_del_pnf((p7_vnf.config.get()), phy.id);
}
}
#else
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
vnf_p7_info* p7_vnf = vnf->p7_vnfs;
// DJP nfapi_vnf_p7_del_pnf((p7_vnf->config.get()), phy->id);
nfapi_vnf_p7_del_pnf((p7_vnf->config), phy->id);
#endif
return 0;
}
int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp)
{
printf("[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
vnf_info* vnf = (vnf_info*)(config->user_data);
#if 0
auto find_result = vnf->pnfs.find(p5_idx);
if(find_result != vnf->pnfs.end())
{
pnf_info& pnf = find_result->second;
#else
{
pnf_info *pnf = vnf->pnfs;
#endif
for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
{
phy_info phy;
phy.index = resp->pnf_phy.phy[i].phy_config_index;
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j)
{
printf("[VNF] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
phy.rfs[0] = resp->pnf_phy.phy[i].rf_config[j].rf_config_index;
}
pnf->phys[0] = phy;
}
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i)
{
rf_info rf;
rf.index = resp->pnf_rf.rf[i].rf_config_index;
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
pnf->rfs[0] = rf;
}
nfapi_pnf_config_request_t req;
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // DJP pnf.phys.size();
printf("DJP:Hard coded num phy rf to 2\n");
// DJP for(unsigned i = 0; i < pnf.phys.size(); ++i)
for(unsigned i = 0; i < 2; ++i)
{
req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf->phys[i].id;
req.pnf_phy_rf_config.phy_rf_config[i].phy_config_index = pnf->phys[i].index;
req.pnf_phy_rf_config.phy_rf_config[i].rf_config_index = pnf->phys[i].rfs[0];
}
nfapi_vnf_pnf_config_req(config, p5_idx, &req);
}
return 0;
}
int pnf_config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp)
{
printf("[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n", p5_idx, resp->header.phy_id, resp->header.message_id, resp->header.message_length);
if(1)
{
//vnf_info* vnf = (vnf_info*)(config->user_data);
#if 0
auto find_result = vnf->pnfs.find(p5_idx);
if(find_result != vnf->pnfs.end())
{
//pnf_info& pnf = find_result->second;
}
#else
nfapi_pnf_start_request_t req;
memset(&req, 0, sizeof(req));
req.header.phy_id = resp->header.phy_id;
req.header.message_id = NFAPI_PNF_START_REQUEST;
nfapi_vnf_pnf_start_req(config, p5_idx, &req);
#endif
}
else
{
// Rather than send the pnf_start_request we will demonstrate
// sending a vendor extention message. The start request will be
// send when the vendor extension response is received
//vnf_info* vnf = (vnf_info*)(config->user_data);
vendor_ext_p5_req req;
memset(&req, 0, sizeof(req));
req.header.message_id = P5_VENDOR_EXT_REQ;
req.dummy1 = 45;
req.dummy2 = 1977;
nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
}
return 0;
}
int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf)
{
eNB_proc_t *proc=&eNB->proc;
eNB_rxtx_proc_t *proc_rxtx=&proc->proc_rxtx[sf&1];
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
//int i;
struct timespec wait;
wait.tv_sec=0;
wait.tv_nsec=5000000L;
#if 0
/* accept some delay in processing - up to 5ms */
for (i = 0; i < 10 && proc_rxtx->instance_cnt_rxtx == 0; i++) {
LOG_W( PHY,"[eNB] sfn/sf:%d:%d proc_rxtx[%d]:TXsfn:%d/%d eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", sfn, sf, sf&1, proc_rxtx->frame_tx, proc_rxtx->subframe_tx, proc_rxtx->instance_cnt_rxtx);
usleep(500);
}
if (proc_rxtx->instance_cnt_rxtx == 0) {
exit_fun( "TX thread busy" );
return(-1);
}
#endif
// wake up TX for subframe n+4
// lock the TX mutex and make sure the thread is ready
if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx );
exit_fun( "error locking mutex_rxtx" );
return(-1);
}
{
static uint16_t old_sf = 0;
static uint16_t old_sfn = 0;
proc->subframe_rx = old_sf;
proc->frame_rx = old_sfn;
// Try to be 1 frame back
old_sf = sf;
old_sfn = sfn;
if (old_sf == 0 && old_sfn % 100==0) LOG_W( PHY,"[eNB] sfn/sf:%d:%d old_sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d]\n", sfn, sf, old_sfn, old_sf, proc->frame_rx, proc->subframe_rx);
}
++proc_rxtx->instance_cnt_rxtx;
//LOG_E( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d] proc_rxtx->instance_cnt_rxtx:%d \n", sfn, sf, proc->frame_rx, proc->subframe_rx, proc_rxtx->instance_cnt_rxtx);
// We have just received and processed the common part of a subframe, say n.
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
// transmitted timestamp of the next TX slot (first).
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
// we want to generate subframe (n+4), so TS_tx = TX_rx+4*samples_per_tti,
// and proc->subframe_tx = proc->subframe_rx+4
proc_rxtx->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti);
proc_rxtx->frame_rx = proc->frame_rx;
proc_rxtx->subframe_rx = proc->subframe_rx;
proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > 5) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + 4)%10;
// the thread can now be woken up
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" );
return(-1);
}
pthread_mutex_unlock( &proc_rxtx->mutex_rxtx );
return(0);
}
extern pthread_cond_t nfapi_sync_cond;
extern pthread_mutex_t nfapi_sync_mutex;
extern int nfapi_sync_var;
int phy_sync_indication(struct nfapi_vnf_p7_config* config, uint8_t sync)
{
//vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
printf("[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
if (1)
{
if (sync==1 && nfapi_sync_var!=0)
{
printf("[VNF] Signal to OAI main code that it can go\n");
pthread_mutex_lock(&nfapi_sync_mutex);
nfapi_sync_var=0;
pthread_cond_broadcast(&nfapi_sync_cond);
pthread_mutex_unlock(&nfapi_sync_mutex);
}
}
return(0);
}
int phy_subframe_indication(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf)
{
static uint8_t first_time = 1;
if (first_time)
{
printf("[VNF] subframe indication %d\n", sfn_sf);
first_time = 0;
}
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_subframe_ind(p7_vnf->mac, phy_id, sfn_sf);
#if 1
if (RC.eNB && RC.eNB[0][0]->configured)
{
uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
//LOG_E(PHY,"[VNF] subframe indication sfn_sf:%d sfn:%d sf:%d\n", sfn_sf, sfn, sf);
wake_eNB_rxtx(RC.eNB[0][0], sfn, sf);
}
else
{
printf("[VNF] %s() RC.eNB:%p\n", __FUNCTION__, RC.eNB);
if (RC.eNB) printf("RC.eNB[0][0]->configured:%d\n", RC.eNB[0][0]->configured);
}
#endif
return 0;
}
int phy_rach_indication(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind)
{
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_preambles:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
printf("[VNF] RACH_IND eNB:%p sfn_sf:%d number_of_preambles:%d\n", eNB, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.rach_ind.number_of_preambles = ind->rach_indication_body.number_of_preambles;
eNB->UL_INFO.rach_ind.preamble_list = eNB->preamble_list;
eNB->UL_INFO.rach_ind.tl.tag = NFAPI_RACH_INDICATION_BODY_TAG;
for (int i=0;i<ind->rach_indication_body.number_of_preambles++;i++)
{
if (ind->rach_indication_body.preamble_list[i].preamble_rel8.tl.tag == NFAPI_PREAMBLE_REL8_TAG)
{
printf("preamble[%d]: rnti:%02x preamble:%d timing_advance:%d\n",
i,
ind->rach_indication_body.preamble_list[i].preamble_rel8.rnti,
ind->rach_indication_body.preamble_list[i].preamble_rel8.preamble,
ind->rach_indication_body.preamble_list[i].preamble_rel8.timing_advance
);
}
if(ind->rach_indication_body.preamble_list[i].preamble_rel13.tl.tag == NFAPI_PREAMBLE_REL13_TAG)
{
printf("RACH PREAMBLE REL13 present\n");
}
eNB->preamble_list[i] = ind->rach_indication_body.preamble_list[i];
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_rach_ind(p7_vnf->mac, ind);
return 1;
}
int phy_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind)
{
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.harq_ind = *ind;
eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list;
for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++)
{
memcpy(&eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i]));
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_harq_ind(p7_vnf->mac, ind);
return 1;
}
int phy_crc_indication(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind)
{
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.crc_ind = *ind;
nfapi_crc_indication_t *dest_ind = &eNB->UL_INFO.crc_ind;
nfapi_crc_indication_pdu_t *dest_pdu_list = eNB->crc_pdu_list;
*dest_ind = *ind;
dest_ind->crc_indication_body.crc_pdu_list = dest_pdu_list;
LOG_E(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++)
{
LOG_D(MAC, "%s() PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n",
__FUNCTION__,
i,
ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti,
eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_crc_ind(p7_vnf->mac, ind);
return 1;
}
int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind)
{
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_pdus:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_rx_indication_t *dest_ind = &eNB->UL_INFO.rx_ind;
nfapi_rx_indication_pdu_t *dest_pdu_list = eNB->rx_pdu_list;
*dest_ind = *ind;
dest_ind->rx_indication_body.rx_pdu_list = dest_pdu_list;
for(int i=0; i<ind->rx_indication_body.number_of_pdus; i++)
{
nfapi_rx_indication_pdu_t *dest_pdu = &dest_ind->rx_indication_body.rx_pdu_list[i];
nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i];
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
// DJP - TODO FIXME - intentional memory leak
dest_pdu->data = malloc(dest_pdu->rx_indication_rel8.length);
memcpy(dest_pdu->data, src_pdu->data, dest_pdu->rx_indication_rel8.length);
LOG_E(PHY, "%s() handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n",
__FUNCTION__,
dest_pdu->rx_ue_information.handle,
dest_pdu->rx_ue_information.rnti,
dest_pdu->rx_indication_rel8.length,
dest_pdu->rx_indication_rel8.offset,
dest_pdu->rx_indication_rel8.ul_cqi,
dest_pdu->rx_indication_rel8.timing_advance,
dest_pdu->data
);
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_rx_ind(p7_vnf->mac, ind);
return 1;
}
int phy_srs_indication(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_srs_ind(p7_vnf->mac, ind);
return 1;
}
int phy_sr_indication(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_sr_ind(p7_vnf->mac, ind);
return 1;
}
int phy_cqi_indication(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_cqi_ind(p7_vnf->mac, ind);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_cqis:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.cqi_ind = ind->cqi_indication_body;
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 1;
}
int phy_lbt_dl_indication(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_lbt_dl_ind(p7_vnf->mac, ind);
return 1;
}
int phy_nb_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_nb_harq_ind(p7_vnf->mac, ind);
return 1;
}
int phy_nrach_indication(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_nrach_ind(p7_vnf->mac, ind);
return 1;
}
void* vnf_allocate(size_t size)
{
//return (void*)memory_pool::allocate(size);
return (void*)malloc(size);
}
void vnf_deallocate(void* ptr)
{
//memory_pool::deallocate((uint8_t*)ptr);
free(ptr);
}
void vnf_trace(nfapi_trace_level_t level, const char* message, ...)
{
va_list args;
va_start(args, message);
vprintf(message, args);
va_end(args);
}
int phy_vendor_ext(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg)
{
if(msg->message_id == P7_VENDOR_EXT_IND)
{
//vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
//printf("[VNF] vendor_ext (error_code:%d)\n", ind->error_code);
}
else
{
printf("[VNF] unknown %02x\n", msg->message_id);
}
return 0;
}
nfapi_p7_message_header_t* phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size)
{
if(message_id == P7_VENDOR_EXT_IND)
{
*msg_size = sizeof(vendor_ext_p7_ind);
return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_ind));
}
return 0;
}
void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header)
{
free(header);
}
/// maybe these should be in the mac file...
int phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p7_codec_config_t* codec)
{
(void)tl;
(void)ppReadPackedMessage;
(void)ve;
return -1;
}
int phy_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codec)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
switch(tlv->tag)
{
case VENDOR_EXT_TLV_1_TAG:
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
vendor_ext_tlv_1* ve = (vendor_ext_tlv_1*)tlv;
if(!push32(ve->dummy, ppWritePackedMsg, end))
return 0;
return 1;
}
break;
default:
return -1;
break;
}
}
int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* config)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P7_VENDOR_EXT_IND)
{
vendor_ext_p7_ind* req = (vendor_ext_p7_ind*)(header);
if(!pull16(ppReadPackedMessage, &req->error_code, end))
return 0;
}
return 1;
}
int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P7_VENDOR_EXT_REQ)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
if(!(push16(req->dummy1, ppWritePackedMsg, end) &&
push16(req->dummy2, ppWritePackedMsg, end)))
return 0;
}
return 1;
}
int vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P5_VENDOR_EXT_REQ)
{
vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
return (!(push16(req->dummy1, ppWritePackedMsg, end) &&
push16(req->dummy2, ppWritePackedMsg, end)));
}
return 0;
}
static pthread_t vnf_start_pthread;
static pthread_t vnf_p7_start_pthread;
void* vnf_p7_start_thread(void *ptr)
{
printf("%s()\n", __FUNCTION__);
nfapi_vnf_p7_config_t* config = (nfapi_vnf_p7_config_t*)ptr;
nfapi_vnf_p7_start(config);
return config;
}
void set_thread_priority(int priority);
void* vnf_p7_thread_start(void* ptr)
{
set_thread_priority(79);
vnf_p7_info* p7_vnf = (vnf_p7_info*)ptr;
p7_vnf->config->port = p7_vnf->local_port;
p7_vnf->config->sync_indication = &phy_sync_indication;
p7_vnf->config->subframe_indication = &phy_subframe_indication;
p7_vnf->config->harq_indication = &phy_harq_indication;
p7_vnf->config->crc_indication = &phy_crc_indication;
p7_vnf->config->rx_indication = &phy_rx_indication;
p7_vnf->config->rach_indication = &phy_rach_indication;
p7_vnf->config->srs_indication = &phy_srs_indication;
p7_vnf->config->sr_indication = &phy_sr_indication;
p7_vnf->config->cqi_indication = &phy_cqi_indication;
p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
p7_vnf->config->nrach_indication = &phy_nrach_indication;
p7_vnf->config->malloc = &vnf_allocate;
p7_vnf->config->free = &vnf_deallocate;
p7_vnf->config->trace = &vnf_trace;
p7_vnf->config->vendor_ext = &phy_vendor_ext;
p7_vnf->config->user_data = p7_vnf;
p7_vnf->mac->user_data = p7_vnf;
p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
p7_vnf->config->codec_config.allocate = &vnf_allocate;
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config);
}
return 0;
}
int pnf_start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp)
{
vnf_info* vnf = (vnf_info*)(config->user_data);
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
printf("[VNF] pnf start response idx:%d config:%p user_data:%p p7_vnf[config:%p thread_started:%d]\n", p5_idx, config, config->user_data, vnf->p7_vnfs[0].config, vnf->p7_vnfs[0].thread_started);
if(p7_vnf->thread_started == 0)
{
pthread_t vnf_p7_thread;
pthread_create(&vnf_p7_thread, NULL, &vnf_p7_thread_start, p7_vnf);
p7_vnf->thread_started = 1;
}
else
{
// P7 thread already running.
}
// start all the phys in the pnf.
#if 0
auto find_result = vnf->pnfs.find(p5_idx);
if(find_result != vnf->pnfs.end())
{
pnf_info& pnf = find_result->second;
for(unsigned i = 0; i < pnf.phys.size(); ++i)
{
pnf_info& pnf = find_result->second;
}
}
#else
{
pnf_info *pnf = vnf->pnfs;
nfapi_param_request_t req;
printf("[VNF] Sending NFAPI_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PARAM_REQUEST;
req.header.phy_id = pnf->phys[0].id;
nfapi_vnf_param_req(config, p5_idx, &req);
}
#endif
return 0;
}
extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw);
int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp)
{
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
vnf_info* vnf = (vnf_info*)(config->user_data);
#if 0
auto find_result = vnf->pnfs.find(p5_idx);
if(find_result != vnf->pnfs.end())
{
pnf_info& pnf = find_result->second;
auto found = std::find_if(pnf.phys.begin(), pnf.phys.end(), [&](phy_info& item)
{ return item.id == resp->header.phy_id; });
if(found != pnf.phys.end())
{
phy_info& phy = (*found);
#else
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
{
{
#endif
phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
struct sockaddr_in pnf_p7_sockaddr;
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
// for now just 1
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
printf("[VNF] %d.%d pnf p7 %s:%d timing %d %d %d %d\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
nfapi_config_request_t *req = &RC.mac[0]->config[0];
//memset(&req, 0, sizeof(req));
req->header.message_id = NFAPI_CONFIG_REQUEST;
req->header.phy_id = phy->id;
printf("[VNF] Send NFAPI_CONFIG_REQUEST\n");
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
req->num_tlv++;
printf("[VNF] DJP local_port:%d\n", p7_vnf->local_port);
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
struct sockaddr_in vnf_p7_sockaddr;
vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
req->num_tlv++;
printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
printf("[VNF] Timing window:%d\n", p7_vnf->timing_window);
req->num_tlv++;
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled)
{
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG;
req->nfapi_config.timing_info_mode.value = (p7_vnf->aperiodic_timing_enabled << 1) | (p7_vnf->periodic_timing_enabled);
req->num_tlv++;
if(p7_vnf->periodic_timing_enabled)
{
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG;
req->nfapi_config.timing_info_period.value = p7_vnf->periodic_timing_period;
req->num_tlv++;
}
}
vendor_ext_tlv_2 ve2;
memset(&ve2, 0, sizeof(ve2));
ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
ve2.dummy = 2016;
req->vendor_extension = &ve2.tl;
nfapi_vnf_config_req(config, p5_idx, req);
printf("[VNF] Sent NFAPI_CONFIG_REQ num_tlv:%u\n",req->num_tlv);
}
#if 0
else
{
printf("[VNF] param response failed to find pnf %d phy %d\n", p5_idx, resp->header.phy_id);
}
#endif
}
#if 0
else
{
printf("[VNF] param response failed to find pnf %d\n", p5_idx);
}
#endif
return 0;
}
int config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp)
{
nfapi_start_request_t req;
printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
printf("[VNF] Calling oai_enb_init()\n");
oai_enb_init();
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_START_REQUEST;
req.header.phy_id = resp->header.phy_id;
nfapi_vnf_start_req(config, p5_idx, &req);
printf("[VNF] Send NFAPI_START_REQUEST idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
return 0;
}
int start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp)
{
printf("[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
vnf_info* vnf = (vnf_info*)(config->user_data);
#if 0
auto find_result = vnf->pnfs.find(p5_idx);
if(find_result != vnf->pnfs.end())
{
pnf_info& pnf = find_result->second;
auto found = std::find_if(pnf.phys.begin(), pnf.phys.end(), [&](phy_info& item)
{ return item.id == resp->header.phy_id; });
if(found != pnf.phys.end())
{
phy_info& phy = (*found);
vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
nfapi_vnf_p7_add_pnf((p7_vnf.config.get()), phy.remote_addr.c_str(), phy.remote_port, phy.id);
}
}
#else
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, phy->remote_port, phy->id);
#if 0
{
extern pthread_cond_t nfapi_sync_cond;
extern pthread_mutex_t nfapi_sync_mutex;
extern int nfapi_sync_var;
printf("[VNF] Signal to OAI main code that it can go\n");
pthread_mutex_lock(&nfapi_sync_mutex);
nfapi_sync_var=0;
pthread_cond_broadcast(&nfapi_sync_cond);
pthread_mutex_unlock(&nfapi_sync_mutex);
}
#endif
#endif
return 0;
}
int vendor_ext_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg)
{
printf("[VNF] %s\n", __FUNCTION__);
switch(msg->message_id)
{
case P5_VENDOR_EXT_RSP:
{
vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)msg;
printf("[VNF] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
// send the start request
nfapi_pnf_start_request_t req;
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_START_REQUEST;
nfapi_vnf_pnf_start_req(config, p5_idx, &req);
}
break;
}
return 0;
}
int vnf_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P5_VENDOR_EXT_RSP)
{
vendor_ext_p5_rsp* req = (vendor_ext_p5_rsp*)(header);
return(!pull16(ppReadPackedMessage, &req->error_code, end));
}
return 0;
}
nfapi_p4_p5_message_header_t* vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size)
{
if(message_id == P5_VENDOR_EXT_RSP)
{
*msg_size = sizeof(vendor_ext_p5_rsp);
return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_rsp));
}
return 0;
}
void vnf_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header)
{
free(header);
}
nfapi_vnf_config_t *config = 0;
void vnf_start_thread(void* ptr)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
config = (nfapi_vnf_config_t*)ptr;
nfapi_vnf_start(config);
}
static vnf_info vnf;
extern uint8_t nfapi_mode;
/*------------------------------------------------------------------------------*/
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port)
{
nfapi_mode = 2;
memset(&vnf, 0, sizeof(vnf));
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
vnf.p7_vnfs[0].timing_window = 32;
vnf.p7_vnfs[0].periodic_timing_enabled = 1;
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
vnf.p7_vnfs[0].periodic_timing_period = 10;
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
vnf.p7_vnfs[0].local_port = 50001;
vnf.p7_vnfs[0].mac = (mac_t*)malloc(sizeof(mac_t));
nfapi_vnf_config_t* config = nfapi_vnf_config_create();
config->malloc = malloc;
config->free = free;
config->trace = &vnf_trace;
config->vnf_p5_port = vnf_p5_port;
config->vnf_ipv4 = 1;
config->vnf_ipv6 = 0;
config->pnf_list = 0;
config->phy_list = 0;
config->pnf_connection_indication = &pnf_connection_indication_cb;
config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
config->pnf_param_resp = &pnf_param_resp_cb;
config->pnf_config_resp = &pnf_config_resp_cb;
config->pnf_start_resp = &pnf_start_resp_cb;
config->param_resp = &param_resp_cb;
config->config_resp = &config_resp_cb;
config->start_resp = &start_resp_cb;
config->vendor_ext = &vendor_ext_cb;
config->user_data = &vnf;
// To allow custom vendor extentions to be added to nfapi
config->codec_config.unpack_vendor_extension_tlv = &vnf_unpack_vendor_extension_tlv;
config->codec_config.pack_vendor_extension_tlv = &vnf_pack_vendor_extension_tlv;
config->codec_config.unpack_p4_p5_vendor_extension = &vnf_unpack_p4_p5_vendor_extension;
config->codec_config.pack_p4_p5_vendor_extension = &vnf_pack_p4_p5_vendor_extension;
config->allocate_p4_p5_vendor_ext = &vnf_allocate_p4_p5_vendor_ext;
config->deallocate_p4_p5_vendor_ext = &vnf_deallocate_p4_p5_vendor_ext;
config->codec_config.allocate = &vnf_allocate;
config->codec_config.deallocate = &vnf_deallocate;
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&vnf_start_pthread, NULL, (void*)&vnf_start_thread, config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
}
}
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req)
{
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
//dl_config_req->header.message_id = NFAPI_DL_CONFIG_BCH_PDU_TYPE;
//NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, dl_config_req->header.message_id);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() DL_CONFIG p7_config:%p phy_id:%d message_id:%02x sfn_sf:%d pdcch:%d dci:%d pdu:%d pdsch_rnti:%d pcfich:%d\n", __FUNCTION__, p7_config, dl_config_req->header.phy_id, dl_config_req->header.message_id, NFAPI_SFNSF2DEC(dl_config_req->sfn_sf), dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols, dl_config_req->dl_config_request_body.number_dci, dl_config_req->dl_config_request_body.number_pdu, dl_config_req->dl_config_request_body.number_pdsch_rnti, dl_config_req->dl_config_request_body.transmission_power_pcfich);
int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
if (retval!=0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
{
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() TX_REQ p7_config:%p phy_id:%d message_id:%02x sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, p7_config, tx_req->header.phy_id, tx_req->header.message_id, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
if (retval!=0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req)
{
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() HI_DCI0_REQ p7_config:%p phy_id:%d message_id:%02x sfn_sf:%d number_of_dci:%d number_of_hi:%d\n", __FUNCTION__, p7_config, hi_dci0_req->header.phy_id, hi_dci0_req->header.message_id, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req);
if (retval!=0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req)
{
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
//NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() UL_CONFIG p7_config:%p phy_id:%d message_id:%02x sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n",
__FUNCTION__, p7_config, ul_config_req->header.phy_id, ul_config_req->header.message_id, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf),
ul_config_req->ul_config_request_body.number_of_pdus,
ul_config_req->ul_config_request_body.rach_prach_frequency_resources,
ul_config_req->ul_config_request_body.srs_present);
int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req);
if (retval!=0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
else
{
// Reset number of PDUs so that it is not resent
ul_config_req->ul_config_request_body.number_of_pdus=0;
}
return retval;
}
#if !defined(NFAPI_VNF_H__)
#define NFAPI_VNF_H__
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
#endif
/*
* Copyright 2017 Cisco Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
#ifndef _VENDOR_EXT_H_
#define _VENDOR_EXT_H_
#include "nfapi_interface.h"
typedef enum
{
P5_VENDOR_EXT_REQ = NFAPI_VENDOR_EXT_MSG_MIN,
P5_VENDOR_EXT_RSP,
P7_VENDOR_EXT_REQ,
P7_VENDOR_EXT_IND
} vendor_ext_message_id_e;
typedef struct {
nfapi_p4_p5_message_header_t header;
uint16_t dummy1;
uint16_t dummy2;
} vendor_ext_p5_req;
typedef struct {
nfapi_p4_p5_message_header_t header;
uint16_t error_code;
} vendor_ext_p5_rsp;
typedef struct {
nfapi_p7_message_header_t header;
uint16_t dummy1;
uint16_t dummy2;
} vendor_ext_p7_req;
typedef struct {
nfapi_p7_message_header_t header;
uint16_t error_code;
} vendor_ext_p7_ind;
typedef struct {
nfapi_tl_t tl;
uint32_t dummy;
} vendor_ext_tlv_1;
#define VENDOR_EXT_TLV_1_TAG 0xF001
typedef struct {
nfapi_tl_t tl;
uint32_t dummy;
} vendor_ext_tlv_2;
#define VENDOR_EXT_TLV_2_TAG 0xF002
#endif // _VENDOR_EXT_
......@@ -17,3 +17,11 @@ alias oait='cd $OPENAIR_TARGETS'
alias oailte='cd $OPENAIR_TARGETS/RT/USER'
alias oais='cd $OPENAIR_TARGETS/SIMU/USER'
alias oaiex='cd $OPENAIR_TARGETS/SIMU/EXAMPLES'
export NFAPI_DIR=${HOME}/open-nFAPI
alias bld='cd $OPENAIR_HOME/cmake_targets ; ./build_oai --eNB -x -w USRP'
alias b='cd $OPENAIR_HOME/cmake_targets ; ./build_oai --eNB -x -w USRP'
alias run='cd $OPENAIR_HOME/cmake_targets/lte_build_oai/build'
alias nf='cd $OPENAIR_HOME/nfapi'
alias conf='cd $OPENAIR_HOME/targets/PROJECTS/GENERIC-LTE-EPC/CONF'
diff --git a/nfapi/public_inc/nfapi_interface.h b/nfapi/public_inc/nfapi_interface.h
index 2d58c2a..45af99a 100644
index 2d58c2a..f665d11 100644
--- a/nfapi/public_inc/nfapi_interface.h
+++ b/nfapi/public_inc/nfapi_interface.h
@@ -34,7 +34,7 @@
#define NFAPI_MAX_NUM_ANTENNAS 8
#define NFAPI_MAX_NUM_SUBBANDS 13
#define NFAPI_MAX_BF_VECTORS 8
-#define NFAPI_MAX_CC 1
+#define NFAPI_MAX_CC 2
#define NFAPI_MAX_NUM_PHYSICAL_ANTENNAS 8
#define NFAPI_MAX_RSSI 8
#define NFAPI_MAX_PSC_LIST 32
@@ -1689,7 +1689,7 @@ typedef struct {
uint16_t number_pdu;
uint8_t number_pdsch_rnti;
uint16_t transmission_power_pcfich;
- nfapi_dl_config_request_pdu_t* dl_config_pdu_list;
+ nfapi_dl_config_request_pdu_t* dl_config_pdu_list;
} nfapi_dl_config_request_body_t;
#define NFAPI_DL_CONFIG_REQUEST_BODY_TAG 0x2000
@@ -1772,7 +1772,7 @@ typedef struct {
uint8_t number_of_cc;
struct {
......@@ -29,12 +11,1164 @@ index 2d58c2a..45af99a 100644
} cc[NFAPI_MAX_CC];
} nfapi_ul_config_aperiodic_cqi_pmi_ri_report_t;
@@ -1962,7 +1962,7 @@ typedef struct {
} nfapi_ul_config_harq_information_rel8_fdd_t;
#define NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG 0x2019
diff --git a/nfapi/src/nfapi.c b/nfapi/src/nfapi.c
index 0e06963..3f017bc 100644
--- a/nfapi/src/nfapi.c
+++ b/nfapi/src/nfapi.c
@@ -823,6 +823,10 @@ uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *e
{
NFAPI_TRACE(NFAPI_TRACE_WARN, "Warning pack_tlv tag 0x%x does not match expected 0x%x\n", tl->tag, tag);
}
+ else
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "Warning pack_tlv tag 0x%x ZERO does not match expected 0x%x\n", tl->tag, tag);
+ }
}
return 1;
diff --git a/nfapi/src/nfapi_p7.c b/nfapi/src/nfapi_p7.c
index a3b0141..76be11a 100644
--- a/nfapi/src/nfapi_p7.c
+++ b/nfapi/src/nfapi_p7.c
@@ -111,6 +111,8 @@ static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWrite
{
nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format);
+
return ( push8(value->dci_format, ppWritePackedMsg, end) &&
push8(value->cce_idx, ppWritePackedMsg, end) &&
push8(value->aggregation_level, ppWritePackedMsg, end) &&
@@ -234,6 +236,8 @@ static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePac
{
nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__);
+
return( push16(value->length, ppWritePackedMsg, end) &&
push16(value->pdu_index, ppWritePackedMsg, end) &&
push16(value->transmission_power, ppWritePackedMsg, end));
@@ -545,6 +549,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
{
nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich);
+
if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) &&
push8(value->number_dci, ppWritePackedMsg, end) &&
push16(value->number_pdu, ppWritePackedMsg, end) &&
@@ -574,6 +580,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
{
case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
{
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__);
+
if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
@@ -587,6 +595,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
break;
case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
{
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__);
+
if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value)))
return 0;
}
@@ -684,10 +694,21 @@ static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uin
{
nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+ //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
+ //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+ {
+ uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+ uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value);
+ uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+ if (!x || !y || !z)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z);
+ }
+ return x && y && z;
+ }
}
static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end)
@@ -1518,7 +1539,21 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg,
for(j = 0; j < pdu->num_segments; ++j)
{
// Use -1 as it is unbounded
- if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
+ // DJP - does not handle -1
+ // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
+ int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
+
+ if (0 && pdu->segments[j].segment_length == 3)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
+ pdu->segments[j].segment_data[0],
+ pdu->segments[j].segment_data[1],
+ pdu->segments[j].segment_data[2]
+ );
+ }
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret);
+
+ if (push_ret == 0)
{
return 0;
}
@@ -1532,9 +1567,13 @@ static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
{
nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+ int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+ int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value);
+ int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z);
+
+ return x && y && z;
}
static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
@@ -2592,11 +2631,16 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
return -1;
}
+ if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
+ }
// look for the specific message
uint8_t result = 0;
switch (pMessageHeader->message_id)
{
case NFAPI_DL_CONFIG_REQUEST:
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__);
result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
break;
@@ -2609,6 +2653,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
break;
case NFAPI_TX_REQUEST:
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
break;
@@ -4394,6 +4439,14 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
{
if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
return 0;
+ if (0 && pdu->segments[0].segment_length == 3)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
+ pdu->segments[0].segment_data[0],
+ pdu->segments[0].segment_data[1],
+ pdu->segments[0].segment_data[2]
+ );
+ }
}
else
{
diff --git a/pnf/public_inc/nfapi_pnf_interface.h b/pnf/public_inc/nfapi_pnf_interface.h
index f93624d..b25caf2 100644
--- a/pnf/public_inc/nfapi_pnf_interface.h
+++ b/pnf/public_inc/nfapi_pnf_interface.h
@@ -319,10 +319,10 @@ typedef struct nfapi_pnf_config
* 0 will be returned if it fails.
*
* \code
- * nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+ * nfapi_pnf_config_t* config = nfapi_pnf_config_create(void);
* \endcode
*/
-nfapi_pnf_config_t* nfapi_pnf_config_create();
+nfapi_pnf_config_t* nfapi_pnf_config_create(void);
/*! Delete a pnf configuration
* \param config A pointer to a pnf configuraiton
@@ -681,7 +681,7 @@ typedef struct nfapi_pnf_p7_config
/*! Create and initialise a nfapi_pnf_p7_config structure
* \return A pointer to a PNF P7 config structure
*/
-nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create();
+nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create(void);
/*! Delete an nfapi_pnf_p7_config structure
* \param config
diff --git a/pnf/src/pnf.c b/pnf/src/pnf.c
index d6cf364..d0a7fa6 100644
--- a/pnf/src/pnf.c
+++ b/pnf/src/pnf.c
@@ -412,10 +412,10 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{
nfapi_start_request_t req;
- NFAPI_TRACE(NFAPI_TRACE_INFO, "START.request received\n");
-
nfapi_pnf_config_t* config = &(pnf->_public);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
+
// unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{
diff --git a/pnf/src/pnf_interface.c b/pnf/src/pnf_interface.c
index 74f29a0..7310fc0 100644
--- a/pnf/src/pnf_interface.c
+++ b/pnf/src/pnf_interface.c
@@ -76,6 +76,7 @@ int nfapi_pnf_start(nfapi_pnf_config_t* config)
sleep(1);
}
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
return 0;
}
@@ -227,7 +228,7 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res
}
else
{
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknown phy id %d\n", __FUNCTION__, resp->header.phy_id);
return -1;
}
diff --git a/pnf/src/pnf_p7.c b/pnf/src/pnf_p7.c
index 0fd7828..263f93c 100644
--- a/pnf/src/pnf_p7.c
+++ b/pnf/src/pnf_p7.c
@@ -25,12 +25,13 @@
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
+#include <stdio.h>
#include "pnf_p7.h"
#define FAPI2_IP_DSCP 0
-uint32_t get_current_time_hr()
+uint32_t pnf_get_current_time_hr(void)
{
struct timeval now;
(void)gettimeofday(&now, NULL);
@@ -64,11 +65,14 @@ void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr)
// todo : for now these just malloc/free need to move to a memory cache
nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7)
{
- return pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t));
+ void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t));
+ //printf("%s() ptr:%p\n", __FUNCTION__, ptr);
+ return ptr;
}
void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t* pnf_p7)
{
+ //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->dl_config_request_body.dl_config_pdu_list);
if(pnf_p7->_public.codec_config.deallocate)
{
(pnf_p7->_public.codec_config.deallocate)(req->dl_config_request_body.dl_config_pdu_list);
@@ -83,11 +87,14 @@ void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t
nfapi_ul_config_request_t* allocate_nfapi_ul_config_request(pnf_p7_t* pnf_p7)
{
- return pnf_p7_malloc(pnf_p7, sizeof(nfapi_ul_config_request_t));
+ void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_ul_config_request_t));
+ //printf("%s() ptr:%p\n", __FUNCTION__, ptr);
+ return ptr;
}
void deallocate_nfapi_ul_config_request(nfapi_ul_config_request_t* req, pnf_p7_t* pnf_p7)
{
+ //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->ul_config_request_body.ul_config_pdu_list);
if(pnf_p7->_public.codec_config.deallocate)
{
(pnf_p7->_public.codec_config.deallocate)(req->ul_config_request_body.ul_config_pdu_list);
@@ -107,6 +114,7 @@ nfapi_hi_dci0_request_t* allocate_nfapi_hi_dci0_request(pnf_p7_t* pnf_p7)
void deallocate_nfapi_hi_dci0_request(nfapi_hi_dci0_request_t* req, pnf_p7_t* pnf_p7)
{
+ //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->hi_dci0_request_body.hi_dci0_pdu_list);
if(pnf_p7->_public.codec_config.deallocate)
{
(pnf_p7->_public.codec_config.deallocate)(req->hi_dci0_request_body.hi_dci0_pdu_list);
@@ -127,6 +135,9 @@ nfapi_tx_request_t* allocate_nfapi_tx_request(pnf_p7_t* pnf_p7)
void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7)
{
int i = 0;
+
+ //printf("%s() SFN/SF:%d %s req:%p pdu[0]:data:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->tx_request_body.tx_pdu_list[i].segments[0].segment_data);
+
for(i = 0; i < req->tx_request_body.number_of_pdus; ++i)
{
void* data = req->tx_request_body.tx_pdu_list[i].segments[0].segment_data;
@@ -307,11 +318,11 @@ void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reas
}
-uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
+static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
{
if(now_hr < sf_start_hr)
{
- NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier that start of subframe\n");
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr);
return 0;
}
else
@@ -482,29 +493,36 @@ void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7)
void send_dummy_subframe(pnf_p7_t* pnf_p7, uint16_t sfn_sf)
{
+ if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
+ {
+ pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy tx_req - enter\n");
+ (pnf_p7->_public.tx_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.tx_req);
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy tx_req - exit\n");
+ }
if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
{
pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf;
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - enter\n");
(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - exit\n");
}
if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
{
pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy ul_config_req - enter\n");
(pnf_p7->_public.ul_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.ul_config_req);
}
if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req)
{
pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf;
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy hi_dci0 - enter\n");
(pnf_p7->_public.hi_dci0_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.hi_dci0_req);
}
- if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
- {
- pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
- (pnf_p7->_public.tx_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.tx_req);
- }
if(pnf_p7->_public.lbt_dl_config_req && pnf_p7->_public.dummy_subframe.lbt_dl_config_req)
{
pnf_p7->_public.dummy_subframe.lbt_dl_config_req->sfn_sf = sfn_sf;
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy lbt - enter\n");
(pnf_p7->_public.lbt_dl_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.lbt_dl_config_req);
}
}
@@ -527,7 +545,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
}
// save the curren time and sfn_sf
- pnf_p7->sf_start_time_hr = get_current_time_hr();
+ pnf_p7->sf_start_time_hr = pnf_get_current_time_hr();
pnf_p7->sfn_sf = sfn_sf;
// If the subframe_buffer has been configured
@@ -558,18 +576,38 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
nfapi_pnf_p7_subframe_buffer_t* subframe_buffer = &(pnf_p7->subframe_buffer[buffer_index]);
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() subframe_buffer->sfn_sf:%d sfn_sf:%d sfn_sf_dec:%d buffer_index:%u subframe_buffer->dl_config_req:%p\n",
+ //__FUNCTION__, subframe_buffer->sfn_sf, sfn_sf, sfn_sf_dec, buffer_index, subframe_buffer->dl_config_req);
+
// if the subframe buffer sfn sf is set then we have atlease 1 message
// from the vnf.
// todo : how to handle the messages we don't have, send dummies for
// now
if(subframe_buffer->sfn_sf == sfn_sf)
{
+ if(subframe_buffer->tx_req != 0)
+ {
+ if(pnf_p7->_public.tx_req)
+ (pnf_p7->_public.tx_req)(&(pnf_p7->_public), subframe_buffer->tx_req);
+
+ //deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
+ }
+ else
+ {
+ // send dummy
+ if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
+ {
+ pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
+ (pnf_p7->_public.tx_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.tx_req);
+ }
+ }
+
if(subframe_buffer->dl_config_req != 0)
{
if(pnf_p7->_public.dl_config_req)
(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), subframe_buffer->dl_config_req);
- deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
+ //deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
}
else
{
@@ -586,7 +624,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
if(pnf_p7->_public.ul_config_req)
(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), subframe_buffer->ul_config_req);
- deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
+ //deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
}
else
{
@@ -603,7 +641,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
if(pnf_p7->_public.hi_dci0_req)
(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), subframe_buffer->hi_dci0_req);
- deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
+ //deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
}
else
{
@@ -615,29 +653,12 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
}
}
- if(subframe_buffer->tx_req != 0)
- {
- if(pnf_p7->_public.tx_req)
- (pnf_p7->_public.tx_req)(&(pnf_p7->_public), subframe_buffer->tx_req);
-
- deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
- }
- else
- {
- // send dummy
- if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
- {
- pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
- (pnf_p7->_public.tx_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.tx_req);
- }
- }
-
if(subframe_buffer->lbt_dl_config_req != 0)
{
if(pnf_p7->_public.lbt_dl_config_req)
(pnf_p7->_public.lbt_dl_config_req)(&(pnf_p7->_public), subframe_buffer->lbt_dl_config_req);
- deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
+ //deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
}
else
{
@@ -650,6 +671,17 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
}
+ if(subframe_buffer->dl_config_req != 0)
+ deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
+ if(subframe_buffer->ul_config_req != 0)
+ deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
+ if(subframe_buffer->hi_dci0_req != 0)
+ deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
+ if(subframe_buffer->tx_req != 0)
+ deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
+ if(subframe_buffer->lbt_dl_config_req != 0)
+ deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
+
memset(&(pnf_p7->subframe_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_subframe_buffer_t));
pnf_p7->subframe_buffer[buffer_index].sfn_sf = -1;
}
@@ -685,7 +717,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
if(pnf_p7->tick == 1000)
{
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] (ONTIME/LATE) DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
pnf_p7->stats.dl_conf_ontime, pnf_p7->stats.dl_conf_late,
pnf_p7->stats.ul_conf_ontime, pnf_p7->stats.ul_conf_late,
pnf_p7->stats.hi_dci0_ontime, pnf_p7->stats.hi_dci0_late,
@@ -724,7 +756,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
if(recv_sfn_sf_dec > ((current_sfn_sf_dec + timing_window) % NFAPI_MAX_SFNSFDEC))
{
// out of window
- //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is late %d (with wrap)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
+ NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is late %d (with wrap)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
}
else
{
@@ -736,7 +768,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
else
{
// too late
- //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in late %d (%d)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (current_sfn_sf_dec - recv_sfn_sf_dec));
+ NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in late %d (delta:%d)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (current_sfn_sf_dec - recv_sfn_sf_dec));
}
}
@@ -751,8 +783,8 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
}
else
{
- // to far in the future
- //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (%d) [%d]\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (recv_sfn_sf_dec - current_sfn_sf_dec), timing_window);
+ // too far in the future
+ NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (recv_sfn_sf_dec - current_sfn_sf_dec), timing_window);
}
}
@@ -785,15 +817,32 @@ void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
return;
}
- if(is_p7_request_in_window(req->sfn_sf, "dl_config_request", pnf_p7))
- {
- uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
- uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+ if (
+ 0 &&
+ (NFAPI_SFNSF2DEC(req->sfn_sf) % 100 ==0 ||
+ NFAPI_SFNSF2DEC(req->sfn_sf) % 105 ==0
+ )
+ )
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req sfn_sf:%d pdcch:%u dci:%u pdu:%u pdsch_rnti:%u pcfich:%u\n",
+ NFAPI_SFNSF2DEC(req->sfn_sf),
+ req->dl_config_request_body.number_pdcch_ofdm_symbols,
+ req->dl_config_request_body.number_dci,
+ req->dl_config_request_body.number_pdu,
+ req->dl_config_request_body.number_pdsch_rnti,
+ req->dl_config_request_body.transmission_power_pcfich
+ );
+
+ if(is_p7_request_in_window(req->sfn_sf, "dl_config_request", pnf_p7))
+ {
+ uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+ uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+
+ //printf("%s() POPULATE DL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, sfn_sf_dec, buffer_index);
// if there is already an dl_config_req make sure we free it.
if(pnf_p7->subframe_buffer[buffer_index].dl_config_req != 0)
{
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "HERE HERE HERE\n");
+ NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_sf:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), buffer_index);
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing dl_config_req at index %d (%d/%d)",
// pMyPhyInfo->sfnSf, bufferIdx,
// SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
@@ -994,6 +1043,13 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+//printf("%s() POPULATE TX_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, sfn_sf_dec, buffer_index);
+
+ if (0 && NFAPI_SFNSF2DEC(req->sfn_sf)%100==0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX_REQ.req sfn_sf:%d pdus:%d - TX_REQ is within window\n",
+ __FUNCTION__,
+ NFAPI_SFNSF2DEC(req->sfn_sf),
+ req->tx_request_body.number_of_pdus);
+
if(pnf_p7->subframe_buffer[buffer_index].tx_req != 0)
{
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing tx_req at index %d (%d/%d)",
@@ -1126,12 +1182,27 @@ uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t
uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
uint32_t t2 = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us;
+ if (0)
+ {
+ static uint32_t prev_t2 = 0;
+
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s(now_time_hr:%u sfn_sf:%d sf_start_time_Hr:%u) sf_time_us:%u t2:%u prev_t2:%u diff:%u\n",
+ __FUNCTION__,
+ now_time_hr, NFAPI_SFNSF2DEC(sfn_sf), sf_start_time_hr,
+ sf_time_us,
+ t2,
+ prev_t2,
+ t2-prev_t2);
+
+ prev_t2 = t2;
+ }
+
return t2;
}
uint32_t calculate_t3(uint16_t sfn_sf, uint32_t sf_start_time_hr)
{
- uint32_t now_time_hr = get_current_time_hr();
+ uint32_t now_time_hr = pnf_get_current_time_hr();
uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
@@ -1391,6 +1462,8 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
// read the segment
recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size);
+ now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp???
+
if(recvfrom_result > 0)
{
pnf_handle_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time);
@@ -1417,7 +1490,10 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
// need to update the time as we would only use the value from the
// select
- now_hr_time = get_current_time_hr();
+#if 0
+// DJP - why do this here and not on return from recv???
+ now_hr_time = pnf_get_current_time_hr();
+#endif
}
while(recvfrom_result > 0);
}
@@ -1512,7 +1588,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout);
- uint32_t now_hr_time = get_current_time_hr();
+ uint32_t now_hr_time = pnf_get_current_time_hr();
if(selectRetval == 0)
{
diff --git a/vnf/inc/vnf_p7.h b/vnf/inc/vnf_p7.h
index ab9a335..fc2ab4e 100644
--- a/vnf/inc/vnf_p7.h
+++ b/vnf/inc/vnf_p7.h
@@ -116,7 +116,8 @@ typedef struct {
} vnf_p7_t;
-uint32_t get_current_time_hr();
+uint32_t vnf_get_current_time_hr(void);
+
uint16_t increment_sfn_sf(uint16_t sfn_sf);
int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
int send_mac_subframe_indications(vnf_p7_t* config);
diff --git a/vnf/public_inc/nfapi_vnf_interface.h b/vnf/public_inc/nfapi_vnf_interface.h
index 6659e5d..4629013 100644
--- a/vnf/public_inc/nfapi_vnf_interface.h
+++ b/vnf/public_inc/nfapi_vnf_interface.h
@@ -450,7 +450,7 @@ typedef struct nfapi_vnf_config
/*! Creates and initialise the vnf config structure before use
* \return A pointer to a vnf config structure
*/
-nfapi_vnf_config_t* nfapi_vnf_config_create();
+nfapi_vnf_config_t* nfapi_vnf_config_create(void);
/*! Delete an vnf config
*/
@@ -864,7 +864,7 @@ typedef struct nfapi_vnf_p7_config
/*! Creates and initializes the nfapi_vnf_p7_config structure before use
* \return A pointer to an allocated vnf p7 configuration
*/
-nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create();
+nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create(void);
/*! Cleanup and delete nfapi_vnf_p7_config structure
* \param config A pointer to an vnf p7 configuration structure
diff --git a/vnf/src/vnf.c b/vnf/src/vnf.c
index fea3cf7..6800ee2 100644
--- a/vnf/src/vnf.c
+++ b/vnf/src/vnf.c
@@ -82,11 +82,18 @@ void nfapi_vnf_pnf_list_add(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* no
nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5_idx)
{
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : config->pnf_list:%p\n", __FUNCTION__, config->pnf_list);
+
nfapi_vnf_pnf_info_t* curr = config->pnf_list;
while(curr != 0)
{
if(curr->p5_idx == p5_idx)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : curr->p5_idx:%d p5_idx:%d\n", __FUNCTION__, curr->p5_idx, p5_idx);
return curr;
+ }
+
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : curr->next:%p\n", __FUNCTION__, curr->next);
curr = curr->next;
}
diff --git a/vnf/src/vnf_interface.c b/vnf/src/vnf_interface.c
index e559730..0aba0a2 100644
--- a/vnf/src/vnf_interface.c
+++ b/vnf/src/vnf_interface.c
@@ -342,6 +342,7 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF connection (fd:%d) accepted from %s:%d \n", p5Sock, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
nfapi_vnf_pnf_info_t* pnf = (nfapi_vnf_pnf_info_t*)malloc(sizeof(nfapi_vnf_pnf_info_t));
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
pnf->p5_sock = p5Sock;
pnf->p5_idx = p5_idx++;
@@ -663,7 +664,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
info->p5_idx = p5_idx;
info->phy_id = vnf->next_phy_id++;
- info->timing_window = 10;
+ info->timing_window = 30; // This seems to override what gets set by the user - why???
info->timing_info_mode = 0x03;
info->timing_info_period = 128;
diff --git a/vnf/src/vnf_p7.c b/vnf/src/vnf_p7.c
index 8630385..4947c40 100644
--- a/vnf/src/vnf_p7.c
+++ b/vnf/src/vnf_p7.c
@@ -15,6 +15,8 @@
*/
+#include <time.h>
+
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
@@ -159,7 +161,7 @@ vnf_p7_rx_message_t* vnf_p7_rx_reassembly_queue_add_segment(vnf_p7_t* vnf_p7, vn
msg->sequence_number = sequence_number;
msg->num_segments_expected = m ? 255 : segment_number + 1;
msg->num_segments_received = 1;
- msg->rx_hr_time = get_current_time_hr();
+ msg->rx_hr_time = vnf_get_current_time_hr();
msg->segments[segment_number].buffer = (uint8_t*)vnf_p7_malloc(vnf_p7, data_len);
memcpy(msg->segments[segment_number].buffer, data, data_len);
@@ -216,7 +218,7 @@ void vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7_t* vnf_p7, vnf_p7_rx_reas
vnf_p7_rx_message_t* iterator = queue->msg_queue;
vnf_p7_rx_message_t* previous = 0;
- uint32_t rx_hr_time = get_current_time_hr();
+ uint32_t rx_hr_time = vnf_get_current_time_hr();
while(iterator != 0)
{
@@ -254,7 +256,7 @@ void vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7_t* vnf_p7, vnf_p7_rx_reas
}
}
-uint32_t get_current_time_hr()
+uint32_t vnf_get_current_time_hr()
{
struct timeval now;
(void)gettimeofday(&now, NULL);
@@ -297,7 +299,7 @@ struct timespec timespec_delta(struct timespec start, struct timespec end)
return temp;
}
-uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
+static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
{
if(now_hr < sf_start_hr)
{
@@ -321,7 +323,7 @@ uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
uint32_t calculate_t1(uint16_t sfn_sf, uint32_t sf_start_time_hr)
{
- uint32_t now_time_hr = get_current_time_hr();
+ uint32_t now_time_hr = vnf_get_current_time_hr();
uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
@@ -344,7 +346,7 @@ uint32_t calculate_t4(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t
uint32_t calculate_transmit_timestamp(uint16_t sfn_sf, uint32_t sf_start_time_hr)
{
- uint32_t now_time_hr = get_current_time_hr();
+ uint32_t now_time_hr = vnf_get_current_time_hr();
uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
@@ -410,6 +412,8 @@ int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* hea
int len = nfapi_p7_message_pack(header, buffer, sizeof(buffer), &vnf_p7->_public.codec_config);
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n", __FUNCTION__, header->phy_id, len, vnf_p7->_public.segment_size);
+
if(len < 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() failed to pack p7 message phy_id:%d\n", __FUNCTION__, header->phy_id);
@@ -429,6 +433,7 @@ int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* hea
int segment = 0;
int offset = NFAPI_P7_HEADER_LENGTH;
uint8_t tx_buffer[vnf_p7->_public.segment_size];
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() MORE THAN ONE SEGMENT phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n", __FUNCTION__, header->phy_id, len, vnf_p7->_public.segment_size);
for(segment = 0; segment < segment_count; ++segment)
{
uint8_t last = 0;
@@ -851,7 +856,7 @@ void vnf_handle_p7_vendor_extension(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vn
void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
- uint32_t now_time_hr = get_current_time_hr();
+ uint32_t now_time_hr = vnf_get_current_time_hr();
if (pRecvMsg == NULL || vnf_p7 == NULL)
{
@@ -871,7 +876,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
nfapi_vnf_p7_connection_info_t* phy = vnf_p7_connection_info_list_find(vnf_p7, ind.header.phy_id);
uint32_t t4 = calculate_t4(now_time_hr, phy->sfn_sf, vnf_p7->sf_start_time_hr);
- uint32_t tx_2_rx = t4 - ind.t1;
+ uint32_t tx_2_rx = t4>ind.t1 ? t4 - ind.t1 : t4 + NFAPI_MAX_SFNSFDEC - ind.t1 ;
uint32_t pnf_proc_time = ind.t3 - ind.t2;
// divide by 2 using shift operator
@@ -881,7 +886,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
phy->latency[phy->min_sync_cycle_count] = latency;
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%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",
NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id, ind.t1, ind.t2, ind.t3, t4,
tx_2_rx, pnf_proc_time, latency);
}
@@ -923,15 +928,27 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
if(1)
{
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
- NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
+ struct timespec 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_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
ind.t1, ind.t2, ind.t3, t4,
- tx_2_rx, pnf_proc_time, latency, phy->sf_offset, phy->sf_offset_filtered,
+ tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->sf_offset, phy->sf_offset_filtered,
(ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
}
}
+ if (phy->filtered_adjust && (phy->sf_offset_filtered > 1e6 || phy->sf_offset_filtered < -1e6))
+ {
+ phy->filtered_adjust = 0;
+ phy->zero_count=0;
+ phy->min_sync_cycle_count = 2;
+ phy->in_sync = 0;
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s - ADJUST TOO BAD - go out of filtered phy->sf_offset_filtered:%d\n", __FUNCTION__, phy->sf_offset_filtered);
+ }
+
if(phy->min_sync_cycle_count)
phy->min_sync_cycle_count--;
@@ -954,7 +971,6 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
phy->sf_offset = ind.t2 - (ind.t1 - phy->average_latency);
sfn_sf_dec += (phy->sf_offset / 1000);
-
}
else
{
@@ -981,7 +997,6 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
phy->previous_t1 = 0;
phy->previous_t2 = 0;
-
if(phy->previous_sf_offset_filtered > 0)
{
if( phy->sf_offset_filtered > phy->previous_sf_offset_filtered)
@@ -1083,9 +1098,14 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
if(phy->insync_minor_adjustment != 0)
{
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (sf_offset_filtered:%d) %d %d %d\n",
+ NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (sf_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adjustment:%d\n",
NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
- phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->sf_offset_filtered, insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend);
+ phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration,
+ phy->sf_offset_filtered,
+ insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend,
+ NFAPI_SFNSF2DEC(new_sfn_sf),
+ NFAPI_SFNSF2DEC(curr_sfn_sf),
+ phy->adjustment);
}
}
}
@@ -1121,10 +1141,13 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
// out of sync?
}
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (adjusment:%d sf_offset_filtered:%d) %d %d %d\n",
+ NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (adjustment:%d sf_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adj:%d\n",
NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->sf_offset_filtered,
- insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend);
+ insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend,
+ NFAPI_SFNSF2DEC(new_sfn_sf),
+ NFAPI_SFNSF2DEC(curr_sfn_sf),
+ phy->adjustment);
}
else if(phy->adjustment < 0)
@@ -1151,7 +1174,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
// out of sync?
}
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (adjusment:%d sf_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 subframes (adjustment:%d sf_offset_filtered:%d) %d %d %d\n",
NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->sf_offset_filtered,
insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend);
diff --git a/vnf/src/vnf_p7_interface.c b/vnf/src/vnf_p7_interface.c
index ab4f00c..0f9c90d 100644
--- a/vnf/src/vnf_p7_interface.c
+++ b/vnf/src/vnf_p7_interface.c
@@ -142,6 +142,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n");
+ struct timespec original_pselect_timeout;
struct timespec pselect_timeout;
pselect_timeout.tv_sec = 0;
pselect_timeout.tv_nsec = 1000000; // ns in a 1 us
@@ -157,13 +158,13 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
struct timespec sf_duration;
sf_duration.tv_sec = 0;
- sf_duration.tv_nsec = 1000000; // ns in a 1 us
+ sf_duration.tv_nsec = 1e6; // We want 1ms pause
struct timespec sf_start;
clock_gettime(CLOCK_MONOTONIC, &sf_start);
long millisecond = sf_start.tv_nsec / 1e6;
sf_start = timespec_add(sf_start, sf_duration);
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
while(vnf_p7->terminate == 0)
{
@@ -181,6 +182,8 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) )
{
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
+
if((pselect_start.tv_sec > sf_start.tv_sec) ||
((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
@@ -196,8 +199,18 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
{
// still time before the end of the subframe wait
pselect_timeout = timespec_sub(sf_start, pselect_start);
+
+#if 0
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sf_start:%d.%ld pselect_start:%d.%ld pseclect_timeout:%d.%ld\n",
+ __FUNCTION__,
+ sf_start.tv_sec, sf_start.tv_nsec,
+ pselect_start.tv_sec, pselect_start.tv_nsec,
+ pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
+#endif
}
+original_pselect_timeout = pselect_timeout;
+
// detemine how long to sleep in ns before the start of the next 1ms
//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
@@ -237,34 +250,91 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
*/
+//long wraps = pselect_timeout.tv_nsec % 1e9;
+
+
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
+ nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
+
+if (selectRetval==-1 && errno == 22)
+{
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
+ pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
+ phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
+ sf_duration.tv_sec, sf_duration.tv_nsec);
+}
+#if 0
+ if (selectRetval != 0 || phy->insync_minor_adjustment_duration != 0)
+ NFAPI_TRACE(NFAPI_TRACE_NOTE, "pselect()=%d maxSock:%d vnf_p7->socket:%d pselect_timeout:%u.%u original_pselect_timeout:%u.%u\n",
+ selectRetval, maxSock, vnf_p7->socket, pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
+ original_pselect_timeout.tv_sec, original_pselect_timeout.tv_nsec);
+#endif
+
if(selectRetval == 0)
{
- // calcualte the start of the next subframe
+ // calculate the start of the next subframe
sf_start = timespec_add(sf_start, sf_duration);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
- nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
{
- NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %dus\n", phy->insync_minor_adjustment);
+ long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
+
+ sf_start.tv_nsec -= insync_minor_adjustment_ns;
+
+#if 1
+ if (sf_start.tv_nsec > 1e9)
+ {
+ sf_start.tv_sec++;
+ sf_start.tv_nsec-=1e9;
+ }
+ else if (sf_start.tv_nsec < 0)
+ {
+ sf_start.tv_sec--;
+ sf_start.tv_nsec+=1e9;
+ }
+#else
+ //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
if(phy->insync_minor_adjustment > 0)
{
// decrease the subframe duration a little
- sf_start.tv_nsec = sf_start.tv_nsec - (phy->insync_minor_adjustment * 1000);
+ if (sf_start.tv_nsec > insync_minor_adjustment_ns)
+ sf_start.tv_nsec -= insync_minor_adjustment_ns;
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
+ sf_start.tv_sec--;
+ sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
+ }
}
else if(phy->insync_minor_adjustment < 0)
{
// todo check we don't go below 0
// increase the subframe duration a little
- sf_start.tv_nsec = sf_start.tv_nsec - (phy->insync_minor_adjustment * 1000);
+ sf_start.tv_nsec += insync_minor_adjustment_ns;
+
+ if (sf_start.tv_nsec < 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
+ sf_start.tv_sec++;
+ sf_start.tv_nsec += 1e9;
+ }
}
+#endif
//phy->insync_minor_adjustment = 0;
- phy->insync_minor_adjustment_duration--;
+ phy->insync_minor_adjustment_duration--;
+
+ 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);
+
+ if (phy->insync_minor_adjustment_duration==0)
+ {
+ phy->insync_minor_adjustment = 0;
+ }
}
/*
long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
@@ -298,7 +368,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
if(selectRetval == 0)
{
- vnf_p7->sf_start_time_hr = get_current_time_hr();
+ vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
// pselect timed out
nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
@@ -326,14 +396,18 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
else
{
// pselect error
- if(selectRetval == EINTR)
+ if(selectRetval == -1 && errno == EINTR)
{
// a sigal was received.
}
else
{
- NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
// should we exit now?
+ if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
+ {
+ usleep(100000);
+ }
}
}
@@ -360,10 +434,12 @@ int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config)
int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, int pnf_p7_port, int phy_id)
{
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d pnf_addr:%s:%d)\n", __FUNCTION__, phy_id, pnf_p7_addr, pnf_p7_port);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p phy_id:%d pnf_addr:%s pnf_p7_port:%d)\n", __FUNCTION__, config, phy_id, pnf_p7_addr, pnf_p7_port);
if(config == 0)
- return -1;
+ {
+ return -1;
+ }
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
@@ -411,6 +487,8 @@ int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id)
}
int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_request_t* req)
{
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req);
+
if(config == 0 || req == 0)
return -1;
diff --git a/xml/pnf_phy_1_A.xml b/xml/pnf_phy_1_A.xml
index da6cc26..02a6b14 100644
--- a/xml/pnf_phy_1_A.xml
+++ b/xml/pnf_phy_1_A.xml
@@ -26,7 +26,7 @@
<phy>
<index>88</index>
<port>2500</port>
- <address>127.0.0.1</address>
+ <address>192.168.1.74</address>
<duplex_mode>1</duplex_mode>
@@ -54,9 +54,9 @@
-typedef struct {
+typedef struct {
nfapi_tl_t tl;
uint8_t harq_size;
uint8_t ack_nack_mode;
<data>
<udp>
- <rx_port>7722</rx_port>
- <tx_addr>127.0.0.1</tx_addr>
- <tx_port>7733</tx_port>
+ <rx_port>5201</rx_port>
+ <tx_addr>192.168.1.78</tx_addr>
+ <tx_port>5200</tx_port>
</udp>
</data>
</phy>
diff --git a/xml/vnf_A.xml b/xml/vnf_A.xml
index e609c93..ec14b7b 100644
--- a/xml/vnf_A.xml
+++ b/xml/vnf_A.xml
@@ -2,8 +2,8 @@
<vnf>
<vnf_p7_list>
<vnf_p7>
- <port>5200</port>
- <address>127.0.0.1</address>
+ <port>5201</port>
+ <address>192.168.1.78</address>
<timing_window>10</timing_window>
<periodic_timing_enabled>0</periodic_timing_enabled>
<periodic_timing_window>0</periodic_timing_window>
@@ -12,7 +12,7 @@
<data>
<udp>
<rx_port>8891</rx_port>
- <tx_addr>127.0.0.1</tx_addr>
+ <tx_addr>192.168.1.78</tx_addr>
<tx_port>8892</tx_port>
</udp>
</data>
......@@ -32,6 +32,9 @@
#include "assertions.h"
#include <math.h>
extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
extern int32_t get_uldl_offset(int eutra_bandP);
extern uint16_t prach_root_sequence_map0_3[838];
extern uint16_t prach_root_sequence_map4[138];
uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10};
......@@ -42,24 +45,41 @@ int N_RB_DL_array[6] = {6,15,25,50,75,100};
int l1_north_init_eNB() {
int i,j;
AssertFatal(RC.nb_L1_inst>0,"nb_L1_inst=%d\n",RC.nb_L1_inst);
AssertFatal(RC.nb_L1_CC!=NULL,"nb_L1_CC is null\n");
AssertFatal(RC.eNB!=NULL,"RC.eNB is null\n");
for (i=0;i<RC.nb_L1_inst;i++) {
AssertFatal(RC.eNB[i]!=NULL,"RC.eNB[%d] is null\n",i);
AssertFatal(RC.nb_L1_CC[i]>0,"RC.nb_L1_CC[%d]=%d\n",i,RC.nb_L1_CC[i]);
for (j=0;j<RC.nb_L1_CC[i];j++) {
AssertFatal(RC.eNB[i][j]!=NULL,"RC.eNB[%d][%d] is null\n",i,j);
if ((RC.eNB[i][j]->if_inst = IF_Module_init(i))<0) return(-1);
RC.eNB[i][j]->if_inst->PHY_config_req = phy_config_request;
RC.eNB[i][j]->if_inst->schedule_response = schedule_response;
if (RC.nb_L1_inst > 0 && RC.nb_L1_CC != NULL && RC.eNB != NULL)
{
AssertFatal(RC.nb_L1_inst>0,"nb_L1_inst=%d\n",RC.nb_L1_inst);
AssertFatal(RC.nb_L1_CC!=NULL,"nb_L1_CC is null\n");
AssertFatal(RC.eNB!=NULL,"RC.eNB is null\n");
LOG_I(PHY,"%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst);
for (i=0;i<RC.nb_L1_inst;i++) {
AssertFatal(RC.eNB[i]!=NULL,"RC.eNB[%d] is null\n",i);
AssertFatal(RC.nb_L1_CC[i]>0,"RC.nb_L1_CC[%d]=%d\n",i,RC.nb_L1_CC[i]);
LOG_I(PHY,"%s() RC.nb_L1_CC[%d]:%d\n", __FUNCTION__, i, RC.nb_L1_CC[i]);
for (j=0;j<RC.nb_L1_CC[i];j++) {
AssertFatal(RC.eNB[i][j]!=NULL,"RC.eNB[%d][%d] is null\n",i,j);
if ((RC.eNB[i][j]->if_inst = IF_Module_init(i))<0) return(-1);
LOG_I(PHY,"%s() RC.eNB[%d][%d] installing callbacks\n", __FUNCTION__, i, j);
RC.eNB[i][j]->if_inst->PHY_config_req = phy_config_request;
RC.eNB[i][j]->if_inst->schedule_response = schedule_response;
}
}
}
else
{
LOG_I(PHY,"%s() Not installing PHY callbacks - RC.nb_L1_inst:%d RC.nb_L1_CC:%p RC.eNB:%p\n", __FUNCTION__, RC.nb_L1_inst, RC.nb_L1_CC, RC.eNB);
}
return(0);
}
void phy_config_request(PHY_Config_t *phy_config) {
uint8_t Mod_id = phy_config->Mod_id;
......@@ -71,13 +91,14 @@ void phy_config_request(PHY_Config_t *phy_config) {
PHICH_RESOURCE_t phich_resource_table[4]={oneSixth,half,one,two};
int eutra_band = cfg->nfapi_config.rf_bands.rf_band[0];
int dl_Bandwidth = cfg->rf_config.dl_channel_bandwidth.value;
int ul_Bandwidth = cfg->rf_config.ul_channel_bandwidth.value;
int Nid_cell = cfg->sch_config.physical_cell_id.value;
int Ncp = cfg->subframe_config.dl_cyclic_prefix_type.value;
int p_eNB = cfg->rf_config.tx_antenna_ports.value;
uint32_t dl_CarrierFreq = cfg->nfapi_config.earfcn.value;
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,Ncp %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
Mod_id, CC_id, eutra_band, N_RB_DL_array[dl_Bandwidth], Nid_cell, p_eNB,Ncp,dl_CarrierFreq,
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,eNB_tx_antenna_ports %d,Ncp %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
Mod_id, CC_id, eutra_band, dl_Bandwidth, ul_Bandwidth, Nid_cell, p_eNB,Ncp,dl_CarrierFreq,
cfg->phich_config.phich_resource.value,
cfg->phich_config.phich_duration.value);
......@@ -91,8 +112,8 @@ void phy_config_request(PHY_Config_t *phy_config) {
fp = &RC.eNB[Mod_id][CC_id]->frame_parms;
fp->N_RB_DL = N_RB_DL_array[dl_Bandwidth];
fp->N_RB_UL = N_RB_DL_array[dl_Bandwidth];
fp->N_RB_DL = dl_Bandwidth;
fp->N_RB_UL = ul_Bandwidth;
fp->Nid_cell = Nid_cell;
fp->nushift = fp->Nid_cell%6;
fp->eutra_band = eutra_band;
......@@ -154,93 +175,95 @@ void phy_config_request(PHY_Config_t *phy_config) {
RC.eNB[Mod_id][CC_id]->X_u);
#ifdef Rel14
if (cfg->emtc_config.prach_ce_level_0_enable.value == 1) {
fp->prach_emtc_config_common.prach_Config_enabled=1;
fp->prach_emtc_config_common.rootSequenceIndex = cfg->emtc_config.prach_catm_root_sequence_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag = cfg->emtc_config.prach_catm_high_speed_flag.value;
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig = cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.value;
// CE Level 3 parameters
fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3] = cfg->emtc_config.prach_ce_level_3_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3] = cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3] = cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.value;
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3],
"prach_starting_subframe_periodicity[3] < prach_numPetitionPerPreambleAttempt[3]\n");
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3] = cfg->emtc_config.prach_ce_level_3_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[3] = cfg->emtc_config.prach_ce_level_3_frequency_offset.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[3] = cfg->emtc_config.prach_ce_level_3_hopping_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[3] = cfg->emtc_config.prach_ce_level_3_hopping_offset.value;
if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3] == 1)
compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u_br[3]);
// CE Level 2 parameters
fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2] = cfg->emtc_config.prach_ce_level_2_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[2] = cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[2] = cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.value;
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[2]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[2],
"prach_starting_subframe_periodicity[2] < prach_numPetitionPerPreambleAttempt[2]\n");
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[2] = cfg->emtc_config.prach_ce_level_2_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[2] = cfg->emtc_config.prach_ce_level_2_frequency_offset.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[2] = cfg->emtc_config.prach_ce_level_2_hopping_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[2] = cfg->emtc_config.prach_ce_level_2_hopping_offset.value;
if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2] == 1)
compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u_br[2]);
// CE Level 1 parameters
fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1] = cfg->emtc_config.prach_ce_level_1_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1] = cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1] = cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value;
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1],
"prach_starting_subframe_periodicity[1] < prach_numPetitionPerPreambleAttempt[1]\n");
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[1] = cfg->emtc_config.prach_ce_level_1_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[1] = cfg->emtc_config.prach_ce_level_1_frequency_offset.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[1] = cfg->emtc_config.prach_ce_level_1_hopping_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[1] = cfg->emtc_config.prach_ce_level_1_hopping_offset.value;
if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1] == 1)
compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u_br[1]);
fp->prach_emtc_config_common.prach_Config_enabled=1;
fp->prach_emtc_config_common.rootSequenceIndex = cfg->emtc_config.prach_catm_root_sequence_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag = cfg->emtc_config.prach_catm_high_speed_flag.value;
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig = cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.value;
// CE Level 3 parameters
fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3] = cfg->emtc_config.prach_ce_level_3_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3] = cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3] = cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.value;
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3],
"prach_starting_subframe_periodicity[3] < prach_numPetitionPerPreambleAttempt[3]\n");
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3] = cfg->emtc_config.prach_ce_level_3_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[3] = cfg->emtc_config.prach_ce_level_3_frequency_offset.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[3] = cfg->emtc_config.prach_ce_level_3_hopping_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[3] = cfg->emtc_config.prach_ce_level_3_hopping_offset.value;
if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3] == 1)
compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u_br[3]);
// CE Level 2 parameters
fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2] = cfg->emtc_config.prach_ce_level_2_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[2] = cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[2] = cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.value;
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[2]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[2],
"prach_starting_subframe_periodicity[2] < prach_numPetitionPerPreambleAttempt[2]\n");
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[2] = cfg->emtc_config.prach_ce_level_2_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[2] = cfg->emtc_config.prach_ce_level_2_frequency_offset.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[2] = cfg->emtc_config.prach_ce_level_2_hopping_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[2] = cfg->emtc_config.prach_ce_level_2_hopping_offset.value;
if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2] == 1)
compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u_br[2]);
// CE Level 1 parameters
fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1] = cfg->emtc_config.prach_ce_level_1_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1] = cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1] = cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value;
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1],
"prach_starting_subframe_periodicity[1] < prach_numPetitionPerPreambleAttempt[1]\n");
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[1] = cfg->emtc_config.prach_ce_level_1_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[1] = cfg->emtc_config.prach_ce_level_1_frequency_offset.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[1] = cfg->emtc_config.prach_ce_level_1_hopping_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[1] = cfg->emtc_config.prach_ce_level_1_hopping_offset.value;
if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1] == 1)
compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u_br[1]);
// CE Level 0 parameters
fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] = cfg->emtc_config.prach_ce_level_0_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0] = cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] = cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.value;
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0],
"prach_starting_subframe_periodicity[0] %d < prach_numPetitionPerPreambleAttempt[0] %d\n",
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0],
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]);
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] > 0,
"prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]==0\n");
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[0] = cfg->emtc_config.prach_ce_level_0_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0] = cfg->emtc_config.prach_ce_level_0_frequency_offset.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[0] = cfg->emtc_config.prach_ce_level_0_hopping_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[0] = cfg->emtc_config.prach_ce_level_0_hopping_offset.value;
if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] == 1)
compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u_br[0]);
}
// CE Level 0 parameters
fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] = cfg->emtc_config.prach_ce_level_0_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0] = cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] = cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.value;
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0],
"prach_starting_subframe_periodicity[0] %d < prach_numPetitionPerPreambleAttempt[0] %d\n",
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0],
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]);
#if 0
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] > 0,
"prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]==0\n");
#else
LOG_E(PHY,"***DJP*** removed assert on preamble fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]:%d expecting >0 %s:%d\n\n\n", fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0], __FILE__, __LINE__);
#endif
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[0] = cfg->emtc_config.prach_ce_level_0_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0] = cfg->emtc_config.prach_ce_level_0_frequency_offset.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[0] = cfg->emtc_config.prach_ce_level_0_hopping_enable.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[0] = cfg->emtc_config.prach_ce_level_0_hopping_offset.value;
if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] == 1)
compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u_br[0]);
#endif
......@@ -267,9 +290,9 @@ void phy_config_request(PHY_Config_t *phy_config) {
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 0;
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
if (cfg->uplink_reference_signal_config.uplink_rs_hopping.value == 1)
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
if (cfg->uplink_reference_signal_config.uplink_rs_hopping.value == 2)
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 1;
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 1;
LOG_I(PHY,"pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = %d\n",fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = cfg->uplink_reference_signal_config.group_assignment.value;
LOG_I(PHY,"pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = %d\n",fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
......@@ -316,14 +339,14 @@ void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
}
/*
void phy_config_sib2_eNB(uint8_t Mod_id,
int CC_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
{
void phy_config_sib2_eNB(uint8_t Mod_id,
int CC_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
{
LTE_DL_FRAME_PARMS *fp = &RC.eNB[Mod_id][CC_id]->frame_parms;
//LTE_eNB_UE_stats *eNB_UE_stats = RC.eNB[Mod_id][CC_id].eNB_UE_stats;
......@@ -350,7 +373,7 @@ void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
init_prach_tables(839);
compute_prach_seq(&fp->prach_config_common,fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u);
RC.eNB[Mod_id][CC_id]->X_u);
fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon.deltaPUCCH_Shift;
fp->pucch_config_common.nRB_CQI = radioResourceConfigCommon->pucch_ConfigCommon.nRB_CQI;
......@@ -392,15 +415,15 @@ void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
fp->soundingrs_ul_config_common.enabled_flag = 0;
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) {
fp->soundingrs_ul_config_common.enabled_flag = 1;
fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
fp->soundingrs_ul_config_common.enabled_flag = 1;
fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
fp->soundingrs_ul_config_common.srs_MaxUpPts = 1;
else
fp->soundingrs_ul_config_common.srs_MaxUpPts = 0;
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
fp->soundingrs_ul_config_common.srs_MaxUpPts = 1;
else
fp->soundingrs_ul_config_common.srs_MaxUpPts = 0;
}
......@@ -428,34 +451,34 @@ void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
// MBSFN
if (mbsfn_SubframeConfigList != NULL) {
fp->num_MBSFN_config = mbsfn_SubframeConfigList->list.count;
for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
fp->MBSFN_config[i].radioframeAllocationPeriod = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod;
fp->MBSFN_config[i].radioframeAllocationOffset = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset;
if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
fp->MBSFN_config[i].fourFrames_flag = 0;
fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
fp->MBSFN_config[i].mbsfn_SubframeConfig);
} else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
fp->MBSFN_config[i].fourFrames_flag = 1;
fp->MBSFN_config[i].mbsfn_SubframeConfig =
mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]|
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16);
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
fp->MBSFN_config[i].mbsfn_SubframeConfig);
}
}
fp->num_MBSFN_config = mbsfn_SubframeConfigList->list.count;
for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
fp->MBSFN_config[i].radioframeAllocationPeriod = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod;
fp->MBSFN_config[i].radioframeAllocationOffset = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset;
if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
fp->MBSFN_config[i].fourFrames_flag = 0;
fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
fp->MBSFN_config[i].mbsfn_SubframeConfig);
} else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
fp->MBSFN_config[i].fourFrames_flag = 1;
fp->MBSFN_config[i].mbsfn_SubframeConfig =
mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]|
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16);
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
fp->MBSFN_config[i].mbsfn_SubframeConfig);
}
}
} else
fp->num_MBSFN_config = 0;
fp->num_MBSFN_config = 0;
//
}
}
*/
void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
......@@ -855,7 +878,7 @@ void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, Mobility
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
LOG_I(PHY,"SET C-RNTI %x %x\n",PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti,
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti);
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti);
}
if(ho_failed) {
......@@ -884,67 +907,67 @@ void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n
}
/*
void phy_config_dedicated_eNB(uint8_t Mod_id,
int CC_id,
uint16_t rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated)
{
void phy_config_dedicated_eNB(uint8_t Mod_id,
int CC_id,
uint16_t rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated)
{
PHY_VARS_eNB *eNB = RC.eNB[Mod_id][CC_id];
int8_t UE_id = find_ue(rnti,eNB);
int i;
if (UE_id == -1) {
LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id);
return;
LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id);
return;
}
if (physicalConfigDedicated) {
eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated;
LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
if (physicalConfigDedicated->antennaInfo) {
switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
case AntennaInfoDedicated__transmissionMode_tm1:
eNB->transmission_mode[UE_id] = 1;
break;
case AntennaInfoDedicated__transmissionMode_tm2:
eNB->transmission_mode[UE_id] = 2;
break;
case AntennaInfoDedicated__transmissionMode_tm3:
eNB->transmission_mode[UE_id] = 3;
break;
case AntennaInfoDedicated__transmissionMode_tm4:
eNB->transmission_mode[UE_id] = 4;
break;
case AntennaInfoDedicated__transmissionMode_tm5:
eNB->transmission_mode[UE_id] = 5;
break;
case AntennaInfoDedicated__transmissionMode_tm6:
eNB->transmission_mode[UE_id] = 6;
break;
case AntennaInfoDedicated__transmissionMode_tm7:
lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],eNB->frame_parms.Nid_cell,rnti);
for (i=0;i<eNB->num_RU;i++) eNB->RU_list[i]->do_precoding=1;
eNB->transmission_mode[UE_id] = 7;
break;
default:
LOG_E(PHY,"Unknown transmission mode!\n");
break;
}
LOG_I(PHY,"Transmission Mode (phy_config_dedicated_eNB) %d\n",eNB->transmission_mode[UE_id]);
eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated;
LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
if (physicalConfigDedicated->antennaInfo) {
switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
case AntennaInfoDedicated__transmissionMode_tm1:
eNB->transmission_mode[UE_id] = 1;
break;
case AntennaInfoDedicated__transmissionMode_tm2:
eNB->transmission_mode[UE_id] = 2;
break;
case AntennaInfoDedicated__transmissionMode_tm3:
eNB->transmission_mode[UE_id] = 3;
break;
case AntennaInfoDedicated__transmissionMode_tm4:
eNB->transmission_mode[UE_id] = 4;
break;
case AntennaInfoDedicated__transmissionMode_tm5:
eNB->transmission_mode[UE_id] = 5;
break;
case AntennaInfoDedicated__transmissionMode_tm6:
eNB->transmission_mode[UE_id] = 6;
break;
case AntennaInfoDedicated__transmissionMode_tm7:
lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],eNB->frame_parms.Nid_cell,rnti);
for (i=0;i<eNB->num_RU;i++) eNB->RU_list[i]->do_precoding=1;
eNB->transmission_mode[UE_id] = 7;
break;
default:
LOG_E(PHY,"Unknown transmission mode!\n");
break;
}
LOG_I(PHY,"Transmission Mode (phy_config_dedicated_eNB) %d\n",eNB->transmission_mode[UE_id]);
} else {
LOG_D(PHY,"[eNB %d] : Received NULL radioResourceConfigDedicated->antennaInfo from eNB %d\n",Mod_id,UE_id);
}
} else {
LOG_D(PHY,"[eNB %d] : Received NULL radioResourceConfigDedicated->antennaInfo from eNB %d\n",Mod_id,UE_id);
}
} else {
LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
return;
LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
return;
}
}
}
*/
#if defined(Rel10) || defined(Rel14)
......@@ -956,11 +979,11 @@ void phy_config_dedicated_scell_ue(uint8_t Mod_id,
}
/*
void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
uint16_t rnti,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id)
{
void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
uint16_t rnti,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id)
{
uint8_t UE_id = find_ue(rnti,RC.eNB[Mod_id][0]);
......@@ -971,37 +994,37 @@ void phy_config_dedicated_scell_ue(uint8_t Mod_id,
uint32_t carrier_freq_local;
if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) {
carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,
//eNB->frame
0,
CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,
//eNB->frame
0,
CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
} else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) {
carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1
// this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,
//eNB->frame
0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1
// this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,
//eNB->frame
0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
} else {
LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %ld of SCell %d for UE %d not supported\n",Mod_id,
//eNB->frame
0,dl_CarrierFreq_r10,CC_id,UE_id);
LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %ld of SCell %d for UE %d not supported\n",Mod_id,
//eNB->frame
0,dl_CarrierFreq_r10,CC_id,UE_id);
}
if (physicalConfigDedicatedSCell_r10) {
//#warning " eNB->physicalConfigDedicatedSCell_r10 does not exist in eNB"
// eNB->physicalConfigDedicatedSCell_r10[UE_id] = physicalConfigDedicatedSCell_r10;
LOG_I(PHY,"[eNB %d] Frame %d: Configured phyConfigDedicatedSCell with CC_id %d for UE %d\n",Mod_id,
//eNB->frame
0,CC_id,UE_id);
//#warning " eNB->physicalConfigDedicatedSCell_r10 does not exist in eNB"
// eNB->physicalConfigDedicatedSCell_r10[UE_id] = physicalConfigDedicatedSCell_r10;
LOG_I(PHY,"[eNB %d] Frame %d: Configured phyConfigDedicatedSCell with CC_id %d for UE %d\n",Mod_id,
//eNB->frame
0,CC_id,UE_id);
} else {
LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated (CC_id %d, UE %d)\n",Mod_id,
//eNB->frame
0,CC_id,UE_id);
return;
LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated (CC_id %d, UE %d)\n",Mod_id,
//eNB->frame
0,CC_id,UE_id);
return;
}
}
}
*/
#endif
......@@ -1178,7 +1201,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
}
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) {
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) {
// configure PUCCH CQI reporting
// configure PUCCH CQI reporting
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex)
......@@ -1221,12 +1244,12 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
}
//phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
else
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
}
......@@ -1690,7 +1713,7 @@ int phy_init_RU(RU_t *ru) {
ru->common.txdata[i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes)\n",i,ru->common.txdata[i],
fp->samples_per_tti*10*sizeof(int32_t));
fp->samples_per_tti*10*sizeof(int32_t));
}
for (i=0;i<ru->nb_rx;i++) {
......@@ -1747,9 +1770,13 @@ int phy_init_RU(RU_t *ru) {
AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
LOG_E(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
for (i=0; i<RC.nb_L1_inst; i++) {
for (p=0;p<15;p++) {
LOG_D(PHY,"[INIT] %s() nb_antenna_ports_eNB:%d \n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB);
if (p<ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p==5) {
LOG_D(PHY,"[INIT] %s() DO BEAM WEIGHTS nb_antenna_ports_eNB:%d nb_tx:%d\n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB, ru->nb_tx);
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
for (j=0; j<ru->nb_tx; j++) {
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
......@@ -1758,15 +1785,20 @@ int phy_init_RU(RU_t *ru) {
// antenna ports 5-14 are mapped on all antennas
if (((p<4) && (p==j)) || ((p==4) && (j==0))) {
for (re=0; re<fp->ofdm_symbol_size; re++)
{
ru->beam_weights[i][p][j][re] = 0x00007fff;
//LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]);
}
}
else if (p>4) {
for (re=0; re<fp->ofdm_symbol_size; re++)
{
ru->beam_weights[i][p][j][re] = 0x00007fff/ru->nb_tx;
//LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]);
}
}
LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d] = %p (%lu bytes)\n",
i,j,ru->beam_weights[i][p][j],
fp->ofdm_symbol_size*sizeof(int32_t));
//LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d] = %p (%lu bytes)\n", i,j,ru->beam_weights[i][p][j], fp->ofdm_symbol_size*sizeof(int32_t));
}
}
}
......@@ -1793,6 +1825,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
#endif
int i, UE_id;
LOG_I(PHY,"[eNB %d] %s() About to wait for eNB to be configured", eNB->Mod_id, __FUNCTION__);
eNB->total_dlsch_bitrate = 0;
eNB->total_transmitted_bits = 0;
......@@ -1801,10 +1834,18 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
while(eNB->configured == 0) usleep(10000);
LOG_I(PHY,"[eNB %"PRIu8"] Initializing DL_FRAME_PARMS : N_RB_DL %"PRIu8", PHICH Resource %d, PHICH Duration %d\n",
LOG_I(PHY,"[eNB %"PRIu8"] Initializing DL_FRAME_PARMS : N_RB_DL %"PRIu8", PHICH Resource %d, PHICH Duration %d nb_antennas_tx:%u nb_antennas_rx:%u nb_antenna_ports_eNB:%u PRACH[rootSequenceIndex:%u prach_Config_enabled:%u configIndex:%u highSpeed:%u zeroCorrelationZoneConfig:%u freqOffset:%u]\n",
eNB->Mod_id,
fp->N_RB_DL,fp->phich_config_common.phich_resource,
fp->phich_config_common.phich_duration);
fp->phich_config_common.phich_duration,
fp->nb_antennas_tx, fp->nb_antennas_rx, fp->nb_antenna_ports_eNB,
fp->prach_config_common.rootSequenceIndex,
fp->prach_config_common.prach_Config_enabled,
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset
);
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_eNB][MOD %02"PRIu8"][]\n", eNB->Mod_id);
......@@ -1831,6 +1872,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
common_vars->txdataF = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t*));
common_vars->rxdataF = (int32_t **)malloc16(64*sizeof(int32_t*));
LOG_D(PHY,"[INIT] NB_ANTENNA_PORTS_ENB:%d fp->nb_antenna_ports_eNB:%d\n", NB_ANTENNA_PORTS_ENB, fp->nb_antenna_ports_eNB);
for (i=0; i<NB_ANTENNA_PORTS_ENB; i++) {
if (i<fp->nb_antenna_ports_eNB || i==5) {
common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
......@@ -1883,12 +1926,12 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
#endif
/* number of elements of an array X is computed as sizeof(X) / sizeof(X[0])
AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->rxsigF) / sizeof(prach_vars->rxsigF[0]),
"nb_antennas_rx too large");
for (i=0; i<fp->nb_antennas_rx; i++) {
prach_vars->rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]);
}*/
AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->rxsigF) / sizeof(prach_vars->rxsigF[0]),
"nb_antennas_rx too large");
for (i=0; i<fp->nb_antennas_rx; i++) {
prach_vars->rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]);
}*/
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
......@@ -1916,7 +1959,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
pusch_vars[UE_id]->ul_ch_mag[i] = (int32_t*)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t*)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
}
}
pusch_vars[UE_id]->llr = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
} //UE_id
......@@ -1931,3 +1974,9 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
return (0);
}
void install_schedule_handlers(IF_Module_t *if_inst)
{
if_inst->PHY_config_req = phy_config_request;
if_inst->schedule_response = schedule_response;
}
......@@ -2216,6 +2216,11 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
int Msymb2;
int split_flag=0;
if (num_dci>0)
{
LOG_D(PHY,"%s(num_pdcch_symbols:%d num_dci:%d dci_alloc:%p n_rnti:%04x amp:%d frame_parms:%p txdataF:%p subframe:%d)\n", __FUNCTION__, num_pdcch_symbols, num_dci, dci_alloc, n_rnti, amp, frame_parms, txdataF, subframe);
}
switch (frame_parms->N_RB_DL) {
case 100:
Msymb2 = Msymb;
......@@ -2300,7 +2305,9 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
}
// Scrambling
// printf("pdcch scrambling\n");
#ifdef DEBUG_DCI_ENCODING
printf("pdcch scrambling\n");
#endif
pdcch_scrambling(frame_parms,
subframe,
e,
......@@ -2384,6 +2391,18 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
// printf("DCI (SF %d) : txdataF %p (0 %p)\n",subframe,&txdataF[0][512*14*subframe],&txdataF[0][0]);
#ifdef DEBUG_DCI_ENCODING
printf("kprime loop - N_RB_DL:%d lprime:num_pdcch_symbols:%d Ncp:%d pcfich:%02x,%02x,%02x,%02x ofdm_symbol_size:%d first_carrier_offset:%d nb_antenna_ports_eNB:%d\n",
frame_parms->N_RB_DL, num_pdcch_symbols,frame_parms->Ncp,
frame_parms->pcfich_reg[0],
frame_parms->pcfich_reg[1],
frame_parms->pcfich_reg[2],
frame_parms->pcfich_reg[3],
frame_parms->ofdm_symbol_size,
frame_parms->first_carrier_offset,
frame_parms->nb_antenna_ports_eNB
);
#endif
for (kprime=0; kprime<frame_parms->N_RB_DL*12; kprime++) {
for (lprime=0; lprime<num_pdcch_symbols; lprime++) {
......
......@@ -801,6 +801,28 @@ void generate_RIV_tables()
// n_tilde_PRB(0,1) = (0,2)
void check_dlsch(char *file, int line)
{
PHY_VARS_eNB *eNB = RC.eNB[0][0];
static char oldbuf[13*NUMBER_OF_UE_MAX+100]="";
char buf[13*NUMBER_OF_UE_MAX+100];
char *pbuf=buf;
for (int i=0; i<NUMBER_OF_UE_MAX; i++) {
pbuf+=sprintf(pbuf, "[%02d]:%02x:%04x ", i, eNB->dlsch[i][0]->harq_mask, eNB->dlsch[i][0]->rnti);
}
int diff_size = memcmp(oldbuf, buf, strlen(buf));
if (diff_size!=0)
{
LOG_I(PHY,"check_dlsch:%s:%d:%s\n", file, line, buf);
LOG_I(PHY,"check_dlsch:%s:%d:%s\n", file, line, oldbuf);
}
memcpy(oldbuf, buf, sizeof(buf));
}
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
{
uint8_t i;
......@@ -811,7 +833,7 @@ int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i);
AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i);
LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n",
rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
if ((eNB->dlsch[i][0]->harq_mask >0) &&
(eNB->dlsch[i][0]->rnti==rnti)) return i;
else if ((eNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
......@@ -2456,10 +2478,10 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
ulsch->harq_processes[harq_pid]->dci_alloc = 1;
ulsch->harq_processes[harq_pid]->rar_alloc = 0;
ulsch->harq_processes[harq_pid]->n_DMRS = ulsch_pdu->ulsch_pdu_rel8.cyclic_shift_2_for_drms;
ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1);
ulsch->harq_processes[harq_pid]->srs_active = use_srs;
//Mapping of cyclic shift field in DCI format0 to n_DMRS2 (3GPP 36.211, Table 5.5.2.1.1-1)
if(ulsch->harq_processes[harq_pid]->n_DMRS == 0)
ulsch->harq_processes[harq_pid]->n_DMRS2 = 0;
......@@ -2477,23 +2499,23 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
ulsch->harq_processes[harq_pid]->n_DMRS2 = 10;
else if(ulsch->harq_processes[harq_pid]->n_DMRS == 7)
ulsch->harq_processes[harq_pid]->n_DMRS2 = 9;
LOG_D(PHY,"[eNB %d][PUSCH %d] Programming PUSCH with n_DMRS2 %d (cshift %d) for Frame %d, Subframe %d\n",
eNB->Mod_id,harq_pid,ulsch->harq_processes[harq_pid]->n_DMRS2,ulsch->harq_processes[harq_pid]->n_DMRS,
frame,subframe);
ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version;
ulsch->harq_processes[harq_pid]->Qm = ulsch_pdu->ulsch_pdu_rel8.modulation_type;
// Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be
// Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be
ulsch->harq_processes[harq_pid]->O_ACK = 0;
if ((ulsch->harq_processes[harq_pid]->status == SCH_IDLE) ||
(ulsch->harq_processes[harq_pid]->ndi != ulsch_pdu->ulsch_pdu_rel8.new_data_indication) ||
(new_ulsch == TRUE)){
ulsch->harq_processes[harq_pid]->status = ACTIVE;
ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3;
ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->harq_processes[harq_pid]->Nsymb_pusch;
ulsch->harq_processes[harq_pid]->round = 0;
......@@ -2503,7 +2525,7 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
// will be set if MAC has activated ULSCH_CQI_RI_PDU or ULSCH_CQI_HARQ_RI_PDU
ulsch->harq_processes[harq_pid]->Or1 = 0;
ulsch->harq_processes[harq_pid]->Or2 = 0;
}
}
else ulsch->harq_processes[harq_pid]->round++;
ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti;
......@@ -2519,7 +2541,7 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
ulsch->harq_processes[harq_pid]->rvidx,
ulsch->harq_processes[harq_pid]->Qm,
ulsch->harq_processes[harq_pid]->TBS,
ulsch->harq_processes[harq_pid]->round);
ulsch->harq_processes[harq_pid]->round);
}
int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
......@@ -2607,7 +2629,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
break;
case 25:
LOG_D(PHY,"DCI format0 (FDD, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n",
LOG_I(PHY,"DCI format0 (FDD, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n",
dci->rnti,
((uint32_t*)&dci->dci_pdu[0])[0],
((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->hopping,
......
......@@ -38,7 +38,7 @@
#include "defs.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_DLSCH_MODULATION
//#define DEBUG_DLSCH_MODULATION 1
//#define is_not_pilot(pilots,re,nushift,use2ndpilots) ((pilots==0) || ((re!=nushift) && (re!=nushift+6)&&((re!=nushift+3)||(use2ndpilots==1))&&((re!=nushift+9)||(use2ndpilots==1)))?1:0)
......@@ -78,7 +78,7 @@ uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp,
if ((re!=nushift+offset) && (re!=((nushift+4+offset)%12)) && (re!=((nushift+8+offset)%12)))
return(1);
/*else{
printf("(is_no_UEspec_RS):lprime=%d, re=%d, nushift=%d, offset=%d\n",lprime, re,nushift,offset);
LOG_I(PHY,"(is_no_UEspec_RS):lprime=%d, re=%d, nushift=%d, offset=%d\n",lprime, re,nushift,offset);
}*/
} else {
if ((re!=nushift+offset) && (re!=((nushift+3+offset)%12)) && (re!=((nushift+6+offset)%12)) && (re!=((nushift+9+offset)%12)))
......@@ -270,7 +270,7 @@ int allocate_REs_in_RB_pilots_16QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
if (skip_dc == 0) {
// printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
// LOG_I(PHY,"pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<12;
x0p+=4) {
......@@ -281,7 +281,7 @@ int allocate_REs_in_RB_pilots_16QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
qam16_table_offset_im+=x0p[3];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
// printf("pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
// LOG_I(PHY,"pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
......@@ -497,7 +497,7 @@ int allocate_REs_in_RB_pilots_64QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
if (skip_dc == 0) {
// printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
// LOG_I(PHY,"pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<12;
x0p+=6) {
......@@ -510,7 +510,7 @@ int allocate_REs_in_RB_pilots_64QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
qam64_table_offset_im+=x0p[5];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
// printf("pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
// LOG_I(PHY,"pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
......@@ -667,11 +667,11 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
if (dlsch0_harq != NULL){
#ifdef DEBUG_DLSCH_MODULATION
printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
LOG_I(PHY,"allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
#endif
} else{
#ifdef DEBUG_DLSCH_MODULATION
printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
LOG_I(PHY,"allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
#endif
}
......@@ -685,7 +685,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
for (re=first_re; re<last_re; re++) {
// printf("element %d precoder_index for allocation %d\n",re, precoder_index );
// LOG_I(PHY,"element %d precoder_index for allocation %d\n",re, precoder_index );
if ((skip_dc == 1) && (re==6))
re_off=re_off - frame_parms->ofdm_symbol_size+1;
......@@ -695,7 +695,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
//check that RE is not from Cell-specific RS
if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==1) {
//printf("re %d (jj %d)\n",re,*jj);
//LOG_I(PHY,"re %d (jj %d)\n",re,*jj);
if (mimo_mode == SISO) { //SISO mapping
......@@ -705,7 +705,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
case 2: //QPSK
//printf("re %d %d(%d) : %d,%d => ",re,tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//LOG_I(PHY,"re %d %d(%d) : %d,%d => ",re,tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
((int16_t*)&txdataF[0][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
*jj = *jj + 1;
......@@ -971,12 +971,12 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
break;
case 2: //QPSK
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//LOG_I(PHY,"%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx0_re = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
xx0_im = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//LOG_I(PHY,"%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -1042,12 +1042,12 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
break;
case 2: //QPSK
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//LOG_I(PHY,"%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//LOG_I(PHY,"%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -1114,7 +1114,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
((int16_t *)&txdataF[0][tti_offset])[1]+=((xx0_im+xx1_im)>>1);
((int16_t *)&txdataF[1][tti_offset])[1]+=(s*((xx0_im-xx1_im)>>1));
/*
printf("CDD: xx0 (%d,%d), xx1(%d,%d), s(%d), txF[0] (%d,%d), txF[1] (%d,%d)\n",
LOG_I(PHY,"CDD: xx0 (%d,%d), xx1(%d,%d), s(%d), txF[0] (%d,%d), txF[1] (%d,%d)\n",
xx0_re,xx0_im,xx1_re,xx1_im, s, ((int16_t *)&txdataF[0][tti_offset])[0],((int16_t *)&txdataF[0][tti_offset])[1],
((int16_t *)&txdataF[1][tti_offset])[0],((int16_t *)&txdataF[1][tti_offset])[1]);
*/
......@@ -1244,7 +1244,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
precoder_index1 = 3; //[1 -j]
}
else {
printf("problem with precoder in TM4\n");
LOG_I(PHY,"problem with precoder in TM4\n");
return(-1);
}
......@@ -1263,7 +1263,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//LOG_I(PHY,"%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
if (frame_parms->nb_antenna_ports_eNB == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
......@@ -1466,7 +1466,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
((int16_t*)&txdataF[5][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
//printf("%d(%d) : %d,%d =>
//LOG_I(PHY,"%d(%d) : %d,%d =>
//",tti_offset,*jj,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]);
break;
......@@ -1545,7 +1545,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
}
} else {
//precoding UE spec RS
//printf("precoding UE spec RS\n");
//LOG_I(PHY,"precoding UE spec RS\n");
ind = 3*lprime*dlsch0_harq->nb_rb+mprime2;
ind_dword = ind>>4;
......@@ -1563,7 +1563,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
switch (mod_order0) {
case 2: //QPSK
// printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
// LOG_I(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (int layer=first_layer0; layer<=(first_layer0+Nlayers0); layer++) {
((int16_t*)&txdataF[layer][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
*jj = *jj + 1;
......@@ -1651,7 +1651,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
}
}
} else if (mimo_mode>=TM9_10) {
printf("allocate_REs_in_RB() [dlsch.c] : ERROR, unknown mimo_mode %d\n",mimo_mode);
LOG_I(PHY,"allocate_REs_in_RB() [dlsch.c] : ERROR, unknown mimo_mode %d\n",mimo_mode);
return(-1);
}
}
......@@ -1686,7 +1686,7 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
uint8_t first_re,last_re;
int inc;
#ifdef DEBUG_DLSCH_MODULATION
printf("allocate_re_MCH (mod %d): symbol_offset %d re_offset %d (%d), jj %d -> %d,%d, gain_lin_QPSK %d,txdataF %p\n",mod_order,symbol_offset,re_offset,skip_dc,*jj, x0[*jj], x0[1+*jj],gain_lin_QPSK,&txdataF[0][symbol_offset]);
LOG_I(PHY,"allocate_re_MCH (mod %d): symbol_offset %d re_offset %d (%d), jj %d -> %d,%d, gain_lin_QPSK %d,txdataF %p\n",mod_order,symbol_offset,re_offset,skip_dc,*jj, x0[*jj], x0[1+*jj],gain_lin_QPSK,&txdataF[0][symbol_offset]);
#endif
last_re=12;
......@@ -1707,7 +1707,7 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
tti_offset = symbol_offset + re_off + re;
//printf("re %d (jj %d)\n",re,*jj);
//LOG_I(PHY,"re %d (jj %d)\n",re,*jj);
*re_allocated = *re_allocated + 1;
......@@ -1715,7 +1715,7 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
case 2: //QPSK
// printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
// LOG_I(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
((int16_t*)&txdataF[4][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
*jj = *jj + 1;
......@@ -1724,7 +1724,7 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
*jj = *jj + 1;
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//LOG_I(PHY,"%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
......@@ -1931,7 +1931,7 @@ inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms
inline int check_skiphalf(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms,int l,int nsymb) __attribute__((always_inline));
inline int check_skiphalf(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms,int l,int nsymb) {
// printf("check_skiphalf : rb %d, subframe_offset %d,l %d, nsymb %d\n",rb,subframe_offset,l,nsymb);
// LOG_I(PHY,"check_skiphalf : rb %d, subframe_offset %d,l %d, nsymb %d\n",rb,subframe_offset,l,nsymb);
if ((frame_parms->N_RB_DL&1) == 1) { // ODD N_RB_DL
......@@ -2154,19 +2154,19 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
re_allocated=0;
// printf("num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
// LOG_I(PHY,"num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
for (l=num_pdcch_symbols; l<nsymb; l++) {
if (dlsch0 != NULL ) {
#ifdef DEBUG_DLSCH_MODULATION
printf("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n",
LOG_I(PHY,"Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d)\n",
harq_pid,
dlsch0_harq->mimo_mode,
pmi2hex_2Ar2(dlsch0_harq->pmi_alloc),
mod_order0,
mod_order1,
rb_alloc[0],
len);
rb_alloc[0]
);
#endif
}
......@@ -2216,6 +2216,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
for (eNB_id=0;eNB_id<ru->num_eNB;eNB_id++){
if (phy_vars_eNB == ru->eNB_list[eNB_id]) {
for (aa=0;aa<ru->nb_tx;aa++){
LOG_I(PHY,"ru_id:%d eNB_id:%d aa:%d memcpy(ru->beam_weights, dlsch0->ue_spec_bf_weights[ru_id][0],)\n", ru_id, eNB_id, aa);
memcpy(ru->beam_weights[eNB_id][5][aa],
dlsch0->ue_spec_bf_weights[ru_id][0],
frame_parms->ofdm_symbol_size*sizeof(int32_t));
......@@ -2233,7 +2234,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
if (pilots>0) { // compute pilot arrays, could be done statically if performance suffers
if (frame_parms->nb_antenna_ports_eNB == 1) {
// printf("l %d, nushift %d, offset %d\n",l,frame_parms->nushift,offset);
// LOG_I(PHY,"l %d, nushift %d, offset %d\n",l,frame_parms->nushift,offset);
for (i=0,i2=0;i<12;i++) {
if ((i!=(frame_parms->nushift+offset)) && (i!=((frame_parms->nushift+6+offset)%12)))
P1_SHIFT[i2++]=1;
......@@ -2340,7 +2341,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
//for (aa=0;aa<frame_parms->nb_antennas_tx;aa++)
//memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2);
//printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots);
//LOG_I(PHY,"symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots);
for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
if (rb < 32)
......@@ -2371,7 +2372,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
if (dlsch1) {
if (dlsch1_harq->Nlayers>1) {
printf("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
LOG_I(PHY,"Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
return(-1);
}
}
......@@ -2379,7 +2380,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
if (rb_alloc_ind > 0) {
// printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj);
// LOG_I(PHY,"Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj);
if (dlsch0 != NULL) {
get_pmi_temp = get_pmi(frame_parms->N_RB_DL,
......@@ -2419,7 +2420,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
mprime +=3+frame_parms->Ncp;
}
else {
// printf("Unallocated rb %d/symbol %d, re_offset %d, jj %d\n",rb,l,re_offset,jj);
// LOG_I(PHY,"Unallocated rb %d/symbol %d, re_offset %d, jj %d\n",rb,l,re_offset,jj);
}
re_offset+=12; // go to next RB
......@@ -2436,9 +2437,9 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
#ifdef DEBUG_DLSCH_MODULATION
if (dlsch0 != NULL){
printf("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset));
LOG_I(PHY,"generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset,1));
}else{
printf("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch1_harq->nb_rb,dlsch1_harq->rb_alloc,mod_order1,Nl1,2,0,subframe_offset));
LOG_I(PHY,"generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch1_harq->nb_rb,dlsch1_harq->rb_alloc,mod_order1,Nl1,2,0,subframe_offset,1));
}
#endif
......@@ -2493,7 +2494,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
jj = jj + 1;
//printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
//LOG_I(PHY,"recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
i++;
break;
......@@ -2580,7 +2581,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
#ifdef DEBUG_DLSCH_MODULATION
printf("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset,1/*transmission mode*/));
LOG_I(PHY,"generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset,1/*transmission mode*/));
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT);
......@@ -2618,11 +2619,11 @@ int mch_modulation(int32_t **txdataF,
jj=0;
re_allocated=0;
// printf("num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
// LOG_I(PHY,"num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
for (l=2; l<nsymb_pmch; l++) {
#ifdef DEBUG_DLSCH_MODULATION
printf("Generating MCH (mod %d) in subframe %d for symbol %d\n",mod_order, subframe_offset,l);
LOG_I(PHY,"Generating MCH (mod %d) in subframe %d for symbol %d\n",mod_order, subframe_offset,l);
#endif
re_offset = frame_parms->first_carrier_offset;
......@@ -2647,7 +2648,7 @@ int mch_modulation(int32_t **txdataF,
else
qam_table_s = NULL;
//printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
//LOG_I(PHY,"Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
allocate_REs_in_RB_MCH(txdataF,
&jj,
re_offset,
......@@ -2674,7 +2675,7 @@ int mch_modulation(int32_t **txdataF,
}
#ifdef DEBUG_DLSCH_MODULATION
printf("generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset,1/*transmission mode*/));
LOG_I(PHY,"generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset,1/*transmission mode*/));
#endif
return (re_allocated);
......
......@@ -174,6 +174,8 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
pbch_E = (frame_parms->Ncp==NORMAL) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
// pbch_E_bytes = pbch_coded_bits>>3;
//LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4==0);
if (frame_mod4==0) {
bzero(pbch_a,PBCH_A>>3);
bzero(eNB_pbch->pbch_e,pbch_E);
......
......@@ -39,6 +39,7 @@
#include "UTIL/LOG/vcd_signal_dumper.h"
//#define PRACH_DEBUG 1
//#define PRACH_WRITE_OUTPUT_DEBUG 1
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case
......@@ -562,7 +563,7 @@ int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
#ifdef PRACH_DEBUG
LOG_D(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
prach_ConfigIndex,
subframe,
t0_ra,t1_ra,t2_ra);
......@@ -655,7 +656,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#else //normal case (simulation)
prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset;
LOG_D(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start,
ue->rx_offset,
ue->hw_timing_advance,
......@@ -723,7 +724,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
} else { // This is the high-speed case
#ifdef PRACH_DEBUG
LOG_D(PHY,"[UE %d] High-speed mode, NCS_config %d\n",ue->Mod_id,Ncs_config);
LOG_I(PHY,"[UE %d] High-speed mode, NCS_config %d\n",ue->Mod_id,Ncs_config);
#endif
not_found = 1;
......@@ -784,7 +785,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#ifdef PRACH_DEBUG
if (NCS>0)
LOG_D(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n",
LOG_I(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n",
rootSequenceIndex,preamble_index,NCS,Ncs_config,N_ZC/NCS,n_ra_prb,
preamble_offset,preamble_shift);
......@@ -1039,14 +1040,14 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
break;
}
//LOG_D(PHY,"prach_len=%d\n",prach_len);
//LOG_I(PHY,"prach_len=%d\n",prach_len);
AssertFatal(prach_fmt<4,
"prach_fmt4 not fully implemented" );
#if defined(EXMIMO) || defined(OAI_USRP)
int j;
int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti;
LOG_D( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) {
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
......@@ -1079,7 +1080,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#if 0
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
......@@ -1114,7 +1115,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint8_t restricted_set;
uint8_t n_ra_prb;
#ifdef PRACH_DEBUG
int frame;
#endif
int subframe;
int16_t *prachF=NULL;
int16_t **rxsigF=NULL;
......@@ -1131,7 +1134,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint16_t numshift=0;
uint16_t *prach_root_sequence_map;
uint8_t not_found;
int k;
int k=0;
uint16_t u;
int16_t *Xu;
uint16_t offset;
......@@ -1148,10 +1151,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
#ifdef Rel14
int prach_ifft_cnt=0;
#endif
#ifdef PRACH_DEBUG
int en0=0;
#endif
int en;
int en=0;
if (ru) {
fp = &ru->frame_parms;
nb_rx = ru->nb_rx;
......@@ -1202,7 +1202,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
#ifdef Rel14
if (br_flag == 1) {
prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level];
#ifdef PRACH_DEBUG
frame = eNB->proc.frame_prach_br;
#endif
subframe = eNB->proc.subframe_prach_br;
prachF = eNB->prach_vars_br.prachF;
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
......@@ -1219,19 +1221,23 @@ void rx_prach0(PHY_VARS_eNB *eNB,
#endif
{
prach_ifftp = eNB->prach_vars.prach_ifft[0];
#ifdef PRACH_DEBUG
frame = eNB->proc.frame_prach;
#endif
subframe = eNB->proc.subframe_prach;
prachF = eNB->prach_vars.prachF;
rxsigF = eNB->prach_vars.rxsigF[0];
#ifdef PRACH_DEBUG
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n",
subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
//if ((frame&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
#endif
}
}
else {
#ifdef Rel14
if (br_flag == 1) {
#ifdef PRACH_DEBUG
frame = ru->proc.frame_prach_br;
#endif
subframe = ru->proc.subframe_prach_br;
rxsigF = ru->prach_rxsigF_br[ce_level];
#ifdef PRACH_DEBUG
......@@ -1242,6 +1248,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
else
#endif
{
#ifdef PRACH_DEBUG
frame = ru->proc.frame_prach;
#endif
subframe = ru->proc.subframe_prach;
rxsigF = ru->prach_rxsigF;
#ifdef PRACH_DEBUG
......@@ -1256,9 +1265,32 @@ void rx_prach0(PHY_VARS_eNB *eNB,
for (aa=0; aa<nb_rx; aa++) {
if (ru->if_south == LOCAL_RF) { // set the time-domain signal if we have to use it in this node
// DJP - indexing below in subframe zero takes us off the beginning of the array???
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
#ifdef PRACH_DEBUG
if ((frame&1023) < 20) LOG_I(PHY,"RU %d, br_flag %d ce_level %d frame %d subframe %d, : prach %p (energy %d)\n",ru->idx,br_flag,ce_level,frame,subframe,prach[aa],dB_fixed(en0=signal_energy(prach[aa],fp->samples_per_tti)));
int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
int8_t dbEn0 = dB_fixed(en0);
int8_t rach_dBm = dbEn0 - eNB->rx_total_gain_dB;
#ifdef PRACH_WRITE_OUTPUT_DEBUG
if (dbEn0>32 && prach[0]!= NULL)
{
static int counter=0;
char buffer[80];
//counter++;
sprintf(buffer, "%s%d", "/tmp/prach_rx",counter);
write_output(buffer,"prach_rx",prach[0],fp->samples_per_tti,1,13);
}
#endif
if (dbEn0>32)
{
#ifdef PRACH_WRITE_OUTPUT_DEBUG
if (prach[0]!= NULL) write_output("prach_rx","prach_rx",prach[0],fp->samples_per_tti,1,1);
#endif
LOG_I(PHY,"RU %d, br_flag %d ce_level %d frame %d subframe %d per_tti:%d prach:%p (energy %d) TA:%d rach_dBm:%d rxdata:%p index:%d\n",ru->idx,br_flag,ce_level,frame,subframe,fp->samples_per_tti,prach[aa],dbEn0,ru->N_TA_offset,rach_dBm,ru->common.rxdata[aa], (subframe*fp->samples_per_tti)-ru->N_TA_offset);
}
#endif
}
}
......@@ -1341,7 +1373,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
if (((eNB!=NULL) && (ru->function != NGFI_RAU_IF4p5))||
((eNB==NULL) && (ru->function == NGFI_RRU_IF4p5))) { // compute the DFTs of the PRACH temporal resources
// Do forward transform
LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d\n",fp->N_RB_UL);
#ifdef PRACH_DEBUG
LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d nb_rx:%d Ncp:%d\n",fp->N_RB_UL, nb_rx, Ncp);
#endif
for (aa=0; aa<nb_rx; aa++) {
AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa);
prach2 = prach[aa] + (Ncp<<1);
......@@ -1446,7 +1480,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
k+=13;
k*=2;
int dftsize_x2 = fp->ofdm_symbol_size*24;
LOG_D(PHY,"Shifting prach_rxF from %d to 0\n",k);
//LOG_D(PHY,"Shifting prach_rxF from %d to 0\n",k);
if ((k+(839*2)) > dftsize_x2) { // PRACH signal is split around DC
memmove((void*)&rxsigF[aa][dftsize_x2-k],(void*)&rxsigF[aa][0],(k+(839*2)-dftsize_x2)*2);
......@@ -1476,6 +1510,8 @@ void rx_prach0(PHY_VARS_eNB *eNB,
#ifdef PRACH_DEBUG
if ((en > 60)&&(br_flag==1)) LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
#endif
if (en > 60)
LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
}
......@@ -1621,7 +1657,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
}
memset(prachF, 0, sizeof(int16_t)*2*1024 );
#ifdef PRACH_DEBUG
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
if (prach[0]!= NULL) write_output("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
#endif
// write_output("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
......@@ -1655,7 +1691,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>15;
}
#ifdef PRACH_DEBUG
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
if (aa==0) write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
#endif
// if (aa=1) write_output("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
......@@ -1704,19 +1740,22 @@ void rx_prach0(PHY_VARS_eNB *eNB,
k*=2;
if (br_flag == 0) {
/*
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
write_output("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
write_output("Xu.m","xu",Xu,N_ZC,1,1);
write_output("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);*/
write_output("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);
#endif
}
else {
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
printf("Dumping prach (br_flag %d), k = %d (n_ra_prb %d)\n",br_flag,k,n_ra_prb);
write_output("rxsigF_br.m","prach_rxF_br",&rxsigF[0][0],12288,1,1);
write_output("prach_rxF_comp0_br.m","prach_rxF_comp0_br",prachF,1024,1,1);
write_output("Xu_br.m","xu_br",Xu,N_ZC,1,1);
write_output("prach_ifft0_br.m","prach_t0_br",prach_ifft,1024,1,1);
exit(-1);
#endif
}
}
......
......@@ -185,7 +185,7 @@ int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB,
LOG_D(PHY,"ulsch ra (eNB): harq_pid %d\n",harq_pid);
LOG_D(PHY,"ulsch ra (eNB): round %d\n",ulsch_harq->round);
LOG_D(PHY,"ulsch ra (eNB): TBS %d\n",ulsch_harq->TBS);
LOG_D(PHY,"ulsch ra (eNB): mcs %d\n",ulsch_harq->mcs);
LOG_D(PHY,"ulsch ra (eNB): mcs %d\n",ulsch_harq->Msc_initial);
LOG_D(PHY,"ulsch ra (eNB): Or1 %d\n",ulsch_harq->Or1);
LOG_D(PHY,"ulsch ra (eNB): ORI %d\n",ulsch_harq->O_RI);
#endif
......