Merge branch 'restruct_update' into restruct_update_paul

master
Andre Puschmann 8 years ago committed by GitHub
commit 1d1916d6e0

@ -203,10 +203,12 @@ endif(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-write-strings -Wno-format-extra-args -Winline -Wno-unused-result -Wno-format -std=c99 -D_GNU_SOURCE -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable")
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
find_package(SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -DDEBUG_MODE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -std=c++03")
if(HAVE_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
elseif(HAVE_SSE)
@ -214,14 +216,18 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif(HAVE_AVX)
else(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++03")
find_package(SSE)
if (HAVE_AVX2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx2 -Ofast -funroll-loops -DLV_HAVE_AVX -DLV_HAVE_SSE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
else (HAVE_AVX2)
if(HAVE_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx -Ofast -funroll-loops -DLV_HAVE_AVX -DLV_HAVE_SSE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
elseif(HAVE_SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -msse4.1 -Ofast -funroll-loops -DLV_HAVE_SSE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
endif(HAVE_AVX)
endif (HAVE_AVX2)
@ -289,6 +295,19 @@ include_directories(${PROJECT_SOURCE_DIR}/lib/include)
# Includes needed by all code previously resided in srsUE
include_directories(${PROJECT_SOURCE_DIR}/lib/include/srslte)
########################################################################
# Add headers to cmake project (useful for IDEs)
########################################################################
set(HEADERS_ALL "")
file(GLOB headers *)
foreach(_header ${headers})
if(IS_DIRECTORY ${_header})
file(GLOB_RECURSE tmp "${_header}/*.h")
list(APPEND HEADERS_ALL ${tmp})
endif(IS_DIRECTORY ${_header})
endforeach()
add_custom_target(add_srslte_headers SOURCES ${HEADERS_ALL})
########################################################################
# Add the subdirectories
########################################################################

@ -26,19 +26,6 @@ INSTALL(DIRECTORY include/
FILES_MATCHING PATTERN "*.h"
)
########################################################################
# Add headers to cmake project (useful for IDEs)
########################################################################
set(HEADERS_ALL "")
file(GLOB headers *)
FOREACH (_header ${headers})
if(IS_DIRECTORY ${_header})
file(GLOB_RECURSE tmp "${_header}/*.h")
list(APPEND HEADERS_ALL ${tmp})
endif(IS_DIRECTORY ${_header})
ENDFOREACH()
add_custom_target (add_srslte_headers SOURCES ${HEADERS_ALL})
########################################################################
# Find Dependencies
########################################################################

@ -121,8 +121,12 @@ struct LIBLTE_BYTE_MSG_STRUCT{
}
LIBLTE_BYTE_MSG_STRUCT & operator= (const LIBLTE_BYTE_MSG_STRUCT & buf)
{
// avoid self assignment
if (&buf == this)
return *this;
N_bytes = buf.N_bytes;
memcpy(msg, buf.msg, N_bytes);
return *this;
}
uint32 get_headroom()
{
@ -152,8 +156,12 @@ struct LIBLTE_BIT_MSG_STRUCT{
memcpy(msg, buf.msg, N_bits);
}
LIBLTE_BIT_MSG_STRUCT & operator= (const LIBLTE_BIT_MSG_STRUCT & buf){
// avoid self assignment
if (&buf == this)
return *this;
N_bits = buf.N_bits;
memcpy(msg, buf.msg, N_bits);
return *this;
}
uint32 get_headroom()
{

@ -4494,7 +4494,7 @@ typedef enum{
}LIBLTE_RRC_MAX_RETX_THRESHOLD_ENUM;
static const char liblte_rrc_max_retx_threshold_text[LIBLTE_RRC_MAX_RETX_THRESHOLD_N_ITEMS][20] = { "t1", "t2", "t3", "t4",
"t6", "t8", "t16", "t32"};
static const int32 liblte_rrc_max_retx_threshold_num[LIBLTE_RRC_MAX_RETX_THRESHOLD_N_ITEMS] = { 1, 2, 3, 4,
static const uint32_t liblte_rrc_max_retx_threshold_num[LIBLTE_RRC_MAX_RETX_THRESHOLD_N_ITEMS] = { 1, 2, 3, 4,
6, 8, 16, 32};
typedef enum{
LIBLTE_RRC_T_REORDERING_MS0 = 0,

@ -57,7 +57,7 @@ public:
buffer_pool(uint32_t nof_buffers = POOL_SIZE)
{
pthread_mutex_init(&mutex, NULL);
for(int i=0;i<nof_buffers;i++) {
for(uint32_t i=0;i<nof_buffers;i++) {
buffer_t *b = new buffer_t;
available.push(b);
}

@ -126,8 +126,12 @@ public:
}
byte_buffer_t & operator= (const byte_buffer_t & buf)
{
// avoid self assignment
if (&buf == this)
return *this;
N_bytes = buf.N_bytes;
memcpy(msg, buf.msg, N_bytes);
return *this;
}
void reset()
{
@ -187,8 +191,12 @@ struct bit_buffer_t{
memcpy(msg, buf.msg, N_bits);
}
bit_buffer_t & operator= (const bit_buffer_t & buf){
// avoid self assignment
if (&buf == this)
return *this;
N_bits = buf.N_bits;
memcpy(msg, buf.msg, N_bits);
return *this;
}
void reset()
{

@ -83,7 +83,7 @@ public:
}
bool new_subh() {
if (nof_subheaders < max_subheaders - 1 && rem_len > 0) {
if (nof_subheaders < (int)max_subheaders - 1 && rem_len > 0) {
nof_subheaders++;
next();
return true;
@ -169,7 +169,7 @@ private:
total_sdu_len = 0;
last_sdu_idx = -1;
reset();
for (int i=0;i<max_subheaders;i++) {
for (uint32_t i=0;i<max_subheaders;i++) {
subheaders[i].parent = this;
subheaders[i].init();
}

@ -106,22 +106,22 @@ public:
}
void step_all() {
for (int i=0;i<nof_timers;i++) {
for (uint32_t i=0;i<nof_timers;i++) {
get(i)->step();
}
}
void stop_all() {
for (int i=0;i<nof_timers;i++) {
for (uint32_t i=0;i<nof_timers;i++) {
get(i)->stop();
}
}
void run_all() {
for (int i=0;i<nof_timers;i++) {
for (uint32_t i=0;i<nof_timers;i++) {
get(i)->run();
}
}
void reset_all() {
for (int i=0;i<nof_timers;i++) {
for (uint32_t i=0;i<nof_timers;i++) {
get(i)->reset();
}
}

@ -134,7 +134,7 @@ private:
int32_t t_poll_retx; // Poll retx timeout (ms)
int32_t poll_pdu; // Insert poll bit after this many PDUs
int32_t poll_byte; // Insert poll bit after this much data (KB)
int32_t max_retx_thresh; // Max number of retx
uint32_t max_retx_thresh; // Max number of retx
// RX configs
int32_t t_reordering; // Timer used by rx to detect PDU loss (ms)

@ -126,7 +126,7 @@ struct rlc_amd_pdu_header_t{
lsf = h.lsf;
so = h.so;
N_li = h.N_li;
for(int i=0;i<h.N_li;i++)
for(uint32_t i=0;i<h.N_li;i++)
li[i] = h.li[i];
}
};

@ -18,7 +18,7 @@
# and at http://www.gnu.org/licenses/.
#
include_directories(hdr)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-unused-but-set-variable -Wno-unused-variable -Wno-return-type -Wno-sign-compare -Wno-reorder -Wno-parantheses")
add_library(srslte_asn1 SHARED
liblte_common.cc
liblte_rrc.cc

@ -58,11 +58,11 @@ void mac_pcap::pack_and_write(uint8_t* pdu, uint32_t pdu_len_bytes, uint32_t reT
{
FDD_RADIO, direction, rnti_type,
crnti, /* RNTI */
ue_id, /* UEId */
reTX, /* Retx */
(uint16_t)ue_id, /* UEId */
(uint8_t)reTX, /* Retx */
crc_ok, /* CRC Stsatus (i.e. OK) */
tti/10, /* Sysframe number */
tti%10 /* Subframe number */
(uint16_t)(tti/10), /* Sysframe number */
(uint16_t)(tti%10) /* Subframe number */
};
if (pdu) {
MAC_LTE_PCAP_WritePDU(pcap_file, &context, pdu, pdu_len_bytes);

@ -176,7 +176,7 @@ uint8_t* sch_pdu::write_packet(srslte::log *log_h)
uint8_t *pdu_start_ptr = ptr;
// Add single/two byte padding first
for (int i=0;i<onetwo_padding;i++) {
for (uint32_t i=0;i<onetwo_padding;i++) {
padding.write_subheader(&ptr, false);
}
// Then write subheaders for MAC CE
@ -244,7 +244,7 @@ uint8_t* sch_pdu::write_packet(srslte::log *log_h)
return NULL;
}
if (header_sz + ce_payload_sz != (int) (ptr - pdu_start_ptr)) {
if ((int)(header_sz + ce_payload_sz) != (int) (ptr - pdu_start_ptr)) {
fprintf(stderr, "Expected a header and CE payload of %d bytes but wrote %d\n",
header_sz+ce_payload_sz,(int) (ptr - pdu_start_ptr));
return NULL;
@ -291,7 +291,13 @@ bool sch_pdu::update_space_ce(uint32_t nbytes)
bool sch_pdu::has_space_sdu(uint32_t nbytes)
{
return get_sdu_space() >= nbytes;
int s = get_sdu_space();
if (s < 0) {
return false;
} else {
return (uint32_t)s >= nbytes;
}
}
bool sch_pdu::update_space_sdu(uint32_t nbytes)
@ -495,7 +501,7 @@ bool sch_subh::set_bsr(uint32_t buff_size[4], sch_subh::cetype format)
w_payload_ce[1] = (buff_size_table(buff_size[1])&0xf) << 4 | (buff_size_table(buff_size[2])&0xf0)>>4;
w_payload_ce[2] = (buff_size_table(buff_size[2])&0x3) << 6 | (buff_size_table(buff_size[3])&0x3f);
} else {
w_payload_ce[0] = (nonzero_lcg&0x3)<<6 | buff_size_table(buff_size[nonzero_lcg])&0x3f;
w_payload_ce[0] = (nonzero_lcg&0x3)<<6 | (buff_size_table(buff_size[nonzero_lcg])&0x3f);
}
lcid = format;
((sch_pdu*)parent)->update_space_ce(ce_size);
@ -569,7 +575,7 @@ int sch_subh::set_sdu(uint32_t lcid_, uint32_t requested_bytes, read_pdu_interfa
payload = ((sch_pdu*)parent)->get_current_sdu_ptr();
// Copy data and get final number of bytes written to the MAC PDU
int sdu_sz = sdu_itf->read_pdu(lcid, payload, requested_bytes);
uint32_t sdu_sz = sdu_itf->read_pdu(lcid, payload, requested_bytes);
if (sdu_sz < 0 || sdu_sz > requested_bytes) {
return -1;
@ -652,7 +658,7 @@ bool sch_subh::read_subheader(uint8_t** ptr)
nof_bytes = (uint32_t)*(*ptr) & 0x7f;
*ptr += 1;
if (F_bit) {
nof_bytes = nof_bytes<<8 | (uint32_t) *(*ptr) & 0xff;
nof_bytes = nof_bytes<<8 | ((uint32_t) *(*ptr) & 0xff);
*ptr += 1;
}
} else {
@ -807,7 +813,7 @@ void rar_subh::set_temp_crnti(uint16_t temp_rnti_)
// Section 6.2.2
void rar_subh::write_subheader(uint8_t** ptr, bool is_last)
{
*(*ptr) = (uint8_t) (!is_last<<7 | 1<<6 | preamble & 0x3f);
*(*ptr) = (uint8_t) (!is_last<<7 | 1<<6 | (preamble & 0x3f));
*ptr += 1;
}
// Section 6.2.3

@ -84,7 +84,7 @@ thread_pool::thread_pool(uint32_t max_workers_) :
{
max_workers = max_workers_;
for (int i=0;i<max_workers;i++) {
for (uint32_t i=0;i<max_workers;i++) {
workers[i] = NULL;
status[i] = IDLE;
pthread_mutex_init(&mutex[i], NULL);
@ -177,7 +177,7 @@ thread_pool::worker* thread_pool::wait_worker()
}
bool thread_pool::find_finished_worker(uint32_t tti, uint32_t *id) {
for(int i=0;i<nof_workers;i++) {
for(uint32_t i=0;i<nof_workers;i++) {
if (status[i] == IDLE) {
*id = i;
return true;

@ -542,7 +542,7 @@ int srslte_pdsch_encode(srslte_pdsch_t *q,
if (srslte_sequence_pdsch(&seq, rnti, 0, 2 * cfg->sf_idx, q->cell.id, cfg->nbits.nof_bits)) {
return SRSLTE_ERROR;
}
srslte_scrambling_bytes(&q->users[rnti]->seq[cfg->sf_idx], (uint8_t*) q->e, cfg->nbits.nof_bits);
srslte_scrambling_bytes(&seq, (uint8_t*) q->e, cfg->nbits.nof_bits);
srslte_sequence_free(&seq);
} else {
srslte_scrambling_bytes(&q->users[rnti]->seq[cfg->sf_idx], (uint8_t*) q->e, cfg->nbits.nof_bits);

@ -36,87 +36,84 @@
#include <SoapySDR/Device.h>
#include <SoapySDR/Formats.h>
//#include "lime/LimeSuite.h"
typedef struct {
SoapySDRKwargs args;
SoapySDRDevice *device;
SoapySDRRange *ranges;
SoapySDRStream *rxStream;
SoapySDRStream *txStream;
} rf_soapy_handler_t;
int soapy_error(void *h)
{
return 0;
}
void rf_soapy_get_freq_range(void *h)
{
}
void rf_soapy_suppress_handler(const char *x)
{
// not supported
}
void rf_soapy_msg_handler(const char *msg)
{
// not supported
}
void rf_soapy_suppress_stdout(void *h)
{
// not supported
}
void rf_soapy_register_error_handler(void *notused, srslte_rf_error_handler_t new_handler)
{
// not supported
}
static bool isLocked(rf_soapy_handler_t *handler, char *sensor_name, void *value_h)
{
// not supported
return true;
}
char* rf_soapy_devname(void* h)
{
return "soapy";
}
bool rf_soapy_rx_wait_lo_locked(void *h)
{
// not supported
printf("TODO: implement rf_soapy_rx_wait_lo_locked()\n");
return true;
}
void rf_soapy_set_tx_cal(void *h, srslte_rf_cal_t *cal)
{
printf("TODO: implement rf_soapy_rx_wait_lo_locked()\n");
// not supported
}
void rf_soapy_set_rx_cal(void *h, srslte_rf_cal_t *cal)
{
// not supported
printf("TODO: implement rf_soapy_set_rx_cal()\n");
}
int rf_soapy_start_rx_stream(void *h)
{
//printf("starting SOAPY rx stream \n");
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
//SoapySDRStream *rxStream;
if(SoapySDRDevice_activateStream(handler->device, handler->rxStream, 0, 0, 0)!=0)//start streaming
if (SoapySDRDevice_activateStream(handler->device, handler->rxStream, 0, 0, 0) != 0)
return SRSLTE_ERROR;
return SRSLTE_SUCCESS;
}
@ -124,41 +121,38 @@ int rf_soapy_start_rx_stream(void *h)
int rf_soapy_start_tx_stream(void *h)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
//SoapySDRStream *rxStream;
if (SoapySDRDevice_setupStream(handler->device, &(handler->txStream), SOAPY_SDR_TX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0)
{
if (SoapySDRDevice_setupStream(handler->device, &(handler->txStream), SOAPY_SDR_TX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
printf("setupStream fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
if(SoapySDRDevice_activateStream(handler->device, handler->txStream, 0, 0, 0) != 0)
return SRSLTE_ERROR;
return SRSLTE_SUCCESS;
}
int rf_soapy_stop_rx_stream(void *h)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if(SoapySDRDevice_deactivateStream(handler->device, handler->rxStream, 0, 0) != 0)
if (SoapySDRDevice_deactivateStream(handler->device, handler->rxStream, 0, 0) != 0)
return SRSLTE_ERROR;
return SRSLTE_SUCCESS;
}
int rf_soapy_stop_tx_stream(void *h)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if(SoapySDRDevice_deactivateStream(handler->device, handler->txStream, 0, 0) != 0)
return SRSLTE_ERROR;
return SRSLTE_SUCCESS;
}
void rf_soapy_flush_buffer(void *h)
{
int n;
@ -170,29 +164,33 @@ void rf_soapy_flush_buffer(void *h)
} while (n > 0);
}
bool rf_soapy_has_rssi(void *h)
{
printf("TODO: implement rf_soapy_has_rssi()\n");
return false;
}
float rf_soapy_get_rssi(void *h)
{
printf("TODO: implement rf_soapy_get_rssi()\n");
return 0.0;
}
//TODO: add multi-channel support
int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
{//SoapySDRKwargs soapy_args = {};
{
size_t length;
const SoapySDRKwargs *soapy_args = SoapySDRDevice_enumerate(NULL, &length);
if(length == 0)
{
if (length == 0) {
printf("No Soapy devices found.\n");
return SRSLTE_ERROR;
}
for (size_t i = 0; i < length; i++)
{
for (size_t i = 0; i < length; i++) {
printf("Soapy Has Found device #%d: ", (int)i);
for (size_t j = 0; j < soapy_args[i].size; j++)
{
@ -201,38 +199,27 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
printf("\n");
}
// SoapySDRrgs_set(&soapy_args, "driver", "rtlsdr");
SoapySDRDevice *sdr = SoapySDRDevice_make(&(soapy_args[0]));
if(sdr == NULL)
{
if (sdr == NULL) {
printf("failed to create SOAPY object\n");
return SRSLTE_ERROR;
}
//SoapySDRKwargs_clear(&soapy_args);
// create handler
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) malloc(sizeof(rf_soapy_handler_t));
bzero(handler, sizeof(rf_soapy_handler_t));
*h = handler;
handler->device = sdr;
//size_t channels[1];
//channels[0] = 0;
if (SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0)
{
if (SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
printf("setupStream fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
return SRSLTE_SUCCESS;
}
int rf_soapy_open(char *args, void **h)
{
return rf_soapy_open_multi(args, h, 1);
@ -242,64 +229,69 @@ int rf_soapy_open(char *args, void **h)
int rf_soapy_close(void *h)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if (handler->txStream) {
rf_soapy_stop_tx_stream(handler);
SoapySDRDevice_closeStream(handler->device, handler->txStream);
}
if (handler->rxStream) {
rf_soapy_stop_rx_stream(handler);
SoapySDRDevice_closeStream(handler->device, handler->rxStream);
}
SoapySDRDevice_unmake(handler->device);
free(handler);
return SRSLTE_SUCCESS;
}
void rf_soapy_set_master_clock_rate(void *h, double rate)
{
// Allow the soapy to automatically set the appropriate clock rate
printf("SET MASTER CLOCK RATE\n");
// TODO: implement this function
}
bool rf_soapy_is_master_clock_dynamic(void *h)
{
printf("TODO: implement rf_soapy_is_master_clock_dynamic()\n");
return false;
}
double rf_soapy_set_rx_srate(void *h, double rate)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if (SoapySDRDevice_setSampleRate(handler->device, SOAPY_SDR_RX, 0, rate) != 0)
{
if (SoapySDRDevice_setSampleRate(handler->device, SOAPY_SDR_RX, 0, rate) != 0) {
printf("setSampleRate fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
double ret = SoapySDRDevice_getSampleRate(handler->device, SOAPY_SDR_RX,0);
printf("Sampling rate is set to %f.3 : \n",ret);
return ret;
return SoapySDRDevice_getSampleRate(handler->device, SOAPY_SDR_RX,0);
}
double rf_soapy_set_tx_srate(void *h, double rate)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if (SoapySDRDevice_setSampleRate(handler->device, SOAPY_SDR_TX, 0, rate) != 0)
{
if (SoapySDRDevice_setSampleRate(handler->device, SOAPY_SDR_TX, 0, rate) != 0) {
printf("setSampleRate fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
double ret = SoapySDRDevice_getSampleRate(handler->device, SOAPY_SDR_TX,0);
printf("Sampling rate is set to %f.3 : \n",ret);
return ret;
return SoapySDRDevice_getSampleRate(handler->device, SOAPY_SDR_TX,0);
}
double rf_soapy_set_rx_gain(void *h, double gain)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if (SoapySDRDevice_setGain(handler->device, SOAPY_SDR_RX, 0, gain) != 0)
{
printf("setGain fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
double ret = rf_soapy_get_rx_gain(h);
printf("gain has been set to %f.2 \n",ret);
return ret;
return rf_soapy_get_rx_gain(h);
}
double rf_soapy_set_tx_gain(void *h, double gain)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
@ -308,28 +300,26 @@ double rf_soapy_set_tx_gain(void *h, double gain)
printf("setGain fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
double ret = rf_soapy_get_rx_gain(h);
printf("gain has been set to %f.2 \n",ret);
return ret;
return rf_soapy_get_rx_gain(h);
}
double rf_soapy_get_rx_gain(void *h)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
return SoapySDRDevice_getGain(handler->device,SOAPY_SDR_RX,0);
}
double rf_soapy_get_tx_gain(void *h)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
return SoapySDRDevice_getGain(handler->device,SOAPY_SDR_TX,0);
}
double rf_soapy_set_rx_freq(void *h, double freq)
{
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if (SoapySDRDevice_setFrequency(handler->device, SOAPY_SDR_RX, 0, freq, NULL) != 0)
{
@ -337,10 +327,7 @@ double rf_soapy_set_rx_freq(void *h, double freq)
return SRSLTE_ERROR;
}
double ret = SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_RX, 0);
printf("Frequency has been set to %f : \n",ret);
return ret;
return SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_RX, 0);
}
double rf_soapy_set_tx_freq(void *h, double freq)
@ -351,10 +338,7 @@ double rf_soapy_set_tx_freq(void *h, double freq)
printf("setFrequency fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR;
}
double ret = SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_RX, 0);
printf("Frequency has been set to %f : \n",ret);
return ret;
return SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_RX, 0);
}
@ -381,8 +365,7 @@ int rf_soapy_recv_with_time_multi(void *h,
int ret = 0;
long long timeNs; //timestamp for receive buffer
int n = 0;
do{
do {
size_t rx_samples = nsamples;
if (rx_samples > nsamples - n)
@ -390,26 +373,32 @@ int rf_soapy_recv_with_time_multi(void *h,
rx_samples = nsamples - n;
}
void *buffs_ptr[4];
for (int i=0;i<num_channels;i++)
for (int i=0; i<num_channels; i++)
{
cf_t *data_c = (cf_t*) data[i];
buffs_ptr[i] = &data_c[n];
} //(void*)(&data)
ret = SoapySDRDevice_readStream(handler->device, handler->rxStream,buffs_ptr , rx_samples, &flags, &timeNs, 1000000);
if(ret < 0)
ret = SoapySDRDevice_readStream(handler->device, handler->rxStream, buffs_ptr , rx_samples, &flags, &timeNs, 1000000);
if(ret < 0) {
// continue when getting overflows
if (ret == SOAPY_SDR_OVERFLOW) {
fprintf(stderr, "O");
fflush(stderr);
continue;
} else {
return SRSLTE_ERROR;
}
}
n += ret;
trials++;
}while (n < nsamples && trials < 100);
} while (n < nsamples && trials < 100);
//*secs = timeNs / 1000000000;
//*frac_secs = (timeNs % 1000000000)/1000000000;
// printf("ret=%d, flags=%d, timeNs=%lld\n", ret, flags, timeNs);
return n;
}
int rf_soapy_recv_with_time(void *h,
@ -433,25 +422,14 @@ int rf_soapy_send_timed(void *h,
bool is_start_of_burst,
bool is_end_of_burst)
{
int flags;
long long timeNs;
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
timeNs = secs * 1000000000;
timeNs = timeNs + (frac_secs * 1000000000);
int ret = SoapySDRDevice_writeStream(handler->device, handler->txStream, &data, nsamples, &flags, timeNs, 100000);
int ret = SoapySDRDevice_writeStream(handler->device, handler->txStream, data, nsamples, &flags, timeNs, 100000);
if(ret != nsamples)
return SRSLTE_ERROR;
return ret;
}

@ -30,10 +30,10 @@
#include "srslte/phy/rf/rf.h"
SRSLTE_API int rf_soapy_open( char *args,
SRSLTE_API int rf_soapy_open(char *args,
void **handler);
SRSLTE_API int rf_soapy_open_multi( char *args,
SRSLTE_API int rf_soapy_open_multi(char *args,
void **handler,
uint32_t nof_rx_antennas);

@ -698,7 +698,7 @@ void srslte_vec_arg_cf(cf_t *x, float *arg, uint32_t len) {
uint32_t srslte_vec_max_fi(float *x, uint32_t len) {
#ifdef HAVE_VOLK_MAX_FUNCTION
uint32_t target=0;
uint16_t target=0;
volk_32f_index_max_16u(&target,x,len);
return target;
@ -763,7 +763,7 @@ void srslte_vec_max_fff(float *x, float *y, float *z, uint32_t len) {
uint32_t srslte_vec_max_abs_ci(cf_t *x, uint32_t len) {
#ifdef HAVE_VOLK_MAX_ABS_FUNCTION
uint32_t target=0;
uint16_t target=0;
volk_32fc_index_max_16u(&target,x,len);
return target;

@ -115,7 +115,7 @@ void gw::write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu)
gw_log->warning("TUN/TAP not up - dropping gw RX message\n");
}else{
int n = write(tun_fd, pdu->msg, pdu->N_bytes);
if(pdu->N_bytes != n)
if(n > 0 && (pdu->N_bytes != (uint32_t)n))
{
gw_log->warning("DL TUN/TAP write failure\n");
}

@ -372,9 +372,9 @@ void rlc_am::check_reordering_timeout()
bool rlc_am::poll_required()
{
if(poll_pdu > 0 && pdu_without_poll > poll_pdu)
if(poll_pdu > 0 && pdu_without_poll > (uint32_t)poll_pdu)
return true;
if(poll_byte > 0 && byte_without_poll > poll_byte)
if(poll_byte > 0 && byte_without_poll > (uint32_t)poll_byte)
return true;
if(poll_retx())
return true;
@ -402,7 +402,7 @@ int rlc_am::prepare_status()
int rlc_am::build_status_pdu(uint8_t *payload, uint32_t nof_bytes)
{
int pdu_len = rlc_am_packed_length(&status);
if(nof_bytes >= pdu_len)
if(pdu_len > 0 && nof_bytes >= (uint32_t)pdu_len)
{
log->info("%s Tx status PDU - %s\n",
rb_id_text[lcid], rlc_am_to_string(&status).c_str());
@ -432,7 +432,7 @@ int rlc_am::build_retx_pdu(uint8_t *payload, uint32_t nof_bytes)
}
// Is resegmentation needed?
if(retx.is_segment || required_buffer_size(retx) > nof_bytes) {
if(retx.is_segment || required_buffer_size(retx) > (int)nof_bytes) {
log->debug("%s build_retx_pdu - resegmentation required\n", rb_id_text[lcid]);
return build_segment(payload, nof_bytes, retx);
}
@ -506,7 +506,7 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r
uint32_t upper = 0;
uint32_t li = 0;
for(int i=0; i<old_header.N_li; i++) {
for(uint32_t i=0; i<old_header.N_li; i++) {
if(lower >= retx.so_end)
break;
@ -561,7 +561,7 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r
debug_state();
int pdu_len = (ptr-payload) + len;
if(pdu_len > nof_bytes) {
if(pdu_len > (int)nof_bytes) {
log->error("%s Retx PDU segment length error. Available: %d, Used: %d\n",
rb_id_text[lcid], nof_bytes, pdu_len);
log->debug("%s Retx PDU segment length error. Header len: %d, Payload len: %d, N_li: %d\n",
@ -784,8 +784,8 @@ void rlc_am::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_h
if(
vr_x == vr_r ||
(RX_MOD_BASE(vr_x) < RX_MOD_BASE(vr_r) ||
RX_MOD_BASE(vr_x) > RX_MOD_BASE(vr_mr) &&
vr_x != vr_mr)
(RX_MOD_BASE(vr_x) > RX_MOD_BASE(vr_mr) &&
vr_x != vr_mr))
)
{
reordering_timeout.reset();
@ -902,7 +902,7 @@ void rlc_am::handle_control_pdu(uint8_t *payload, uint32_t nof_bytes)
std::map<uint32_t, rlc_amd_tx_pdu_t>::iterator it;
bool nack = false;
for(int j=0;j<status.N_nack;j++) {
for(uint32_t j=0;j<status.N_nack;j++) {
if(status.nacks[j].nack_sn == i) {
nack = true;
update_vt_a = false;
@ -963,7 +963,7 @@ void rlc_am::reassemble_rx_sdus()
while(rx_window.end() != rx_window.find(vr_r))
{
// Handle any SDU segments
for(int i=0; i<rx_window[vr_r].header.N_li; i++)
for(uint32_t i=0; i<rx_window[vr_r].header.N_li; i++)
{
int len = rx_window[vr_r].header.li[i];
memcpy(&rx_sdu->msg[rx_sdu->N_bytes], rx_window[vr_r].buf->msg, len);
@ -1076,7 +1076,7 @@ bool rlc_am::add_segment_and_check(rlc_amd_rx_pdu_segments_t *pdu, rlc_amd_rx_pd
if(it->header.N_li > 0) {
header.li[header.N_li++] = it->header.li[0] + carryover;
count += it->header.li[0];
for(int i=1; i<it->header.N_li; i++) {
for(uint32_t i=1; i<it->header.N_li; i++) {
header.li[header.N_li++] = it->header.li[i];
count += it->header.li[i];
}
@ -1134,7 +1134,7 @@ int rlc_am::required_buffer_size(rlc_amd_retx_t retx)
uint32_t upper = 0;
uint32_t li = 0;
for(int i=0; i<old_header.N_li; i++) {
for(uint32_t i=0; i<old_header.N_li; i++) {
if(lower >= retx.so_end)
break;
@ -1448,7 +1448,7 @@ std::string rlc_am_to_string(rlc_status_pdu_t *status)
if(status->N_nack > 0)
{
ss << ", NACK_SN = ";
for(int i=0; i<status->N_nack; i++)
for(uint32_t i=0; i<status->N_nack; i++)
{
if(status->nacks[i].has_so) {
ss << "[" << status->nacks[i].nack_sn << " " << status->nacks[i].so_start \

@ -295,7 +295,8 @@ int rlc_um::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
// Check for SDU segment
if(tx_sdu)
{
to_move = ((pdu_space-head_len) >= tx_sdu->N_bytes) ? tx_sdu->N_bytes : pdu_space-head_len;
uint32_t space = pdu_space-head_len;
to_move = space >= tx_sdu->N_bytes ? tx_sdu->N_bytes : space;
log->debug("%s adding remainder of SDU segment - %d bytes of %d remaining\n",
rb_id_text[lcid], to_move, tx_sdu->N_bytes);
memcpy(pdu_ptr, tx_sdu->msg, to_move);
@ -323,7 +324,8 @@ int rlc_um::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
header.li[header.N_li++] = last_li;
head_len = rlc_um_packed_length(&header);
tx_sdu_queue.read(&tx_sdu);
to_move = ((pdu_space-head_len) >= tx_sdu->N_bytes) ? tx_sdu->N_bytes : pdu_space-head_len;
uint32_t space = pdu_space-head_len;
to_move = space >= tx_sdu->N_bytes ? tx_sdu->N_bytes : space;
log->debug("%s adding new SDU segment - %d bytes of %d remaining\n",
rb_id_text[lcid], to_move, tx_sdu->N_bytes);
memcpy(pdu_ptr, tx_sdu->msg, to_move);
@ -445,14 +447,14 @@ void rlc_um::reassemble_rx_sdus()
rx_sdu->reset();
}else{
// Handle any SDU segments
for(int i=0; i<rx_window[vr_ur].header.N_li; i++)
for(uint32_t i=0; i<rx_window[vr_ur].header.N_li; i++)
{
int len = rx_window[vr_ur].header.li[i];
memcpy(&rx_sdu->msg[rx_sdu->N_bytes], rx_window[vr_ur].buf->msg, len);
rx_sdu->N_bytes += len;
rx_window[vr_ur].buf->msg += len;
rx_window[vr_ur].buf->N_bytes -= len;
if(pdu_lost && !rlc_um_start_aligned(rx_window[vr_ur].header.fi) || vr_ur != ((vr_ur_in_rx_sdu+1)%rx_mod)) {
if((pdu_lost && !rlc_um_start_aligned(rx_window[vr_ur].header.fi)) || (vr_ur != ((vr_ur_in_rx_sdu+1)%rx_mod))) {
log->warning("Dropping remainder of lost PDU (lower edge middle segments, vr_ur=%d, vr_ur_in_rx_sdu=%d)\n", vr_ur, vr_ur_in_rx_sdu);
rx_sdu->reset();
} else {
@ -497,7 +499,7 @@ void rlc_um::reassemble_rx_sdus()
while(rx_window.end() != rx_window.find(vr_ur))
{
// Handle any SDU segments
for(int i=0; i<rx_window[vr_ur].header.N_li; i++)
for(uint32_t i=0; i<rx_window[vr_ur].header.N_li; i++)
{
int len = rx_window[vr_ur].header.li[i];
memcpy(&rx_sdu->msg[rx_sdu->N_bytes], rx_window[vr_ur].buf->msg, len);
@ -506,7 +508,7 @@ void rlc_um::reassemble_rx_sdus()
rx_sdu->N_bytes += len;
rx_window[vr_ur].buf->msg += len;
rx_window[vr_ur].buf->N_bytes -= len;
if(pdu_lost && !rlc_um_start_aligned(rx_window[vr_ur].header.fi) || vr_ur != ((vr_ur_in_rx_sdu+1)%rx_mod)) {
if((pdu_lost && !rlc_um_start_aligned(rx_window[vr_ur].header.fi)) || (vr_ur != ((vr_ur_in_rx_sdu+1)%rx_mod))) {
log->warning("Dropping remainder of lost PDU (update vr_ur middle segments, vr_ur=%d, vr_ur_in_rx_sdu=%d)\n", vr_ur, vr_ur_in_rx_sdu);
rx_sdu->reset();
} else {

@ -282,7 +282,7 @@ void rrc::write_pdu_bcch_dlsch(byte_buffer_t *pdu)
liblte_rrc_si_window_length_num[sib1.si_window_length],
liblte_rrc_si_periodicity_num[sib1.sched_info[0].si_periodicity]);
std::stringstream ss;
for(int i=0;i<sib1.N_plmn_ids;i++){
for(uint32_t i=0;i<sib1.N_plmn_ids;i++){
std::string mcc;
std::string mnc;
mcc_to_string(sib1.plmn_id[i].id.mcc, &mcc);
@ -340,7 +340,7 @@ void rrc::write_pdu_pcch(byte_buffer_t *pdu)
}
LIBLTE_RRC_S_TMSI_STRUCT *s_tmsi_paged;
for (int i=0;i<pcch_msg.paging_record_list_size;i++) {
for (uint32_t i=0;i<pcch_msg.paging_record_list_size;i++) {
s_tmsi_paged = &pcch_msg.paging_record_list[i].ue_identity.s_tmsi;
rrc_log->info("Received paging (%d/%d) for UE 0x%x\n", i+1, pcch_msg.paging_record_list_size,
pcch_msg.paging_record_list[i].ue_identity.s_tmsi);
@ -396,7 +396,7 @@ void rrc::send_con_request()
// Byte align and pack the message bits for PDCP
if((bit_buf.N_bits % 8) != 0)
{
for(int i=0; i<8-(bit_buf.N_bits % 8); i++)
for(uint32_t i=0; i<8-(bit_buf.N_bits % 8); i++)
bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8);
}
@ -409,7 +409,7 @@ void rrc::send_con_request()
uint64_t uecri=0;
uint8_t *ue_cri_ptr = (uint8_t*) &uecri;
uint32_t nbytes = 6;
for (int i=0;i<nbytes;i++) {
for (uint32_t i=0;i<nbytes;i++) {
ue_cri_ptr[nbytes-i-1] = pdcp_buf->msg[i];
}
rrc_log->debug("Setting UE contention resolution ID: %d\n", uecri);
@ -490,7 +490,7 @@ void rrc::send_con_restablish_request()
// Byte align and pack the message bits for PDCP
if((bit_buf.N_bits % 8) != 0)
{
for(int i=0; i<8-(bit_buf.N_bits % 8); i++)
for(uint32_t i=0; i<8-(bit_buf.N_bits % 8); i++)
bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8);
}
@ -502,7 +502,7 @@ void rrc::send_con_restablish_request()
uint64_t uecri=0;
uint8_t *ue_cri_ptr = (uint8_t*) &uecri;
uint32_t nbytes = 6;
for (int i=0;i<nbytes;i++) {
for (uint32_t i=0;i<nbytes;i++) {
ue_cri_ptr[nbytes-i-1] = pdcp_buf->msg[i];
}
rrc_log->debug("Setting UE contention resolution ID: %d\n", uecri);
@ -527,7 +527,7 @@ void rrc::send_con_restablish_complete()
// Byte align and pack the message bits for PDCP
if((bit_buf.N_bits % 8) != 0)
{
for(int i=0; i<8-(bit_buf.N_bits % 8); i++)
for(uint32_t i=0; i<8-(bit_buf.N_bits % 8); i++)
bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8);
}
@ -558,7 +558,7 @@ void rrc::send_con_setup_complete(byte_buffer_t *nas_msg)
// Byte align and pack the message bits for PDCP
if((bit_buf.N_bits % 8) != 0)
{
for(int i=0; i<8-(bit_buf.N_bits % 8); i++)
for(uint32_t i=0; i<8-(bit_buf.N_bits % 8); i++)
bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8);
}
@ -592,7 +592,7 @@ void rrc::send_ul_info_transfer(uint32_t lcid, byte_buffer_t *sdu)
// Byte align and pack the message bits for PDCP
if((bit_buf.N_bits % 8) != 0)
{
for(int i=0; i<8-(bit_buf.N_bits % 8); i++)
for(uint32_t i=0; i<8-(bit_buf.N_bits % 8); i++)
bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8);
}
@ -616,7 +616,7 @@ void rrc::send_security_mode_complete(uint32_t lcid, byte_buffer_t *pdu)
// Byte align and pack the message bits for PDCP
if((bit_buf.N_bits % 8) != 0)
{
for(int i=0; i<8-(bit_buf.N_bits % 8); i++)
for(uint32_t i=0; i<8-(bit_buf.N_bits % 8); i++)
bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8);
}
@ -640,7 +640,7 @@ void rrc::send_rrc_con_reconfig_complete(uint32_t lcid, byte_buffer_t *pdu)
// Byte align and pack the message bits for PDCP
if((bit_buf.N_bits % 8) != 0)
{
for(int i=0; i<8-(bit_buf.N_bits % 8); i++)
for(uint32_t i=0; i<8-(bit_buf.N_bits % 8); i++)
bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8);
}
@ -727,7 +727,7 @@ void rrc::send_rrc_ue_cap_info(uint32_t lcid, byte_buffer_t *pdu)
// Byte align and pack the message bits for PDCP
if((bit_buf.N_bits % 8) != 0)
{
for(int i=0; i<8-(bit_buf.N_bits % 8); i++)
for(uint32_t i=0; i<8-(bit_buf.N_bits % 8); i++)
bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8);
}
@ -823,7 +823,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, byte_buffer_t *pdu)
break;
case LIBLTE_RRC_DL_DCCH_MSG_TYPE_UE_CAPABILITY_ENQUIRY:
transaction_id = dl_dcch_msg.msg.ue_cap_enquiry.rrc_transaction_id;
for(int i=0; i<dl_dcch_msg.msg.ue_cap_enquiry.N_ue_cap_reqs; i++)
for(uint32_t i=0; i<dl_dcch_msg.msg.ue_cap_enquiry.N_ue_cap_reqs; i++)
{
if(LIBLTE_RRC_RAT_TYPE_EUTRA == dl_dcch_msg.msg.ue_cap_enquiry.ue_capability_request[i])
{
@ -1251,14 +1251,14 @@ void rrc::apply_rr_config_dedicated(LIBLTE_RRC_RR_CONFIG_DEDICATED_STRUCT *cnfg)
if(cnfg->rlf_timers_and_constants_present) {
//TODO
}
for(int i=0; i<cnfg->srb_to_add_mod_list_size; i++) {
for(uint32_t i=0; i<cnfg->srb_to_add_mod_list_size; i++) {
// TODO: handle SRB modification
add_srb(&cnfg->srb_to_add_mod_list[i]);
}
for(int i=0; i<cnfg->drb_to_release_list_size; i++) {
for(uint32_t i=0; i<cnfg->drb_to_release_list_size; i++) {
release_drb(cnfg->drb_to_release_list[i]);
}
for(int i=0; i<cnfg->drb_to_add_mod_list_size; i++) {
for(uint32_t i=0; i<cnfg->drb_to_add_mod_list_size; i++) {
// TODO: handle DRB modification
add_drb(&cnfg->drb_to_add_mod_list[i]);
}

@ -52,6 +52,7 @@ void* thread_loop(void *a) {
filter.info("Thread %d: %d", args->thread_id, i);
filter.debug("Thread %d: %d", args->thread_id, i);
}
return NULL;
}
void* thread_loop_hex(void *a) {

@ -47,7 +47,7 @@ int main(int argc, char **argv) {
assert(s.N_nack == 0);
rlc_am_write_status_pdu(&s, &b2);
assert(b2.N_bytes == PDU1_LEN);
for(int i=0;i<b2.N_bytes;i++)
for(uint32_t i=0;i<b2.N_bytes;i++)
assert(b2.msg[i] == b1.msg[i]);
b1.reset();
@ -65,6 +65,6 @@ int main(int argc, char **argv) {
assert(s.nacks[3].nack_sn == 4);
rlc_am_write_status_pdu(&s, &b2);
assert(b2.N_bytes == PDU2_LEN);
for(int i=0;i<b2.N_bytes;i++)
for(uint32_t i=0;i<b2.N_bytes;i++)
assert(b2.msg[i] == b1.msg[i]);
}

@ -59,7 +59,7 @@ int main(int argc, char **argv) {
assert(6 == h.sn);
rlc_am_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU1_LEN);
for(int i=0;i<b2.N_bytes;i++)
for(uint32_t i=0;i<b2.N_bytes;i++)
assert(b2.msg[i] == b1.msg[i]);
b1.reset();
@ -81,7 +81,7 @@ int main(int argc, char **argv) {
assert(0 == h.sn);
rlc_am_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU2_LEN);
for(int i=0;i<b2.N_bytes;i++)
for(uint32_t i=0;i<b2.N_bytes;i++)
assert(b2.msg[i] == b1.msg[i]);
b1.reset();
@ -104,6 +104,6 @@ int main(int argc, char **argv) {
assert(0 == h.sn);
rlc_am_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU3_LEN);
for(int i=0;i<b2.N_bytes;i++)
for(uint32_t i=0;i<b2.N_bytes;i++)
assert(b2.msg[i] == b1.msg[i]);
}

@ -50,7 +50,7 @@ int main(int argc, char **argv) {
assert(226 == h.sn);
rlc_um_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU1_LEN);
for(int i=0;i<b2.N_bytes;i++)
for(uint32_t i=0;i<b2.N_bytes;i++)
assert(b2.msg[i] == b1.msg[i]);
b1.reset();
@ -66,6 +66,6 @@ int main(int argc, char **argv) {
assert(104 == h.li[0]);
rlc_um_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU2_LEN);
for(int i=0;i<b2.N_bytes;i++)
for(uint32_t i=0;i<b2.N_bytes;i++)
assert(b2.msg[i] == b1.msg[i]);
}

@ -41,7 +41,7 @@
typedef struct {
int id;
uint32_t id;
int Bj;
int PBR; // -1 sets to infinity
uint32_t BSD;

@ -1,165 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE 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 Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef UEPHY_H
#define UEPHY_H
#include "srslte/srslte.h"
#include "common/phy_interface.h"
#include "common/log.h"
#include "phy/phy_metrics.h"
#include "phy/phch_recv.h"
#include "phy/prach.h"
#include "phy/phch_worker.h"
#include "phy/phch_common.h"
#include "radio/radio.h"
#include "common/task_dispatcher.h"
#include "common/trace.h"
#include "common/mac_interface.h"
#include "common/interfaces.h"
namespace srsue {
typedef _Complex float cf_t;
class phy
: public phy_interface_mac
, public phy_interface_rrc
{
public:
phy();
bool init(srslte::radio *radio_handler,
mac_interface_phy *mac,
rrc_interface_phy *rrc,
srslte::log *log_h,
phy_args_t *args = NULL);
void stop();
void set_agc_enable(bool enabled);
void get_metrics(phy_metrics_t &m);
void set_crnti(uint16_t rnti);
static uint32_t tti_to_SFN(uint32_t tti);
static uint32_t tti_to_subf(uint32_t tti);
void enable_pregen_signals(bool enable);
void start_trace();
void write_trace(std::string filename);
/********** RRC INTERFACE ********************/
void reset();
bool status_is_sync();
void configure_ul_params(bool pregen_disabled = false);
void resync_sfn();
/********** MAC INTERFACE ********************/
/* Functions to synchronize with a cell */
void sync_start();
void sync_stop();
/* Instructs the PHY to configure using the parameters written by set_param() */
void configure_prach_params();
/* Transmits PRACH in the next opportunity */
void prach_send(uint32_t preamble_idx, int allowed_subframe = -1, float target_power_dbm = 0.0);
int prach_tx_tti();
/* Indicates the transmission of a SR signal in the next opportunity */
void sr_send();
int sr_last_tx_tti();
// Time advance commands
void set_timeadv_rar(uint32_t ta_cmd);
void set_timeadv(uint32_t ta_cmd);
/* Sets RAR grant payload */
void set_rar_grant(uint32_t tti, uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN]);
/* Instruct the PHY to decode PDCCH with the CRC scrambled with given RNTI */
void pdcch_ul_search(srslte_rnti_type_t rnti_type, uint16_t rnti, int tti_start = -1, int tti_end = -1);
void pdcch_dl_search(srslte_rnti_type_t rnti_type, uint16_t rnti, int tti_start = -1, int tti_end = -1);
void pdcch_ul_search_reset();
void pdcch_dl_search_reset();
/* Get/Set PHY parameters interface from RRC */
void get_config(phy_cfg_t *phy_cfg);
void set_config(phy_cfg_t *phy_cfg);
void set_config_dedicated(LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *dedicated);
void set_config_common(phy_cfg_common_t *common);
void set_config_tdd(LIBLTE_RRC_TDD_CONFIG_STRUCT *tdd);
void set_config_64qam_en(bool enable);
float get_phr();
float get_pathloss_db();
uint32_t get_current_tti();
void get_current_cell(srslte_cell_t *cell);
void start_plot();
void start_channel_emulator(const char *filename, int *path_taps, int nof_paths, int nof_coeffs, int nof_samples, int nof_tti);
private:
uint32_t nof_workers;
const static int MAX_WORKERS = 4;
const static int DEFAULT_WORKERS = 2;
const static int SF_RECV_THREAD_PRIO = 1;
const static int WORKERS_THREAD_PRIO = 0;
srslte::radio *radio_handler;
srslte::log *log_h;
srslte::thread_pool workers_pool;
std::vector<phch_worker> workers;
phch_common workers_common;
phch_recv sf_recv;
prach prach_buffer;
srslte_cell_t cell;
phy_cfg_t config;
phy_args_t *args;
/* Current time advance */
uint32_t n_ta;
bool init_(srslte::radio *radio_handler, mac_interface_phy *mac, srslte::log *log_h, bool do_agc, uint32_t nof_workers);
void set_default_args(phy_args_t *args);
bool check_args(phy_args_t *args);
};
} // namespace srsue
#endif // UEPHY_H

@ -160,7 +160,7 @@ public:
private:
static ue *instance;
ue();
~ue();
virtual ~ue();
srslte::radio_multi radio;
srsue::phy phy;

@ -158,7 +158,7 @@ void demux::process_sch_pdu(srslte::sch_pdu *pdu_msg)
if (pdu_msg->get()->get_sdu_lcid() == 0) {
uint8_t *x = pdu_msg->get()->get_sdu_ptr();
uint32_t sum = 0;
for (int i=0;i<pdu_msg->get()->get_payload_size();i++) {
for (uint32_t i=0;i<pdu_msg->get()->get_payload_size();i++) {
sum += x[i];
}
if (sum == 0) {

@ -197,7 +197,7 @@ bool dl_harq_entity::dl_harq_process::is_sps()
bool dl_harq_entity::dl_harq_process::calc_is_new_transmission(mac_interface_phy::mac_grant_t grant) {
bool is_new_tb = true;
if (srslte_tti_interval(grant.tti, cur_grant.tti) <= 8 && grant.n_bytes == cur_grant.n_bytes ||
if ((srslte_tti_interval(grant.tti, cur_grant.tti) <= 8 && (grant.n_bytes == cur_grant.n_bytes)) ||
pid == HARQ_BCCH_PID)
{
is_new_tb = false;

@ -68,7 +68,7 @@ void mux::reset()
bool mux::is_pending_any_sdu()
{
for (int i=0;i<lch.size();i++) {
for (uint32_t i=0;i<lch.size();i++) {
if (rlc->get_buffer_state(lch[i].id)) {
return true;
}
@ -82,7 +82,7 @@ bool mux::is_pending_sdu(uint32_t lch_id) {
int mux::find_lchid(uint32_t lcid)
{
for (int i=0;i<lch.size();i++) {
for (uint32_t i=0;i<lch.size();i++) {
if(lch[i].id == lcid) {
return i;
}
@ -131,10 +131,11 @@ srslte::sch_subh::cetype bsr_format_convert(bsr_proc::bsr_format_t format) {
switch(format) {
case bsr_proc::LONG_BSR:
return srslte::sch_subh::LONG_BSR;
case bsr_proc::SHORT_BSR:
return srslte::sch_subh::SHORT_BSR;
case bsr_proc::TRUNC_BSR:
return srslte::sch_subh::TRUNC_BSR;
case bsr_proc::SHORT_BSR:
default:
return srslte::sch_subh::SHORT_BSR;
}
}
@ -151,12 +152,12 @@ uint8_t* mux::pdu_get(uint8_t *payload, uint32_t pdu_sz, uint32_t tx_tti, uint32
pthread_mutex_lock(&mutex);
// Update Bj
for (int i=0;i<lch.size();i++) {
for (uint32_t i=0;i<lch.size();i++) {
// Add PRB unless it's infinity
if (lch[i].PBR >= 0) {
lch[i].Bj += lch[i].PBR;
}
if (lch[i].Bj >= lch[i].BSD) {
if (lch[i].Bj >= (int)lch[i].BSD) {
lch[i].Bj = lch[i].BSD*lch[i].PBR;
}
}
@ -197,14 +198,14 @@ uint8_t* mux::pdu_get(uint8_t *payload, uint32_t pdu_sz, uint32_t tx_tti, uint32
}
// Update buffer states for all logical channels
int sdu_space = pdu_msg.get_sdu_space();
for (int i=0;i<lch.size();i++) {
for (uint32_t i=0;i<lch.size();i++) {
lch[i].buffer_len = rlc->get_buffer_state(lch[i].id);
lch[i].sched_len = 0;
}
// data from any Logical Channel, except data from UL-CCCH;
// first only those with positive Bj
for (int i=0;i<lch.size();i++) {
for (uint32_t i=0;i<lch.size();i++) {
if (lch[i].id != 0) {
if (sched_sdu(&lch[i], &sdu_space, (lch[i].PBR<0)?-1:lch[i].Bj) && lch[i].PBR >= 0) {
lch[i].Bj -= lch[i].sched_len;
@ -213,7 +214,7 @@ uint8_t* mux::pdu_get(uint8_t *payload, uint32_t pdu_sz, uint32_t tx_tti, uint32
}
// If resources remain, allocate regardless of their Bj value
for (int i=0;i<lch.size();i++) {
for (uint32_t i=0;i<lch.size();i++) {
if (lch[i].id != 0) {
sched_sdu(&lch[i], &sdu_space, -1);
}
@ -221,7 +222,7 @@ uint8_t* mux::pdu_get(uint8_t *payload, uint32_t pdu_sz, uint32_t tx_tti, uint32
// Maximize the grant utilization
if (lch.size() > 0) {
for (int i=lch.size()-1;i--;i>=0) {
for (int i=(int)lch.size()-1;i>=0;i--) {
if (lch[i].sched_len > 0) {
lch[i].sched_len = -1;
break;
@ -229,7 +230,7 @@ uint8_t* mux::pdu_get(uint8_t *payload, uint32_t pdu_sz, uint32_t tx_tti, uint32
}
}
// Now allocate the SDUs from the RLC
for (int i=0;i<lch.size();i++) {
for (uint32_t i=0;i<lch.size();i++) {
if (lch[i].sched_len != 0) {
log_h->info("Allocating scheduled lch=%d len=%d\n", lch[i].id, lch[i].sched_len);
allocate_sdu(lch[i].id, &pdu_msg, lch[i].sched_len);

@ -222,14 +222,14 @@ void bsr_proc::step(uint32_t tti)
}
int periodic = liblte_rrc_periodic_bsr_timer_num[mac_cfg->main.ulsch_cnfg.periodic_bsr_timer];
if (periodic != timers_db->get(mac::BSR_TIMER_PERIODIC)->get_timeout() && periodic > 0)
if (periodic > 0 && (uint32_t)periodic != timers_db->get(mac::BSR_TIMER_PERIODIC)->get_timeout())
{
timers_db->get(mac::BSR_TIMER_PERIODIC)->set(this, periodic);
timers_db->get(mac::BSR_TIMER_PERIODIC)->run();
Info("BSR: Configured timer periodic %d ms\n", periodic);
}
int retx = liblte_rrc_retransmission_bsr_timer_num[mac_cfg->main.ulsch_cnfg.retx_bsr_timer];
if (retx != timers_db->get(mac::BSR_TIMER_RETX)->get_timeout() && retx > 0)
if (retx > 0 && (uint32_t)retx != timers_db->get(mac::BSR_TIMER_RETX)->get_timeout())
{
timers_db->get(mac::BSR_TIMER_RETX)->set(this, retx);
timers_db->get(mac::BSR_TIMER_RETX)->run();
@ -279,6 +279,8 @@ char* bsr_proc::bsr_format_tostring(bsr_format_t format) {
return (char*) "Short";
case bsr_proc::TRUNC_BSR:
return (char*) "Truncated";
default:
return (char*) "Short";
}
}
@ -290,7 +292,7 @@ bool bsr_proc::need_to_send_bsr_on_ul_grant(uint32_t grant_size, bsr_t *bsr)
if (triggered_bsr_type == PERIODIC || triggered_bsr_type == REGULAR) {
/* Check if grant + MAC SDU headers is enough to accomodate all pending data */
int total_data = 0;
for (int i=0;i<MAX_LCID && total_data < grant_size;i++) {
for (int i=0;i<MAX_LCID && total_data < (int)grant_size;i++) {
total_data += srslte::sch_pdu::size_header_sdu(rlc->get_buffer_state(i))+rlc->get_buffer_state(i);
}
total_data--; // Because last SDU has no size header
@ -300,7 +302,7 @@ bool bsr_proc::need_to_send_bsr_on_ul_grant(uint32_t grant_size, bsr_t *bsr)
*/
generate_bsr(bsr, 0);
bsr_sz = bsr->format==LONG_BSR?3:1;
if (total_data <= grant_size && total_data + 1 + bsr_sz > grant_size) {
if (total_data <= (int)grant_size && total_data + 1 + bsr_sz > grant_size) {
Debug("Grant is not enough to accomodate the BSR MAC CE\n");
} else {
Debug("BSR: Including Regular BSR: grant_size=%d, total_data=%d, bsr_sz=%d\n",
@ -390,7 +392,8 @@ void bsr_proc::set_priority(uint32_t lcid, uint32_t priority) {
}
uint32_t bsr_proc::find_max_priority_lcid() {
uint32_t max_prio = 0, max_idx = 0;
int32_t max_prio = 0;
uint32_t max_idx = 0;
for (int i=0;i<MAX_LCID;i++) {
if (priorities[i] > max_prio) {
max_prio = priorities[i];

@ -450,7 +450,7 @@ void ra_proc::step_contention_resolution() {
{
// Random Access with transmission of MAC C-RNTI CE
if ((!started_by_pdcch && pdcch_to_crnti_received == PDCCH_CRNTI_UL_GRANT) ||
started_by_pdcch && pdcch_to_crnti_received != PDCCH_CRNTI_NOT_RECEIVED)
(started_by_pdcch && pdcch_to_crnti_received != PDCCH_CRNTI_NOT_RECEIVED))
{
rDebug("PDCCH for C-RNTI received\n");
timers_db->get(mac::CONTENTION_TIMER)->stop();
@ -515,6 +515,7 @@ void ra_proc::step(uint32_t tti_)
case COMPLETION:
step_completition();
case COMPLETION_DONE:
case RA_PROBLEM:
break;
}
}

@ -57,7 +57,7 @@ bool sr_proc::need_tx(uint32_t tti)
{
int last_tx_tti = phy_h->sr_last_tx_tti();
if (last_tx_tti >= 0) {
if (tti > last_tx_tti) {
if (tti > (uint32_t)last_tx_tti) {
if (tti - last_tx_tti > 8) {
return true;
}

@ -95,7 +95,7 @@ void ul_harq_entity::set_ack(uint32_t tti, bool ack) {
tti_harq += 10240;
}
uint32_t pid_harq = pidof(tti_harq);
if (proc[pid_harq].has_grant() && proc[pid_harq].last_tx_tti() <= tti_harq) {
if (proc[pid_harq].has_grant() && (proc[pid_harq].last_tx_tti() <= (uint32_t)tti_harq)) {
proc[pid_harq].set_harq_feedback(ack);
}
}
@ -228,7 +228,7 @@ void ul_harq_entity::ul_harq_process::run_tti(uint32_t tti_tx, mac_interface_phy
{
int max_retx;
uint32_t max_retx;
if (is_msg3) {
max_retx = harq_entity->mac_cfg->rach.max_harq_msg3_tx;
} else {
@ -238,7 +238,7 @@ void ul_harq_entity::ul_harq_process::run_tti(uint32_t tti_tx, mac_interface_phy
// Receive and route HARQ feedbacks
if (grant) {
if ((!grant->rnti_type == SRSLTE_RNTI_TEMP && grant->ndi != get_ndi()) ||
if ((!(grant->rnti_type == SRSLTE_RNTI_TEMP) && grant->ndi != get_ndi()) ||
(grant->rnti_type == SRSLTE_RNTI_USER && !has_grant()) ||
grant->is_from_rar)
{

@ -84,7 +84,7 @@ void phch_common::init(phy_interface_rrc::phy_cfg_t *_config, phy_args_t *_args,
is_first_tx = true;
sr_last_tx_tti = -1;
for (int i=0;i<nof_mutex;i++) {
for (uint32_t i=0;i<nof_mutex;i++) {
pthread_mutex_init(&tx_mutex[i], NULL);
}
}
@ -95,8 +95,8 @@ void phch_common::set_nof_mutex(uint32_t nof_mutex_) {
}
bool phch_common::ul_rnti_active(uint32_t tti) {
if ((tti >= ul_rnti_start && ul_rnti_start >= 0 || ul_rnti_start < 0) &&
(tti < ul_rnti_end && ul_rnti_end >= 0 || ul_rnti_end < 0))
if ((((int)tti >= ul_rnti_start && ul_rnti_start >= 0) || ul_rnti_start < 0) &&
(((int)tti < ul_rnti_end && ul_rnti_end >= 0) || ul_rnti_end < 0))
{
return true;
} else {
@ -106,8 +106,8 @@ bool phch_common::ul_rnti_active(uint32_t tti) {
bool phch_common::dl_rnti_active(uint32_t tti) {
Debug("tti=%d, dl_rnti_start=%d, dl_rnti_end=%d, dl_rnti=0x%x\n", tti, dl_rnti_start, dl_rnti_end, dl_rnti);
if (((tti >= dl_rnti_start && dl_rnti_start >= 0) || dl_rnti_start < 0) &&
((tti < dl_rnti_end && dl_rnti_end >= 0) || dl_rnti_end < 0))
if ((((int)tti >= dl_rnti_start && dl_rnti_start >= 0) || dl_rnti_start < 0) &&
(((int)tti < dl_rnti_end && dl_rnti_end >= 0) || dl_rnti_end < 0))
{
bool ret = true;
// FIXME: This scheduling decision belongs to RRC
@ -325,7 +325,7 @@ void phch_common::reset_ul()
{
is_first_tx = true;
is_first_of_burst = true;
for (int i=0;i<nof_mutex;i++) {
for (uint32_t i=0;i<nof_mutex;i++) {
pthread_mutex_trylock(&tx_mutex[i]);
pthread_mutex_unlock(&tx_mutex[i]);
}

@ -63,7 +63,7 @@ void phch_recv::init(srslte::radio_multi* _radio_handler, mac_interface_phy *_ma
cell_is_set = false;
sync_sfn_cnt = 0;
for (int i=0;i<nof_rx_antennas;i++) {
for (uint32_t i=0;i<nof_rx_antennas;i++) {
sf_buffer_sfn[i] = (cf_t*) srslte_vec_malloc(sizeof(cf_t)*3*SRSLTE_SF_LEN_PRB(100));
}
@ -81,7 +81,7 @@ void phch_recv::init(srslte::radio_multi* _radio_handler, mac_interface_phy *_ma
void phch_recv::stop() {
running = false;
wait_thread_finish();
for (int i=0;i<nof_rx_antennas;i++) {
for (uint32_t i=0;i<nof_rx_antennas;i++) {
if (sf_buffer_sfn[i]) {
free(sf_buffer_sfn[i]);
}
@ -156,7 +156,7 @@ bool phch_recv::init_cell() {
// Set options defined in expert section
set_ue_sync_opts(&ue_sync);
for (int i=0;i<workers_pool->get_nof_workers();i++) {
for (uint32_t i=0;i<workers_pool->get_nof_workers();i++) {
if (!((phch_worker*) workers_pool->get_worker(i))->init_cell(cell)) {
Error("Error setting cell: initiating PHCH worker\n");
return false;
@ -180,7 +180,7 @@ bool phch_recv::init_cell() {
void phch_recv::free_cell()
{
if (cell_is_set) {
for (int i=0;i<workers_pool->get_nof_workers();i++) {
for (uint32_t i=0;i<workers_pool->get_nof_workers();i++) {
((phch_worker*) workers_pool->get_worker(i))->free_cell();
}
prach_buffer->free_cell();
@ -402,7 +402,7 @@ void phch_recv::run_thread()
worker = (phch_worker*) workers_pool->wait_worker(tti);
sync_res = 0;
if (worker) {
for (int i=0;i<nof_rx_antennas;i++) {
for (uint32_t i=0;i<nof_rx_antennas;i++) {
buffer[i] = worker->get_buffer(i);
}

@ -93,7 +93,7 @@ bool phch_worker::init_cell(srslte_cell_t cell_)
memcpy(&cell, &cell_, sizeof(srslte_cell_t));
// ue_sync in phy.cc requires a buffer for 3 subframes
for (int i=0;i<phy->args->nof_rx_ant;i++) {
for (uint32_t i=0;i<phy->args->nof_rx_ant;i++) {
signal_buffer[i] = (cf_t*) srslte_vec_malloc(3 * sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
if (!signal_buffer[i]) {
Error("Allocating memory\n");
@ -121,7 +121,7 @@ bool phch_worker::init_cell(srslte_cell_t cell_)
void phch_worker::free_cell()
{
if (cell_initiated) {
for (int i=0;i<phy->args->nof_rx_ant;i++) {
for (uint32_t i=0;i<phy->args->nof_rx_ant;i++) {
if (signal_buffer[i]) {
free(signal_buffer[i]);
}
@ -950,7 +950,7 @@ void phch_worker::start_plot() {
}
int phch_worker::read_ce_abs(float *ce_abs) {
int i=0;
uint32_t i=0;
int sz = srslte_symbol_sz(cell.nof_prb);
bzero(ce_abs, sizeof(float)*sz);
int g = (sz - 12*cell.nof_prb)/2;

@ -118,7 +118,7 @@ bool phy::init(srslte::radio_multi* radio_handler_, mac_interface_phy *mac, rrc_
nof_workers = args->nof_phy_threads;
// Add workers to workers pool and start threads
for (int i=0;i<nof_workers;i++) {
for (uint32_t i=0;i<nof_workers;i++) {
workers[i].set_common(&workers_common);
workers_pool.init_worker(i, &workers[i], WORKERS_THREAD_PRIO, args->worker_cpu_mask);
}
@ -141,14 +141,14 @@ void phy::set_agc_enable(bool enabled)
void phy::start_trace()
{
for (int i=0;i<nof_workers;i++) {
for (uint32_t i=0;i<nof_workers;i++) {
workers[i].start_trace();
}
}
void phy::write_trace(std::string filename)
{
for (int i=0;i<nof_workers;i++) {
for (uint32_t i=0;i<nof_workers;i++) {
string i_str = static_cast<ostringstream*>( &(ostringstream() << i) )->str();
workers[i].write_trace(filename + "_" + i_str);
}
@ -200,7 +200,7 @@ void phy::configure_prach_params()
void phy::configure_ul_params(bool pregen_disabled)
{
Info("PHY: Configuring UL parameters\n");
for (int i=0;i<nof_workers;i++) {
for (uint32_t i=0;i<nof_workers;i++) {
workers[i].set_ul_params(pregen_disabled);
}
}

@ -17,7 +17,7 @@
# the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/.
#
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch")
add_executable(mac_test mac_test.cc)
target_link_libraries(mac_test srsue_mac srsue_phy srslte_common srslte_phy srslte_radio srslte_asn1 ${SRSLTE_LIBRARIES} ${LIBLTE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})

@ -200,7 +200,7 @@ void process_connsetup(LIBLTE_RRC_CONNECTION_SETUP_STRUCT *msg, srsue::mac *mac,
phy->configure_ul_params();
// Setup radio bearers
for (int i=0;i<msg->rr_cnfg.srb_to_add_mod_list_size;i++) {
for (uint32_t i=0;i<msg->rr_cnfg.srb_to_add_mod_list_size;i++) {
if (msg->rr_cnfg.srb_to_add_mod_list[i].lc_default_cnfg_present) {
printf("Setting up Default Configuration for SRB%d \n", msg->rr_cnfg.srb_to_add_mod_list[i].srb_id);
switch(msg->rr_cnfg.srb_to_add_mod_list[i].srb_id) {
@ -315,7 +315,7 @@ public:
uint8_t *ue_cri_ptr = (uint8_t*) &uecri;
uint32_t nbytes = bit_msg.N_bits/8;
uint8_t *ptr = bit_msg.msg;
for (int i=0;i<nbytes;i++) {
for (uint32_t i=0;i<nbytes;i++) {
ue_cri_ptr[nbytes-i-1] = (uint8_t) srslte_bit_pack(&ptr, 8);
}
printf("Setting UE contention resolution ID: %lu\n", uecri);
@ -370,6 +370,8 @@ public:
connsetup_decoded = true;
break;
case LIBLTE_RRC_DL_CCCH_MSG_TYPE_RRC_CON_REJ:
case LIBLTE_RRC_DL_CCCH_MSG_TYPE_RRC_CON_REEST:
case LIBLTE_RRC_DL_CCCH_MSG_TYPE_RRC_CON_REEST_REJ:
break;
}
} else if (lcid == 1) {

@ -225,7 +225,7 @@ public:
liblte_rrc_si_window_length_num[sib1.si_window_length],
liblte_rrc_si_periodicity_num[sib1.sched_info[0].si_periodicity]);
std::stringstream ss;
for(int i=0;i<sib1.N_plmn_ids;i++){
for(uint32_t i=0;i<sib1.N_plmn_ids;i++){
ss << " PLMN Id: MCC " << sib1.plmn_id[i].id.mcc << " MNC " << sib1.plmn_id[i].id.mnc;
}
log_h->console("SIB1 received, CellID=%d, %s\n",
@ -250,13 +250,13 @@ public:
// Send Msg3
sdu->N_bytes = 10;
for (int i=0;i<sdu->N_bytes;i++) {
for (uint32_t i=0;i<sdu->N_bytes;i++) {
sdu->msg[i] = i+1;
}
uint64_t uecri = 0;
uint8_t *ue_cri_ptr = (uint8_t*) &uecri;
uint32_t nbytes = 6;
for (int i=0;i<nbytes;i++) {
for (uint32_t i=0;i<nbytes;i++) {
ue_cri_ptr[nbytes-i-1] = sdu->msg[i];
}
log_h->info("Setting UE contention resolution ID: %d\n", uecri);
@ -274,7 +274,7 @@ public:
void write_pdu(uint32_t lcid, srslte::byte_buffer_t *sdu)
{
int n=0;
uint32_t n=0;
switch(lcid) {
case LCID:
n = write(tun_fd, sdu->msg, sdu->N_bytes);

Loading…
Cancel
Save