Beispiel #1
0
void srslte_sync_free(srslte_sync_t *q) {
  if (q) {
    srslte_pss_synch_free(&q->pss);     
    srslte_sss_synch_free(&q->sss);  
    srslte_cfo_free(&q->cfocorr);
  }
}
Beispiel #2
0
void srslte_ue_dl_free(srslte_ue_dl_t *q) {
  if (q) {
    for (int port = 0; port < SRSLTE_MAX_PORTS; port++) {
      srslte_ofdm_rx_free(&q->fft[port]);
    }
    srslte_ofdm_rx_free(&q->fft_mbsfn);
    srslte_chest_dl_free(&q->chest);
    srslte_regs_free(&q->regs);
    srslte_pcfich_free(&q->pcfich);
    srslte_phich_free(&q->phich);
    srslte_pdcch_free(&q->pdcch);
    srslte_pdsch_free(&q->pdsch);
    srslte_pmch_free(&q->pmch);
    srslte_cfo_free(&q->sfo_correct);
    for (int i = 0; i < SRSLTE_MAX_TB; i++) {
      srslte_softbuffer_rx_free(q->softbuffers[i]);
      if (q->softbuffers[i]) {
        free(q->softbuffers[i]);
      }
    }
    for (int j = 0; j < SRSLTE_MAX_PORTS; j++) {
      if (q->sf_symbols_m[j]) {
        free(q->sf_symbols_m[j]);
      }
      for (uint32_t i=0;i<SRSLTE_MAX_PORTS;i++) {
        if (q->ce_m[i][j]) {
          free(q->ce_m[i][j]);
        }
      }
    }
    bzero(q, sizeof(srslte_ue_dl_t));
  }
}
Beispiel #3
0
int main(int argc, char **argv) {
  int i;
  cf_t *input, *output;
  srslte_cfo_t cfocorr;
  float mse;

  if (argc < 5) {
    usage(argv[0]);
    exit(-1);
  }

  parse_args(argc, argv);

  input = malloc(sizeof(cf_t) * num_samples);
  if (!input) {
    perror("malloc");
    exit(-1);
  }
  output = malloc(sizeof(cf_t) * num_samples);
  if (!output) {
    perror("malloc");
    exit(-1);
  }

  for (i=0;i<num_samples;i++) {
    input[i] = 100 * (rand()/RAND_MAX + I*rand()/RAND_MAX);
    output[i] = input[i];
  }

  if (srslte_cfo_init(&cfocorr, num_samples)) {
    fprintf(stderr, "Error initiating CFO\n");
    return -1;
  }

  srslte_cfo_correct(&cfocorr, output, output, freq);
  srslte_cfo_correct(&cfocorr, output, output, -freq);

  mse = 0;
  for (i=0;i<num_samples;i++) {
    mse += cabsf(input[i] - output[i]) / num_samples;
  }

  srslte_cfo_free(&cfocorr);
  free(input);
  free(output);

  printf("MSE: %f\n", mse);
  if (mse > MAX_MSE) {
    printf("MSE too large\n");
    exit(-1);
  } else {
    printf("Ok\n");
    exit(0);
  }
}
Beispiel #4
0
void srslte_sync_free(srslte_sync_t *q)
{
  if (q) {
    srslte_pss_free(&q->pss);
    srslte_sss_free(&q->sss);
    srslte_cfo_free(&q->cfo_corr_frame);
    srslte_cfo_free(&q->cfo_corr_symbol);
    srslte_cp_synch_free(&q->cp_synch);

    for (int i = 0; i < 2; i++) {
      if (q->cfo_i_corr[i]) {
        free(q->cfo_i_corr[i]);
      }
      srslte_pss_free(&q->pss_i[i]);
    }

    if (q->temp) {
      free(q->temp);
    }
  }
}
Beispiel #5
0
void srslte_sync_free(srslte_sync_t *q) {
  if (q) {
    srslte_pss_synch_free(&q->pss);     
    srslte_sss_synch_free(&q->sss);  
    srslte_cfo_free(&q->cfocorr);
    srslte_cp_synch_free(&q->cp_synch);
    for (int i=0;i<2;i++) {
      if (q->cfo_i_corr[i]) {
        free(q->cfo_i_corr[i]);
      }
      srslte_pss_synch_free(&q->pss_i[i]);
    }
  }
}
Beispiel #6
0
void srslte_ue_dl_free(srslte_ue_dl_t *q) {
  if (q) {
    srslte_ofdm_rx_free(&q->fft);
    srslte_chest_dl_free(&q->chest);
    srslte_regs_free(&q->regs);
    srslte_pcfich_free(&q->pcfich);
    srslte_phich_free(&q->phich);
    srslte_pdcch_free(&q->pdcch);
    srslte_pdsch_free(&q->pdsch);
    srslte_cfo_free(&q->sfo_correct);
    srslte_softbuffer_rx_free(&q->softbuffer);
    if (q->sf_symbols) {
      free(q->sf_symbols);
    }
    for (uint32_t i=0;i<q->cell.nof_ports;i++) {
      if (q->ce[i]) {
        free(q->ce[i]);
      }
    }
    bzero(q, sizeof(srslte_ue_dl_t));
  }
}