예제 #1
0
파일: sss.c 프로젝트: marojevic/libLTE
int sss_synch_init(sss_synch_t *q, uint32_t fft_size) {
  
  if (q                 != NULL  &&
      fft_size          < 2048)
  {
    uint32_t N_id_2;
    struct sss_tables sss_tables;

    bzero(q, sizeof(sss_synch_t));
    
    if (dft_plan(&q->dftp_input, fft_size, FORWARD, COMPLEX)) {
      sss_synch_free(q);
      return LIBLTE_ERROR;
    }
    q->fft_size = fft_size; 
    
    generate_N_id_1_table(q->N_id_1_table);
    dft_plan_set_mirror(&q->dftp_input, true);
    dft_plan_set_dc(&q->dftp_input, true);
    
    for (N_id_2=0;N_id_2<3;N_id_2++) {
      generate_sss_all_tables(&sss_tables, N_id_2);
      convert_tables(&q->fc_tables[N_id_2], &sss_tables);
    }
    q->N_id_2 = 0;
    return LIBLTE_SUCCESS;
  } 
  return LIBLTE_ERROR_INVALID_INPUTS;
}
예제 #2
0
파일: pss.c 프로젝트: SPLURGE831/libLTE
int pss_synch_init_N_id_2(cf_t *pss_signal_freq, uint32_t N_id_2, uint32_t fft_size) {
  dft_plan_t plan;
  cf_t pss_signal_pad[2048];
  cf_t pss_signal_time[PSS_LEN];
  int ret = LIBLTE_ERROR_INVALID_INPUTS;
  
  if (lte_N_id_2_isvalid(N_id_2)    && 
      fft_size                  <= 2048) 
  {
    
    pss_generate(pss_signal_time, N_id_2);

    bzero(pss_signal_pad, fft_size * sizeof(cf_t));
    bzero(pss_signal_freq, fft_size * sizeof(cf_t));
    memcpy(&pss_signal_pad[(fft_size-PSS_LEN)/2], pss_signal_time, PSS_LEN * sizeof(cf_t));

    if (dft_plan(&plan, fft_size, BACKWARD, COMPLEX)) {
      return LIBLTE_ERROR;
    }
    
    dft_plan_set_mirror(&plan, true);
    dft_plan_set_dc(&plan, true);
    dft_plan_set_norm(&plan, true);
    dft_run_c(&plan, pss_signal_pad, pss_signal_freq);

    vec_conj_cc(pss_signal_freq, pss_signal_freq, fft_size);
    vec_sc_prod_cfc(pss_signal_freq, 1.0/62.0, pss_signal_freq, fft_size);

    dft_plan_free(&plan);
    
    ret = LIBLTE_SUCCESS;
  }
  return ret;
}
예제 #3
0
파일: sss.c 프로젝트: marojevic/libLTE
int sss_synch_realloc(sss_synch_t *q, uint32_t fft_size) {
  if (q                 != NULL  &&
      fft_size          < 2048)
  {
    dft_plan_free(&q->dftp_input);
    if (dft_plan(&q->dftp_input, fft_size, FORWARD, COMPLEX)) {
      sss_synch_free(q);
      return LIBLTE_ERROR;
    }
    dft_plan_set_mirror(&q->dftp_input, true);
    dft_plan_set_dc(&q->dftp_input, true);
    
    q->fft_size = fft_size;
    return LIBLTE_SUCCESS;
  }
  return LIBLTE_ERROR_INVALID_INPUTS;
}