Lines Matching refs:cfg
52 cfg = get_cfg(prm, hw); variable
56 cfg = select_mode(common_mcic_list, a_mfir_list, b_mfir_list, common_clkdiv_list, cfg); variable
57 cfg = get_cic_config(prm, cfg, hw); variable
58 cfg = get_fir_config(prm, cfg, hw, spec); variable
65 function cfg = get_fir_config(prm, cfg, hw, spec)
68 [coef, shift] = get_fir(cfg.mfir_a, prm, cfg, hw, spec);
70 [cfg.fir_coef_a, cfg.fir_shift_a, cfg.fir_length_a] = ...
71 scale_fir_coef(coef, shift, spec.scale, cfg.remain_gain_to_fir, hw.bits_fir_coef);
72 cfg.fir_gain_a = 1;
74 cfg.fir_gain_a = 0;
75 cfg.fir_coef_a = 0;
76 cfg.fir_shift_a = 0;
77 cfg.fir_length_a = 1;
81 [coef, shift] = get_fir(cfg.mfir_b, prm, cfg, hw, spec);
83 [cfg.fir_coef_b, cfg.fir_shift_b, cfg.fir_length_b] = ...
84 scale_fir_coef(coef, shift, spec.scale, cfg.remain_gain_to_fir, hw.bits_fir_coef);
85 cfg.fir_gain_b = 1;
87 cfg.fir_gain_b = 0;
88 cfg.fir_coef_b = 0;
89 cfg.fir_shift_b = 0;
90 cfg.fir_length_b = 1;
110 function [coef32, shift] = get_fir(mfir, prm, cfg, hw, spec)
112 fs_fir = cfg.mic_clk/cfg.mcic;
119 dmic_fir(spec.rp, spec.rs, passhz, stophz, cfg.mic_clk, fs_fir, max_length, spec.linear_phase);
144 function cfg = select_mode(common_mcic_list, a_mfir_list, b_mfir_list, common_clkdiv_list, cfg)
146 cfg.mcic = 0;
147 cfg.mfir_a = 0;
148 cfg.mfir_b = 0;
149 cfg.clk_div = 0;
167 cfg.mcic = common_mcic_list(n);
168 cfg.clk_div = common_clkdiv_list(n);
170 cfg.mfir_a = a_mfir_list(n);
173 cfg.mfir_b = b_mfir_list(n);
176 cfg.clk_div, cfg.mcic, cfg.mfir_a, cfg.mfir_b);
182 function cfg = get_cic_config(prm, cfg, hw)
184 cfg.mic_clk = hw.ioclk/cfg.clk_div;
185 g_cic = cfg.mcic^5;
187 cfg.cic_shift = bitsneeded - hw.bits_fir_input;
193 if cfg.cic_shift < hw.cic_shift_right_range(1);
194 fprintf(1,'Warning: Limited CIC shift right from %d', cfg.cic_shift);
195 cfg.cic_shift = hw.cic_shift_right_range(1);
198 if cfg.cic_shift > hw.cic_shift_right_range(2);
199 fprintf(1,'Error: Limited CIC shift right from %d', cfg.cic_shift);
200 cfg.cic_shift = hw.cic_shift_right_range(2);
204 cfg.remain_gain_to_fir = 2^(hw.bits_fir_input-1)/(g_cic/2^cfg.cic_shift);
301 function cfg = get_cfg(prm, hw)
310 cfg.hw_version = hw.version;
312 cfg.fifo_a_fs = prm.fifo_a_fs;
313 cfg.fifo_b_fs = prm.fifo_b_fs;
315 cfg.pdm01_provided = (prm.pdm(1).enable_mic_a | prm.pdm(1).enable_mic_b) ...
317 cfg.ch01_provided = (prm.fifo_a_fs > 0) + (prm.fifo_b_fs > 0)*2;
320 cfg.a_nchannels = prm.pdm(1).enable_mic_a + prm.pdm(1).enable_mic_b ...
323 cfg.a_nchannels = 0;
326 cfg.b_nchannels = prm.pdm(1).enable_mic_a + prm.pdm(1).enable_mic_b ...
329 cfg.b_nchannels = 0;