Merge branch 'next' into next_paul_libs

This commit is contained in:
Paul Sutton 2017-06-08 11:26:33 +01:00
commit 07d8997395
15 changed files with 68 additions and 50 deletions

View File

@ -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")

View File

@ -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) {

View File

@ -76,7 +76,7 @@ public:
{
printf("%d buffers in queue\n", (int) used.size());
for (uint32_t i=0;i<used.size();i++) {
printf("%s\n", used[i]->debug_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

View File

@ -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)
{

View File

@ -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})

View File

@ -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})

View File

@ -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;i<e_bits;i++) {
mean += fabsf(q->llr[i]);
}
mean /= e_bits;
printf("power %f\n",mean);
ret = SRSLTE_SUCCESS;
}
return ret;

View File

@ -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;

View File

@ -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;i<len;i++) {
y[lut[i]] = x[i];
}
#else
srslte_vec_lut_sss_sse(x, lut, y, len);
#endif
#endif
}
void srslte_vec_interleave_cf(float *real, float *imag, cf_t *x, uint32_t len) {
#ifdef HAVE_VOLK_INTERLEAVE_FUNCTION
#ifdef HAVE_VOLK_INTERLEAVE_FUNCTION
volk_32f_x2_interleave_32fc(x, real, imag, len);
#else
int i;
@ -320,7 +323,7 @@ void srslte_vec_interleave_cf(float *real, float *imag, cf_t *x, uint32_t len) {
}
void srslte_vec_deinterleave_cf(cf_t *x, float *real, float *imag, uint32_t len) {
#ifdef HAVE_VOLK_DEINTERLEAVE_FUNCTION
#ifdef HAVE_VOLK_DEINTERLEAVE_FUNCTION
volk_32fc_deinterleave_32f_x2(real, imag, x, len);
#else
int i;
@ -517,8 +520,6 @@ void srslte_vec_prod_fff(float *x, float *y, float *z, uint32_t len) {
}
void srslte_vec_prod_sss(short *x, short *y, short *z, uint32_t len) {
#ifdef LV_HAVE_AVX
srslte_vec_prod_sss_avx(x,y,z,len);
#else

View File

@ -21,3 +21,4 @@
file(GLOB SOURCES "*.cc")
add_library(srsenb_upper STATIC ${SOURCES})
install(TARGETS srsenb_upper DESTINATION ${LIBRARY_DIR})

View File

@ -48,7 +48,7 @@ public:
uint8_t* request_buffer(uint32_t pid, uint32_t len);
void deallocate(uint8_t* payload_buffer_ptr);
void push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes);
void push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp);
void push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes);
void set_uecrid_callback(bool (*callback)(void*, uint64_t), void *arg);

View File

@ -34,7 +34,6 @@ target_link_libraries(srsue srsue_mac
srslte_phy
srslte_upper
srslte_radio
${LIBLTE_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES})

View File

@ -117,10 +117,10 @@ void demux::push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes)
* This function enqueues the packet and returns quicly because ACK
* deadline is important here.
*/
void demux::push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes)
void demux::push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp)
{
if (pid < NOF_HARQ_PID) {
return pdus.push(buff, nof_bytes);
return pdus.push(buff, nof_bytes, tstamp);
} else if (pid == NOF_HARQ_PID) {
/* Demultiplexing of MAC PDU associated with SI-RNTI. The PDU passes through
* the MAC in transparent mode.

View File

@ -300,7 +300,7 @@ void dl_harq_entity::dl_harq_process::tb_decoded(bool ack_)
harq_entity->pcap->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++);
}
}
}

View File

@ -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);