Fix LGTM warnings

This commit is contained in:
Xavier Arteaga 2020-04-14 20:50:00 +02:00 committed by Andre Puschmann
parent ad0abe740b
commit 562590e595
30 changed files with 135 additions and 75 deletions

View File

@ -45,7 +45,6 @@
#define SRSLTE_PUCCH_1A_2A_NOF_ACK (1)
#define SRSLTE_PUCCH_1B_2B_NOF_ACK (2)
#define SRSLTE_PUCCH3_NOF_BITS (4 * SRSLTE_NRE)
#define SRSLTE_PUCCH_MAX_BITS SRSLTE_CQI_MAX_BITS
#define SRSLTE_PUCCH_MAX_SYMBOLS (SRSLTE_PUCCH_N_SEQ * SRSLTE_PUCCH2_N_SF * SRSLTE_NOF_SLOTS_PER_SF)
// PUCCH Format 1B Channel selection

View File

@ -29,7 +29,7 @@
#define SRSLTE_PUCCH_SIZE_AN_CS 4
#define SRSLTE_PUCCH_SIZE_AN_N3 4
#define SRSLTE_PUCCH_NOF_AN_CS 2
#define SRSLTE_PUCCH2_MAX_DMRS_BITS 16
#define SRSLTE_PUCCH_MAX_BITS SRSLTE_CQI_MAX_BITS
typedef enum SRSLTE_API {
SRSLTE_PUCCH_FORMAT_1 = 0,
@ -80,7 +80,7 @@ typedef struct SRSLTE_API {
// PUCCH configuration generated during a call to encode/decode
srslte_pucch_format_t format;
uint16_t n_pucch;
uint8_t pucch2_drs_bits[SRSLTE_PUCCH2_MAX_DMRS_BITS];
uint8_t pucch2_drs_bits[SRSLTE_PUCCH_MAX_BITS];
} srslte_pucch_cfg_t;

View File

@ -96,6 +96,11 @@ SRSLTE_API void srslte_vec_cf_zero(cf_t* ptr, uint32_t nsamples);
SRSLTE_API void srslte_vec_f_zero(float* ptr, uint32_t nsamples);
SRSLTE_API void srslte_vec_u8_zero(uint8_t* ptr, uint32_t nsamples);
/* Copy memory */
SRSLTE_API void srs_vec_cf_copy(cf_t* dst, const cf_t* src, uint32_t len);
SRSLTE_API void srs_vec_f_copy(float* dst, const float* src, uint32_t len);
SRSLTE_API void srs_vec_u8_copy(uint8_t* dst, const uint8_t* src, uint32_t len);
/* print vectors */
SRSLTE_API void srslte_vec_fprint_c(FILE* stream, const cf_t* x, const uint32_t len);
SRSLTE_API void srslte_vec_fprint_f(FILE* stream, const float* x, const uint32_t len);
@ -267,9 +272,6 @@ SRSLTE_API void srslte_vec_abs_dB_cf(const cf_t* x, float default_value, float*
*/
SRSLTE_API void srslte_vec_arg_deg_cf(const cf_t* x, float default_value, float* arg, const uint32_t len);
/* Copy 256 bit aligned vector */
SRSLTE_API void srs_vec_cf_cpy(const cf_t* src, cf_t* dst, const int len);
SRSLTE_API void srslte_vec_interleave(const cf_t* x, const cf_t* y, cf_t* z, const int len);
SRSLTE_API void srslte_vec_interleave_add(const cf_t* x, const cf_t* y, cf_t* z, const int len);

View File

@ -298,8 +298,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_pack_protocolextensioncontainer(LIBLTE_M2AP_PROTOC
// Length
liblte_value_2_bits(ie->len - 1, ptr, 16);
liblte_align_up_zero(ptr, 8);
uint32_t i;
for (i = 0; i < ie->len; i++) {
for (uint32_t i = 0; i < ie->len; i++) {
if (liblte_m2ap_pack_protocolextensionfield(&ie->buffer[i], ptr) != LIBLTE_SUCCESS) {
return LIBLTE_ERROR_ENCODE_FAIL;
}
@ -324,8 +323,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_protocolextensioncontainer(uint8_t**
ie->len);
return LIBLTE_ERROR_DECODE_FAIL;
}
uint32_t i;
for (i = 0; i < ie->len; i++) {
for (uint32_t i = 0; i < ie->len; i++) {
if (liblte_m2ap_unpack_protocolextensionfield(ptr, &ie->buffer[i]) != LIBLTE_SUCCESS) {
return LIBLTE_ERROR_DECODE_FAIL;
}
@ -413,8 +411,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_pack_ipaddress(LIBLTE_M2AP_IP_ADDRESS_STRUCT* ie,
liblte_value_2_bits(ie->len - 4, ptr, 4);
liblte_align_up_zero(ptr, 8);
// Octets
uint32_t i;
for (i = 0; i < ie->len; i++) {
for (uint8_t i = 0; i < ie->len; i++) {
liblte_value_2_bits(ie->buffer[i], ptr, 8);
}
err = LIBLTE_SUCCESS;
@ -433,7 +430,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_ipaddress(uint8_t** ptr, LIBLTE_M2AP_IP_ADD
if (ie->len > 16) {
return LIBLTE_ERROR_DECODE_FAIL;
}
for (int i = 0; i < ie->len; i++) {
for (uint8_t i = 0; i < ie->len; i++) {
ie->buffer[i] = liblte_bits_2_value(ptr, 8);
}
err = LIBLTE_SUCCESS;
@ -981,7 +978,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_pack_mbmsserviceareaidlist(LIBLTE_M2AP_MBMS_SERVIC
{
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
liblte_value_2_bits(ie->len - 1, ptr, 8);
for (int i = 0; i < ie->len; i++) {
for (uint8_t i = 0; i < ie->len; i++) {
liblte_m2ap_pack_mbmsservicearea(&ie->buffer[i], ptr);
}
err = LIBLTE_SUCCESS;
@ -994,7 +991,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mbmsserviceareaidlist(uint8_t**
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
if (ie != NULL && ptr != NULL) {
ie->len = liblte_bits_2_value(ptr, 8) + 1;
for (int i = 0; i < ie->len; i++) {
for (uint8_t i = 0; i < ie->len; i++) {
liblte_m2ap_unpack_mbmsservicearea(ptr, &ie->buffer[i]);
}
err = LIBLTE_SUCCESS;
@ -2106,7 +2103,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_pack_enbmbmsconfigurationdatalist(LIBLTE_M2AP_ENB_
// Length
liblte_value_2_bits(ie->len - 1, ptr, 8);
for (uint16_t i = 0; i < ie->len; i++) {
for (uint8_t i = 0; i < ie->len; i++) {
LIBLTE_BIT_MSG_STRUCT tmp_msg;
uint8_t* tmp_ptr;
@ -2152,7 +2149,7 @@ liblte_m2ap_unpack_enbmbmsconfigurationdatalist(uint8_t** ptr, LIBLTE_M2AP_ENB_M
return LIBLTE_ERROR_DECODE_FAIL;
}
for (uint16_t i = 0; i < ie->len; i++) {
for (uint8_t i = 0; i < ie->len; i++) {
if (liblte_m2ap_unpack_protocolie_singlecontainer(ptr, &proto_container) != LIBLTE_SUCCESS) {
return LIBLTE_ERROR_DECODE_FAIL;
}
@ -2258,7 +2255,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_pack_mbmssessionlistperpmchitem(LIBLTE_M2AP_MBMS_S
// Length
liblte_value_2_bits(ie->len - 1, ptr, 5);
for (int i = 0; i < ie->len; i++) {
for (uint16_t i = 0; i < ie->len; i++) {
liblte_value_2_bits(ie->buffer[i].ext, ptr, 1);
liblte_value_2_bits(ie->buffer[i].iE_Extensions_present, ptr, 1);
@ -2285,7 +2282,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mbmssessionlistperpmchitem(uint8_t**
// Length
ie->len = liblte_bits_2_value(ptr, 5) + 1;
for (int i = 0; i < ie->len; i++) {
for (uint16_t i = 0; i < ie->len; i++) {
ie->buffer[i].ext = liblte_bits_2_value(ptr, 1);
ie->buffer[i].iE_Extensions_present = liblte_bits_2_value(ptr, 1);
// TMGI
@ -2410,7 +2407,7 @@ liblte_m2ap_pack_mbsfnsubframeconfigurationlist(LIBLTE_M2AP_MBSFN_SUBFRAME_CONFI
liblte_value_2_bits(ie->len - 1, ptr, 3);
liblte_align_up_zero(ptr, 8);
for (uint16_t i = 0; i < ie->len; i++) {
for (uint32_t i = 0; i < ie->len; i++) {
LIBLTE_BIT_MSG_STRUCT tmp_msg;
uint8_t* tmp_ptr;
@ -2458,7 +2455,7 @@ liblte_m2ap_unpack_mbsfnsubframeconfigurationlist(uint8_t**
return LIBLTE_ERROR_DECODE_FAIL;
}
for (uint16_t i = 0; i < ie->len; i++) {
for (uint32_t i = 0; i < ie->len; i++) {
if (liblte_m2ap_unpack_protocolie_header(ptr, &ie_id, &crit, &len) != LIBLTE_SUCCESS) {
return LIBLTE_ERROR_DECODE_FAIL;
}
@ -2864,7 +2861,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_pack_mbsfnareaconfigurationlist(LIBLTE_M2AP_MBSFN_
// Length
liblte_value_2_bits(ie->len - 1, ptr, 8);
for (uint16_t i = 0; i < ie->len; i++) {
for (uint8_t i = 0; i < ie->len; i++) {
// ProtocolIE - MBSFN-Area-Configuration-Item
err = liblte_m2ap_pack_mbsfnareaconfigurationitem(&ie->buffer[i], ptr);
if (err != LIBLTE_SUCCESS) {
@ -2897,7 +2894,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_mbsfnareaconfigurationlist(uint8_t**
return LIBLTE_ERROR_DECODE_FAIL;
}
for (uint16_t i = 0; i < ie->len; i++) {
for (uint8_t i = 0; i < ie->len; i++) {
err = liblte_m2ap_unpack_mbsfnareaconfigurationitem(ptr, &ie->buffer[i]);
if (err != LIBLTE_SUCCESS)
return err;

View File

@ -39,13 +39,13 @@ static void crash_handler(int sig)
printf("srsLTE crashed... we could not save backtrace in '%s'...\n", crash_file_name);
} else {
time_t lnTime;
struct tm* stTime;
struct tm stTime;
char strdate[32];
time(&lnTime);
stTime = localtime(&lnTime);
gmtime_r(&lnTime, &stTime);
strftime(strdate, 32, "%d/%m/%Y %H:%M:%S", stTime);
strftime(strdate, sizeof(strdate), "%d/%m/%Y %H:%M:%S", &stTime);
fprintf(f, "--- command='");
for (int i = 0; i < bt_argc; i++) {

View File

@ -234,9 +234,9 @@ void log_filter::get_tti_str(const uint32_t tti_, char* buffer, const uint32_t b
void log_filter::now_time(char* buffer, const uint32_t buffer_len)
{
struct timeval rawtime;
struct tm* timeinfo;
char us[16];
timeval rawtime = {};
tm timeinfo = {};
char us[16];
srslte_timestamp_t now;
uint64_t usec_epoch;
@ -247,16 +247,16 @@ void log_filter::now_time(char* buffer, const uint32_t buffer_len)
}
if (!time_src) {
gettimeofday(&rawtime, NULL);
timeinfo = localtime(&rawtime.tv_sec);
gettimeofday(&rawtime, nullptr);
gmtime_r(&rawtime.tv_sec, &timeinfo);
if (time_format == TIME) {
strftime(buffer, buffer_len, "%H:%M:%S.", timeinfo);
strftime(buffer, buffer_len, "%H:%M:%S.", &timeinfo);
snprintf(us, 16, "%06ld", rawtime.tv_usec);
uint32_t dest_len = strlen(buffer);
uint32_t dest_len = (uint32_t)strlen(buffer);
strncat(buffer, us, buffer_len - dest_len - 1);
} else {
usec_epoch = rawtime.tv_sec * 1000000 + rawtime.tv_usec;
usec_epoch = rawtime.tv_sec * 1000000UL + rawtime.tv_usec;
snprintf(buffer, buffer_len, "%" PRIu64, usec_epoch);
}
} else {
@ -265,7 +265,7 @@ void log_filter::now_time(char* buffer, const uint32_t buffer_len)
if (time_format == TIME) {
snprintf(buffer, buffer_len, "%ld:%06u", now.full_secs, (uint32_t)(now.frac_secs * 1e6));
} else {
usec_epoch = now.full_secs * 1000000 + (uint32_t)(now.frac_secs * 1e6);
usec_epoch = now.full_secs * 1000000UL + (uint64_t)(now.frac_secs * 1e6);
snprintf(buffer, buffer_len, "%" PRIu64, usec_epoch);
}
}

View File

@ -156,8 +156,11 @@ clean_exit:
void srslte_chest_dl_free(srslte_chest_dl_t* q)
{
if (&q->csr_refs)
srslte_refsignal_free(&q->csr_refs);
if (!q) {
return;
}
srslte_refsignal_free(&q->csr_refs);
if (q->mbsfn_refs) {
for (int i = 0; i < SRSLTE_MAX_MBSFN_AREA_IDS; i++) {

View File

@ -106,8 +106,8 @@ int srslte_dft_replan(srslte_dft_plan_t* plan, const int new_dft_points)
static void allocate(srslte_dft_plan_t* plan, int size_in, int size_out, int len)
{
plan->in = fftwf_malloc(size_in * len);
plan->out = fftwf_malloc(size_out * len);
plan->in = fftwf_malloc((size_t)size_in * len);
plan->out = fftwf_malloc((size_t)size_out * len);
}
int srslte_dft_replan_guru_c(srslte_dft_plan_t* plan,
@ -294,11 +294,11 @@ static void copy_pre(uint8_t* dst, uint8_t* src, int size_d, int len, bool forwa
int offset = dc ? 1 : 0;
if (mirror && !forward) {
int hlen = dft_floor(len, 2);
memset(dst, 0, size_d * offset);
memcpy(&dst[size_d * offset], &src[size_d * hlen], size_d * (len - hlen - offset));
memcpy(&dst[(len - hlen) * size_d], src, size_d * hlen);
memset(dst, 0, (size_t)size_d * offset);
memcpy(&dst[size_d * offset], &src[size_d * hlen], (size_t)size_d * (len - hlen - offset));
memcpy(&dst[(len - hlen) * size_d], src, (size_t)size_d * hlen);
} else {
memcpy(dst, src, size_d * len);
memcpy(dst, src, (size_t)size_d * len);
}
}
@ -307,10 +307,10 @@ static void copy_post(uint8_t* dst, uint8_t* src, int size_d, int len, bool forw
int offset = dc ? 1 : 0;
if (mirror && forward) {
int hlen = dft_ceil(len, 2);
memcpy(dst, &src[size_d * hlen], size_d * (len - hlen));
memcpy(&dst[(len - hlen) * size_d], &src[size_d * offset], size_d * (hlen - offset));
memcpy(dst, &src[size_d * hlen], (size_t)size_d * (len - hlen));
memcpy(&dst[(len - hlen) * size_d], &src[size_d * offset], (size_t)size_d * (hlen - offset));
} else {
memcpy(dst, src, size_d * len);
memcpy(dst, src, (size_t)size_d * len);
}
}

View File

@ -18,6 +18,8 @@
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_PARITY_H_
#define SRSLTE_PARITY_H_
#include <inttypes.h>
@ -53,3 +55,5 @@ static inline uint32_t parity(int x)
x ^= (x >> 8);
return parityb(x);
}
#endif /* SRSLTE_PARITY_H_ */

View File

@ -19,6 +19,9 @@
*
*/
#ifndef SRSLTE_VITERBI37_H_
#define SRSLTE_VITERBI37_H_
#include <stdbool.h>
void* create_viterbi37_port(int polys[3], uint32_t len);
@ -77,4 +80,6 @@ int chainback_viterbi37_avx2_16bit(void* p, uint8_t* data, uint32_t nbits, uint3
void delete_viterbi37_avx2_16bit(void* p);
int update_viterbi37_blk_avx2_16bit(void* p, uint16_t* syms, uint32_t nbits, uint32_t* best_state);
int update_viterbi37_blk_avx2_16bit(void* p, uint16_t* syms, uint32_t nbits, uint32_t* best_state);
#endif /* SRSLTE_VITERBI37_H_ */

View File

@ -53,7 +53,7 @@ int srslte_layermap_multiplex(cf_t* d[SRSLTE_MAX_CODEWORDS],
{
if (nof_cw == nof_layers) {
for (int i = 0; i < nof_cw; i++) {
srs_vec_cf_cpy(d[i], x[i], (uint32_t)nof_symbols[0]);
srs_vec_cf_copy(x[i], d[i], (uint32_t)nof_symbols[0]);
}
return nof_symbols[0];
} else if (nof_cw == 1) {

View File

@ -1889,16 +1889,16 @@ int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS],
if (nof_ports > SRSLTE_MAX_PORTS) {
ERROR("Maximum number of ports is %d (nof_ports=%d)\n", SRSLTE_MAX_PORTS, nof_ports);
return -1;
return SRSLTE_ERROR;
}
if (nof_layers > SRSLTE_MAX_LAYERS) {
ERROR("Maximum number of layers is %d (nof_layers=%d)\n", SRSLTE_MAX_LAYERS, nof_layers);
return -1;
return SRSLTE_ERROR;
}
switch (type) {
case SRSLTE_TXSCHEME_CDD:
if (nof_layers >= 2 && nof_layers <= 4) {
if (nof_layers == 2) {
switch (mimo_decoder) {
case SRSLTE_MIMO_DECODER_ZF:
return srslte_predecoding_ccd_zf(y, h, x, csi, nof_rxant, nof_ports, nof_layers, nof_symbols, scaling);
@ -1908,9 +1908,9 @@ int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS],
}
} else {
ERROR("Invalid number of layers %d\n", nof_layers);
return -1;
return SRSLTE_ERROR;
}
return -1;
return SRSLTE_ERROR;
case SRSLTE_TXSCHEME_PORT0:
if (nof_ports == 1 && nof_layers == 1) {
return srslte_predecoding_single_multi(y, h[0], x[0], csi, nof_rxant, nof_symbols, scaling, noise_estimate);
@ -1918,14 +1918,14 @@ int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS],
ERROR("Number of ports and layers must be 1 for transmission on single antenna ports (%d, %d)\n",
nof_ports,
nof_layers);
return -1;
return SRSLTE_ERROR;
}
case SRSLTE_TXSCHEME_DIVERSITY:
if (nof_ports == nof_layers) {
return srslte_predecoding_diversity_multi(y, h, x, csi, nof_rxant, nof_ports, nof_symbols, scaling);
} else {
ERROR("Error number of layers must equal number of ports in transmit diversity\n");
return -1;
return SRSLTE_ERROR;
}
case SRSLTE_TXSCHEME_SPATIALMUX:
return srslte_predecoding_multiplex(

View File

@ -19,6 +19,9 @@
*
*/
#ifndef SRSLTE_HARD_DEMOD_LTE_H_
#define SRSLTE_HARD_DEMOD_LTE_H_
#include <complex.h>
#include <math.h>
#include <stdint.h>
@ -280,4 +283,6 @@ inline void hard_qam256_demod(const cf_t* in, uint8_t* out, uint32_t N)
out[8 * s + 7] = 0x0;
}
}
}
}
#endif /* SRSLTE_HARD_DEMOD_LTE_H_ */

View File

@ -18,6 +18,8 @@
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_LTE_TABLES_H_
#define SRSLTE_LTE_TABLES_H_
#include <srslte/config.h>
@ -54,3 +56,5 @@ void set_16QAMtable(cf_t* table);
void set_64QAMtable(cf_t* table);
void set_256QAMtable(cf_t* table);
#endif /* SRSLTE_LTE_TABLES_H_ */

View File

@ -517,7 +517,7 @@ int srslte_npbch_decode_frame(srslte_npbch_t* q,
uint32_t nof_bits,
uint32_t nof_ports)
{
memcpy(&q->temp[dst * nof_bits], &q->llr[src * nof_bits], n * nof_bits * sizeof(float));
srs_vec_f_copy(&q->temp[dst * nof_bits], &q->llr[src * nof_bits], n * nof_bits);
// descramble
srslte_scrambling_f_offset(&q->seq, &q->temp[dst * nof_bits], dst * nof_bits, n * nof_bits);

View File

@ -401,7 +401,7 @@ int decode_frame(srslte_pbch_t* q, uint32_t src, uint32_t dst, uint32_t n, uint3
int j;
if (dst + n <= 4 && src + n <= 4) {
memcpy(&q->temp[dst * nof_bits], &q->llr[src * nof_bits], n * nof_bits * sizeof(float));
srs_vec_f_copy(&q->temp[dst * nof_bits], &q->llr[src * nof_bits], n * nof_bits);
/* descramble */
srslte_scrambling_f_offset(&q->seq, &q->temp[dst * nof_bits], dst * nof_bits, n * nof_bits);

View File

@ -18,6 +18,8 @@
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_PRB_DL_H_
#define SRSLTE_PRB_DL_H_
#include "srslte/config.h"
@ -25,3 +27,5 @@ void prb_cp_ref(cf_t** input, cf_t** output, int offset, int nof_refs, int nof_i
void prb_cp(cf_t** input, cf_t** output, int nof_prb);
void prb_cp_half(cf_t** input, cf_t** output, int nof_prb);
void prb_put_ref_(cf_t** input, cf_t** output, int offset, int nof_refs, int nof_intervals);
#endif /* SRSLTE_PRB_DL_H_ */

View File

@ -1251,7 +1251,7 @@ int srslte_ulsch_encode(srslte_sch_t* q,
srslte_bit_pack_vector(q->temp_g_bits, g_bits, Q_prime_cqi * Qm);
// Reset the buffer because will be reused in ulsch_interleave
bzero(q->temp_g_bits, Q_prime_cqi * Qm);
srslte_vec_u8_zero(q->temp_g_bits, Q_prime_cqi * Qm);
}
e_offset += Q_prime_cqi * Qm;

View File

@ -19,6 +19,9 @@
*
*/
#ifndef SRSLTE_TBS_TABLES_H_
#define SRSLTE_TBS_TABLES_H_
/* Modulation and TBS index table for PDSCH from 3GPP TS 36.213 v10.3.0 table 7.1.7.1-1 */
static const int dl_mcs_tbs_idx_table[29] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13,
14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
@ -266,3 +269,5 @@ static const int tbs_table[SRSLTE_RA_NOF_TBS_IDX][110] = {
63776, 63776, 66592, 66592, 68808, 68808, 71112, 71112, 71112, 73712, 75376, 76208, 76208, 76208, 78704, 78704,
81176, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800,
93800, 97896, 97896, 97896, 97896, 97896, 97896, 97896, 97896, 97896, 97896, 97896, 97896, 97896}};
#endif /* SRSLTE_TBS_TABLES_H_ */

View File

@ -18,6 +18,8 @@
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_RF_HELPER_H_
#define SRSLTE_RF_HELPER_H_
// A bunch of helper functions to process device arguments
@ -109,4 +111,6 @@ static inline int parse_uint32(char* args, const char* config_arg_base, int chan
*value = tmp_value;
return ret;
}
}
#endif /* SRSLTE_RF_HELPER_H_ */

View File

@ -19,6 +19,9 @@
*
*/
#ifndef SRSLTE_RF_SOAPY_IMP_H_
#define SRSLTE_RF_SOAPY_IMP_H_
#include "srslte/config.h"
#include "srslte/phy/rf/rf.h"
#include <stdbool.h>
@ -98,3 +101,5 @@ int rf_soapy_send_timed_multi(void* h,
bool blocking,
bool is_start_of_burst,
bool is_end_of_burst);
#endif /* SRSLTE_RF_SOAPY_IMP_H_ */

View File

@ -18,6 +18,8 @@
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_RF_UHD_IMP_H_
#define SRSLTE_RF_UHD_IMP_H_
#include <stdbool.h>
#include <stdint.h>
@ -102,3 +104,5 @@ SRSLTE_API int rf_uhd_send_timed_multi(void* h,
bool blocking,
bool is_start_of_burst,
bool is_end_of_burst);
#endif /* SRSLTE_RF_UHD_IMP_H_ */

View File

@ -379,8 +379,6 @@ int rf_zmq_open_multi(char* args, void** h, uint32_t nof_channels)
int rf_zmq_close(void* h)
{
rf_zmq_stop_rx_stream(h);
rf_zmq_handler_t* handler = (rf_zmq_handler_t*)h;
rf_zmq_info(handler->id, "Closing ...\n");
@ -705,7 +703,7 @@ int rf_zmq_recv_with_time_multi(void* h,
}
}
#endif // ZMQ_MONITOR
if (n > 0) {
if (n > SRSLTE_SUCCESS) {
// No error
count[i] += n;
} else if (n == SRSLTE_ERROR_TIMEOUT) {
@ -713,7 +711,7 @@ int rf_zmq_recv_with_time_multi(void* h,
if (handler->receiver[i].fail_on_disconnect) {
goto clean_exit;
}
} else if (n > 0) {
} else if (n < SRSLTE_SUCCESS) {
// Other error, exit
fprintf(stderr, "Error: receiving data.\n");
goto clean_exit;

View File

@ -19,6 +19,9 @@
*
*/
#ifndef SRSLTE_RF_ZMQ_IMP_H_
#define SRSLTE_RF_ZMQ_IMP_H_
#include <inttypes.h>
#include <stdbool.h>
@ -96,3 +99,5 @@ SRSLTE_API int rf_zmq_send_timed_multi(void* h,
bool blocking,
bool is_start_of_burst,
bool is_end_of_burst);
#endif /* SRSLTE_RF_ZMQ_IMP_H_ */

View File

@ -138,7 +138,7 @@ static int _rf_zmq_tx_baseband(rf_zmq_tx_t* q, cf_t* buffer, uint32_t nsamples)
// Send base-band if request was received
if (n > 0) {
n = zmq_send(q->sock, buf, sample_sz * nsamples, 0);
n = zmq_send(q->sock, buf, (size_t)sample_sz * nsamples, 0);
if (n < 0) {
if (rf_zmq_handle_error(q->id, "tx baseband send")) {
n = SRSLTE_ERROR;

View File

@ -18,6 +18,8 @@
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_UHD_C_API_C_
#define SRSLTE_UHD_C_API_C_
#include "srslte/config.h"
#include "srslte/phy/rf/rf.h"
@ -30,3 +32,5 @@ SRSLTE_API void uhd_tx_metadata_set_start(uhd_tx_metadata_handle* md, bool is_st
SRSLTE_API void uhd_tx_metadata_set_has_time_spec(uhd_tx_metadata_handle* md, bool has_time_spec);
SRSLTE_API void uhd_tx_metadata_set_end(uhd_tx_metadata_handle* md, bool is_end_of_burst);
SRSLTE_API void uhd_tx_metadata_add_time_spec(uhd_tx_metadata_handle* md, double frac_secs);
#endif /* SRSLTE_UHD_C_API_C_ */

View File

@ -200,6 +200,21 @@ void srslte_vec_f_zero(float* ptr, uint32_t nsamples)
memset(ptr, 0, sizeof(float) * nsamples);
}
void srs_vec_cf_copy(cf_t* dst, const cf_t* src, uint32_t len)
{
srslte_vec_cp_simd(src, dst, len);
}
void srs_vec_f_copy(float* dst, const float* src, uint32_t len)
{
memcpy(dst, src, sizeof(float) * len);
}
void srs_vec_u8_copy(uint8_t* dst, const uint8_t* src, uint32_t len)
{
memcpy(dst, src, sizeof(uint8_t) * len);
}
void* srslte_vec_realloc(void* ptr, uint32_t old_size, uint32_t new_size)
{
#ifndef LV_HAVE_SSE
@ -627,11 +642,6 @@ void srslte_vec_quant_sus(const int16_t* in,
}
}
void srs_vec_cf_cpy(const cf_t* src, cf_t* dst, int len)
{
srslte_vec_cp_simd(src, dst, len);
}
void srslte_vec_interleave(const cf_t* x, const cf_t* y, cf_t* z, const int len)
{
srslte_vec_interleave_simd(x, y, z, len);

View File

@ -2081,7 +2081,7 @@ int rlc_am_write_status_pdu(rlc_status_pdu_t* status, uint8_t* payload)
bool rlc_am_is_valid_status_pdu(const rlc_status_pdu_t& status)
{
for (uint16_t i = 0; i < status.N_nack; ++i) {
for (uint32_t i = 0; i < status.N_nack; ++i) {
if (status.nacks[i].nack_sn == status.ack_sn) {
return false;
}

View File

@ -586,9 +586,11 @@ void rrc::log_neighbour_cells()
int n = 0;
n += snprintf(ordered, MAX_STR_LEN, "[%s", neighbour_cells[0]->to_string().c_str());
for (uint32_t i = 1; i < neighbour_cells.size(); i++) {
if (MAX_STR_LEN - n > 0) { // make sure there is still room left
int m = snprintf(&ordered[n], MAX_STR_LEN - n, " | %s", neighbour_cells[i]->to_string().c_str());
n += m;
if (n < MAX_STR_LEN) { // make sure there is still room left
int m = snprintf(&ordered[n], (size_t)MAX_STR_LEN - n, " | %s", neighbour_cells[i]->to_string().c_str());
if (m > 0) {
n += m;
}
}
}
rrc_log->info("Neighbours: %s]\n", ordered);

View File

@ -932,7 +932,7 @@ int pcsc_usim::scard::get_imsi(char* imsi, size_t* len)
imsilen = (blen - 2) * 2 + 1;
log->debug("SCARD: IMSI file length=%ld imsilen=%ld\n", (long)blen, (long)imsilen);
if (blen < 2 || imsilen > *len) {
if (imsilen > *len) {
*len = imsilen;
return -4;
}