diff --git a/CMakeLists.txt b/CMakeLists.txt index ebf00eb5e..83ebeb618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ option(ENABLE_BLADERF "Enable BladeRF" ON) option(BUILD_STATIC "Attempt to statically link external deps" OFF) option(RPATH "Enable RPATH" OFF) +option(USE_LTE_RATES "Use standard LTE sampling rates" OFF) set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.") @@ -89,18 +90,6 @@ else(POLARSSL_FOUND) endif (MBEDTLS_FOUND) endif(POLARSSL_FOUND) -find_package(MKL) -if(MKL_FOUND) - include_directories(${MKL_INCLUDE_DIRS}) - link_directories(${MKL_LIBRARY_DIRS}) -else(MKL_FOUND) - find_package(FFTW3F REQUIRED) - if(FFTW3F_FOUND) - include_directories(${FFTW3F_INCLUDE_DIRS}) - link_directories(${FFTW3F_LIBRARY_DIRS}) - endif(FFTW3F_FOUND) -endif(MKL_FOUND) - find_package(UHD) if(UHD_FOUND) include_directories(${UHD_INCLUDE_DIRS}) @@ -235,6 +224,11 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") + if (USE_LTE_RATES) + message(STATUS "Using standard LTE sampling rates") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFORCE_STANDARD_RATE") + endif (USE_LTE_RATES) + find_package(SSE) if (HAVE_AVX2) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE") diff --git a/lib/examples/usrp_capture_sync.c b/lib/examples/usrp_capture_sync.c index 6938ee878..6d2ec18dc 100644 --- a/lib/examples/usrp_capture_sync.c +++ b/lib/examples/usrp_capture_sync.c @@ -100,7 +100,7 @@ void parse_args(int argc, char **argv) { int srslte_rf_recv_wrapper(void *h, cf_t *data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t *t) { DEBUG(" ---- Receive %d samples ---- \n", nsamples); - return srslte_rf_recv(h, data[2], nsamples, 1); + return srslte_rf_recv(h, data[0], nsamples, 1); } int main(int argc, char **argv) { diff --git a/lib/include/srslte/common/buffer_pool.h b/lib/include/srslte/common/buffer_pool.h index 182c287e3..eec35b79a 100644 --- a/lib/include/srslte/common/buffer_pool.h +++ b/lib/include/srslte/common/buffer_pool.h @@ -76,7 +76,7 @@ public: { printf("%d buffers in queue\n", (int) used.size()); for (uint32_t i=0;idebug_name?used[i]->debug_name:"Undefined"); + printf("%s\n", strlen(used[i]->debug_name)?used[i]->debug_name:"Undefined"); } } @@ -97,7 +97,8 @@ public: } #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED if (debug_name) { - strncpy(b->debug_name, debug_name, 128); + strncpy(b->debug_name, debug_name, SRSLTE_BUFFER_POOL_LOG_NAME_LEN); + b->debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN-1] = 0; } #endif diff --git a/lib/include/srslte/common/common.h b/lib/include/srslte/common/common.h index d1f2f770f..5f13ab214 100644 --- a/lib/include/srslte/common/common.h +++ b/lib/include/srslte/common/common.h @@ -54,6 +54,7 @@ #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #define pool_allocate (pool->allocate(__FUNCTION__)) +#define SRSLTE_BUFFER_POOL_LOG_NAME_LEN 128 #else #define pool_allocate (pool->allocate()) #endif @@ -121,7 +122,7 @@ public: uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BYTES]; uint8_t *msg; #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED - char debug_name[128]; + char debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN]; #endif byte_buffer_t():N_bytes(0) @@ -129,6 +130,9 @@ public: timestamp_is_set = false; msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; next = NULL; +#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED + debug_name[0] = 0; +#endif } byte_buffer_t(const byte_buffer_t& buf) { diff --git a/lib/src/common/CMakeLists.txt b/lib/src/common/CMakeLists.txt index bd6ca7556..723085e24 100644 --- a/lib/src/common/CMakeLists.txt +++ b/lib/src/common/CMakeLists.txt @@ -20,7 +20,9 @@ file(GLOB CXX_SOURCES "*.cc") file(GLOB C_SOURCES "*.c") + add_library(srslte_common STATIC ${C_SOURCES} ${CXX_SOURCES}) +target_include_directories(srslte_common PUBLIC ${SEC_INCLUDE_DIRS}) target_link_libraries(srslte_common ${SEC_LIBRARIES}) install(TARGETS srslte_common DESTINATION ${LIBRARY_DIR}) diff --git a/lib/src/phy/CMakeLists.txt b/lib/src/phy/CMakeLists.txt index c253fd525..a0b5cd516 100644 --- a/lib/src/phy/CMakeLists.txt +++ b/lib/src/phy/CMakeLists.txt @@ -63,6 +63,19 @@ if(NOT DisableMEX) add_library(srslte_phy_static STATIC ${srslte_srcs}) endif(NOT DisableMEX) +find_package(MKL) +if(MKL_FOUND) + include_directories(${MKL_INCLUDE_DIRS}) + link_directories(${MKL_LIBRARY_DIRS}) +else(MKL_FOUND) + find_package(FFTW3F REQUIRED) + if(FFTW3F_FOUND) + include_directories(${FFTW3F_INCLUDE_DIRS}) + link_directories(${FFTW3F_LIBRARY_DIRS}) + endif(FFTW3F_FOUND) +endif(MKL_FOUND) + + if(MKL_FOUND) if(STATIC_MKL) target_link_libraries(srslte_phy ${MKL_STATIC_LIBRARIES}) diff --git a/lib/src/phy/phch/pdcch.c b/lib/src/phy/phch/pdcch.c index 6ff788cec..cfdb19621 100644 --- a/lib/src/phy/phch/pdcch.c +++ b/lib/src/phy/phch/pdcch.c @@ -473,13 +473,6 @@ int srslte_pdcch_extract_llr_multi(srslte_pdcch_t *q, cf_t *sf_symbols[SRSLTE_MA /* descramble */ srslte_scrambling_f_offset(&q->seq[nsubframe], q->llr, 0, e_bits); - float mean = 0; - for (int i=0;illr[i]); - } - mean /= e_bits; - printf("power %f\n",mean); - ret = SRSLTE_SUCCESS; } return ret; diff --git a/lib/src/phy/ue/ue_sync.c b/lib/src/phy/ue/ue_sync.c index 3d13c6176..b5b2be3d0 100644 --- a/lib/src/phy/ue/ue_sync.c +++ b/lib/src/phy/ue/ue_sync.c @@ -78,8 +78,17 @@ int srslte_ue_sync_init_file(srslte_ue_sync_t *q, uint32_t nof_prb, char *file_n } INFO("Offseting input file by %d samples and %.1f kHz\n", offset_time, offset_freq/1000); - - srslte_filesource_read(&q->file_source, dummy_offset_buffer, offset_time); + + if (offset_time) { + cf_t *file_offset_buffer = srslte_vec_malloc(offset_time * sizeof(cf_t)); + if (!file_offset_buffer) { + perror("malloc"); + goto clean_exit; + } + srslte_filesource_read(&q->file_source, file_offset_buffer, offset_time); + free(file_offset_buffer); + } + srslte_ue_sync_reset(q); ret = SRSLTE_SUCCESS; diff --git a/lib/src/phy/utils/vector.c b/lib/src/phy/utils/vector.c index d1961011e..26be1b2b4 100644 --- a/lib/src/phy/utils/vector.c +++ b/lib/src/phy/utils/vector.c @@ -39,6 +39,13 @@ #include "volk/volk.h" #endif +#ifdef DEBUG_MODE +#warning FIXME: Disabling SSE/AVX vector code +#undef LV_HAVE_SSE +#undef LV_HAVE_AVX +#endif + + int srslte_vec_acc_ii(int *x, uint32_t len) { int i; int z=0; @@ -295,21 +302,17 @@ void srslte_vec_lut_fuf(float *x, uint32_t *lut, float *y, uint32_t len) { } void srslte_vec_lut_sss(short *x, unsigned short *lut, short *y, uint32_t len) { -#ifdef DEBUG_MODE -#warning FIXME: Disabling SSE/AVX in srslte_vec_lut_sss -#else -#ifdef LV_HAVE_SSE +#ifndef LV_HAVE_SSE for (int i=0;ipcap->write_dl_sirnti(payload_buffer_ptr, cur_grant.n_bytes, ack, cur_grant.tti); } Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (BCCH)\n", cur_grant.n_bytes); - harq_entity->demux_unit->push_pdu(pid, payload_buffer_ptr, cur_grant.n_bytes); + harq_entity->demux_unit->push_pdu(pid, payload_buffer_ptr, cur_grant.n_bytes, cur_grant.tti); } else { if (harq_entity->pcap) { harq_entity->pcap->write_dl_crnti(payload_buffer_ptr, cur_grant.n_bytes, cur_grant.rnti, ack, cur_grant.tti); @@ -311,10 +311,10 @@ void dl_harq_entity::dl_harq_process::tb_decoded(bool ack_) harq_entity->demux_unit->push_pdu_temp_crnti(payload_buffer_ptr, cur_grant.n_bytes); } else { Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit\n", cur_grant.n_bytes); - harq_entity->demux_unit->push_pdu(pid, payload_buffer_ptr, cur_grant.n_bytes); - - // Compute average number of retransmissions per packet - harq_entity->average_retx = SRSLTE_VEC_CMA((float) n_retx, harq_entity->average_retx, harq_entity->nof_pkts++); + harq_entity->demux_unit->push_pdu(pid, payload_buffer_ptr, cur_grant.n_bytes, cur_grant.tti); + + // Compute average number of retransmissions per packet + harq_entity->average_retx = SRSLTE_VEC_CMA((float) n_retx, harq_entity->average_retx, harq_entity->nof_pkts++); } } } diff --git a/srsue/src/mac/proc_bsr.cc b/srsue/src/mac/proc_bsr.cc index db2e12c15..d93b7f0f4 100644 --- a/srsue/src/mac/proc_bsr.cc +++ b/srsue/src/mac/proc_bsr.cc @@ -82,7 +82,7 @@ void bsr_proc::timer_expired(uint32_t timer_id) { if (triggered_bsr_type == NONE) { // Check condition 4 in Sec 5.4.5 triggered_bsr_type = PERIODIC; - Info("BSR: Triggering Periodic BSR\n"); + Debug("BSR: Triggering Periodic BSR\n"); } break; case mac::BSR_TIMER_RETX: @@ -90,7 +90,7 @@ void bsr_proc::timer_expired(uint32_t timer_id) { int periodic = liblte_rrc_periodic_bsr_timer_num[mac_cfg->main.ulsch_cnfg.periodic_bsr_timer]; if (periodic >= 0) { triggered_bsr_type = REGULAR; - Info("BSR: Triggering BSR reTX\n"); + Debug("BSR: Triggering BSR reTX\n"); sr_is_sent = false; } break; @@ -121,7 +121,7 @@ bool bsr_proc::check_highest_channel() { if (nbytes > last_pending_data[pending_data_lcid]) { if (triggered_bsr_type != REGULAR) { - Info("BSR: Triggered REGULAR BSR for Max Priority LCID=%d\n", pending_data_lcid); + Debug("BSR: Triggered REGULAR BSR for Max Priority LCID=%d\n", pending_data_lcid); } triggered_bsr_type = REGULAR; return true; @@ -158,7 +158,7 @@ bool bsr_proc::check_single_channel() { // If there is new data available for this logical channel if (nbytes > last_pending_data[pending_data_lcid]) { triggered_bsr_type = REGULAR; - Info("BSR: Triggered REGULAR BSR for single LCID=%d\n", pending_data_lcid); + Debug("BSR: Triggered REGULAR BSR for single LCID=%d\n", pending_data_lcid); return true; } } @@ -336,8 +336,9 @@ bool bsr_proc::generate_padding_bsr(uint32_t nof_padding_bytes, bsr_t *bsr) } generate_bsr(bsr, nof_padding_bytes); ret = true; - Info("BSR: Including BSR type %s, format %s, nof_padding_bytes=%d\n", - bsr_type_tostring(triggered_bsr_type), bsr_format_tostring(bsr->format), nof_padding_bytes); + Info("BSR: Type %s, Format %s, Value=%d,%d,%d,%d\n", + bsr_type_tostring(triggered_bsr_type), bsr_format_tostring(bsr->format), + bsr->buff_size[0], bsr->buff_size[1], bsr->buff_size[2], bsr->buff_size[3]); if (timers_db->get(mac::BSR_TIMER_PERIODIC)->get_timeout() && bsr->format != TRUNC_BSR) { timers_db->get(mac::BSR_TIMER_PERIODIC)->reset(); @@ -369,7 +370,7 @@ bool bsr_proc::need_to_send_sr(uint32_t tti) { if (srslte_tti_interval(tti,next_tx_tti)>0 && srslte_tti_interval(tti,next_tx_tti) < 10240-4) { reset_sr = false; sr_is_sent = true; - Info("BSR: Need to send sr: sr_is_sent=true, reset_sr=false, tti=%d, next_tx_tti=%d\n", tti, next_tx_tti); + Debug("BSR: Need to send sr: sr_is_sent=true, reset_sr=false, tti=%d, next_tx_tti=%d\n", tti, next_tx_tti); return true; } else { Debug("BSR: Not sending SR because tti=%d, next_tx_tti=%d\n", tti, next_tx_tti);