Skip to content

Commit a5f67a4

Browse files
committed
plugins: adrv9002: moved profile gen config functions closer to scope and removed for() loops
- removed the for() loop by implicit memcpy() in lte_lvs_3072_MHz_10() to match lte_defaults() definition style Signed-off-by: Andrei Popa <[email protected]>
1 parent 490203d commit a5f67a4

File tree

1 file changed

+116
-114
lines changed

1 file changed

+116
-114
lines changed

plugins/adrv9002.c

+116-114
Original file line numberDiff line numberDiff line change
@@ -173,120 +173,6 @@ typedef struct adrv9002_config
173173
clock_config clk_cfg;
174174
} adrv9002_config;
175175

176-
static adrv9002_config lte_defaults(void)
177-
{
178-
radio_config radio_config;
179-
radio_config.ssi_lanes = 2;
180-
radio_config.ddr = true; // needs logic
181-
radio_config.short_strobe = true;
182-
radio_config.lvds = true;
183-
radio_config.adc_rate_mode = 3;
184-
radio_config.fdd = false;
185-
186-
tx_radio_channel_config tx_config[2];
187-
int i;
188-
for(i = 0; i < CHANNEL_COUNT; i++) {
189-
tx_config[i].enabled = true;
190-
tx_config[i].sample_rate_hz = 61440000;
191-
tx_config[i].frequency_offset_correction_enable = false;
192-
tx_config[i].analog_filter_power_mode = 2;
193-
tx_config[i].channel_bandwidth_hz = 38000000;
194-
tx_config[i].elb_type = 0;
195-
tx_config[i].orx_enabled = false;
196-
197-
radio_config.tx_config[i] = tx_config[i];
198-
}
199-
200-
rx_radio_channel_config rx_config[2];
201-
for(i = 0; i < CHANNEL_COUNT; i++) {
202-
rx_config[i].enabled = true;
203-
rx_config[i].sample_rate_hz = 61440000;
204-
rx_config[i].frequency_offset_correction_enable = false;
205-
rx_config[i].analog_filter_power_mode = 2;
206-
rx_config[i].channel_bandwidth_hz = 38000000;
207-
rx_config[i].adc_high_performance_mode = true;
208-
rx_config[i].analog_filter_biquad = false; // got from default cfg
209-
rx_config[i].analog_filter_bandwidth_hz = 18000000; // got from default cfg
210-
rx_config[i].nco_enable = false;
211-
rx_config[i].nco_frequency_hz = 0;
212-
rx_config[i].rf_port = 0;
213-
214-
radio_config.rx_config[i] = rx_config[i];
215-
}
216-
adrv9002_config cfg;
217-
cfg.radio_cfg = radio_config;
218-
219-
clock_config clock_config;
220-
clock_config.device_clock_frequency_khz = 38400;
221-
clock_config.device_clock_output_enable = true;
222-
clock_config.device_clock_output_divider = 2;
223-
clock_config.clock_pll_high_performance_enable = false;
224-
clock_config.clock_pll_power_mode = 2;
225-
clock_config.processor_clock_divider = 1;
226-
227-
cfg.clk_cfg = clock_config;
228-
return cfg;
229-
}
230-
231-
static adrv9002_config lte_lvs_3072_MHz_10(void)
232-
{
233-
rx_radio_channel_config rx1;
234-
rx1.enabled = 1;
235-
rx1.adc_high_performance_mode = true;
236-
rx1.frequency_offset_correction_enable = false;
237-
rx1.analog_filter_power_mode = 2; // High power/performance
238-
rx1.analog_filter_biquad = false;
239-
rx1.channel_bandwidth_hz = 18000000;
240-
rx1.sample_rate_hz = 30720000;
241-
rx1.nco_enable = false;
242-
rx1.nco_frequency_hz = 0;
243-
rx1.rf_port = 0; // RX-A
244-
rx1.analog_filter_bandwidth_hz = 0; // TODO: not used?
245-
246-
// Copy rx1 to rx2
247-
rx_radio_channel_config rx2 = rx1;
248-
rx2.rf_port = 0; // RX-B
249-
250-
// TX side
251-
tx_radio_channel_config tx1;
252-
tx1.enabled = 1;
253-
tx1.sample_rate_hz = 30720000;
254-
tx1.frequency_offset_correction_enable = false;
255-
tx1.analog_filter_power_mode = 2; // High power/performance
256-
tx1.channel_bandwidth_hz = 18000000;
257-
tx1.orx_enabled = true;
258-
tx1.elb_type = 2;
259-
260-
// Copy tx1 to tx2
261-
tx_radio_channel_config tx2 = tx1;
262-
263-
radio_config r_cfg;
264-
r_cfg.adc_rate_mode = 3; // High Performance
265-
r_cfg.fdd = false;
266-
r_cfg.lvds = true;
267-
r_cfg.ssi_lanes = 2;
268-
r_cfg.ddr = true;
269-
r_cfg.adc_rate_mode = 3; // High Performance
270-
r_cfg.short_strobe = true;
271-
r_cfg.rx_config[0] = rx1;
272-
r_cfg.rx_config[1] = rx2;
273-
r_cfg.tx_config[0] = tx1;
274-
r_cfg.tx_config[1] = tx2;
275-
276-
clock_config clk_cfg;
277-
clk_cfg.device_clock_frequency_khz = 38400;
278-
clk_cfg.clock_pll_high_performance_enable = true;
279-
clk_cfg.clock_pll_power_mode = 2; // High power/performance
280-
clk_cfg.processor_clock_divider = 1;
281-
clk_cfg.device_clock_output_divider = 0; // TODO: not used?
282-
clk_cfg.device_clock_output_enable = 0;
283-
284-
adrv9002_config adrv_cfg;
285-
adrv_cfg.clk_cfg = clk_cfg;
286-
adrv_cfg.radio_cfg = r_cfg;
287-
288-
return adrv_cfg;
289-
}
290176
/*---------------------------------------------------------------------------*/
291177

292178
#ifndef ENOTSUPP
@@ -1206,6 +1092,122 @@ static void load_profile(GtkFileChooser *chooser, gpointer data)
12061092
gtk_file_chooser_set_filename(chooser, "(None)");
12071093
}
12081094

1095+
// profile generator default config structures
1096+
static adrv9002_config lte_defaults(void)
1097+
{
1098+
tx_radio_channel_config tx1;
1099+
tx1.enabled = true;
1100+
tx1.sample_rate_hz = 61440000;
1101+
tx1.frequency_offset_correction_enable = false;
1102+
tx1.analog_filter_power_mode = 2;
1103+
tx1.channel_bandwidth_hz = 38000000;
1104+
tx1.elb_type = 0;
1105+
tx1.orx_enabled = false;
1106+
1107+
tx_radio_channel_config tx2 = tx1;
1108+
1109+
rx_radio_channel_config rx1;
1110+
rx1.enabled = true;
1111+
rx1.sample_rate_hz = 61440000;
1112+
rx1.frequency_offset_correction_enable = false;
1113+
rx1.analog_filter_power_mode = 2;
1114+
rx1.channel_bandwidth_hz = 38000000;
1115+
rx1.adc_high_performance_mode = true;
1116+
rx1.analog_filter_biquad = false; // got from default cfg
1117+
rx1.analog_filter_bandwidth_hz = 18000000; // got from default cfg
1118+
rx1.nco_enable = false;
1119+
rx1.nco_frequency_hz = 0;
1120+
rx1.rf_port = 0;
1121+
1122+
rx_radio_channel_config rx2 = rx1;
1123+
1124+
radio_config radio_config;
1125+
radio_config.ssi_lanes = 2;
1126+
radio_config.ddr = true; // needs logic
1127+
radio_config.short_strobe = true;
1128+
radio_config.lvds = true;
1129+
radio_config.adc_rate_mode = 3;
1130+
radio_config.fdd = false;
1131+
radio_config.tx_config[0] = tx1;
1132+
radio_config.tx_config[1] = tx2;
1133+
radio_config.rx_config[0] = rx1;
1134+
radio_config.rx_config[1] = rx2;
1135+
1136+
clock_config clock_config;
1137+
clock_config.device_clock_frequency_khz = 38400;
1138+
clock_config.device_clock_output_enable = true;
1139+
clock_config.device_clock_output_divider = 2;
1140+
clock_config.clock_pll_high_performance_enable = false;
1141+
clock_config.clock_pll_power_mode = 2;
1142+
clock_config.processor_clock_divider = 1;
1143+
1144+
adrv9002_config cfg;
1145+
cfg.radio_cfg = radio_config;
1146+
cfg.clk_cfg = clock_config;
1147+
1148+
return cfg;
1149+
}
1150+
1151+
static adrv9002_config lte_lvs_3072_MHz_10(void)
1152+
{
1153+
rx_radio_channel_config rx1;
1154+
rx1.enabled = 1;
1155+
rx1.adc_high_performance_mode = true;
1156+
rx1.frequency_offset_correction_enable = false;
1157+
rx1.analog_filter_power_mode = 2; // High power/performance
1158+
rx1.analog_filter_biquad = false;
1159+
rx1.channel_bandwidth_hz = 18000000;
1160+
rx1.sample_rate_hz = 30720000;
1161+
rx1.nco_enable = false;
1162+
rx1.nco_frequency_hz = 0;
1163+
rx1.rf_port = 0; // RX-A
1164+
rx1.analog_filter_bandwidth_hz = 0; // TODO: not used?
1165+
1166+
// Copy rx1 to rx2
1167+
rx_radio_channel_config rx2 = rx1;
1168+
rx2.rf_port = 0; // RX-B
1169+
1170+
// TX side
1171+
tx_radio_channel_config tx1;
1172+
tx1.enabled = 1;
1173+
tx1.sample_rate_hz = 30720000;
1174+
tx1.frequency_offset_correction_enable = false;
1175+
tx1.analog_filter_power_mode = 2; // High power/performance
1176+
tx1.channel_bandwidth_hz = 18000000;
1177+
tx1.orx_enabled = true;
1178+
tx1.elb_type = 2;
1179+
1180+
// Copy tx1 to tx2
1181+
tx_radio_channel_config tx2 = tx1;
1182+
1183+
radio_config r_cfg;
1184+
r_cfg.adc_rate_mode = 3; // High Performance
1185+
r_cfg.fdd = false;
1186+
r_cfg.lvds = true;
1187+
r_cfg.ssi_lanes = 2;
1188+
r_cfg.ddr = true;
1189+
r_cfg.adc_rate_mode = 3; // High Performance
1190+
r_cfg.short_strobe = true;
1191+
r_cfg.rx_config[0] = rx1;
1192+
r_cfg.rx_config[1] = rx2;
1193+
r_cfg.tx_config[0] = tx1;
1194+
r_cfg.tx_config[1] = tx2;
1195+
1196+
clock_config clk_cfg;
1197+
clk_cfg.device_clock_frequency_khz = 38400;
1198+
clk_cfg.clock_pll_high_performance_enable = true;
1199+
clk_cfg.clock_pll_power_mode = 2; // High power/performance
1200+
clk_cfg.processor_clock_divider = 1;
1201+
clk_cfg.device_clock_output_divider = 0; // TODO: not used?
1202+
clk_cfg.device_clock_output_enable = 0;
1203+
1204+
adrv9002_config adrv_cfg;
1205+
adrv_cfg.clk_cfg = clk_cfg;
1206+
adrv_cfg.radio_cfg = r_cfg;
1207+
1208+
return adrv_cfg;
1209+
}
1210+
12091211
static void profile_gen_append_debug_info(gpointer data, char *string)
12101212
{
12111213
struct plugin_private *priv = data;

0 commit comments

Comments
 (0)