Commit b7e147e5 authored by Aikaterini's avatar Aikaterini

Merge branch 'enhancement-74-SoDeRa' into develop

parents e439a593 1de3183d
...@@ -42,6 +42,10 @@ set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) ...@@ -42,6 +42,10 @@ set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
project (OpenAirInterface) project (OpenAirInterface)
add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms7002m lms7002m)
add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR lmsSDR)
add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/Si5351C Si5351C)
########################################### ###########################################
# macros to define options as there is numerous options in oai # macros to define options as there is numerous options in oai
################################################ ################################################
...@@ -159,7 +163,7 @@ set(CMAKE_C_FLAGS ...@@ -159,7 +163,7 @@ set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP" "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP"
) )
set(CMAKE_CXX_FLAGS set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR}" "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 "
) )
...@@ -172,6 +176,7 @@ add_definitions(-DCMAKER) ...@@ -172,6 +176,7 @@ add_definitions(-DCMAKER)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
Message("RF_BOARD is ${RF_BOARD}")
# Below has been put in comment because does not work with # Below has been put in comment because does not work with
# SVN authentication. # SVN authentication.
# #
...@@ -412,7 +417,7 @@ add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4 ...@@ -412,7 +417,7 @@ add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4
add_list1_option(NB_ANTENNAS_TX "2" "Number of antennas in transmission" "1" "2" "4") add_list1_option(NB_ANTENNAS_TX "2" "Number of antennas in transmission" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4") add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4")
add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW") add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR")
add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET") add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
...@@ -443,6 +448,13 @@ set(HWLIB_BLADERF_SOURCE ...@@ -443,6 +448,13 @@ set(HWLIB_BLADERF_SOURCE
) )
add_library(oai_bladerfdevif MODULE ${HWLIB_BLADERF_SOURCE} ) add_library(oai_bladerfdevif MODULE ${HWLIB_BLADERF_SOURCE} )
include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/")
set (option_HWLMSSDRLIB_lib "-l LMS_SDR -l LMS7002M -l Si5351C")
set(HWLIB_LMSSDR_SOURCE
${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
)
add_library(oai_lmssdrdevif MODULE ${HWLIB_LMSSDR_SOURCE} )
include_directories("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/") include_directories("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/")
set(TPLIB_ETHERNET_SOURCE set(TPLIB_ETHERNET_SOURCE
${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
...@@ -451,6 +463,7 @@ set(TPLIB_ETHERNET_SOURCE ...@@ -451,6 +463,7 @@ set(TPLIB_ETHERNET_SOURCE
) )
add_library(oai_eth_transpro MODULE ${TPLIB_ETHERNET_SOURCE} ) add_library(oai_eth_transpro MODULE ${TPLIB_ETHERNET_SOURCE} )
# RF devices / transport protocols settings # RF devices / transport protocols settings
###################################################################### ######################################################################
if (${RF_BOARD} STREQUAL "EXMIMO") if (${RF_BOARD} STREQUAL "EXMIMO")
...@@ -478,9 +491,25 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF") ...@@ -478,9 +491,25 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c ${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
) )
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu") LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
set(option_HW_lib "bladeRF -rdynamic -ldl") set(option_HW_lib "bladeRF -rdynamic -ldl")
#set(LOWLATENCY False)
elseif (${RF_BOARD} STREQUAL "CPRIGW") #to ask
elseif (${RF_BOARD} STREQUAL "OAI_LMSSDR")
include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB")
include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR")
include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms7002m")
include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/Si5351C")
include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR/LMS_StreamBoard")
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lmsSDR")
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lms7002m")
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/Si5351C")
set(HW_SOURCE ${HW_SOURCE} ${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp)
set(LOWLATENCY False)
set(option_HW_lib "-lLMS_SDR -lLMS7002M -lSi5351C -rdynamic -ldl")
elseif (${RF_BOARD} STREQUAL "CPRIGW")
set(HW_SOURCE ${HW_SOURCE} set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/CPRIGW/USERSPACE/LIB/cprigw_lib.c ${OPENAIR_TARGETS}/ARCH/CPRIGW/USERSPACE/LIB/cprigw_lib.c
) )
...@@ -1491,13 +1520,14 @@ add_executable(lte-softmodem ...@@ -1491,13 +1520,14 @@ add_executable(lte-softmodem
target_link_libraries (lte-softmodem target_link_libraries (lte-softmodem
-Wl,--start-group -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} 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}
-Wl,--end-group ) -Wl,--end-group )
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) 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 ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} )
target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES})
target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
# lte-softmodem-nos1 is both eNB and UE implementation # lte-softmodem-nos1 is both eNB and UE implementation
################################################### ###################################################
...@@ -1531,8 +1561,7 @@ target_link_libraries (lte-softmodem-nos1 ...@@ -1531,8 +1561,7 @@ target_link_libraries (lte-softmodem-nos1
target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} )
target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES})
# rrh # rrh
################################ ################################
...@@ -1546,7 +1575,6 @@ add_executable(rrh_gw ...@@ -1546,7 +1575,6 @@ add_executable(rrh_gw
${HW_SOURCE} ${HW_SOURCE}
${TRANSPORT_SOURCE} ${TRANSPORT_SOURCE}
) )
# assert
target_include_directories(rrh_gw PRIVATE ${OPENAIR_DIR}/common/utils/itti) target_include_directories(rrh_gw PRIVATE ${OPENAIR_DIR}/common/utils/itti)
target_link_libraries(rrh_gw target_link_libraries(rrh_gw
-Wl,--start-group -Wl,--start-group
...@@ -1554,12 +1582,21 @@ target_link_libraries(rrh_gw ...@@ -1554,12 +1582,21 @@ target_link_libraries(rrh_gw
-Wl,--end-group ) -Wl,--end-group )
target_link_libraries (rrh_gw rt pthread m ) target_link_libraries (rrh_gw rt pthread m )
target_link_libraries (rrh_gw ${option_HW_lib} ${option_TP_lib} ${LIBBOOST_LIBRARIES} ) target_link_libraries (rrh_gw ${option_HW_lib} ${option_TP_lib} ${LIBBOOST_LIBRARIES} )
target_link_libraries (rrh_gw ${LIB_LMS_LIBRARIES})
Message("-- option_HW_lib=${option_HW_lib}") Message("-- option_HW_lib=${option_HW_lib}")
Message("-- HW_SOURCE=${HW_SOURCE}") Message("-- HW_SOURCE=${HW_SOURCE}")
Message("-- option_TP_lib=${option_TP_lib}") Message("-- option_TP_lib=${option_TP_lib}")
Message("-- TRANSPORT_SOURCE=${TRANSPORT_SOURCE}") Message("-- TRANSPORT_SOURCE=${TRANSPORT_SOURCE}")
if (${RF_BOARD} STREQUAL "OAI_LMSSDR")
add_dependencies(lte-softmodem LMS7002M LMS_SDR Si5351C)
add_dependencies(lte-softmodem-nos1 LMS7002M LMS_SDR Si5351C)
add_dependencies(rrh_gw LMS7002M LMS_SDR Si5351C)
endif (${RF_BOARD} STREQUAL "OAI_LMSSDR")
# USIM process # USIM process
################# #################
#add_executable(usim #add_executable(usim
......
...@@ -91,7 +91,7 @@ Options ...@@ -91,7 +91,7 @@ Options
default is Rel10, default is Rel10,
Rel8 limits the implementation to 3GPP Release 8 version Rel8 limits the implementation to 3GPP Release 8 version
-w | --hardware -w | --hardware
EXMIMO (Default), USRP, BLADERF, None EXMIMO (Default), USRP, BLADERF, LMSSDR, None
Adds this RF board support (in external packages installation and in compilation) Adds this RF board support (in external packages installation and in compilation)
-t | --transport protocol -t | --transport protocol
ETHERNET , None ETHERNET , None
...@@ -181,7 +181,7 @@ function main() { ...@@ -181,7 +181,7 @@ function main() {
-w | --hardware) -w | --hardware)
HW="$2" #"${i#*=}" HW="$2" #"${i#*=}"
# Use OAI_USRP as the key word USRP is used inside UHD driver # Use OAI_USRP as the key word USRP is used inside UHD driver
if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "None" -a "$HW" != "EXMIMO" ] ; then if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "LMSSDR" -a "$HW" != "None" -a "$HW" != "EXMIMO" ] ; then
echo_fatal "Unknown HW type $HW will exit..." echo_fatal "Unknown HW type $HW will exit..."
else else
if [ "$HW" == "USRP" ] ; then if [ "$HW" == "USRP" ] ; then
...@@ -190,6 +190,9 @@ function main() { ...@@ -190,6 +190,9 @@ function main() {
if [ "$HW" == "BLADERF" ] ; then if [ "$HW" == "BLADERF" ] ; then
HW="OAI_BLADERF" HW="OAI_BLADERF"
fi fi
if [ "$HW" == "LMSSDR" ] ; then
HW="OAI_LMSSDR"
fi
echo_info "Setting hardware to: $HW" echo_info "Setting hardware to: $HW"
fi fi
shift 2;; shift 2;;
...@@ -299,6 +302,7 @@ function main() { ...@@ -299,6 +302,7 @@ function main() {
fi fi
fi fi
echo_info "RF HW set to $HW"
#Now we set flags to enable deadline scheduler settings #Now we set flags to enable deadline scheduler settings
#By default: USRP: disable, #By default: USRP: disable,
#By default: BLADERF: enable, #By default: BLADERF: enable,
...@@ -312,6 +316,8 @@ function main() { ...@@ -312,6 +316,8 @@ function main() {
LOWLATENCY_FLAG_USER="False" LOWLATENCY_FLAG_USER="False"
elif [ "$HW" = "OAI_BLADERF" ] ; then elif [ "$HW" = "OAI_BLADERF" ] ; then
LOWLATENCY_FLAG_USER="False" LOWLATENCY_FLAG_USER="False"
elif [ "$HW" = "OAI_LMSSDR" ] ; then
LOWLATENCY_FLAG_USER="False"
elif [ "$HW" = "None" ] ; then elif [ "$HW" = "None" ] ; then
LOWLATENCY_FLAG_USER="False" LOWLATENCY_FLAG_USER="False"
else else
...@@ -689,6 +695,16 @@ function main() { ...@@ -689,6 +695,16 @@ function main() {
ln -s liboai_bladerfdevif.so liboai_device.so ln -s liboai_bladerfdevif.so liboai_device.so
ln -s $dbin/liboai_bladerfdevif.so.$REL $dbin/liboai_device.so ln -s $dbin/liboai_bladerfdevif.so.$REL $dbin/liboai_device.so
echo_info "liboai_device.so is linked to BLADERF device library" echo_info "liboai_device.so is linked to BLADERF device library"
elif [ "$HW" == "OAI_LMSSDR" ] ; then
# if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations \
$build_dir oai_lmssdrdevif \
liboai_lmssdrdevif.so $dbin/liboai_lmssdrdevif.so.$REL
# fi
ln -s liboai_lmssdrdevif.so liboai_device.so
ln -s $dbin/liboai_lmssdrdevif.so.$REL $dbin/liboai_device.so
echo_info "liboai_device.so is linked to LMSSDR device library"
else else
echo_info "liboai_device.so is not linked to any device library" echo_info "liboai_device.so is not linked to any device library"
fi fi
......
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0}; short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0};
short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0}; short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0};
short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0}; short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0};
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "gain_control.h" #include "gain_control.h"
#endif #endif
#if defined(OAI_USRP) || defined(EXMIMO) #if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_LMSSDR)
#include "common_lib.h" #include "common_lib.h"
extern openair0_config_t openair0_cfg[]; extern openair0_config_t openair0_cfg[];
#endif #endif
...@@ -291,17 +291,10 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) ...@@ -291,17 +291,10 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
frame_parms->Ncp=NORMAL; frame_parms->Ncp=NORMAL;
frame_parms->frame_type=FDD; frame_parms->frame_type=FDD;
init_frame_parms(frame_parms,1); init_frame_parms(frame_parms,1);
/*
// write_output("rxdata0.m","rxd0",phy_vars_ue->lte_ue_common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); write_output("rxdata0.m","rxd0",phy_vars_ue->lte_ue_common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
exit(-1);
/*#ifdef OAI_USRP */
for (aarx = 0; aarx<frame_parms->nb_antennas_rx;aarx++) {
rxdata128 = (__m128i*)phy_vars_ue->lte_ue_common_vars.rxdata[aarx];
for (i=0; i<(frame_parms->samples_per_tti*10)>>2; i++) {
rxdata128[i] = _mm_srai_epi16(rxdata128[i],4);
}
}
#endif*/
sync_pos = lte_sync_time(phy_vars_ue->lte_ue_common_vars.rxdata, sync_pos = lte_sync_time(phy_vars_ue->lte_ue_common_vars.rxdata,
frame_parms, frame_parms,
(int *)&phy_vars_ue->lte_ue_common_vars.eNb_id); (int *)&phy_vars_ue->lte_ue_common_vars.eNb_id);
...@@ -336,9 +329,11 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) ...@@ -336,9 +329,11 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
#else #else
#ifndef OAI_USRP #ifndef OAI_USRP
#ifndef OAI_BLADERF #ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(phy_vars_ue,0); phy_adjust_gain(phy_vars_ue,0);
#endif #endif
#endif
#endif #endif
#endif #endif
...@@ -569,7 +564,7 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) ...@@ -569,7 +564,7 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration, phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration,
phich_string[phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource], phich_string[phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource],
phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB); phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB);
#if defined(OAI_USRP) || defined(EXMIMO) #if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_LMSSDR)
LOG_I(PHY,"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n", LOG_I(PHY,"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n",
phy_vars_ue->Mod_id, phy_vars_ue->Mod_id,
phy_vars_ue->frame_rx, phy_vars_ue->frame_rx,
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#endif #endif
extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index); extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) #if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
#include "common_lib.h" #include "common_lib.h"
extern openair0_config_t openair0_cfg[]; extern openair0_config_t openair0_cfg[];
#endif #endif
...@@ -97,10 +97,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -97,10 +97,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
#ifdef EXMIMO #ifdef EXMIMO
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]); len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]);
#endif #endif
#if defined(OAI_USRP) || defined(OAI_BLADERF) #if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB); len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB);
#endif #endif
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d), estimated carrier frequency %f Hz\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset,openair0_cfg[0].rx_freq[0]-phy_vars_ue->lte_ue_common_vars.freq_offset); len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d), estimated carrier frequency %f Hz\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset,openair0_cfg[0].rx_freq[0]-phy_vars_ue->lte_ue_common_vars.freq_offset);
#endif #endif
len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]); len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]);
......
...@@ -88,7 +88,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) ...@@ -88,7 +88,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX ); fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED ); fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED );
fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color
fl_set_xyplot_ybounds(fdui->rxsig_t,30,70); fl_set_xyplot_ybounds(fdui->rxsig_t,10,70);
// Time-domain channel response // Time-domain channel response
fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" ); fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" );
...@@ -396,7 +396,7 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) ...@@ -396,7 +396,7 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void )
fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX ); fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED ); fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED );
fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color
fl_set_xyplot_ybounds(fdui->rxsig_t,30,70); fl_set_xyplot_ybounds(fdui->rxsig_t,10,70);
// Time-domain channel response // Time-domain channel response
fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" ); fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" );
......
...@@ -121,7 +121,7 @@ extern int rx_sig_fifo; ...@@ -121,7 +121,7 @@ extern int rx_sig_fifo;
#endif #endif
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
#endif #endif
...@@ -197,7 +197,7 @@ void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) ...@@ -197,7 +197,7 @@ void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe)
exit(-1); exit(-1);
} }
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
//unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162}; //unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162};
/* /*
unsigned int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL) unsigned int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL)
...@@ -669,7 +669,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -669,7 +669,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
uint8_t ack_status=0; uint8_t ack_status=0;
int8_t Po_PUCCH; int8_t Po_PUCCH;
int32_t ulsch_start=0; int32_t ulsch_start=0;
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
int overflow=0; int overflow=0;
int k,l; int k,l;
#endif #endif
...@@ -969,7 +969,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -969,7 +969,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#endif #endif
phy_vars_ue->tx_total_RE = nb_rb*12; phy_vars_ue->tx_total_RE = nb_rb*12;
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(phy_vars_ue->tx_power_dBm, tx_amp = get_tx_amp(phy_vars_ue->tx_power_dBm,
phy_vars_ue->tx_power_max_dBm, phy_vars_ue->tx_power_max_dBm,
phy_vars_ue->lte_frame_parms.N_RB_UL, phy_vars_ue->lte_frame_parms.N_RB_UL,
...@@ -1065,7 +1065,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1065,7 +1065,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#endif #endif
phy_vars_ue->tx_total_RE = 12; phy_vars_ue->tx_total_RE = 12;
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH, tx_amp = get_tx_amp(Po_PUCCH,
phy_vars_ue->tx_power_max_dBm, phy_vars_ue->tx_power_max_dBm,
phy_vars_ue->lte_frame_parms.N_RB_UL, phy_vars_ue->lte_frame_parms.N_RB_UL,
...@@ -1128,7 +1128,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1128,7 +1128,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#endif #endif
phy_vars_ue->tx_total_RE = 12; phy_vars_ue->tx_total_RE = 12;
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH, tx_amp = get_tx_amp(Po_PUCCH,
phy_vars_ue->tx_power_max_dBm, phy_vars_ue->tx_power_max_dBm,
phy_vars_ue->lte_frame_parms.N_RB_UL, phy_vars_ue->lte_frame_parms.N_RB_UL,
...@@ -1230,7 +1230,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1230,7 +1230,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
nsymb = (frame_parms->Ncp == 0) ? 14 : 12; nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
#if defined(EXMIMO) || defined(OAI_USRP) //this is the EXPRESS MIMO case #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)//this is the EXPRESS MIMO case
ulsch_start = (phy_vars_ue->rx_offset+subframe_tx*frame_parms->samples_per_tti- ulsch_start = (phy_vars_ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-
openair_daq_vars.timing_advance- openair_daq_vars.timing_advance-
phy_vars_ue->timing_advance- phy_vars_ue->timing_advance-
...@@ -1257,7 +1257,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1257,7 +1257,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
if (frame_parms->Ncp == 1) if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], PHY_ofdm_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
dummy_tx_buffer, dummy_tx_buffer,
#else #else
&phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start], &phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
...@@ -1268,7 +1268,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1268,7 +1268,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
CYCLIC_PREFIX); CYCLIC_PREFIX);
else else
normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
dummy_tx_buffer, dummy_tx_buffer,
#else #else
&phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start], &phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
...@@ -1289,7 +1289,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1289,7 +1289,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
} }
*/ */
#ifndef OFDMA_ULSCH #ifndef OFDMA_ULSCH
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,0); apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,0);
apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,1); apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,1);
#else #else
...@@ -1304,7 +1304,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1304,7 +1304,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
*/ */
#endif #endif
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
overflow = ulsch_start - 9*frame_parms->samples_per_tti; overflow = ulsch_start - 9*frame_parms->samples_per_tti;
//if ((slot_tx==4) && (aa==0)) printf("ulsch_start %d, overflow %d\n",ulsch_start,overflow); //if ((slot_tx==4) && (aa==0)) printf("ulsch_start %d, overflow %d\n",ulsch_start,overflow);
...@@ -1404,7 +1404,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra ...@@ -1404,7 +1404,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
phy_vars_ue->tx_total_RE = 96; phy_vars_ue->tx_total_RE = 96;
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = get_tx_amp(phy_vars_ue->tx_power_dBm, phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = get_tx_amp(phy_vars_ue->tx_power_dBm,
phy_vars_ue->tx_power_max_dBm, phy_vars_ue->tx_power_max_dBm,
phy_vars_ue->lte_frame_parms.N_RB_UL, phy_vars_ue->lte_frame_parms.N_RB_UL,
...@@ -1553,9 +1553,11 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t ...@@ -1553,9 +1553,11 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
#else #else
#ifndef OAI_USRP #ifndef OAI_USRP
#ifndef OAI_BLADERF #ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain (phy_vars_ue,0); phy_adjust_gain (phy_vars_ue,0);
#endif #endif
#endif
#endif #endif
#endif #endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT);
......
...@@ -60,6 +60,9 @@ case USRP_X300_DEV: ...@@ -60,6 +60,9 @@ case USRP_X300_DEV:
case BLADERF_DEV: case BLADERF_DEV:
printf("[%s] has loaded BLADERF device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH")); printf("[%s] has loaded BLADERF device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break; break;
case LMSSDR_DEV:
printf("[%s] has loaded LMSSDR device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break;
case NONE_DEV: case NONE_DEV:
printf("[%s] has not loaded a HW device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH")); printf("[%s] has not loaded a HW device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break; break;
...@@ -162,6 +165,7 @@ int openair0_transport_load(openair0_device *device, openair0_config_t *openair0 ...@@ -162,6 +165,7 @@ int openair0_transport_load(openair0_device *device, openair0_config_t *openair0
} }
} }
return 0; return 0;
} }
......
...@@ -90,6 +90,8 @@ typedef enum { ...@@ -90,6 +90,8 @@ typedef enum {
USRP_X300_DEV, USRP_X300_DEV,
/*!\brief device is BLADE RF*/ /*!\brief device is BLADE RF*/
BLADERF_DEV, BLADERF_DEV,
/*!\brief device is LMSSDR (SoDeRa)*/
LMSSDR_DEV,
/*!\brief device is NONE*/ /*!\brief device is NONE*/
NONE_DEV, NONE_DEV,
MAX_RF_DEV_TYPE MAX_RF_DEV_TYPE
...@@ -195,7 +197,8 @@ typedef struct { ...@@ -195,7 +197,8 @@ typedef struct {
char *my_addr; char *my_addr;
//! local port number for Ethernet interface (eNB/BBU, UE) //! local port number for Ethernet interface (eNB/BBU, UE)
unsigned int my_port; unsigned int my_port;
//! Configuration file for LMS7002M
char *configFilename;
} openair0_config_t; } openair0_config_t;
/*! \brief RF mapping */ /*! \brief RF mapping */
...@@ -206,6 +209,7 @@ typedef struct { ...@@ -206,6 +209,7 @@ typedef struct {
int chain; int chain;
} openair0_rf_map; } openair0_rf_map;
typedef struct { typedef struct {
char *remote_addr; char *remote_addr;
//! remote port number for Ethernet interface //! remote port number for Ethernet interface
...@@ -355,7 +359,7 @@ extern "C" ...@@ -355,7 +359,7 @@ extern "C"
* \param device the hardware to use * \param device the hardware to use
*/ */
openair0_timestamp get_usrp_time(openair0_device *device); openair0_timestamp get_usrp_time(openair0_device *device);
/*! \brief Set RX frequencies /*! \brief Set RX frequencies
* \param device the hardware to use * \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application * \param openair0_cfg RF frontend parameters set by application
......
set(si5351_src_files
Si5351C.cpp
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 "
)
add_library(Si5351C STATIC ${si5351_src_files})
target_include_directories(Si5351C PUBLIC ../lms7002m ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(Si5351C LMS7002M)
This diff is collapsed.
/**
@file Si5351C.h
@brief Header for Si5351C.cpp
@author Lime Microsystems
*/
#ifndef SI5351C_MODULE
#define SI5351C_MODULE
#include <stdio.h>
#include <string>
using namespace std;
//---------------------------------------------------------------------------
enum eSi_CLOCK_INPUT
{
Si_CLKIN,
Si_XTAL,
Si_CMOS
};
struct Si5351_Channel
{
Si5351_Channel() : outputDivider(1), outputFreqHz(1), multisynthDivider(1), pllSource(0),
phaseOffset(0), powered(true), inverted(false), int_mode(false) {};
int outputDivider;
unsigned long outputFreqHz;
float multisynthDivider;
int pllSource;
float phaseOffset;
bool powered;
bool inverted;
bool int_mode;
};
struct Si5351_PLL
{
Si5351_PLL() : inputFreqHz(0), VCO_Hz(0), feedbackDivider(0), CLKIN_DIV(1), CLK_SRC(1) {}
unsigned long inputFreqHz;
float VCO_Hz;
float feedbackDivider;
int CLKIN_DIV;
int CLK_SRC; //0-XTAL, 1-CLKIN
};
class LMScomms;
class Si5351C
{
public:
enum Status
{
SUCCESS,
FAILED,
};
struct StatusBits
{
StatusBits() : sys_init(0), sys_init_stky(0), lol_b(0), lol_b_stky(0), lol_a(0), lol_a_stky(0), los(0), los_stky(0)
{
}
int sys_init;
int sys_init_stky;
int lol_b;
int lol_b_stky;
int lol_a;
int lol_a_stky;
int los;
int los_stky;
};
StatusBits GetStatusBits();
Status ClearStatus();
Si5351C();
~Si5351C();
void Initialize(LMScomms *mng);
bool LoadRegValuesFromFile(string FName);
void SetPLL(unsigned char id, unsigned long CLKIN_Hz, int CLK_SRC);
void SetClock(unsigned char id, unsigned long fOut_Hz, bool enabled = true, bool inverted = false);
Status UploadConfiguration();
Status ConfigureClocks();
void Reset();
private:
void FindVCO(Si5351_Channel *clocks, Si5351_PLL *plls, const unsigned long Fmin, const unsigned long Fmax);
LMScomms *device;
Si5351_PLL PLL[2];
Si5351_Channel CLK[8];
static const unsigned char m_defaultConfiguration[];
unsigned char m_newConfiguration[255];
};
#endif // SI5351C_MODULE
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE TYPE INTERNAL FORCE)
project("lms7api")
#include modules for finding FFTW and CyAPI
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
cmake_policy(SET CMP0015 OLD)
if(${CMAKE_MAJOR_VERSION} GREATER 2)
cmake_policy(SET CMP0043 NEW)
endif()
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
if(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif()
# set up include-directories
include_directories(
"${PROJECT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}"
cpp-feather-ini-parser
)
set(LMS7002M_src_files
LMS7002M.cpp
LMS7002M_parameters.cpp
LMS7002M_statuses.cpp
LMS7002M_filtersCalibration.cpp
lmsComms.cpp
LMS7002M_RegistersMap.cpp
)
set(ENABLE_USB_CONNECTION "YES" CACHE BOOL INTERNAL)
set(ENABLE_SPI_CONNECTION "NO" CACHE BOOL INTERNAL)
set(CONNECTION_MANAGER_DIR connectionManager)
set(connectionManager_src_files
${CONNECTION_MANAGER_DIR}/ConnectionManager.cpp
${CONNECTION_MANAGER_DIR}/ConnectionCOM.cpp
${CONNECTION_MANAGER_DIR}/ConnectionManager.h
${CONNECTION_MANAGER_DIR}/ConnectionCOM.h
)
if(ENABLE_USB_CONNECTION)
list(APPEND connectionManager_src_files ${CONNECTION_MANAGER_DIR}/ConnectionUSB.cpp ${CONNECTION_MANAGER_DIR}/ConnectionUSB.h)
add_definitions(-DENABLE_USB_CONNECTION)
endif()
if(ENABLE_SPI_CONNECTION)
list(APPEND connectionManager_src_files ${CONNECTION_MANAGER_DIR}/ConnectionSPI.cpp ${CONNECTION_MANAGER_DIR}/ConnectionSPI.h)
add_definitions(-DENABLE_SPI_CONNECTION)
endif()
add_library(LMS7002M STATIC ${LMS7002M_src_files} ${connectionManager_src_files})
target_include_directories(LMS7002M PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(WIN32 AND ENABLE_USB_CONNECTION)
find_package(CyAPI REQUIRED)
LINK_DIRECTORIES(${CYAPI_LIBRARIES})
include_directories(${CYAPI_INCLUDE_DIRS})
set(CONNECTION_MANAGER_LIBS ${CYAPI_LIBRARIES} SetupAPI)
target_link_libraries(LMS7002M ${CONNECTION_MANAGER_LIBS})
endif()
if(UNIX AND ENABLE_USB_CONNECTION)
set(CONNECTION_MANAGER_LIBS usb-1.0 -lpthread)
target_link_libraries(LMS7002M ${CONNECTION_MANAGER_LIBS})
endif()
This diff is collapsed.
/**
@file LMS7002M.h
@author Lime Microsystems (www.limemicro.com)
@brief LMS7002M transceiver configuration interface
*/
#ifndef LMS7API_H
#define LMS7API_H
#include "LMS7002M_statuses.h"
#include "LMS7002M_parameters.h"
#include "typedefs.h"
#include <sstream>
class LMScomms;
class LMS7002M_RegistersMap;
class LMS7002M
{
public:
enum
{
Rx, Tx
};
LMS7002M();
LMS7002M(LMScomms* controlPort);
virtual ~LMS7002M();
///@name Registers writing and reading
liblms7_status UploadAll();
liblms7_status DownloadAll();
bool IsSynced();
liblms7_status ResetChip();
liblms7_status LoadConfig(const char* filename);
liblms7_status SaveConfig(const char* filename);
///@}
///@name Registers writing and reading
uint16_t Get_SPI_Reg_bits(const LMS7Parameter &param, bool fromChip = true);
uint16_t Get_SPI_Reg_bits(uint16_t address, uint8_t msb, uint8_t lsb, bool fromChip = true);
liblms7_status Modify_SPI_Reg_bits(const LMS7Parameter &param, const uint16_t value, bool fromChip = true);
liblms7_status Modify_SPI_Reg_bits(uint16_t address, uint8_t msb, uint8_t lsb, uint16_t value, bool fromChip = true);
liblms7_status SPI_write(uint16_t address, uint16_t data);
uint16_t SPI_read(uint16_t address, bool fromChip = true, liblms7_status *status = 0);
liblms7_status RegistersTest();
///@}
///@name Transmitter, Receiver calibrations
liblms7_status CalibrateRx(float_type bandwidth_MHz);
liblms7_status CalibrateTx(float_type bandwidth_MHz);
///@}
///@name Filters tuning
enum TxFilter
{
TX_LADDER, TX_REALPOLE, TX_HIGHBAND
};
enum RxFilter
{
RX_TIA, RX_LPF_LOWBAND, RX_LPF_HIGHBAND
};
liblms7_status TuneTxFilter(TxFilter filterType, float_type bandwidth_MHz);
liblms7_status TuneTxFilterLowBandChain(float_type ladder_bw_MHz, float_type realpole_bw_MHz);
liblms7_status TuneRxFilter(RxFilter filterType, float_type bandwidth_MHz);
///@}
///@name CGEN and PLL
float_type GetReferenceClk_SX(bool tx);
float_type GetFrequencyCGEN_MHz();
liblms7_status SetFrequencyCGEN(float_type freq_MHz);
float_type GetFrequencySX_MHz(bool tx, float_type refClk_MHz);
liblms7_status SetFrequencySX(bool tx, float_type freq_MHz, float_type refClk_MHz);
///VCO modules available for tuning
enum VCO_Module
{
VCO_CGEN, VCO_SXR, VCO_SXT
};
liblms7_status TuneVCO(VCO_Module module);
///@}
///@name TSP
liblms7_status LoadDC_REG_IQ(bool tx, int16_t I, int16_t Q);
liblms7_status SetNCOFrequency(bool tx, uint8_t index, float_type freq_MHz);
float_type GetNCOFrequency_MHz(bool tx, uint8_t index, float_type refClk_MHz, bool fromChip = true);
liblms7_status SetNCOPhaseOffsetForMode0(bool tx, float_type angle_Deg);
liblms7_status SetNCOPhaseOffset(bool tx, uint8_t index, float_type angle_Deg);
float_type GetNCOPhaseOffset_Deg(bool tx, uint8_t index);
liblms7_status SetGFIRCoefficients(bool tx, uint8_t GFIR_index, const int16_t *coef, uint8_t coefCount);
liblms7_status GetGFIRCoefficients(bool tx, uint8_t GFIR_index, int16_t *coef, uint8_t coefCount);
float_type GetReferenceClk_TSP_MHz(bool tx);
///@}
liblms7_status SetInterfaceFrequency(float_type cgen_freq_MHz, const uint8_t interpolation, const uint8_t decimation);
///enumeration to indicate module registers intervals
enum MemorySection
{
LimeLight = 0, EN_DIR, AFE, BIAS, XBUF, CGEN, LDO, BIST, CDS,
TRF, TBB, RFE, RBB, SX, TxTSP,
TxNCO, TxGFIR1, TxGFIR2, TxGFIR3a, TxGFIR3b, TxGFIR3c,
RxTSP, RxNCO, RxGFIR1, RxGFIR2, RxGFIR3a, RxGFIR3b, RxGFIR3c,
MEMORY_SECTIONS_COUNT
};
virtual liblms7_status SetDefaults(MemorySection module);
LMScomms* GetControlPort() const { return controlPort;};
static const float_type gLadder_lower_limit;
static const float_type gLadder_higher_limit;
static const float_type gRealpole_lower_limit;
static const float_type gRealpole_higher_limit;
static const float_type gHighband_lower_limit;
static const float_type gHighband_higher_limit;
static const float_type gRxTIA_higher_limit;
static const float_type gRxTIA_lower_limit_g1;
static const float_type gRxTIA_lower_limit_g23;
static const float_type gRxLPF_low_lower_limit;
static const float_type gRxLPF_low_higher_limit;
static const float_type gRxLPF_high_lower_limit;
static const float_type gRxLPF_high_higher_limit;
static float_type gVCO_frequency_table[3][2];
static float_type gCGEN_VCO_frequencies[2];
//protected:
LMS7002M_RegistersMap *mRegistersMap;
static const uint16_t readOnlyRegisters[];
static const uint16_t readOnlyRegistersMasks[];
uint16_t MemorySectionAddresses[MEMORY_SECTIONS_COUNT][2];
///@name Algorithms functions
void BackupAllRegisters();
void RestoreAllRegisters();
uint32_t GetRSSI();
void SetRxDCOFF(int8_t offsetI, int8_t offsetQ);
uint32_t FindMinRSSI_Gain(const LMS7Parameter &param, uint16_t *foundValue);
uint32_t FindMinRSSI(const LMS7Parameter &param, const int16_t startValue, int16_t *result, const uint8_t scanWidth, const uint8_t twoCompl, int8_t stepMult = 1);
uint32_t FindMinRSSI(const uint16_t addr, const uint8_t msb, const uint8_t lsb, const int16_t startValue, int16_t *result, const uint8_t scanWidth, const uint8_t twoCompl, int8_t stepMult = 1);
void CalibrateRxDC_RSSI();
liblms7_status CalibrateTxSetup(float_type bandwidth_MHz);
liblms7_status CalibrateRxSetup(float_type bandwidth_MHz);
liblms7_status FixRXSaturation();
void FilterTuning_AdjustGains();
liblms7_status TuneTxFilterSetup(TxFilter type, float_type cutoff_MHz);
liblms7_status TuneRxFilterSetup(RxFilter type, float_type cutoff_MHz);
liblms7_status RFE_TIA_Calibration(float_type TIA_freq_MHz);
liblms7_status RxLPFLow_Calibration(float_type RxLPFL_freq_MHz);
liblms7_status RxLPFHigh_Calibration(float_type RxLPFH_freq_MHz);
liblms7_status RegistersTestInterval(uint16_t startAddr, uint16_t endAddr, uint16_t pattern, std::stringstream &ss);
liblms7_status SPI_write_batch(const uint16_t* spiAddr, const uint16_t* spiData, uint16_t cnt);
liblms7_status SPI_read_batch(const uint16_t* spiAddr, uint16_t* spiData, uint16_t cnt);
liblms7_status Modify_SPI_Reg_mask(const uint16_t *addr, const uint16_t *masks, const uint16_t *values, uint8_t start, uint8_t stop);
///@}
///Reference clock used for Receiver frequency calculations
float_type mRefClkSXR_MHz;
///Reference clock used for Transmitter frequency calculations
float_type mRefClkSXT_MHz;
enum LogType
{
LOG_INFO,
LOG_WARNING,
LOG_ERROR,
LOG_DATA
};
virtual void Log(const char* text, LogType type);
///port used for communicating with LMS7002M
LMScomms* controlPort;
liblms7_status LoadConfigLegacyFile(const char* filename);
};
#endif
#include "LMS7002M_RegistersMap.h"
#include "LMS7002M_parameters.h"
LMS7002M_RegistersMap::LMS7002M_RegistersMap()
{
}
LMS7002M_RegistersMap::~LMS7002M_RegistersMap()
{
}
uint16_t LMS7002M_RegistersMap::GetDefaultValue(uint16_t address) const
{
std::map<uint16_t, Register>::const_iterator iter = mChannelA.find(address);
if( iter != mChannelA.end())
return iter->second.defaultValue;
else
return 0;
}
void LMS7002M_RegistersMap::InitializeDefaultValues(const std::vector<const LMS7Parameter*> parameterList)
{
for(auto parameter : parameterList)
{
uint16_t regValue = mChannelA[parameter->address].defaultValue;
mChannelA[parameter->address].defaultValue = regValue | (parameter->defaultValue << parameter->lsb);
mChannelA[parameter->address].value = mChannelA[parameter->address].defaultValue;
if(parameter->address >= 0x0100)
mChannelB[parameter->address].value = mChannelA[parameter->address].value;
}
}
void LMS7002M_RegistersMap::SetValue(uint8_t channel, const uint16_t address, const uint16_t value)
{
if(channel == 0)
mChannelA[address].value = value;
else if(channel == 1)
mChannelB[address].value = value;
}
uint16_t LMS7002M_RegistersMap::GetValue(uint8_t channel, uint16_t address) const
{
const std::map<const uint16_t, Register> *regMap;
if(channel == 0)
regMap = &mChannelA;
else if(channel == 1)
regMap = &mChannelB;
std::map<const uint16_t, Register>::const_iterator iter;
iter = regMap->find(address);
if (iter != regMap->end())
return iter->second.value;
else
return 0;
}
std::vector<uint16_t> LMS7002M_RegistersMap::GetUsedAddresses(const uint8_t channel) const
{
std::vector<uint16_t> addresses;
if(channel == 0)
for(auto iter : mChannelA)
addresses.push_back(iter.first);
else if(channel == 1)
for(auto iter : mChannelB)
addresses.push_back(iter.first);
return addresses;
}
#ifndef LMS7002M_REGISTERS_MAP_H
#define LMS7002M_REGISTERS_MAP_H
#include <vector>
#include <map>
#include <typedefs.h>
struct LMS7Parameter;
class LMS7002M_RegistersMap
{
public:
struct Register
{
uint16_t value;
uint16_t defaultValue;
uint16_t mask;
};
LMS7002M_RegistersMap();
~LMS7002M_RegistersMap();
uint16_t GetValue(uint8_t channel, uint16_t address) const;
void SetValue(uint8_t channel, const uint16_t address, const uint16_t value);
void InitializeDefaultValues(const std::vector<const LMS7Parameter*> parameterList);
uint16_t GetDefaultValue(uint16_t address) const;
std::vector<uint16_t> GetUsedAddresses(const uint8_t channel) const;
protected:
std::map<const uint16_t, Register> mChannelA;
std::map<const uint16_t, Register> mChannelB;
};
#endif
/**
@file LMS7002M_statuses.cpp
@author Lime Microsystems (www.limemicro.com)
*/
#include "LMS7002M_statuses.h"
const char* undefinedStatusStr = "undefined status";
const char* liblms7_status2string(liblms7_status status)
{
if (status >= 0 && status < LIBLMS7_STATUS_COUNT)
return liblms7_status_strings[status];
else
return undefinedStatusStr;
}
/**
@file LMS7002M_statuses.h
@author Lime Microsystems (www.limemicro.com)
@brief LMS7002M control library statuses enumerations
*/
#ifndef LMS7API_STATUSES_H
#define LMS7API_STATUSES_H
const char liblms7_status_strings[][64] =
{
"success",
"failure",
"index out of range",
"too many values",
"connection manager is NULL",
"port not connected",
"frequency out of range",
"cannot deliver frequency",
"VCO is powered down",
"Bad SEL_PATH_RFE",
"Band not selected",
"file not found",
"file invalid format",
};
enum liblms7_status
{
LIBLMS7_SUCCESS = 0,
LIBLMS7_FAILURE,
LIBLMS7_INDEX_OUT_OF_RANGE,
LIBLMS7_TOO_MANY_VALUES,
LIBLMS7_NO_CONNECTION_MANAGER,
LIBLMS7_NOT_CONNECTED,
LIBLMS7_FREQUENCY_OUT_OF_RANGE,
LIBLMS7_CANNOT_DELIVER_FREQUENCY,
LIBLMS7_VCO_IS_POWERED_DOWN,
LIBLMS7_BAD_SEL_PATH,
LIBLMS7_BAND_NOT_SELECTED,
LIBLMS7_FILE_NOT_FOUND,
LIBLMS7_FILE_INVALID_FORMAT,
LIBLMS7_STATUS_COUNT
};
const char* liblms7_status2string(liblms7_status status);
#endif
/**
@file ConnectionCOM.h
@author Lime Microsystems (www.limemicro.com)
@brief Class for data communications through COM port
*/
#ifndef CONNECTION_COM_PORT_H
#define CONNECTION_COM_PORT_H
#ifndef __unix__
#include "windows.h"
#endif
#include "IConnection.h"
class ConnectionCOM : public IConnection
{
public:
static const int COM_BUFFER_LENGTH = 1024; //max buffer size for data
ConnectionCOM();
~ConnectionCOM();
DeviceStatus Open();
DeviceStatus Open(unsigned i);
void Close();
bool IsOpen();
int GetOpenedIndex();
int Write(const unsigned char *buffer, int length, int timeout_ms = 0);
int Read(unsigned char *buffer, int length, int timeout_ms = 0);
std::vector<std::string> GetDeviceNames();
int RefreshDeviceList();
void ClearComm();
private:
void FindAllComPorts();
DeviceStatus Open(const char *comName, int baudrate);
bool TestConnectivity();
std::string comPortName;
int comBaudrate;
bool connected;
int currentDeviceIndex;
std::vector<std::string> comPortList;
std::vector<std::string> m_deviceNames;
#ifndef __unix__
HANDLE hComm;
COMMTIMEOUTS m_ctmoNew;
COMMTIMEOUTS m_ctmoOld;
OVERLAPPED m_osROverlap;
OVERLAPPED m_osWOverlap;
DCB m_dcbCommPort;
#else
int hComm; //com port file descriptor
#endif
};
#endif
/**
@file ConnectionManager.cpp
@author Lime Microsystems (www.limemicro.com)
@brief Implementation of various connection types to devices
*/
#include "ConnectionManager.h"
#include "ConnectionCOM.h"
#ifdef ENABLE_USB_CONNECTION
#include "ConnectionUSB.h"
#endif
#ifdef ENABLE_SPI_CONNECTION
#include "ConnectionSPI.h"
#endif
#include <sstream>
#include <iomanip>
#include <iostream>
/** @brief Creates connection interfaces
*/
ConnectionManager::ConnectionManager() : activeControlPort(NULL)
{
mLogData = false;
mOpenedDevice = -1;
m_connections[IConnection::COM_PORT] = new ConnectionCOM();
#ifdef ENABLE_USB_CONNECTION
m_connections[IConnection::USB_PORT] = new ConnectionUSB();
#endif
#ifdef ENABLE_SPI_CONNECTION
m_connections[IConnection::SPI_PORT] = new ConnectionSPI();
#endif
}
/** @brief Destroys connection interfaces
*/
ConnectionManager::~ConnectionManager()
{
for (auto iter = m_connections.begin(); iter != m_connections.end(); ++iter)
{
delete iter->second;
}
}
/** @brief Checks if connection to device is opened
@return True if device is connected
*/
bool ConnectionManager::IsOpen()
{
return activeControlPort ? activeControlPort->IsOpen() : false;
}
/** @brief Opens connection to first available device
@return True if connected to device
*/
bool ConnectionManager::Open()
{
return Open(0);
}
/** @brief Connects to selected device
@param i device index from device list
@return 1:Success, 0:failure
*/
int ConnectionManager::Open(unsigned i)
{
if(i >= mDevices.size())
return 0;
if(activeControlPort)
activeControlPort->Close();
switch(mDevices[i].port)
{
case IConnection::COM_PORT:
activeControlPort = m_connections[IConnection::COM_PORT];
break;
case IConnection::USB_PORT:
activeControlPort = m_connections[IConnection::USB_PORT];
break;
case IConnection::SPI_PORT:
activeControlPort = m_connections[IConnection::SPI_PORT];
break;
default:
return 0;
}
mOpenedDevice = -1;
if( i < mDevices.size() )
{
if( activeControlPort->Open(mDevices[i].portIndex) )
{
mOpenedDevice = i;
return 1;
}
}
return 0;
}
/** @brief Closes connection to device
*/
void ConnectionManager::Close()
{
if(activeControlPort)
{
activeControlPort->Close();
//Notify(LMS_Message(MSG_BOARD_DISCONNECTED, "", 0, 0));
}
mOpenedDevice = -1;
}
/** @brief Finds all currently connected devices and forms device list
@return number of devices found
*/
int ConnectionManager::RefreshDeviceList()
{
mDeviceList.clear();
mDevices.clear();
DeviceInfo dev;
for (auto iter = m_connections.begin(); iter != m_connections.end(); ++iter)
{
vector<string> names;
IConnection *port = iter->second;
if(port->RefreshDeviceList() > 0)
{
names = port->GetDeviceNames();
for(unsigned i=0; i<names.size(); ++i)
{
dev.name = names[i];
dev.port = iter->first;
dev.portIndex = i;
mDevices.push_back(dev);
}
}
}
for(unsigned i=0; i<mDevices.size(); ++i)
mDeviceList.push_back(mDevices[i].name);
return mDevices.size();
}
/** @brief Returns currently opened connection index
*/
int ConnectionManager::GetOpenedIndex()
{
return mOpenedDevice;
}
/** @brief Writes given data to currently opened connection
@param buffer outcomming data buffer
@param length bytes to write
@param timeout_ms timeout in milliseconds
@return number of bytes written, on failure negative values
*/
int ConnectionManager::Write(const unsigned char *buffer, const int length, int timeout_ms)
{
if(activeControlPort)
{
int bytesTransferred = activeControlPort->Write(buffer, length, timeout_ms);
#ifndef NDEBUG
if(mLogData)
{
stringstream ss;
ss << "WR(" << (bytesTransferred>=0?bytesTransferred: 0) << "): ";
ss << std::hex << std::setfill('0');
int repeatedZeros = 0;
for(int i=length-1; i>=0; --i)
if(buffer[i] == 0)
++repeatedZeros;
else break;
if(repeatedZeros == 1)
repeatedZeros = 0;
repeatedZeros = repeatedZeros - (repeatedZeros & 0x1);
for(int i=0; i<length-repeatedZeros; ++i)
//casting to short to print as numbers
ss << " " << std::setw(2) << (unsigned short)buffer[i];
if(repeatedZeros > 1)
ss << " (00 x " << std::dec << repeatedZeros << " times)";
cout << ss.str() << endl;
}
#endif
return bytesTransferred;
}
return -1;
}
/** @brief Receives data from currently opened connection
@param buffer incomming data buffer, must be big enough for length bytes
@param length bytes to read
@param timeout_ms timeout in milliseconds
@return number of bytes received
*/
int ConnectionManager::Read(unsigned char *buffer, int length, int timeout_ms)
{
if(activeControlPort)
{
int bytesTransferred = activeControlPort->Read(buffer, length, timeout_ms);
#ifndef NDEBUG
if(mLogData)
{
stringstream ss;
ss << "RD(" << (bytesTransferred>=0?bytesTransferred: 0) << "): ";
ss << std::hex << std::setfill('0');
int repeatedZeros = 0;
for(int i=length-1; i>=0; --i)
if(buffer[i] == 0)
++repeatedZeros;
else break;
if(repeatedZeros == 2)
repeatedZeros = 0;
repeatedZeros = repeatedZeros - (repeatedZeros & 0x1);
for(int i=0; i<length-repeatedZeros; ++i)
//casting to short to print as numbers
ss << " " << std::setw(2) << (unsigned short)buffer[i];
if(repeatedZeros > 2)
ss << " (00 x " << std::dec << repeatedZeros << " times)";
cout << ss.str() << endl;
}
#endif
return bytesTransferred;
}
return -1;
}
int ConnectionManager::WriteStream(const char *buffer, int length)
{
return 0;
}
int ConnectionManager::ReadStream(char *buffer, int length, unsigned int timeout_ms)
{
/*int handle = activeControlPort->BeginDataReading(buffer, length);
activeControlPort->WaitForReading(handle, timeout_ms);
long received = length;
activeControlPort->FinishDataReading(buffer, received, handle);
return received;
*/
long len = length;
int status = activeControlPort->ReadDataBlocking(buffer, len, 0);
return len;
}
int ConnectionManager::BeginDataReading(char *buffer, long length)
{
return activeControlPort->BeginDataReading(buffer, length);
}
/**
@brief Blocks until data is received or set number of milliseconds have passed.
@param contextHandle handle returned by BeginDataReading()
@param timeout_ms number of milliseconds to wait
@return 1-data received, 0-data not received
*/
int ConnectionManager::WaitForReading(int contextHandle, unsigned int timeout_ms)
{
return activeControlPort->WaitForReading(contextHandle, timeout_ms);
}
/**
@brief Finished asynchronous data reading.
@param buffer where to put received data
@param length number of bytes to read, will be changed to actual number of bytes received
@param contextHandle context handle returned by BeginDataReading()
@return received data length
*/
int ConnectionManager::FinishDataReading(char *buffer, long &length, int contextHandle)
{
return activeControlPort->FinishDataReading(buffer, length, contextHandle);
}
/**
@brief Aborts reading operations
*/
void ConnectionManager::AbortReading()
{
activeControlPort->AbortReading();
}
/**
@brief Start asynchronous data sending.
@param buffer data buffer to be sent
@param length number of bytes to send.
@return context handle
*/
int ConnectionManager::BeginDataSending(const char *buffer, long length)
{
return activeControlPort->BeginDataSending(buffer, length);
}
/**
@brief Blocks until data is sent or set number of miliseconds have passed.
@param contextHandle handle returned by BeginDataReading()
@param timeout_ms number of miliseconds to wait
@return 1-data sent, 0-data not sent
*/
int ConnectionManager::WaitForSending(int contextHandle, unsigned int timeout_ms)
{
return activeControlPort->WaitForSending(contextHandle, timeout_ms);
}
/**
@brief Finished asynchronous data sending.
@param buffer where to put received data
@param length number of bytes to send, will be changed to actual number of bytes sent
@param contextHandle context handle returned by BeginDataReading()
@return sent data length
*/
int ConnectionManager::FinishDataSending(const char *buffer, long &length, int contextHandle)
{
return activeControlPort->FinishDataSending(buffer, length, contextHandle);
}
/**
@brief Aborts sending operations
*/
void ConnectionManager::AbortSending()
{
activeControlPort->AbortSending();
}
/**
@file ConnectionManager.h
@author Lime Microsystems (www.limemicro.com)
@brief Class for managing connection to devices
*/
#ifndef LMS_CONNECTION_MANAGER_H
#define LMS_CONNECTION_MANAGER_H
#include "IConnection.h"
#include <map>
class ConnectionManager
{
public:
struct DeviceInfo
{
std::string name;
IConnection::eConnectionType port;
int portIndex;
};
ConnectionManager();
~ConnectionManager();
bool IsOpen();
bool Open();
int Open(unsigned i);
void Close();
int RefreshDeviceList();
int GetOpenedIndex();
std::vector<std::string> GetDeviceList(){return mDeviceList;};
int Write(const unsigned char *buffer, int length, int timeout_ms = 0);
int Read(unsigned char *buffer, int length, int timeout_ms = 0);
int WriteStream(const char *buffer, int length);
int ReadStream(char *buffer, int length, unsigned int timeout_ms);
int BeginDataReading(char *buffer, long length);
int WaitForReading(int contextHandle, unsigned int timeout_ms);
int FinishDataReading(char *buffer, long &length, int contextHandle);
void AbortReading();
int BeginDataSending(const char *buffer, long length);
int WaitForSending(int contextHandle, unsigned int timeout_ms);
int FinishDataSending(const char *buffer, long &length, int contextHandle);
void AbortSending();
protected:
bool mLogData;
/// Port used for communication.
IConnection *activeControlPort;
std::vector<DeviceInfo> mDevices;
std::vector<std::string> mDeviceList;
int mOpenedDevice;
std::map<IConnection::eConnectionType, IConnection*> m_connections;
};
#endif // LMS_CONNECTION_MANAGER_H
/**
@file ConnectionSPI.h
@author Lime Microsystems (www.limemicro.com)
@brief Class for data communications through SPI port
*/
#ifndef CONNECTION_SPI_PORT_H
#define CONNECTION_SPI_PORT_H
#include "IConnection.h"
#include <fstream>
#include <string>
#include <vector>
class ConnectionSPI : public IConnection
{
public:
static const int cSPI_BUF_SIZE;
static const int cSPI_SPEED_HZ;
ConnectionSPI();
~ConnectionSPI();
DeviceStatus Open();
DeviceStatus Open(unsigned i);
void Close();
bool IsOpen();
int GetOpenedIndex();
int Write(const unsigned char *buffer, int length, int timeout_ms = 0);
int Read(unsigned char *buffer, int length, int timeout_ms = 0);
std::vector<std::string> GetDeviceNames();
int RefreshDeviceList();
protected:
std::vector<std::string> m_deviceNames;
std::vector<unsigned char> rxbuf;
int fd;
std::fstream m_SEN;
};
#endif
The MIT License (MIT)
Copyright (c) 2014 Turbine1991
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
[NewSection]
Key=Value
[Section2]
NewKey=Value
123=456
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
@file typedefs.h
@author Lime Microsystems (www.limemicro.com)
@brief Variables types definitions
*/
#ifndef LMS7002M_TYPEDEFS_H
#define LMS7002M_TYPEDEFS_H
typedef unsigned int uint32_t;
typedef int int32_t;
typedef unsigned short uint16_t;
typedef short int16_t;
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef double float_type;
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#ifndef RRH_GW_EXTERNS_H_ #ifndef RRH_GW_EXTERNS_H_
#define RRH_GW_EXTERNS_H_ #define RRH_GW_EXTERNS_H_
extern char rf_config_file[1024];
extern openair0_timestamp timestamp_UE_tx[4] ,timestamp_UE_rx[4] ,timestamp_eNB_rx[4],timestamp_eNB_tx[4]; extern openair0_timestamp timestamp_UE_tx[4] ,timestamp_UE_rx[4] ,timestamp_eNB_rx[4],timestamp_eNB_tx[4];
extern openair0_vtimestamp hw_counter; extern openair0_vtimestamp hw_counter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment