Commit 824d2b47 authored by frtabu's avatar frtabu

new set of cppcheck fixes

parent 63143b87
// suppress error about keysP not free, it is done by calling func */ // suppress error about keysP memory leak, free must be done by calling func */
memleak:common/utils/hashtable/obj_hashtable.c memleak:
common/utils/hashtable/obj_hashtable.c
// suppress error about keys memory leak, free must be done by calling func */
memleak:
openair2/UTIL/OMG/omg_hashtable.c
// followings errors are in file not used in oai exec's included in CI // followings errors are in file not used in oai exec's included in CI
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/ltetest.c invalidPrintfArgType_sint:
memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c memleak:
openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:
openair1/PHY/CODING/TESTBENCH/pdcch_test.c
This diff is collapsed.
...@@ -5,46 +5,41 @@ ...@@ -5,46 +5,41 @@
#include <string.h> #include <string.h>
unsigned long register_notifier(gui *_g, char *notification, widget *w, unsigned long register_notifier(gui *_g, char *notification, widget *w,
notifier handler, void *private) notifier handler, void *private) {
{
struct gui *g = _g; struct gui *g = _g;
unsigned long ret; unsigned long ret;
glock(g); glock(g);
if (g->next_notifier_id == 2UL * 1024 * 1024 * 1024) if (g->next_notifier_id == 2UL * 1024 * 1024 * 1024)
ERR("%s:%d: report a bug\n", __FILE__, __LINE__); ERR("%s:%d: report a bug\n", __FILE__, __LINE__);
g->notifiers = realloc(g->notifiers, g->notifiers = realloc(g->notifiers,
(g->notifiers_count+1) * sizeof(struct notifier)); (g->notifiers_count+1) * sizeof(struct notifier));
if (g->notifiers == NULL) abort(); if (g->notifiers == NULL) abort();
ret = g->next_notifier_id; ret = g->next_notifier_id;
g->notifiers[g->notifiers_count].handler = handler; g->notifiers[g->notifiers_count].handler = handler;
g->notifiers[g->notifiers_count].id = g->next_notifier_id; g->notifiers[g->notifiers_count].id = g->next_notifier_id;
g->next_notifier_id++; g->next_notifier_id++;
g->notifiers[g->notifiers_count].notification = strdup(notification); g->notifiers[g->notifiers_count].notification = strdup(notification);
if (g->notifiers[g->notifiers_count].notification == NULL) abort(); if (g->notifiers[g->notifiers_count].notification == NULL) abort();
g->notifiers[g->notifiers_count].w = w; g->notifiers[g->notifiers_count].w = w;
g->notifiers[g->notifiers_count].private = private; g->notifiers[g->notifiers_count].private = private;
/* initialize done to 1 so as not to call the handler if it's created /* initialize done to 1 so as not to call the handler if it's created
* by the call of another one that is in progress * by the call of another one that is in progress
*/ */
g->notifiers[g->notifiers_count].done = 1; g->notifiers[g->notifiers_count].done = 1;
g->notifiers_count++; g->notifiers_count++;
gunlock(g); gunlock(g);
return ret; return ret;
} }
void unregister_notifier(gui *_g, unsigned long notifier_id) void unregister_notifier(gui *_g, unsigned long notifier_id) {
{
struct gui *g = _g; struct gui *g = _g;
int i; int i;
glock(g); glock(g);
for (i = 0; i < g->notifiers_count; i++) for (i = 0; i < g->notifiers_count; i++)
...@@ -54,13 +49,12 @@ void unregister_notifier(gui *_g, unsigned long notifier_id) ...@@ -54,13 +49,12 @@ void unregister_notifier(gui *_g, unsigned long notifier_id)
ERR("%s:%d: notifier_id %ld not found\n", __FILE__,__LINE__,notifier_id); ERR("%s:%d: notifier_id %ld not found\n", __FILE__,__LINE__,notifier_id);
free(g->notifiers[i].notification); free(g->notifiers[i].notification);
memmove(g->notifiers + i, g->notifiers + i + 1, memmove(g->notifiers + i, g->notifiers + i + 1,
(g->notifiers_count-1 - i) * sizeof(struct notifier)); (g->notifiers_count-1 - i) * sizeof(struct notifier));
g->notifiers_count--; g->notifiers_count--;
g->notifiers = realloc(g->notifiers, g->notifiers = realloc(g->notifiers,
g->notifiers_count * sizeof(struct notifier)); g->notifiers_count * sizeof(struct notifier));
if (g->notifiers == NULL) abort(); if (g->notifiers == NULL) abort();
gunlock(g); gunlock(g);
...@@ -68,19 +62,19 @@ void unregister_notifier(gui *_g, unsigned long notifier_id) ...@@ -68,19 +62,19 @@ void unregister_notifier(gui *_g, unsigned long notifier_id)
/* called with lock ON */ /* called with lock ON */
void gui_notify(struct gui *g, char *notification, widget *w, void gui_notify(struct gui *g, char *notification, widget *w,
void *notification_data) void *notification_data) {
{
void *private; void *private;
notifier handler; notifier handler;
int i; int i;
/* this function is not re-entrant, for the moment keep as is /* this function is not re-entrant, for the moment keep as is
* and if the need is there, we'll make a new thread to handle * and if the need is there, we'll make a new thread to handle
* notifications (or something) * notifications (or something)
* for now let's crash in case of recursive call * for now let's crash in case of recursive call
*/ */
static int inside = 0; static int inside = 0;
if (inside) ERR("%s:%d: BUG! contact the authors\n", __FILE__, __LINE__); if (inside) ERR("%s:%d: BUG! contact the authors\n", __FILE__, __LINE__);
inside = 1; inside = 1;
/* clear all handlers */ /* clear all handlers */
...@@ -91,26 +85,25 @@ void gui_notify(struct gui *g, char *notification, widget *w, ...@@ -91,26 +85,25 @@ void gui_notify(struct gui *g, char *notification, widget *w,
* need to be careful here * need to be careful here
*/ */
loop: loop:
for (i = 0; i < g->notifiers_count; i++) { for (i = 0; i < g->notifiers_count; i++) {
if (g->notifiers[i].done == 1 || if (g->notifiers[i].done == 1 ||
g->notifiers[i].w != w || g->notifiers[i].w != w ||
strcmp(g->notifiers[i].notification, notification) != 0) strcmp(g->notifiers[i].notification, notification) != 0)
continue; continue;
break; break;
} }
if (i == g->notifiers_count) goto done; if (i == g->notifiers_count) goto done;
g->notifiers[i].done = 1; g->notifiers[i].done = 1;
handler = g->notifiers[i].handler; handler = g->notifiers[i].handler;
private = g->notifiers[i].private; private = g->notifiers[i].private;
gunlock(g); gunlock(g);
handler(private, g, notification, w, notification_data); handler(private, g, notification, w, notification_data);
glock(g); glock(g);
goto loop; goto loop;
done: done:
inside = 0; inside = 0;
} }
...@@ -7,21 +7,19 @@ ...@@ -7,21 +7,19 @@
#include "config.h" #include "config.h"
#include "../T_defs.h" #include "../T_defs.h"
void usage(void) void usage(void) {
{
printf( printf(
"options:\n" "options:\n"
" -d <database file> this option is mandatory\n" " -d <database file> this option is mandatory\n"
" -ip <host> connect to given IP address (default %s)\n" " -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n", " -p <port> connect to given port (default %d)\n",
DEFAULT_REMOTE_IP, DEFAULT_REMOTE_IP,
DEFAULT_REMOTE_PORT DEFAULT_REMOTE_PORT
); );
exit(1); exit(1);
} }
int main(int n, char **v) int main(int n, char **v) {
{
char *database_filename = NULL; char *database_filename = NULL;
void *database; void *database;
char *ip = DEFAULT_REMOTE_IP; char *ip = DEFAULT_REMOTE_IP;
...@@ -36,11 +34,28 @@ int main(int n, char **v) ...@@ -36,11 +34,28 @@ int main(int n, char **v)
for (i = 1; i < n; i++) { for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
if (!strcmp(v[i], "-d"))
{ if (i > n-2) usage(); database_filename = v[++i]; continue; } if (!strcmp(v[i], "-d")) {
if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; } if (i > n-2) usage();
if (!strcmp(v[i], "-p"))
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; } database_filename = v[++i];
continue;
}
if (!strcmp(v[i], "-ip")) {
if (i > n-2) usage();
ip = v[++i];
continue;
}
if (!strcmp(v[i], "-p")) {
if (i > n-2) usage();
port = atoi(v[++i]);
continue;
}
usage(); usage();
} }
...@@ -50,71 +65,92 @@ int main(int n, char **v) ...@@ -50,71 +65,92 @@ int main(int n, char **v)
} }
database = parse_database(database_filename); database = parse_database(database_filename);
load_config_file(database_filename); load_config_file(database_filename);
number_of_events = number_of_ids(database); number_of_events = number_of_ids(database);
is_on = calloc(number_of_events, sizeof(int)); is_on = calloc(number_of_events, sizeof(int));
if (is_on == NULL) abort(); if (is_on == NULL) abort();
on_off(database, "ENB_PHY_INPUT_SIGNAL", is_on, 1); on_off(database, "ENB_PHY_INPUT_SIGNAL", is_on, 1);
on_off(database, "ENB_PHY_ULSCH_UE_NACK", is_on, 1); on_off(database, "ENB_PHY_ULSCH_UE_NACK", is_on, 1);
on_off(database, "ENB_PHY_ULSCH_UE_ACK", is_on, 1); on_off(database, "ENB_PHY_ULSCH_UE_ACK", is_on, 1);
ev_input = event_id_from_name(database, "ENB_PHY_INPUT_SIGNAL"); ev_input = event_id_from_name(database, "ENB_PHY_INPUT_SIGNAL");
ev_nack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_NACK"); ev_nack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_NACK");
ev_ack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_ACK"); ev_ack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_ACK");
socket = connect_to(ip, port); socket = connect_to(ip, port);
t = 1; t = 1;
if (socket_send(socket, &t, 1) == -1 || if (socket_send(socket, &t, 1) == -1 ||
socket_send(socket, &number_of_events, sizeof(int)) == -1 || socket_send(socket, &number_of_events, sizeof(int)) == -1 ||
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1) socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
abort(); abort();
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
char dump[10][T_BUFFER_MAX]; char dump[10][T_BUFFER_MAX];
event dump_ev[10]; event dump_ev[10];
FILE *z = fopen("/tmp/dd", "w"); if (z == NULL) abort(); FILE *z = fopen("/tmp/dd", "w");
if (z == NULL) abort();
while (1) { while (1) {
char *v; char *v;
event e; event e;
e = get_event(socket, &ebuf, database); e = get_event(socket, &ebuf, database);
v = ebuf.obuf; v = ebuf.obuf;
if (e.type == -1) break; if (e.type == -1) break;
if (e.type == ev_input) { if (e.type == ev_input) {
int sf = e.e[2].i; int sf = e.e[2].i;
if (ebuf.osize > T_BUFFER_MAX)
{ printf("event size too big\n"); exit(1); } if (ebuf.osize > T_BUFFER_MAX) {
printf("event size too big\n");
exit(1);
}
memcpy(dump[sf], ebuf.obuf, ebuf.osize); memcpy(dump[sf], ebuf.obuf, ebuf.osize);
dump_ev[sf] = e; dump_ev[sf] = e;
printf("input %d/%d\n", e.e[1].i, sf); printf("input %d/%d\n", e.e[1].i, sf);
if (fwrite(dump_ev[sf].e[4].b, dump_ev[sf].e[4].bsize, 1, z) != 1) abort();
fflush(z); if (fwrite(dump_ev[sf].e[4].b, dump_ev[sf].e[4].bsize, 1, z) != 1) abort();
fflush(z);
} }
if (e.type == ev_nack) { if (e.type == ev_nack) {
int sf = e.e[2].i; int sf = e.e[2].i;
printf("nack %d/%d\n", e.e[1].i, sf); printf("nack %d/%d\n", e.e[1].i, sf);
FILE *f = fopen("/tmp/dump.raw", "w"); if (f == NULL) abort(); FILE *f = fopen("/tmp/dump.raw", "w");
if (f == NULL) abort();
if (fwrite(dump[sf] + ((char *)dump_ev[sf].e[4].b - v), if (fwrite(dump[sf] + ((char *)dump_ev[sf].e[4].b - v),
dump_ev[sf].e[4].bsize, 1, f) != 1) abort(); dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
if (fclose(f)) abort(); if (fclose(f)) abort();
printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v)); printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v));
// getchar(); // getchar();
} }
if (e.type == ev_ack) { if (e.type == ev_ack) {
int sf = e.e[2].i; int sf = e.e[2].i;
printf("ack %d/%d\n", e.e[1].i, sf); printf("ack %d/%d\n", e.e[1].i, sf);
FILE *f = fopen("/tmp/dump.raw", "w"); if (f == NULL) abort(); FILE *f = fopen("/tmp/dump.raw", "w");
if (f == NULL) abort();
if (fwrite(dump[sf] + ((char *)dump_ev[sf].e[4].b - v), if (fwrite(dump[sf] + ((char *)dump_ev[sf].e[4].b - v),
dump_ev[sf].e[4].bsize, 1, f) != 1) abort(); dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
if (fclose(f)) abort(); if (fclose(f)) abort();
printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v)); printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v));
// getchar(); // getchar();
} }
} }
if (z)
fclose(z);
return 0; return 0;
} }
This diff is collapsed.
...@@ -9,27 +9,38 @@ ...@@ -9,27 +9,38 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <math.h> #include <math.h>
void new_thread(void *(*f)(void *), void *data) void new_thread(void *(*f)(void *), void *data) {
{
pthread_t t; pthread_t t;
pthread_attr_t att; pthread_attr_t att;
if (pthread_attr_init(&att)) if (pthread_attr_init(&att)) {
{ fprintf(stderr, "pthread_attr_init err\n"); exit(1); } fprintf(stderr, "pthread_attr_init err\n");
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) exit(1);
{ fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); } }
if (pthread_attr_setstacksize(&att, 10000000))
{ fprintf(stderr, "pthread_attr_setstacksize err\n"); exit(1); } if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
if (pthread_create(&t, &att, f, data)) fprintf(stderr, "pthread_attr_setdetachstate err\n");
{ fprintf(stderr, "pthread_create err\n"); exit(1); } exit(1);
if (pthread_attr_destroy(&att)) }
{ fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
if (pthread_attr_setstacksize(&att, 10000000)) {
fprintf(stderr, "pthread_attr_setstacksize err\n");
exit(1);
}
if (pthread_create(&t, &att, f, data)) {
fprintf(stderr, "pthread_create err\n");
exit(1);
}
if (pthread_attr_destroy(&att)) {
fprintf(stderr, "pthread_attr_destroy err\n");
exit(1);
}
} }
void sleepms(int ms) void sleepms(int ms) {
{
struct timespec t; struct timespec t;
t.tv_sec = ms / 1000; t.tv_sec = ms / 1000;
t.tv_nsec = (ms % 1000) * 1000000L; t.tv_nsec = (ms % 1000) * 1000000L;
...@@ -37,12 +48,15 @@ void sleepms(int ms) ...@@ -37,12 +48,15 @@ void sleepms(int ms)
if (nanosleep(&t, NULL)) abort(); if (nanosleep(&t, NULL)) abort();
} }
void bps(char *out, float v, char *suffix) void bps(char *out, float v, char *suffix) {
{
static char *bps_unit[4] = { "", "k", "M", "G" }; static char *bps_unit[4] = { "", "k", "M", "G" };
int flog; int flog;
if (v < 1000) flog = 0; else flog = floor(floor(log10(v)) / 3);
if (v < 1000) flog = 0;
else flog = floor(floor(log10(v)) / 3);
if (flog > 3) flog = 3; if (flog > 3) flog = 3;
v /= pow(10, flog*3); v /= pow(10, flog*3);
sprintf(out, "%g%s%s", round(v*100)/100, bps_unit[flog], suffix); sprintf(out, "%g%s%s", round(v*100)/100, bps_unit[flog], suffix);
} }
...@@ -51,25 +65,31 @@ void bps(char *out, float v, char *suffix) ...@@ -51,25 +65,31 @@ void bps(char *out, float v, char *suffix)
/* list */ /* list */
/****************************************************************************/ /****************************************************************************/
list *list_remove_head(list *l) list *list_remove_head(list *l) {
{
list *ret; list *ret;
if (l == NULL) return NULL; if (l == NULL) return NULL;
ret = l->next; ret = l->next;
if (ret != NULL) ret->last = l->last; if (ret != NULL) ret->last = l->last;
free(l); free(l);
return ret; return ret;
} }
list *list_append(list *l, void *data) list *list_append(list *l, void *data) {
{
list *new = calloc(1, sizeof(list)); list *new = calloc(1, sizeof(list));
if (new == NULL) abort(); if (new == NULL) abort();
new->data = data; new->data = data;
if (l == NULL) { if (l == NULL) {
new->last = new; new->last = new;
return new; return new;
} }
l->last->next = new; l->last->next = new;
l->last = new; l->last = new;
return l; return l;
...@@ -79,88 +99,107 @@ list *list_append(list *l, void *data) ...@@ -79,88 +99,107 @@ list *list_append(list *l, void *data)
/* socket */ /* socket */
/****************************************************************************/ /****************************************************************************/
int create_listen_socket(char *addr, int port) int create_listen_socket(char *addr, int port) {
{
struct sockaddr_in a; struct sockaddr_in a;
int s; int s;
int v; int v;
s = socket(AF_INET, SOCK_STREAM, 0); s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) { perror("socket"); exit(1); }
if (s == -1) {
perror("socket");
exit(1);
}
v = 1; v = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int)))
{ perror("setsockopt"); exit(1); } if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int))) {
perror("setsockopt");
exit(1);
}
a.sin_family = AF_INET; a.sin_family = AF_INET;
a.sin_port = htons(port); a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr); a.sin_addr.s_addr = inet_addr(addr);
if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); } if (bind(s, (struct sockaddr *)&a, sizeof(a))) {
if (listen(s, 5)) { perror("listen"); exit(1); } perror("bind");
exit(1);
}
if (listen(s, 5)) {
perror("listen");
exit(1);
}
return s; return s;
} }
int socket_accept(int s) int socket_accept(int s) {
{
struct sockaddr_in a; struct sockaddr_in a;
socklen_t alen; socklen_t alen;
alen = sizeof(a); alen = sizeof(a);
return accept(s, (struct sockaddr *)&a, &alen); return accept(s, (struct sockaddr *)&a, &alen);
} }
int socket_send(int socket, void *buffer, int size) int socket_send(int socket, void *buffer, int size) {
{
char *x = buffer; char *x = buffer;
int ret; int ret;
while (size) { while (size) {
ret = write(socket, x, size); ret = write(socket, x, size);
if (ret <= 0) return -1; if (ret <= 0) return -1;
size -= ret; size -= ret;
x += ret; x += ret;
} }
return 0; return 0;
} }
int get_connection(char *addr, int port) int get_connection(char *addr, int port) {
{
int s, t; int s, t;
printf("waiting for connection on %s:%d\n", addr, port); printf("waiting for connection on %s:%d\n", addr, port);
s = create_listen_socket(addr, port); s = create_listen_socket(addr, port);
t = socket_accept(s); t = socket_accept(s);
if (t == -1) { perror("accept"); exit(1); }
close(s);
printf("connected\n"); if (t == -1) {
perror("accept");
exit(1);
}
close(s);
printf("connected\n");
return t; return t;
} }
int fullread(int fd, void *_buf, int count) int fullread(int fd, void *_buf, int count) {
{
char *buf = _buf; char *buf = _buf;
int ret = 0; int ret = 0;
int l; int l;
while (count) { while (count) {
l = read(fd, buf, count); l = read(fd, buf, count);
if (l <= 0) return -1; if (l <= 0) return -1;
count -= l; count -= l;
buf += l; buf += l;
ret += l; ret += l;
} }
return ret; return ret;
} }
int try_connect_to(char *addr, int port) int try_connect_to(char *addr, int port) {
{
int s; int s;
struct sockaddr_in a; struct sockaddr_in a;
s = socket(AF_INET, SOCK_STREAM, 0); s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) { perror("socket"); exit(1); }
if (s == -1) {
perror("socket");
exit(1);
}
a.sin_family = AF_INET; a.sin_family = AF_INET;
a.sin_port = htons(port); a.sin_port = htons(port);
...@@ -175,14 +214,12 @@ int try_connect_to(char *addr, int port) ...@@ -175,14 +214,12 @@ int try_connect_to(char *addr, int port)
return s; return s;
} }
int connect_to(char *addr, int port) int connect_to(char *addr, int port) {
{
int s; int s;
printf("connecting to %s:%d\n", addr, port); printf("connecting to %s:%d\n", addr, port);
again: again:
s = try_connect_to(addr, port); s = try_connect_to(addr, port);
if (s == -1) { if (s == -1) {
printf("trying again in 1s\n"); printf("trying again in 1s\n");
sleep(1); sleep(1);
...@@ -196,49 +233,45 @@ again: ...@@ -196,49 +233,45 @@ again:
/* buffer */ /* buffer */
/****************************************************************************/ /****************************************************************************/
void PUTC(OBUF *o, char c) void PUTC(OBUF *o, char c) {
{
if (o->osize == o->omaxsize) { if (o->osize == o->omaxsize) {
o->omaxsize += 512; o->omaxsize += 512;
o->obuf = realloc(o->obuf, o->omaxsize); o->obuf = realloc(o->obuf, o->omaxsize);
if (o->obuf == NULL) abort(); if (o->obuf == NULL) abort();
} }
o->obuf[o->osize] = c; o->obuf[o->osize] = c;
o->osize++; o->osize++;
} }
void PUTS(OBUF *o, char *s) void PUTS(OBUF *o, char *s) {
{
while (*s) PUTC(o, *s++); while (*s) PUTC(o, *s++);
} }
static int clean(char c) static int clean(char c) {
{
if (!isprint(c)) c = ' '; if (!isprint(c)) c = ' ';
return c; return c;
} }
void PUTS_CLEAN(OBUF *o, char *s) void PUTS_CLEAN(OBUF *o, char *s) {
{
while (*s) PUTC(o, clean(*s++)); while (*s) PUTC(o, clean(*s++));
} }
void PUTI(OBUF *o, int i) void PUTI(OBUF *o, int i) {
{
char s[64]; char s[64];
sprintf(s, "%d", i); sprintf(s, "%d", i);
PUTS(o, s); PUTS(o, s);
} }
void PUTX2(OBUF *o, int i) void PUTX2(OBUF *o, int i) {
{
char s[64]; char s[64];
sprintf(s, "%2.2x", i); sprintf(s, "%2.2x", i);
PUTS(o, s); PUTS(o, s);
} }
void PUTUL(OBUF *o, unsigned long l) void PUTUL(OBUF *o, unsigned long l) {
{
char s[128]; char s[128];
sprintf(s, "%ld", l); sprintf(s, "%ld", l);
PUTS(o, s); PUTS(o, s);
......
This diff is collapsed.
...@@ -101,7 +101,7 @@ class phy_info ...@@ -101,7 +101,7 @@ class phy_info
{ {
index = 0; index = 0;
id = 0; id = 0;
udp = 0;
local_port = 0; local_port = 0;
remote_addr = 0; remote_addr = 0;
remote_port = 0; remote_port = 0;
...@@ -178,6 +178,7 @@ class pnf_info ...@@ -178,6 +178,7 @@ class pnf_info
sync_mode = 0; sync_mode = 0;
location_mode = 0; location_mode = 0;
location_coordinates = 0;
dl_config_timing = 0; dl_config_timing = 0;
ul_config_timing = 0; ul_config_timing = 0;
tx_timing = 0; tx_timing = 0;
......
This diff is collapsed.
This diff is collapsed.
...@@ -95,7 +95,6 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) { ...@@ -95,7 +95,6 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
} }
free16(dlsch,sizeof(LTE_eNB_DLSCH_t)); free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
dlsch = NULL;
} }
} }
......
...@@ -1960,6 +1960,10 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF, ...@@ -1960,6 +1960,10 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
case 4: //16QAM case 4: //16QAM
if (qam_table_s == NULL) {
LOG_E(PHY,"qam table pointer is NULL\n");
return -1;
}
qam16_table_offset_re = 0; qam16_table_offset_re = 0;
qam16_table_offset_im = 0; qam16_table_offset_im = 0;
...@@ -2029,7 +2033,9 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF, ...@@ -2029,7 +2033,9 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
((int16_t *)&txdataF[4][tti_offset])[1]=qam_table_s[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); ((int16_t *)&txdataF[4][tti_offset])[1]=qam_table_s[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
break; break;
default:
LOG_E(PHY,"Invalid modulation order %i_n",mod_order);
break;
} }
} }
......
...@@ -308,7 +308,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, ...@@ -308,7 +308,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
if (frame_mod4==0) { if (frame_mod4==0) {
LOG_M"pbch_e.m","pbch_e", LOG_M("pbch_e.m","pbch_e",
eNB_pbch->pbch_e, eNB_pbch->pbch_e,
pbch_E, pbch_E,
1, 1,
...@@ -325,7 +325,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, ...@@ -325,7 +325,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
pbch_E); pbch_E);
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
if (frame_mod4==0) { if (frame_mod4==0) {
LOG_M"pbch_e_s.m","pbch_e_s", LOG_M("pbch_e_s.m","pbch_e_s",
eNB_pbch->pbch_e, eNB_pbch->pbch_e,
pbch_E, pbch_E,
1, 1,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -687,7 +687,7 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -687,7 +687,7 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
ul_ch_mag128_0[i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128_0[i],1),_mm_srai_epi16(ul_ch_mag128_1[i],1)); ul_ch_mag128_0[i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128_0[i],1),_mm_srai_epi16(ul_ch_mag128_1[i],1));
ul_ch_mag128_0b[i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128_0b[i],1),_mm_srai_epi16(ul_ch_mag128_1b[i],1)); ul_ch_mag128_0b[i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128_0b[i],1),_mm_srai_epi16(ul_ch_mag128_1b[i],1));
rxdataF_comp128_0[i] = _mm_add_epi16(rxdataF_comp128_0[i],(*(__m128i*)&jitterc[0])); rxdataF_comp128_0[i] = _mm_add_epi16(rxdataF_comp128_0[i],(*(__m128i*)&jitterc[0]));
}
#elif defined(__arm__) #elif defined(__arm__)
rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12];
...@@ -702,10 +702,10 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -702,10 +702,10 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
ul_ch_mag128_0[i] = vhaddq_s16(ul_ch_mag128_0[i],ul_ch_mag128_1[i]); ul_ch_mag128_0[i] = vhaddq_s16(ul_ch_mag128_0[i],ul_ch_mag128_1[i]);
ul_ch_mag128_0b[i] = vhaddq_s16(ul_ch_mag128_0b[i],ul_ch_mag128_1b[i]); ul_ch_mag128_0b[i] = vhaddq_s16(ul_ch_mag128_0b[i],ul_ch_mag128_1b[i]);
rxdataF_comp128_0[i] = vqaddq_s16(rxdataF_comp128_0[i],(*(int16x8_t*)&jitterc[0])); rxdataF_comp128_0[i] = vqaddq_s16(rxdataF_comp128_0[i],(*(int16x8_t*)&jitterc[0]));
}
#endif #endif
}
} }
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
......
...@@ -80,7 +80,6 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch) ...@@ -80,7 +80,6 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
} }
} }
free16(ulsch,sizeof(LTE_UE_ULSCH_t)); free16(ulsch,sizeof(LTE_UE_ULSCH_t));
ulsch = NULL;
} }
} }
......
...@@ -22,6 +22,7 @@ int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coef ...@@ -22,6 +22,7 @@ int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coef
} }
printf("%d\n",(int)tdd_calib_coeffs[0][0]); printf("%d\n",(int)tdd_calib_coeffs[0][0]);
printf("%d\n",(int)tdd_calib_coeffs[1][599]); printf("%d\n",(int)tdd_calib_coeffs[1][599]);
fclose(calibF_fd);
} else } else
printf("%s not found, running with defaults\n",calibF_fname); printf("%s not found, running with defaults\n",calibF_fname);
/* TODO: what to return? is this code used at all? */ /* TODO: what to return? is this code used at all? */
......
This diff is collapsed.
...@@ -1670,7 +1670,12 @@ int getM(PHY_VARS_eNB *eNB,int frame,int subframe) { ...@@ -1670,7 +1670,12 @@ int getM(PHY_VARS_eNB *eNB,int frame,int subframe) {
subframe, subframe,
m); m);
frame_tx = ul_ACK_subframe2_dl_frame(&eNB->frame_parms,frame, frame_tx = ul_ACK_subframe2_dl_frame(&eNB->frame_parms,frame,
subframe,subframe_tx); subframe,subframe_tx);
if (dlsch0 == NULL || dlsch1 == NULL) {
LOG_E(PHY, "dlsch0 and/or dlsch1 NULL, getM frame %i, subframe %i\n",frame,subframe);
return Mtx;
}
harq_pid = dlsch0->harq_ids[frame_tx%2][subframe_tx]; harq_pid = dlsch0->harq_ids[frame_tx%2][subframe_tx];
if (harq_pid>=0 && harq_pid<10) { if (harq_pid>=0 && harq_pid<10) {
......
...@@ -580,7 +580,7 @@ int main(int argc, char **argv) { ...@@ -580,7 +580,7 @@ int main(int argc, char **argv) {
int dci_received; int dci_received;
PHY_VARS_eNB *eNB; PHY_VARS_eNB *eNB;
RU_t *ru; RU_t *ru;
PHY_VARS_UE *UE; PHY_VARS_UE *UE=NULL;
nfapi_dl_config_request_t DL_req; nfapi_dl_config_request_t DL_req;
nfapi_ul_config_request_t UL_req; nfapi_ul_config_request_t UL_req;
nfapi_hi_dci0_request_t HI_DCI0_req; nfapi_hi_dci0_request_t HI_DCI0_req;
...@@ -782,9 +782,13 @@ int main(int argc, char **argv) { ...@@ -782,9 +782,13 @@ int main(int argc, char **argv) {
break; break;
case 'u': case 'u':
dual_stream_UE=1; dual_stream_UE=1;
UE->use_ia_receiver = 1; if (UE != NULL)
UE->use_ia_receiver = 1;
else {
printf("UE is NULL\n");
exit(-1);
}
if ((n_tx_port!=2) || (transmission_mode!=5)) { if ((n_tx_port!=2) || (transmission_mode!=5)) {
printf("IA receiver only supported for TM5!"); printf("IA receiver only supported for TM5!");
exit(-1); exit(-1);
...@@ -941,10 +945,15 @@ int main(int argc, char **argv) { ...@@ -941,10 +945,15 @@ int main(int argc, char **argv) {
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
if (!dual_stream_UE==0) { if (!dual_stream_UE==0) {
UE->use_ia_receiver = 1; if (UE) {
fl_set_button(form_ue->button_0,1); UE->use_ia_receiver = 1;
fl_set_object_label(form_ue->button_0, "IA Receiver ON"); fl_set_button(form_ue->button_0,1);
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN); fl_set_object_label(form_ue->button_0, "IA Receiver ON");
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
} else {
printf("UE is NULL\n");
exit(-1);
}
} }
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -1909,7 +1909,7 @@ int RCconfig_S1( ...@@ -1909,7 +1909,7 @@ int RCconfig_S1(
default: { default: {
LOG_E(S1AP, "Default I-DRX value in conf file is invalid (%i). Should be 32, 64, 128 or 256. \ LOG_E(S1AP, "Default I-DRX value in conf file is invalid (%i). Should be 32, 64, 128 or 256. \
Default DRX set to 32 in MME configuration\n", Default DRX set to 32 in MME configuration\n",
ccparams_lte.pcch_defaultPagingCycle); ccparams_lte.pcch_defaultPagingCycle);
S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 0; S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 0;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment