/**@ingroup gen_dft * \param direction Direction of the dft: 0 computes a dft and 1 computes an idft (default is 0) * \param mirror 0 computes a normal dft, 1 swaps the two halfes of the input signal before computing * the dft (used in LTE) (default is 0) * \param psd Set to 1 to compute the power spectral density (untested) (default is 0) * \param out_db Set to 1 to produce the output results in dB (untested) (default is 0) * \param dft_size Number of DFT points. This parameter is mandatory. */ int initialize() { int tmp; int i; memset(plans,0,sizeof(dft_plan_t)*NOF_PRECOMPUTED_DFT); memset(extra_plans,0,sizeof(dft_plan_t)*MAX_EXTRA_PLANS); if (param_get_int(param_id("direction"),&direction) != 1) { modinfo("Parameter direction not defined. Setting to FORWARD\n"); direction = 0; } options = 0; if (param_get_int(param_id("mirror"),&tmp) != 1) { modinfo("Parameter mirror not defined. Disabling. \n"); } else { if (tmp) options |= DFT_MIRROR; } if (param_get_int(param_id("psd"),&tmp) != 1) { modinfo("Parameter psd not defined. Disabling. \n"); } else { if (tmp) options |= DFT_PSD; } if (param_get_int(param_id("out_db"),&tmp) != 1) { modinfo("Parameter out_db not defined. Disabling. \n"); } else { if (tmp) options |= DFT_OUT_DB; } if (param_get_int(param_id("normalize"),&tmp) != 1) { modinfo("Parameter normalize not defined. Disabling. \n"); } else { if (tmp) options |= DFT_NORMALIZE; } dft_size_id = param_id("dft_size"); if (!dft_size_id) { moderror("Parameter dft_size not defined\n"); return -1; } if (dft_plan_multi_c2c(precomputed_dft_len, (!direction)?FORWARD:BACKWARD, NOF_PRECOMPUTED_DFT, plans)) { moderror("Precomputing plans\n"); return -1; } for (i=0;i<NOF_PRECOMPUTED_DFT;i++) { plans[i].options = options; } return 0; }
/**@ingroup gen_dft * \param direction Direction of the dft: 0 computes a dft and 1 computes an idft (default is 0) * \param mirror 0 computes a normal dft, 1 swaps the two halfes of the input signal before computing * the dft (used in LTE) (default is 0) * \param dc_offset Set a null to the 0 subcarrier * \param psd Set to 1 to compute the power spectral density (untested) (default is 0) * \param out_db Set to 1 to produce the output results in dB (untested) (default is 0) * \param dft_size Number of DFT points. This parameter is mandatory. * \param df Frequency shift (choose a positive value for upconversion and a negative value for * downconversion) (default is 0--no frequency shift) * \param fs Sampling rate. This parameter is mandatory if df!=0. */ int initialize() { int tmp; int i; memset(plans,0,sizeof(dft_plan_t)*NOF_PRECOMPUTED_DFT); memset(extra_plans,0,sizeof(dft_plan_t)*MAX_EXTRA_PLANS); if (param_get_int(param_id("direction"),&direction) != 1) { modinfo("Parameter direction not defined. Setting to FORWARD\n"); direction = 0; } options = 0; if (param_get_int(param_id("mirror"),&tmp) != 1) { modinfo("Parameter mirror not defined. Disabling. \n"); } else { if (tmp == 1) { options |= DFT_MIRROR_PRE; } else if (tmp == 2) { options |= DFT_MIRROR_POS; } } if (param_get_int(param_id("psd"),&tmp) != 1) { modinfo("Parameter psd not defined. Disabling. \n"); } else { if (tmp) options |= DFT_PSD; } if (param_get_int(param_id("out_db"),&tmp) != 1) { modinfo("Parameter out_db not defined. Disabling. \n"); } else { if (tmp) options |= DFT_OUT_DB; } if (param_get_int(param_id("dc_offset"),&tmp) != 1) { modinfo("Parameter dc_offset not defined. Disabling. \n"); } else { if (tmp) options |= DFT_DC_OFFSET; } if (param_get_int(param_id("normalize"),&tmp) != 1) { modinfo("Parameter normalize not defined. Disabling. \n"); } else { if (tmp) options |= DFT_NORMALIZE; } dft_size_id = param_id("dft_size"); if (!dft_size_id) { /* moderror("Parameter dft_size not defined\n"); return -1;*/ modinfo("Parameter dft_size not defined. Assuming " "dft_size = number of input samples on interface 0.\n"); } if (dft_plan_multi_c2c(precomputed_dft_len, (!direction)?FORWARD:BACKWARD, NOF_PRECOMPUTED_DFT, plans)) { moderror("Precomputing plans\n"); return -1; } for (i=0;i<NOF_PRECOMPUTED_DFT;i++) { plans[i].options = options; } df_id = param_id("df"); fs_id = param_id("fs"); precalculate_shift_vectors(precomputed_shift_1536, precomputed_shift_reg); /* assume 1.4 MHz LTE UL Tx (fs = 1.92 MHz, 128 IFFT, df = 7.5 kHz) */ shift = precomputed_shift_reg; previous_df = df_lte; previous_fs = 1920000; previous_dft_size = 128; shift_increment = 16; return 0; }