Commit 5a04f969 authored by navid's avatar navid

* update bladerf interface

* update the runtime and deadline calcualtion 
* fix the isse with LIB_NAS_UE
* add additional testcases and fix the issues with autotest 


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7736 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 23fd8953
......@@ -377,8 +377,10 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
set(HW_SOURCE ${HW_SOURCE}
${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")
#set(LOWLATENCY False)
elseif (${RF_BOARD} STREQUAL "ETHERNET")
include_directories ("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB")
set(HW_SOURCE ${HW_SOURCE}
......@@ -1219,7 +1221,7 @@ set (libnas_utils_OBJS
${NAS_SRC}COMMON/UTIL/OctetString.c
)
if(NAS_UE)
if(NAS_UE)
set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c
${NAS_SRC}UE/API/USER/at_error.c
......@@ -1307,6 +1309,8 @@ if(NAS_UE)
${libnas_ue_esm_OBJS}
${libnas_ue_esm_sap_OBJS}
)
set(NAS_UE_LIB LIB_NAS_UE)
include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER)
include_directories(${NAS_SRC}UE/API/USIM)
......@@ -1554,17 +1558,19 @@ add_executable(lte-softmodem
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
)
if (MESSAGE_CHART_GENERATOR)
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 MSC L2 ${RAL_LIB} LIB_NAS_UE ${ITTI_LIB} ${MIH_LIB}
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS MSC L2 ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
else (MESSAGE_CHART_GENERATOR)
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 ${RAL_LIB} LIB_NAS_UE ${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 ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
endif(MESSAGE_CHART_GENERATOR)
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} ${XFORMS_LIBRARIES} )
target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES})
......@@ -1757,8 +1763,6 @@ target_link_libraries (rrh_gw ${option_HW_lib} ${LIBBOOST_LIBRARIES} )
Message("-- option_HW_lib=${option_HW_lib}")
Message("-- HW_SOURCE=${HW_SOURCE}")
# USIM process
#################
#add_executable(usim
......
......@@ -20,7 +20,7 @@ test_compile() {
make -j4 $2
} > $tdir/log/$1.txt 2>&1
if [ -s $3 ] ; then
cp $3 $tdir/bin/`basename $3`.$1
cp $3 $tdir/bin/`basename $3`.$5.$1
echo_success "$1 $3 $5 compiled"
xUnit_success "compilation" $1
else
......@@ -47,25 +47,36 @@ test_compile \
test.0102 oaisim_nos1 \
oaisim_nos1 $tdir/bin/oaisim.r8.nas rel8.nos1.nas
cp $tdir/test.0103/CMakeLists.txt.Rel8 $tdir/test.0103/CMakeLists.txt
test_compile \
test.0103 lte-softmodem \
lte-softmodem $tdir/bin/lte-softmodem.r8.rf rel8.rf
lte-softmodem $tdir/bin/lte-softmodem.r8.rf Rel8.EXMIMO
cp $tdir/test.0103/CMakeLists.txt.Rel10 $tdir/test.0103/CMakeLists.txt
test_compile \
test.0103 lte-softmodem \
lte-softmodem $tdir/bin/lte-softmodem.r10.rf Rel10.EXMIMO
cp $tdir/test.0103/CMakeLists.txt.USRP $tdir/test.0103/CMakeLists.txt
test_compile \
test.0103 lte-softmodem \
lte-softmodem $tdir/bin/lte-softmodem.r10.rf Rel10.USRP
test_compile \
test.0104 dlsim \
dlsim $tdir/bin/dlsim
dlsim $tdir/bin/dlsim dlsim.Rel8
test_compile \
test.0104 ulsim \
ulsim $tdir/bin/ulsim
ulsim $tdir/bin/ulsim ulsim.Rel8
test_compile \
test.0106 oaisim \
oaisim $tdir/bin/oaisim.r8.itti rel8.itti
oaisim $tdir/bin/oaisim.r8.itti Rel8.itti
test_compile \
test.0107 oaisim_nos1 \
oaisim_nos1 $tdir/bin/oaisim.r10 rel10.nos1
oaisim_nos1 $tdir/bin/oaisim.r10 Rel10.nos1
test_compile \
test.0108 oaisim \
......@@ -77,7 +88,7 @@ test_compile \
test_compile \
test.0115 oaisim \
oaisim $tdir/bin/oaisim.r10.itti.ral
oaisim $tdir/bin/oaisim.r10.itti.ral rel10.itti.ral
test_compile \
test.0120 nasmesh \
......
......@@ -42,7 +42,7 @@ set ( NAS_BUILT_IN_EPC False )
set ( NAS_BUILT_IN_UE False )
set ( NAS_MME False )
set ( NAS_NETLINK False )
set ( NAS_UE False )
set ( NAS_UE True )
set ( NB_ANTENNAS_RX 2 )
set ( NB_ANTENNAS_TX 2 )
set ( NB_ANTENNAS_TXRX 2 )
......@@ -69,9 +69,9 @@ set ( PHY_EMUL False )
set ( PHYSIM True )
set ( PUCCH True )
set ( RANDOM_BF False )
set ( RF_BOARD EXMIMO )
set ( RF_BOARD OAI_USRP )
set ( RLC_STOP_ON_LOST_PDU False )
set ( RRC_ASN1_VERSION Rel8 )
set ( RRC_ASN1_VERSION Rel10 )
set ( RRC_DEFAULT_RAB_IS_AM False )
set ( RRC_MSG_PRINT False )
set ( RTAI False )
......@@ -103,5 +103,5 @@ set ( USE_MME False )
set ( USER_MODE True )
set ( XER_PRINT False )
set ( XFORMS False )
set(PACKAGE_NAME "lte-softmodem")
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_USE_NAS False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
set ( EMOS False )
set ( ENABLE_FXP True )
set ( ENABLE_ITTI False )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
set ( ENABLE_PGM_TRANSPORT False )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME False )
set ( ENABLE_VCD_FIFO True )
set ( ENB_MODE True )
set ( EPC_BUILD False )
set ( HARD_RT False )
set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
set ( LINUX False )
set ( LINUX_LIST False )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MESSAGE_CHART_GENERATOR False )
set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
set ( MESSAGE_CHART_GENERATOR_PHY False )
set ( MIH_C_MEDIEVAL_EXTENSIONS True )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
set ( NAS_BUILT_IN_EPC False )
set ( NAS_BUILT_IN_UE False )
set ( NAS_MME False )
set ( NAS_NETLINK False )
set ( NAS_UE False )
set ( NB_ANTENNAS_RX 2 )
set ( NB_ANTENNAS_TX 2 )
set ( NB_ANTENNAS_TXRX 2 )
set ( NEW_FFT True )
set ( NO_RRM True )
set ( OAI_EMU False )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK False )
set ( OAISIM False )
set ( OPENAIR1 True )
set ( OPENAIR2 True )
set ( OPENAIR_EMU False )
set ( OPENAIR_LTE True )
set ( PBS_SIM False )
set ( PC_DSP True )
set ( PC_TARGET True )
set ( PDCP_MSG_PRINT False )
set ( PDCP_USE_NETLINK False )
set ( PDCP_USE_NETLINK_QUEUES False )
set ( PERFECT_CE False )
set ( PHY_ABSTRACTION False )
set ( PHY_CONTEXT 1 )
set ( PHY_EMUL False )
set ( PHYSIM True )
set ( PUCCH True )
set ( RANDOM_BF False )
set ( RF_BOARD EXMIMO )
set ( RLC_STOP_ON_LOST_PDU False )
set ( RRC_ASN1_VERSION Rel10 )
set ( RRC_DEFAULT_RAB_IS_AM False )
set ( RRC_MSG_PRINT False )
set ( RTAI False )
set ( S1AP_LIMIT_STREAM_ID_TO_1 False )
set ( S1AP_VERSION R10 )
set ( SMBV False )
set ( SPECTRA False )
set ( STOP_ON_IP_TRAFFIC_OVERLOAD False )
set ( TEST_OMG False )
set ( TRACE_RLC_AM_BO False )
set ( TRACE_RLC_AM_FREE_SDU False )
set ( TRACE_RLC_AM_HOLE False )
set ( TRACE_RLC_AM_PDU False )
set ( TRACE_RLC_AM_RESEGMENT False )
set ( TRACE_RLC_AM_RX_DECODE False )
set ( TRACE_RLC_AM_RX False )
set ( TRACE_RLC_AM_STATUS_CREATION False )
set ( TRACE_RLC_AM_TX False )
set ( TRACE_RLC_AM_TX_STATUS False )
set ( TRACE_RLC_PAYLOAD False )
set ( TRACE_RLC_UM_DAR False )
set ( TRACE_RLC_UM_DISPLAY_ASCII_DATA False )
set ( TRACE_RLC_UM_PDU False )
set ( TRACE_RLC_UM_RX False )
set ( TRACE_RLC_UM_SEGMENT False )
set ( TRACE_RLC_UM_TX_STATUS False )
set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
set ( USE_MME False )
set ( USER_MODE True )
set ( XER_PRINT False )
set ( XFORMS False )
set(PACKAGE_NAME "lte-softmodem")
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_USE_NAS False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
set ( EMOS False )
set ( ENABLE_FXP True )
set ( ENABLE_ITTI False )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
set ( ENABLE_PGM_TRANSPORT False )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME False )
set ( ENABLE_VCD_FIFO True )
set ( ENB_MODE True )
set ( EPC_BUILD False )
set ( HARD_RT False )
set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
set ( LINUX False )
set ( LINUX_LIST False )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MESSAGE_CHART_GENERATOR False )
set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
set ( MESSAGE_CHART_GENERATOR_PHY False )
set ( MIH_C_MEDIEVAL_EXTENSIONS True )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
set ( NAS_BUILT_IN_EPC False )
set ( NAS_BUILT_IN_UE False )
set ( NAS_MME False )
set ( NAS_NETLINK False )
set ( NAS_UE False )
set ( NB_ANTENNAS_RX 2 )
set ( NB_ANTENNAS_TX 2 )
set ( NB_ANTENNAS_TXRX 2 )
set ( NEW_FFT True )
set ( NO_RRM True )
set ( OAI_EMU False )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK False )
set ( OAISIM False )
set ( OPENAIR1 True )
set ( OPENAIR2 True )
set ( OPENAIR_EMU False )
set ( OPENAIR_LTE True )
set ( PBS_SIM False )
set ( PC_DSP True )
set ( PC_TARGET True )
set ( PDCP_MSG_PRINT False )
set ( PDCP_USE_NETLINK False )
set ( PDCP_USE_NETLINK_QUEUES False )
set ( PERFECT_CE False )
set ( PHY_ABSTRACTION False )
set ( PHY_CONTEXT 1 )
set ( PHY_EMUL False )
set ( PHYSIM True )
set ( PUCCH True )
set ( RANDOM_BF False )
set ( RF_BOARD EXMIMO )
set ( RLC_STOP_ON_LOST_PDU False )
set ( RRC_ASN1_VERSION Rel8 )
set ( RRC_DEFAULT_RAB_IS_AM False )
set ( RRC_MSG_PRINT False )
set ( RTAI False )
set ( S1AP_LIMIT_STREAM_ID_TO_1 False )
set ( S1AP_VERSION R10 )
set ( SMBV False )
set ( SPECTRA False )
set ( STOP_ON_IP_TRAFFIC_OVERLOAD False )
set ( TEST_OMG False )
set ( TRACE_RLC_AM_BO False )
set ( TRACE_RLC_AM_FREE_SDU False )
set ( TRACE_RLC_AM_HOLE False )
set ( TRACE_RLC_AM_PDU False )
set ( TRACE_RLC_AM_RESEGMENT False )
set ( TRACE_RLC_AM_RX_DECODE False )
set ( TRACE_RLC_AM_RX False )
set ( TRACE_RLC_AM_STATUS_CREATION False )
set ( TRACE_RLC_AM_TX False )
set ( TRACE_RLC_AM_TX_STATUS False )
set ( TRACE_RLC_PAYLOAD False )
set ( TRACE_RLC_UM_DAR False )
set ( TRACE_RLC_UM_DISPLAY_ASCII_DATA False )
set ( TRACE_RLC_UM_PDU False )
set ( TRACE_RLC_UM_RX False )
set ( TRACE_RLC_UM_SEGMENT False )
set ( TRACE_RLC_UM_TX_STATUS False )
set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
set ( USE_MME False )
set ( USER_MODE True )
set ( XER_PRINT False )
set ( XFORMS False )
set(PACKAGE_NAME "lte-softmodem")
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
cmake_minimum_required(VERSION 2.8)
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_USE_NAS False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
set ( EMOS False )
set ( ENABLE_FXP True )
set ( ENABLE_ITTI False )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
set ( ENABLE_PGM_TRANSPORT False )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME False )
set ( ENABLE_VCD_FIFO True )
set ( ENB_MODE True )
set ( EPC_BUILD False )
set ( HARD_RT False )
set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
set ( LINUX False )
set ( LINUX_LIST False )
set ( LOCALIZATION False )
set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
set ( MESSAGE_CHART_GENERATOR False )
set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
set ( MESSAGE_CHART_GENERATOR_PHY False )
set ( MIH_C_MEDIEVAL_EXTENSIONS True )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
set ( NAS_BUILT_IN_EPC False )
set ( NAS_BUILT_IN_UE False )
set ( NAS_MME False )
set ( NAS_NETLINK False )
set ( NAS_UE False )
set ( NB_ANTENNAS_RX 2 )
set ( NB_ANTENNAS_TX 2 )
set ( NB_ANTENNAS_TXRX 2 )
set ( NEW_FFT True )
set ( NO_RRM True )
set ( OAI_EMU False )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK False )
set ( OAISIM False )
set ( OPENAIR1 True )
set ( OPENAIR2 True )
set ( OPENAIR_EMU False )
set ( OPENAIR_LTE True )
set ( PBS_SIM False )
set ( PC_DSP True )
set ( PC_TARGET True )
set ( PDCP_MSG_PRINT False )
set ( PDCP_USE_NETLINK False )
set ( PDCP_USE_NETLINK_QUEUES False )
set ( PERFECT_CE False )
set ( PHY_ABSTRACTION False )
set ( PHY_CONTEXT 1 )
set ( PHY_EMUL False )
set ( PHYSIM True )
set ( PUCCH True )
set ( RANDOM_BF False )
set ( RF_BOARD OAI_USRP )
set ( RLC_STOP_ON_LOST_PDU False )
set ( RRC_ASN1_VERSION Rel10 )
set ( RRC_DEFAULT_RAB_IS_AM False )
set ( RRC_MSG_PRINT False )
set ( RTAI False )
set ( S1AP_LIMIT_STREAM_ID_TO_1 False )
set ( S1AP_VERSION R10 )
set ( SMBV False )
set ( SPECTRA False )
set ( STOP_ON_IP_TRAFFIC_OVERLOAD False )
set ( TEST_OMG False )
set ( TRACE_RLC_AM_BO False )
set ( TRACE_RLC_AM_FREE_SDU False )
set ( TRACE_RLC_AM_HOLE False )
set ( TRACE_RLC_AM_PDU False )
set ( TRACE_RLC_AM_RESEGMENT False )
set ( TRACE_RLC_AM_RX_DECODE False )
set ( TRACE_RLC_AM_RX False )
set ( TRACE_RLC_AM_STATUS_CREATION False )
set ( TRACE_RLC_AM_TX False )
set ( TRACE_RLC_AM_TX_STATUS False )
set ( TRACE_RLC_PAYLOAD False )
set ( TRACE_RLC_UM_DAR False )
set ( TRACE_RLC_UM_DISPLAY_ASCII_DATA False )
set ( TRACE_RLC_UM_PDU False )
set ( TRACE_RLC_UM_RX False )
set ( TRACE_RLC_UM_SEGMENT False )
set ( TRACE_RLC_UM_TX_STATUS False )
set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
set ( USE_MME False )
set ( USER_MODE True )
set ( XER_PRINT False )
set ( XFORMS False )
set(PACKAGE_NAME "lte-softmodem")
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
......@@ -46,8 +46,6 @@ int trx_brf_init(openair0_device *openair0) {
}
openair0_timestamp trx_get_timestamp(openair0_device *device) {
int status;
......@@ -68,23 +66,44 @@ int trx_brf_start(openair0_device *openair0) {
return 0;
}
static void trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp, void **buff, int nsamps, int cc) {
static void trx_brf_stats(openair0_device *device){
}
static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp, void **buff, int nsamps, int cc) {
int status;
int status, i;
brf_state_t *brf = (brf_state_t*)device->priv;
/* BRF has only 1 rx/tx chaine : is it correct? */
void *samples = (void*)buff[0];
brf->meta_tx.timestamp= ptimestamp;
//brf->meta_tx.flags |= BLADERF_META_FLAG_TX_NOW;
status = bladerf_sync_tx(brf->dev, samples, (unsigned int) nsamps, &brf->meta_tx, brf->timeout_ms);
//brf->meta_tx.flags &= ~BLADERF_META_FLAG_TX_NOW;
brf->meta_tx.flags = BLADERF_META_FLAG_TX_BURST_START |
BLADERF_META_FLAG_TX_NOW |
BLADERF_META_FLAG_TX_BURST_END;
brf->meta_tx.timestamp= (uint64_t) ptimestamp;
status = bladerf_sync_tx(brf->dev, samples, (unsigned int) nsamps, &brf->meta_tx, 2*brf->tx_timeout_ms);
if (status != 0) {
fprintf(stderr, "Failed to TX sample: %s\n", bladerf_strerror(status));
fprintf(stderr,"Failed to TX sample: %s\n", bladerf_strerror(status));
brf->num_tx_errors++;
brf_error(status);
}
} else if (brf->meta_tx.status & BLADERF_META_STATUS_UNDERRUN){
/* libbladeRF does not report this status. It is here for future use. */
fprintf(stderr, "TX Underrun detected. %u valid samples were read.\n", brf->meta_tx.actual_count);
brf->num_underflows++;
}
// printf("tx status %d \n",brf->meta_tx.status);
brf->tx_current_ts=brf->meta_tx.timestamp;
brf->tx_actual_nsamps+=brf->meta_tx.actual_count;
brf->tx_nsamps+=nsamps;
brf->tx_count++;
return(0);
}
static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
......@@ -95,22 +114,26 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
// BRF has only one rx/tx chain
void *samples = (void*)buff[0];
brf->meta_rx.flags |= BLADERF_META_FLAG_RX_NOW;
status = bladerf_sync_rx(brf->dev, samples, (unsigned int) nsamps, &brf->meta_rx, brf->timeout_ms);
status = bladerf_sync_rx(brf->dev, samples, (unsigned int) nsamps, &brf->meta_rx, 2*brf->rx_timeout_ms);
if (status != 0) {
fprintf(stderr, "RX failed: %s\n", bladerf_strerror(status));
brf->num_rx_errors++;
} else if ( brf->meta_rx.status & BLADERF_META_STATUS_OVERRUN) {
brf->num_overflows++;
fprintf(stderr, "RX overrun (%d) in read @ t=0x%"PRIu64". Got %u samples. nsymps %d\n",
fprintf(stderr, "RX overrun (%d) is detected. t=0x%"PRIu64". Got %u samples. nsymps %d\n",
brf->num_overflows,brf->meta_rx.timestamp, brf->meta_rx.actual_count, nsamps);
//brf->meta_rx.timestamp=(unsigned int)(nsamps-brf->meta_rx.actual_count);
} //else printf("[BRF] (buff %p) ts=0x%"PRIu64" %s\n",samples, brf->meta_rx.timestamp,bladerf_strerror(status));
}
//printf("[BRF] (buff %p) ts=0x%"PRIu64" %s\n",samples, brf->meta_rx.timestamp,bladerf_strerror(status));
brf->rx_current_ts=brf->meta_rx.timestamp;
brf->rx_actual_nsamps+=brf->meta_rx.actual_count;
brf->rx_nsamps+=nsamps;
brf->rx_count++;
brf->rx_actual_count+=brf->meta_rx.actual_count;
brf->rx_count+=nsamps;
*ptimestamp = brf->meta_rx.timestamp;
return brf->meta_rx.actual_count;
......@@ -162,7 +185,6 @@ int trx_brf_set_gains(openair0_device* device) {
}
int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
int status;
......@@ -171,16 +193,16 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
brf_state_t *brf = (brf_state_t*)malloc(sizeof(brf_state_t));
memset(brf, 0, sizeof(brf_state_t));
// init required params for BRF
//brf->dev_model = ;
brf->num_buffers = 128;
brf->buffer_size = (unsigned int)openair0_cfg[card].samples_per_packet*sizeof(int32_t); // buffer size = 4096 for sample_len of 1024
brf->num_transfers = 16;
brf->timeout_ms = 0;
brf->num_buffers = 128;
brf->buffer_size = (unsigned int) openair0_cfg[card].samples_per_packet*sizeof(int32_t); // buffer size = 4096 for sample_len of 1024
brf->num_transfers = 16;
brf->rx_timeout_ms = 0;
brf->tx_timeout_ms = 0;
brf->sample_rate=(unsigned int)openair0_cfg[card].sample_rate;
printf("\n[BRF] sampling_rate %d, num_buffers %d, buffer_size %d, num transfer %d, timeout_ms %d\n",
brf->sample_rate, brf->num_buffers, brf->buffer_size,brf->num_transfers, brf->timeout_ms);
printf("\n[BRF] sampling_rate %d, num_buffers %d, buffer_size %d, num transfer %d, timeout_ms (rx %d, tx %d)\n",
brf->sample_rate, brf->num_buffers, brf->buffer_size,brf->num_transfers, brf->rx_timeout_ms, brf->tx_timeout_ms);
if ((status=bladerf_open(&brf->dev, "")) != 0 ) {
fprintf(stderr,"Failed to open brf device: %s\n",bladerf_strerror(status));
......@@ -225,7 +247,7 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
/* Configure the device's RX module for use with the sync interface.
* SC16 Q11 samples *with* metadata are used. */
if ((status=bladerf_sync_config(brf->dev, BLADERF_MODULE_RX, BLADERF_FORMAT_SC16_Q11_META,brf->num_buffers,brf->buffer_size,brf->num_transfers,brf->timeout_ms)) != 0 ) {
if ((status=bladerf_sync_config(brf->dev, BLADERF_MODULE_RX, BLADERF_FORMAT_SC16_Q11_META,brf->num_buffers,brf->buffer_size,brf->num_transfers,brf->rx_timeout_ms)) != 0 ) {
fprintf(stderr,"Failed to configure RX sync interface: %s\n", bladerf_strerror(status));
brf_error(status);
}else
......@@ -267,7 +289,7 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
/* Configure the device's TX module for use with the sync interface.
* SC16 Q11 samples *with* metadata are used. */
if ((status=bladerf_sync_config(brf->dev, BLADERF_MODULE_TX,BLADERF_FORMAT_SC16_Q11_META,brf->num_buffers,brf->buffer_size,brf->num_transfers,brf->timeout_ms)) != 0 ) {
if ((status=bladerf_sync_config(brf->dev, BLADERF_MODULE_TX,BLADERF_FORMAT_SC16_Q11_META,brf->num_buffers,brf->buffer_size,brf->num_transfers,brf->tx_timeout_ms)) != 0 ) {
fprintf(stderr,"Failed to configure TX sync interface: %s\n", bladerf_strerror(status));
brf_error(status);
}else
......@@ -279,7 +301,7 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
fprintf(stderr,"Failed to enable TX module: %s\n", bladerf_strerror(status));
brf_error(status);
} else
printf("[BRF] RX module enabled \n");
printf("[BRF] TX module enabled \n");
bladerf_log_set_verbosity(get_brf_log_level(openair0_cfg[card].log_level));
......@@ -302,14 +324,11 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
int brf_error(int status) {
exit(-1);
//exit(-1);
//return 1; // or status error code
}
int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg) {
return 0;
}
struct bladerf * open_bladerf_from_serial(const char *serial) {
......@@ -340,7 +359,7 @@ struct bladerf * open_bladerf_from_serial(const char *serial) {
int get_brf_log_level(int log_level){
int level=BLADERF_LOG_LEVEL_INFO;
return BLADERF_LOG_LEVEL_DEBUG;
//return BLADERF_LOG_LEVEL_DEBUG;
switch(log_level) {
case LOG_DEBUG:
level=BLADERF_LOG_LEVEL_DEBUG;
......
......@@ -46,7 +46,8 @@ typedef struct {
unsigned int num_buffers;
unsigned int buffer_size;
unsigned int num_transfers;
unsigned int timeout_ms;
unsigned int rx_timeout_ms;
unsigned int tx_timeout_ms;
struct bladerf_metadata meta_rx;
struct bladerf_metadata meta_tx;
......@@ -67,8 +68,12 @@ typedef struct {
int num_rx_errors;
int num_tx_errors;
uint64_t tx_actual_count;
uint64_t rx_actual_count;
uint64_t tx_current_ts;
uint64_t rx_current_ts;
uint64_t tx_actual_nsamps;
uint64_t rx_actual_nsamps;
uint64_t tx_nsamps;
uint64_t rx_nsamps;
uint64_t tx_count;
uint64_t rx_count;
openair0_timestamp rx_timestamp;
......
......@@ -118,10 +118,11 @@ static void trx_usrp_end(openair0_device *device)
s->rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
//send a mini EOB packet
s->tx_md.end_of_burst = true;
s->tx_stream->send("", 0, s->tx_md);
s->tx_md.end_of_burst = false;
//send a mini EOB packet
s->tx_md.end_of_burst = true;
s->tx_stream->send("", 0, s->tx_md);
s->tx_md.end_of_burst = false;
}
static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags)
......
......@@ -28,7 +28,7 @@ eNBs =
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2660000000L;
downlink_frequency = 2680000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
......
......@@ -1026,24 +1026,30 @@ static void* eNB_thread_tx( void* param )
#ifdef LOWLATENCY
struct sched_attr attr;
unsigned int flags = 0;
uint64_t runtime = (uint64_t) (get_runtime_tx(proc->subframe, runtime_phy_tx, target_dl_mcs,frame_parms[0]->N_RB_DL,cpuf,PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx) * 1000000);
uint64_t deadline = 1 * 1000000; // each tx thread will finish within 1ms
uint64_t period = 1 * 10000000; // each tx thread has a period of 10ms from the starting point
if (runtime > 1000000 ){
LOG_W(HW,"estimated runtime %d is larger than 1ms, adjusting\n",runtime);
runtime = (0.97 * 100) * 10000;
}
attr.size = sizeof(attr);
attr.sched_flags = 0;
attr.sched_nice = 0;
attr.sched_priority = 0;
attr.sched_policy = SCHED_DEADLINE;
//attr.sched_runtime = 0.9 * 1000000; // each tx thread requires 1ms to finish its job
attr.sched_runtime = (uint64_t) (get_runtime_tx(proc->subframe, runtime_phy_tx, target_dl_mcs,frame_parms[0]->N_RB_DL,cpuf,PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx) * 1000000); // each tx thread requires 1ms to finish its job
attr.sched_deadline = 1 * 1000000; // each tx thread will finish within 1ms
attr.sched_period = 1 * 10000000; // each tx thread has a period of 10ms from the starting point
attr.sched_policy = SCHED_DEADLINE;
attr.sched_runtime = runtime;
attr.sched_deadline = deadline;
attr.sched_period = period;
if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB tx thread: sched_setattr failed\n");
return &eNB_thread_tx_status[proc->subframe];
}
LOG_I( HW, "[SCHED] eNB TX deadline thread %d(Tid %ld) started on CPU %d\n", proc->subframe, gettid(), sched_getcpu() );
LOG_I( HW, "[SCHED] eNB TX deadline thread %d(TID %ld) started on CPU %d\n", proc->subframe, gettid(), sched_getcpu() );
#else
LOG_I( HW, "[SCHED][eNB] TX thread %d started on CPU %d TID %d\n", proc->subframe, sched_getcpu(),gettid() );
#endif
......@@ -1227,17 +1233,24 @@ static void* eNB_thread_rx( void* param )
#ifdef LOWLATENCY
struct sched_attr attr;
unsigned int flags = 0;
uint64_t runtime = get_runtime_rx(proc->subframe, runtime_phy_rx, target_ul_mcs,frame_parms[0]->N_RB_DL,cpuf,PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_rx) * 1000000;
uint64_t deadline = 1 * 1000000;
uint64_t period = 1 * 10000000; // each rx thread has a period of 10ms from the starting point
if (runtime > 2300000 ) {
LOG_W(HW,"estimated rx runtime %d is larger than expected, adjusting\n",runtime);
runtime = 2300000;
deadline = runtime + 100000;
}
attr.size = sizeof(attr);
attr.sched_flags = 0;
attr.sched_nice = 0;
attr.sched_priority = 0;
/* This creates a 2ms reservation every 10ms period*/
attr.sched_policy = SCHED_DEADLINE;
attr.sched_runtime = (uint64_t)(get_runtime_rx(proc->subframe, runtime_phy_rx, target_ul_mcs,frame_parms[0]->N_RB_DL,cpuf,PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_rx) * 1000000); // each tx thread requires 1ms to finish its job
attr.sched_deadline = 1 * 1000000; // each rx thread will finish within 2ms
attr.sched_period = 1 * 10000000; // each rx thread has a period of 10ms from the starting point
attr.sched_runtime = runtime;
attr.sched_deadline = deadline;
attr.sched_period = period;
if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB RX sched_setattr failed\n");
......@@ -1354,17 +1367,18 @@ void init_eNB_proc(void)
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (i=0; i<NUM_ENB_THREADS; i++) {
// set the stack size
pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] );
/*
if (pthread_attr_setstacksize( &attr_eNB_proc_tx[CC_id][i], PTHREAD_STACK_MIN ) != 0)
perror("[ENB_PROC_TX] setting thread stack size failed\n");
#ifndef LOWLATENCY
/*
pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] );
if (pthread_attr_setstacksize( &attr_eNB_proc_tx[CC_id][i], 64 *PTHREAD_STACK_MIN ) != 0)
perror("[ENB_PROC_TX] setting thread stack size failed\n");
pthread_attr_init( &attr_eNB_proc_rx[CC_id][i] );
if (pthread_attr_setstacksize( &attr_eNB_proc_rx[CC_id][i], PTHREAD_STACK_MIN ) != 0)
if (pthread_attr_setstacksize( &attr_eNB_proc_rx[CC_id][i], 64 * PTHREAD_STACK_MIN ) != 0)
perror("[ENB_PROC_RX] setting thread stack size failed\n");
*/
#ifndef LOWLATENCY
// set the kernel scheduling policy and priority
sched_param_eNB_proc_tx[CC_id][i].sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&attr_eNB_proc_tx[CC_id][i], &sched_param_eNB_proc_tx[CC_id][i]);
......@@ -1562,7 +1576,7 @@ static void* eNB_thread( void* arg )
/* This creates a .2 ms reservation */
attr.sched_policy = SCHED_DEADLINE;
attr.sched_runtime = (0.2 * 100) * 10000;
attr.sched_runtime = (0.3 * 100) * 10000;
attr.sched_deadline = (0.9 * 100) * 10000;
attr.sched_period = 1 * 1000000;
......@@ -1761,7 +1775,7 @@ static void* eNB_thread( void* arg )
stop_meas( &softmodem_stats_hw );
clock_gettime( CLOCK_MONOTONIC, &trx_time1 );
if (frame > 10){
if (frame > 20){
if (rxs != spp)
exit_fun( "problem receiving samples" );
}
......@@ -1770,22 +1784,22 @@ static void* eNB_thread( void* arg )
// Transmit TX buffer based on timestamp from RX
if (frame > 50) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
// prepare tx buffer pointers
for (i=0; i<PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx; i++){
txp[i] = (void*)&rxdata[i][tx_pos];
//printf("tx_pos %d ts %d, ts_offset %d txp[i] %p, ap %d\n", tx_pos, timestamp, (timestamp+(tx_delay*spp)-tx_forward_nsamps),txp[i], i);
if (frame > 50) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
// prepare tx buffer pointers
for (i=0; i<PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx; i++){
txp[i] = (void*)&rxdata[i][tx_pos];
//printf("tx_pos %d ts %d, ts_offset %d txp[i] %p, ap %d\n", tx_pos, timestamp, (timestamp+(tx_delay*spp)-tx_forward_nsamps),txp[i], i);
// if symb_written < spp ==> error
openair0.trx_write_func(&openair0,
(timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps),
txp,
spp,
i,
1);
(timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps),
txp,
spp,
i,
1);
}
}
}
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, timestamp&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps)&0xffffffff );
......@@ -2857,8 +2871,8 @@ int main( int argc, char **argv )
openair0_cfg[card].tx_forward_nsamps = 70;
openair0_cfg[card].tx_delay = 6;
#elif OAI_BLADERF
openair0_cfg[card].tx_forward_nsamps = 70;
openair0_cfg[card].tx_delay = 6;
openair0_cfg[card].tx_forward_nsamps = 0;
openair0_cfg[card].tx_delay = 8;
#endif
#endif
} else if (frame_parms[0]->N_RB_DL == 6) {
......@@ -3426,6 +3440,8 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0_stop(0);
printf("closing openair0_lib\n");
openair0_close();
#else
openair0.trx_end_func(&openair0);
#endif
#ifdef EMOS
......
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