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 */
memleak:common/utils/hashtable/obj_hashtable.c
// suppress error about keysP memory leak, free must be done by calling func */
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
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/ltetest.c
memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c
invalidPrintfArgType_sint:
openair1/PHY/CODING/TESTBENCH/ltetest.c
memleak:
openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:
openair1/PHY/CODING/TESTBENCH/pdcch_test.c
This diff is collapsed.
......@@ -5,11 +5,9 @@
#include <string.h>
unsigned long register_notifier(gui *_g, char *notification, widget *w,
notifier handler, void *private)
{
notifier handler, void *private) {
struct gui *g = _g;
unsigned long ret;
glock(g);
if (g->next_notifier_id == 2UL * 1024 * 1024 * 1024)
......@@ -17,34 +15,31 @@ unsigned long register_notifier(gui *_g, char *notification, widget *w,
g->notifiers = realloc(g->notifiers,
(g->notifiers_count+1) * sizeof(struct notifier));
if (g->notifiers == NULL) abort();
ret = g->next_notifier_id;
g->notifiers[g->notifiers_count].handler = handler;
g->notifiers[g->notifiers_count].id = g->next_notifier_id;
g->next_notifier_id++;
g->notifiers[g->notifiers_count].notification = strdup(notification);
if (g->notifiers[g->notifiers_count].notification == NULL) abort();
g->notifiers[g->notifiers_count].w = w;
g->notifiers[g->notifiers_count].private = private;
/* 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
*/
g->notifiers[g->notifiers_count].done = 1;
g->notifiers_count++;
gunlock(g);
return ret;
}
void unregister_notifier(gui *_g, unsigned long notifier_id)
{
void unregister_notifier(gui *_g, unsigned long notifier_id) {
struct gui *g = _g;
int i;
glock(g);
for (i = 0; i < g->notifiers_count; i++)
......@@ -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);
free(g->notifiers[i].notification);
memmove(g->notifiers + i, g->notifiers + i + 1,
(g->notifiers_count-1 - i) * sizeof(struct notifier));
g->notifiers_count--;
g->notifiers = realloc(g->notifiers,
g->notifiers_count * sizeof(struct notifier));
if (g->notifiers == NULL) abort();
gunlock(g);
......@@ -68,19 +62,19 @@ void unregister_notifier(gui *_g, unsigned long notifier_id)
/* called with lock ON */
void gui_notify(struct gui *g, char *notification, widget *w,
void *notification_data)
{
void *notification_data) {
void *private;
notifier handler;
int i;
/* 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
* notifications (or something)
* for now let's crash in case of recursive call
*/
static int inside = 0;
if (inside) ERR("%s:%d: BUG! contact the authors\n", __FILE__, __LINE__);
inside = 1;
/* clear all handlers */
......@@ -91,26 +85,25 @@ void gui_notify(struct gui *g, char *notification, widget *w,
* need to be careful here
*/
loop:
for (i = 0; i < g->notifiers_count; i++) {
if (g->notifiers[i].done == 1 ||
g->notifiers[i].w != w ||
strcmp(g->notifiers[i].notification, notification) != 0)
continue;
break;
}
if (i == g->notifiers_count) goto done;
g->notifiers[i].done = 1;
handler = g->notifiers[i].handler;
private = g->notifiers[i].private;
gunlock(g);
handler(private, g, notification, w, notification_data);
glock(g);
goto loop;
done:
inside = 0;
}
......@@ -7,21 +7,19 @@
#include "config.h"
#include "../T_defs.h"
void usage(void)
{
void usage(void) {
printf(
"options:\n"
" -d <database file> this option is mandatory\n"
" -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n",
"options:\n"
" -d <database file> this option is mandatory\n"
" -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n",
DEFAULT_REMOTE_IP,
DEFAULT_REMOTE_PORT
);
exit(1);
}
int main(int n, char **v)
{
int main(int n, char **v) {
char *database_filename = NULL;
void *database;
char *ip = DEFAULT_REMOTE_IP;
......@@ -36,11 +34,28 @@ int main(int n, char **v)
for (i = 1; i < n; i++) {
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], "-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; }
if (!strcmp(v[i], "-d")) {
if (i > n-2) usage();
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();
}
......@@ -50,71 +65,92 @@ int main(int n, char **v)
}
database = parse_database(database_filename);
load_config_file(database_filename);
number_of_events = number_of_ids(database);
is_on = calloc(number_of_events, sizeof(int));
if (is_on == NULL) abort();
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_ACK", is_on, 1);
ev_input = event_id_from_name(database, "ENB_PHY_INPUT_SIGNAL");
ev_nack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_NACK");
ev_ack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_ACK");
socket = connect_to(ip, port);
t = 1;
if (socket_send(socket, &t, 1) == -1 ||
socket_send(socket, &number_of_events, sizeof(int)) == -1 ||
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
abort();
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
char dump[10][T_BUFFER_MAX];
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) {
char *v;
event e;
e = get_event(socket, &ebuf, database);
v = ebuf.obuf;
if (e.type == -1) break;
if (e.type == ev_input) {
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);
dump_ev[sf] = e;
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) {
int sf = e.e[2].i;
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),
dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
if (fclose(f)) abort();
printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v));
// getchar();
// getchar();
}
if (e.type == ev_ack) {
int sf = e.e[2].i;
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),
dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
if (fclose(f)) abort();
printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v));
// getchar();
// getchar();
}
}
if (z)
fclose(z);
return 0;
}
This diff is collapsed.
......@@ -9,27 +9,38 @@
#include <arpa/inet.h>
#include <math.h>
void new_thread(void *(*f)(void *), void *data)
{
void new_thread(void *(*f)(void *), void *data) {
pthread_t t;
pthread_attr_t att;
if (pthread_attr_init(&att))
{ fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
{ 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_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); }
if (pthread_attr_init(&att)) {
fprintf(stderr, "pthread_attr_init err\n");
exit(1);
}
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
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_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;
t.tv_sec = ms / 1000;
t.tv_nsec = (ms % 1000) * 1000000L;
......@@ -37,12 +48,15 @@ void sleepms(int ms)
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" };
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;
v /= pow(10, flog*3);
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)
/* list */
/****************************************************************************/
list *list_remove_head(list *l)
{
list *list_remove_head(list *l) {
list *ret;
if (l == NULL) return NULL;
ret = l->next;
if (ret != NULL) ret->last = l->last;
free(l);
return ret;
}
list *list_append(list *l, void *data)
{
list *list_append(list *l, void *data) {
list *new = calloc(1, sizeof(list));
if (new == NULL) abort();
new->data = data;
if (l == NULL) {
new->last = new;
return new;
}
l->last->next = new;
l->last = new;
return l;
......@@ -79,88 +99,107 @@ list *list_append(list *l, void *data)
/* socket */
/****************************************************************************/
int create_listen_socket(char *addr, int port)
{
int create_listen_socket(char *addr, int port) {
struct sockaddr_in a;
int s;
int v;
s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) { perror("socket"); exit(1); }
if (s == -1) {
perror("socket");
exit(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_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr);
if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
if (listen(s, 5)) { perror("listen"); exit(1); }
if (bind(s, (struct sockaddr *)&a, sizeof(a))) {
perror("bind");
exit(1);
}
if (listen(s, 5)) {
perror("listen");
exit(1);
}
return s;
}
int socket_accept(int s)
{
int socket_accept(int s) {
struct sockaddr_in a;
socklen_t alen;
alen = sizeof(a);
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;
int ret;
while (size) {
ret = write(socket, x, size);
if (ret <= 0) return -1;
size -= ret;
x += ret;
}
return 0;
}
int get_connection(char *addr, int port)
{
int get_connection(char *addr, int port) {
int s, t;
printf("waiting for connection on %s:%d\n", addr, port);
s = create_listen_socket(addr, port);
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;
}
int fullread(int fd, void *_buf, int count)
{
int fullread(int fd, void *_buf, int count) {
char *buf = _buf;
int ret = 0;
int l;
while (count) {
l = read(fd, buf, count);
if (l <= 0) return -1;
count -= l;
buf += l;
ret += l;
}
return ret;
}
int try_connect_to(char *addr, int port)
{
int try_connect_to(char *addr, int port) {
int s;
struct sockaddr_in a;
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_port = htons(port);
......@@ -175,14 +214,12 @@ int try_connect_to(char *addr, int port)
return s;
}
int connect_to(char *addr, int port)
{
int connect_to(char *addr, int port) {
int s;
printf("connecting to %s:%d\n", addr, port);
again:
s = try_connect_to(addr, port);
if (s == -1) {
printf("trying again in 1s\n");
sleep(1);
......@@ -196,49 +233,45 @@ again:
/* buffer */
/****************************************************************************/
void PUTC(OBUF *o, char c)
{
void PUTC(OBUF *o, char c) {
if (o->osize == o->omaxsize) {
o->omaxsize += 512;
o->obuf = realloc(o->obuf, o->omaxsize);
if (o->obuf == NULL) abort();
}
o->obuf[o->osize] = c;
o->osize++;
}
void PUTS(OBUF *o, char *s)
{
void PUTS(OBUF *o, char *s) {
while (*s) PUTC(o, *s++);
}
static int clean(char c)
{
static int clean(char c) {
if (!isprint(c)) c = ' ';
return c;
}
void PUTS_CLEAN(OBUF *o, char *s)
{
void PUTS_CLEAN(OBUF *o, char *s) {
while (*s) PUTC(o, clean(*s++));
}
void PUTI(OBUF *o, int i)
{
void PUTI(OBUF *o, int i) {
char s[64];
sprintf(s, "%d", i);
PUTS(o, s);
}
void PUTX2(OBUF *o, int i)
{
void PUTX2(OBUF *o, int i) {
char s[64];
sprintf(s, "%2.2x", i);
PUTS(o, s);
}
void PUTUL(OBUF *o, unsigned long l)
{
void PUTUL(OBUF *o, unsigned long l) {
char s[128];
sprintf(s, "%ld", l);
PUTS(o, s);
......
This diff is collapsed.
......@@ -101,7 +101,7 @@ class phy_info
{
index = 0;
id = 0;
udp = 0;
local_port = 0;
remote_addr = 0;
remote_port = 0;
......@@ -178,6 +178,7 @@ class pnf_info
sync_mode = 0;
location_mode = 0;
location_coordinates = 0;
dl_config_timing = 0;
ul_config_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) {
}
free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
dlsch = NULL;
}
}
......
......@@ -1960,6 +1960,10 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
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_im = 0;
......@@ -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);
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,
#ifdef DEBUG_PBCH
if (frame_mod4==0) {
LOG_M"pbch_e.m","pbch_e",
LOG_M("pbch_e.m","pbch_e",
eNB_pbch->pbch_e,
pbch_E,
1,
......@@ -325,7 +325,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
pbch_E);
#ifdef DEBUG_PBCH
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,
pbch_E,
1,
......
......@@ -33,16 +33,13 @@
#include "PHY/defs_eNB.h"
uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
{
uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
// for FDD
if (frame_parms->frame_type == FDD)
return 1;
// for TDD
switch (frame_parms->tdd_config) {
case 0:
if ((subframe==0) || (subframe==5))
return(2);
......@@ -94,9 +91,7 @@ uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
}
}
unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe)
{
unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) {
if (frame_parms->frame_type == FDD)
return(subframe&7);
......@@ -124,14 +119,12 @@ unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char su
}
break;
}
return(0);
}
int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int subframe)
{
int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int subframe) {
int pusch_frame;
if (frame_parms->frame_type == FDD) {
......@@ -145,8 +138,7 @@ int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int sub
return pusch_frame % 1024;
}
uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
{
uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
uint8_t pusch_subframe = 255;
if (frame_parms->frame_type == FDD)
......@@ -263,9 +255,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
return pusch_subframe;
}
int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg)
{
int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg) {
if ((reg == frame_parms->pcfich_reg[0]) ||
(reg == frame_parms->pcfich_reg[1]) ||
(reg == frame_parms->pcfich_reg[2]) ||
......@@ -275,9 +265,7 @@ int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg)
return(0);
}
void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
{
void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) {
unsigned short n0 = (frame_parms->N_RB_DL * 2) - 4; // 2 REG per RB less the 4 used by PCFICH in first symbol
unsigned short n1 = (frame_parms->N_RB_DL * 3); // 3 REG per RB in second and third symbol
unsigned short n2 = n1;
......@@ -285,11 +273,9 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
unsigned short Ngroup_PHICH;
// uint16_t *phich_reg = frame_parms->phich_reg;
uint16_t *pcfich_reg = frame_parms->pcfich_reg;
// compute Ngroup_PHICH (see formula at beginning of Section 6.9 in 36-211
Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48;
if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0)
Ngroup_PHICH++;
......@@ -299,7 +285,8 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
}
#ifdef DEBUG_PHICH
LOG_D(PHY,"Ngroup_PHICH %d (phich_config_common.phich_resource %d,phich_config_common.phich_duration %s, NidCell %d,Ncp %d, frame_type %d), smallest pcfich REG %d, n0 %d, n1 %d (first PHICH REG %d)\n",
LOG_D(PHY,
"Ngroup_PHICH %d (phich_config_common.phich_resource %d,phich_config_common.phich_duration %s, NidCell %d,Ncp %d, frame_type %d), smallest pcfich REG %d, n0 %d, n1 %d (first PHICH REG %d)\n",
((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1)),
frame_parms->phich_config_common.phich_resource,
frame_parms->phich_config_common.phich_duration==normal?"normal":"extended",
......@@ -315,9 +302,7 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
for (mprime=0;
mprime<((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1));
mprime++) {
if (frame_parms->phich_config_common.phich_duration==normal) { // normal PHICH duration
frame_parms->phich_reg[mprime][0] = (frame_parms->Nid_cell + mprime)%n0;
if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[frame_parms->pcfich_first_reg_idx])
......@@ -334,7 +319,6 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
frame_parms->phich_reg[mprime][1] = (frame_parms->Nid_cell + mprime + (n0/3))%n0;
if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[frame_parms->pcfich_first_reg_idx])
frame_parms->phich_reg[mprime][1]++;
......@@ -347,7 +331,6 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3])
frame_parms->phich_reg[mprime][1]++;
frame_parms->phich_reg[mprime][2] = (frame_parms->Nid_cell + mprime + (2*n0/3))%n0;
if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[frame_parms->pcfich_first_reg_idx])
......@@ -368,10 +351,8 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
} else { // extended PHICH duration
frame_parms->phich_reg[mprime<<1][0] = (frame_parms->Nid_cell + mprime)%n0;
frame_parms->phich_reg[1+(mprime<<1)][0] = (frame_parms->Nid_cell + mprime)%n0;
frame_parms->phich_reg[mprime<<1][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1;
frame_parms->phich_reg[mprime<<1][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2;
frame_parms->phich_reg[1+(mprime<<1)][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1;
frame_parms->phich_reg[1+(mprime<<1)][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2;
//#ifdef DEBUG_PHICH
......
......@@ -56,7 +56,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
#endif
) {
int i;
LTE_DL_FRAME_PARMS *fp;
LTE_DL_FRAME_PARMS *fp=NULL;
lte_frame_type_t frame_type;
uint16_t rootSequenceIndex;
uint8_t prach_ConfigIndex;
......@@ -66,7 +66,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
int subframe;
int16_t *prachF=NULL;
int16_t **rxsigF=NULL;
int nb_rx;
int nb_rx=0;
int16_t *prach2;
uint8_t preamble_index;
uint16_t NCS,NCS2;
......@@ -96,13 +96,16 @@ void rx_prach0(PHY_VARS_eNB *eNB,
int prach_ifft_cnt=0;
#endif
if (ru) {
fp = &ru->frame_parms;
nb_rx = ru->nb_rx;
} else if (eNB) {
fp = &eNB->frame_parms;
if(eNB) {
fp = &(eNB->frame_parms);
nb_rx = fp->nb_antennas_rx;
} else AssertFatal(1==0,"rx_prach called without valid RU or eNB descriptor\n");
} else {
fp = &(ru->frame_parms);
nb_rx = ru->nb_rx;
}
AssertFatal(fp==NULL,"rx_prach called without valid RU or eNB descriptor\n");
frame_type = fp->frame_type;
frame_type = fp->frame_type;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
......@@ -148,10 +151,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prachF = eNB->prach_vars_br.prachF;
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
if (LOG_DEBUGFLAG(PRACH)) {
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,
"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
br_flag,ce_level,ru->proc.frame_prach,subframe,
if (LOG_DEBUGFLAG(PRACH)){
if (((eNB->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
br_flag,ce_level,eNB->proc.frame_prach,subframe,
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
prach_ConfigIndex,rootSequenceIndex,
eNB->prach_vars_br.repetition_number[ce_level],
......@@ -164,10 +166,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
subframe = eNB->proc.subframe_prach;
prachF = eNB->prach_vars.prachF;
rxsigF = eNB->prach_vars.rxsigF[0];
if (LOG_DEBUGFLAG(PRACH)) {
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
if (LOG_DEBUGFLAG(PRACH)){
if (((eNB->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
}
}
}
} else {
......@@ -445,6 +446,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint8_t update_TA2 = 1;
switch (eNB->frame_parms.N_RB_DL) {
case 6:
update_TA = 16;
break;
......@@ -461,10 +463,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
update_TA = 3;
update_TA2 = 2;
break;
case 100:
update_TA = 1;
break;
}
*max_preamble_energy=0;
......
This diff is collapsed.
......@@ -80,7 +80,6 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
}
}
free16(ulsch,sizeof(LTE_UE_ULSCH_t));
ulsch = NULL;
}
}
......
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.
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