Fixed some minor bugs

master
ismagom 11 years ago
parent 590f6748a8
commit 6459f516d8

@ -58,7 +58,7 @@
#define NOF_PORTS 2
float find_threshold = 40.0, track_threshold = 8.0;
int max_track_lost = 9, nof_slots = -1;
int max_track_lost = 20, nof_slots = -1;
int track_len=300;
char *input_file_name = NULL;
int disable_plots = 0;
@ -80,7 +80,7 @@ cfo_t cfocorr;
enum sync_state {FIND, TRACK};
void usage(char *prog) {
printf("Usage: %s [iagfndv]\n", prog);
printf("Usage: %s [iagfndvp]\n", prog);
printf("\t-i input_file [Default use USRP]\n");
#ifndef DISABLE_UHD
printf("\t-a UHD args [Default %s]\n", uhd_args);
@ -90,6 +90,7 @@ void usage(char *prog) {
printf("\t UHD is disabled. CUHD library not available\n");
#endif
printf("\t-n nof_frames [Default %d]\n", nof_slots);
printf("\t-p PSS threshold [Default %f]\n", find_threshold);
#ifndef DISABLE_GRAPHICS
printf("\t-d disable plots [Default enabled]\n");
#else
@ -100,7 +101,7 @@ void usage(char *prog) {
void parse_args(int argc, char **argv) {
int opt;
while ((opt = getopt(argc, argv, "iagfndv")) != -1) {
while ((opt = getopt(argc, argv, "iagfndvp")) != -1) {
switch(opt) {
case 'i':
input_file_name = argv[optind];
@ -114,6 +115,9 @@ void parse_args(int argc, char **argv) {
case 'f':
uhd_freq = atof(argv[optind]);
break;
case 'p':
find_threshold = atof(argv[optind]);
break;
case 'n':
nof_slots = atoi(argv[optind]);
break;
@ -423,7 +427,9 @@ int main(int argc, char **argv) {
find_idx += track_idx - track_len;
if (nslot != sync_get_slot_id(&strack)) {
INFO("Expected slot %d but got %d\n", nslot, sync_get_slot_id(&strack));
printf("\r\n");fflush(stdout);
printf("\r\n");
fflush(stdout);
printf("\r\n");
state = FIND;
}
}
@ -431,7 +437,9 @@ int main(int argc, char **argv) {
/* if we missed too many PSS go back to FIND */
if (frame_cnt - last_found > max_track_lost) {
INFO("%d frames lost. Going back to FIND", frame_cnt - last_found);
printf("\r\n");fflush(stdout);
printf("\r\n");
fflush(stdout);
printf("\r\n");
state = FIND;
}
@ -447,6 +455,9 @@ int main(int argc, char **argv) {
last_found = frame_cnt;
if (verbose == VERBOSE_NONE) {
if (!nof_found_mib) {
printf("\r\n");
fflush(stdout);
printf("\r\n");
pbch_mib_fprint(stdout, &mib);
}
}

@ -53,11 +53,11 @@
#define IS_SIGNAL(i) (10*log10f(rssi[i]) + 30 > rssi_threshold)
int band, earfcn=-1;
float find_threshold = 40.0, track_threshold = 8.0;
float find_threshold = 10.0, track_threshold = 8.0;
int earfcn_start=-1, earfcn_end = -1;
float rssi_threshold = -30.0;
float rssi_threshold = -45.0;
int max_track_lost=9;
int nof_frames_find=8, nof_frames_track=100, nof_samples_rssi=50000;
int nof_frames_find=20, nof_frames_track=100, nof_samples_rssi=50000;
int track_len=500;
cf_t *input_buffer, *fft_buffer, *ce[MAX_PORTS];
@ -72,7 +72,7 @@ int *idx_v, *idx_valid, *t;
float *p2a_v;
void *uhd;
int nof_bands;
float uhd_gain = 30.0;
float uhd_gain = 20.0;
#define MAX_EARFCN 1000
lte_earfcn_t channels[MAX_EARFCN];
@ -232,7 +232,7 @@ void base_free() {
int i;
#ifndef DISABLE_UHD
cuhd_close(&uhd);
cuhd_close(uhd);
#endif
sync_free(&sfind);

@ -49,11 +49,11 @@
int band, earfcn=-1;
float find_threshold = 40.0, track_threshold = 8.0;
float find_threshold = 10.0, track_threshold = 8.0;
int earfcn_start=-1, earfcn_end = -1;
float rssi_threshold = -30.0;
float rssi_threshold = -45.0;
int max_track_lost=9;
int nof_frames_find=8, nof_frames_track=100, nof_samples_rssi=50000;
int nof_frames_find=20, nof_frames_track=100, nof_samples_rssi=50000;
int track_len=500;
cf_t *input_buffer;
@ -184,7 +184,7 @@ int base_init(int frame_length) {
void base_free() {
cuhd_close(&uhd);
cuhd_close(uhd);
free(input_buffer);
free(idx_v);
free(idx_valid);

@ -54,7 +54,7 @@ typedef struct {
enum modem_std std; // Symbol mapping standard (see modem_table.h)
} init;
const cf_t* input;
cf_t* input;
int in_len;
char* output;

@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lte/common/base.h"
@ -156,6 +157,7 @@ char *lte_mimotype2str(mimo_type_t type) {
case SPATIAL_MULTIPLEX:
return "multiplex";
}
return NULL;
}
float get_fd(struct lte_band *band, int earfcn) {

@ -53,8 +53,29 @@ int precoding_diversity(cf_t *x[MAX_LAYERS], cf_t *y[MAX_PORTS], int nof_ports,
}
return i;
} else if (nof_ports == 4) {
fprintf(stderr, "Error not implemented\n");
return -1;
int m_ap = (nof_symbols%4)?(nof_symbols*4-2):nof_symbols*4;
for (i=0;i<m_ap;i++) {
y[0][4*i] = x[0][i]/sqrtf(2);
y[1][4*i] = 0;
y[2][4*i] = -conjf(x[1][i])/sqrtf(2);
y[3][4*i] = 0;
y[0][4*i+1] = x[1][i]/sqrtf(2);
y[1][4*i+1] = 0;
y[2][4*i+1] = conjf(x[0][i])/sqrtf(2);
y[3][4*i+1] = 0;
y[0][4*i+2] = 0;
y[1][4*i+2] = x[2][i]/sqrtf(2);
y[2][4*i+2] = 0;
y[3][4*i+2] = -conjf(x[3][i])/sqrtf(2);
y[0][4*i+3] = 0;
y[1][4*i+3] = x[3][i]/sqrtf(2);
y[2][4*i+3] = 0;
y[3][4*i+3] = conjf(x[2][i])/sqrtf(2);
}
return i;
} else {
fprintf(stderr, "Number of ports must be 2 or 4 for transmit diversity\n");
return -1;
@ -111,7 +132,7 @@ int predecoding_diversity_zf(cf_t *y[MAX_PORTS], cf_t *ce[MAX_PORTS],
cf_t h0, h1, r0, r1;
float hh;
if (nof_ports == 2) {
/* FIXME: Use VOLK here */
/* TODO: Use VOLK here */
for (i=0;i<nof_symbols/2;i++) {
h0 = ce[0][2*i];
h1 = ce[1][2*i];
@ -124,6 +145,29 @@ int predecoding_diversity_zf(cf_t *y[MAX_PORTS], cf_t *ce[MAX_PORTS],
}
return i;
} else if (nof_ports == 4) {
/*
int m_ap = (nof_symbols%4)?((nof_symbols-2)/4):nof_symbols/4;
for (i=0;i<m_ap;i++) {
h0 = ce[0][2*i];
h1 = ce[1][2*i];
h2 = ce[2][2*i];
h3 = ce[3][2*i];
hh = crealf(h0)*crealf(h0)+cimagf(h0)*cimagf(h0)
+ crealf(h1)*crealf(h1)+cimagf(h1)*cimagf(h1)
+ crealf(h2)*crealf(h2)+cimagf(h2)*cimagf(h2)
+ crealf(h3)*crealf(h3)+cimagf(h3)*cimagf(h3);
r0 = y[0][2*i];
r1 = y[0][2*i+1];
r2 = y[0][2*i+2];
r3 = y[0][2*i+3];
x[0][i] = (conjf(h0)*r0 + conjf(h1)*r1)/hh * sqrt(2);
x[1][i] = (h1*conj(r0) + conj(h0)*r1)/hh * sqrt(2);
x[2][i] = (conjf(h0)*r0 + h1*conjf(r1))/hh * sqrt(2);
x[3][i] = (-h1*conj(r0) + conj(h0)*r1)/hh * sqrt(2);
}
*/
fprintf(stderr, "Error not implemented\n");
return -1;
} else {

@ -112,6 +112,7 @@ int main(int argc, char **argv) {
exit(-1);
}
nof_errors = 0;
for (i=0;i<nof_tx_bits;i++) {
if ((unrm_symbols[i] > 0) != bits[i]) {
nof_errors++;

@ -68,6 +68,9 @@ void cexptab_gen(cexptab_t *h, cf_t *x, float freq, int len) {
if (phase >= (float) h->size) {
phase -= (float) h->size;
}
if (phase <= 0) {
phase += (float) h->size;
}
}
}

Loading…
Cancel
Save