@@ -67,7 +67,6 @@ typedef struct rx_radio_channel_config
67
67
68
68
} rx_radio_channel_config ;
69
69
70
- #define CHANNEL_COUNT 2
71
70
72
71
/**
73
72
* @struct tx_radio_channel_config
@@ -1262,7 +1261,7 @@ static void profile_gen_update_orx(GtkComboBox *self, struct plugin_private *pri
1262
1261
1263
1262
tdd_en = atoi (gtk_combo_box_get_active_id (
1264
1263
GTK_COMBO_BOX (gtk_builder_get_object (priv -> builder , "cb_radio_duplex" )))) == 0 ;
1265
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1264
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1266
1265
sprintf (widget_str , "cb_tx_chan%d_en" , chann + 1 );
1267
1266
tx_en = gtk_toggle_button_get_active (
1268
1267
GTK_TOGGLE_BUTTON (gtk_builder_get_object (priv -> builder , widget_str )));
@@ -1391,7 +1390,7 @@ static int profile_gen_config_get_from_device(struct adrv9002_config *cfg, gpoin
1391
1390
1392
1391
int chann ;
1393
1392
char chann_str [32 ];
1394
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1393
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1395
1394
sprintf (chann_str , "voltage%d" , chann );
1396
1395
struct iio_channel * tx = iio_device_find_channel (priv -> adrv9002 , chann_str , true);
1397
1396
if (tx == NULL ) {
@@ -1446,7 +1445,7 @@ static int profile_gen_config_get_from_device(struct adrv9002_config *cfg, gpoin
1446
1445
// radio_config.rx_config
1447
1446
rx_radio_channel_config rx_config [2 ];
1448
1447
1449
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1448
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1450
1449
sprintf (chann_str , "voltage%d" , chann );
1451
1450
struct iio_channel * rx = iio_device_find_channel (priv -> adrv9002 , chann_str , false);
1452
1451
if (rx == NULL ) {
@@ -1671,7 +1670,7 @@ static int profile_gen_config_set_live_device(struct adrv9002_config *cfg, gpoin
1671
1670
gtk_combo_box_set_active_id (GTK_COMBO_BOX (gtk_builder_get_object (priv -> builder , "cb_radio_duplex" )), str_value );
1672
1671
1673
1672
// TX
1674
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1673
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1675
1674
// channel_bandwidth_hz
1676
1675
sprintf (widget_str , "cb_tx_chan%d_bw" , chann + 1 );
1677
1676
sprintf (value , "%d" , cfg -> radio_cfg .tx_config [chann ].channel_bandwidth_hz );
@@ -1702,7 +1701,7 @@ static int profile_gen_config_set_live_device(struct adrv9002_config *cfg, gpoin
1702
1701
}
1703
1702
1704
1703
// RX
1705
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1704
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1706
1705
// channel_bandwidth_hz
1707
1706
sprintf (widget_str , "cb_rx_chan%d_bw" , chann + 1 );
1708
1707
sprintf (value , "%d" , cfg -> radio_cfg .rx_config [chann ].channel_bandwidth_hz );
@@ -1798,7 +1797,7 @@ static int profile_gen_config_set_LTE(struct adrv9002_config *cfg, gpointer data
1798
1797
1799
1798
// sample_rate_hz
1800
1799
for (ch_type = 0 ; ch_type < ARRAY_SIZE (ch_types ); ch_type ++ ) {
1801
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1800
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1802
1801
sprintf (widget_str , "cb_%s_chan%d_interface" , ch_types [ch_type ], chann + 1 );
1803
1802
populate_combo_box (GTK_COMBO_BOX_TEXT (gtk_builder_get_object (priv -> builder , widget_str )),
1804
1803
value_list , value_count , false, NULL );
@@ -1816,7 +1815,7 @@ static int profile_gen_config_set_LTE(struct adrv9002_config *cfg, gpointer data
1816
1815
1817
1816
// channel_bandwidth_hz
1818
1817
for (ch_type = 0 ; ch_type < ARRAY_SIZE (ch_types ); ch_type ++ ) {
1819
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1818
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1820
1819
sprintf (widget_str , "cb_%s_chan%d_interface" , ch_types [ch_type ], chann + 1 );
1821
1820
char * current_sample_rate = gtk_combo_box_text_get_active_text (
1822
1821
GTK_COMBO_BOX_TEXT (gtk_builder_get_object (priv -> builder , widget_str )));
@@ -1870,7 +1869,7 @@ static int profile_gen_config_set_LTE(struct adrv9002_config *cfg, gpointer data
1870
1869
1871
1870
// RX and TX
1872
1871
for (ch_type = 0 ; ch_type < ARRAY_SIZE (ch_types ); ch_type ++ ) {
1873
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1872
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1874
1873
// enabled
1875
1874
sprintf (widget_str , "cb_%s_chan%d_en" , ch_types [ch_type ], chann + 1 );
1876
1875
if (reset_preset ) {
@@ -1891,7 +1890,7 @@ static int profile_gen_config_set_LTE(struct adrv9002_config *cfg, gpointer data
1891
1890
1892
1891
// RX specific
1893
1892
// ft_port
1894
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1893
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1895
1894
sprintf (widget_str , "cb_rx_chan%d_rf_port" , chann + 1 );
1896
1895
sprintf (value , "%d" , cfg -> radio_cfg .rx_config [chann ].rf_port );
1897
1896
if (reset_preset ) {
@@ -1971,7 +1970,7 @@ static int profile_gen_config_populate_from_ui(struct adrv9002_config *cfg, gpoi
1971
1970
atoi (gtk_combo_box_get_active_id (GTK_COMBO_BOX (gtk_builder_get_object (priv -> builder , widget_str ))));
1972
1971
1973
1972
// RX
1974
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1973
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1975
1974
sprintf (widget_str , "cb_rx_chan%d_bw" , chann + 1 );
1976
1975
cfg -> radio_cfg .rx_config [chann ].channel_bandwidth_hz =
1977
1976
(uint32_t )atoi (gtk_combo_box_text_get_active_text (
@@ -1995,7 +1994,7 @@ static int profile_gen_config_populate_from_ui(struct adrv9002_config *cfg, gpoi
1995
1994
}
1996
1995
1997
1996
// TX
1998
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
1997
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
1999
1998
sprintf (widget_str , "cb_tx_chan%d_bw" , chann + 1 );
2000
1999
cfg -> radio_cfg .tx_config [chann ].channel_bandwidth_hz =
2001
2000
(uint32_t )atoi (gtk_combo_box_text_get_active_text (
@@ -2076,7 +2075,7 @@ static char *profile_gen_config_to_str(struct adrv9002_config *cfg)
2076
2075
2077
2076
// radio_cfg.rx_config
2078
2077
cJSON_AddItemToObject (radio_cfg , "rx_config" , rx_config = cJSON_CreateArray ());
2079
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
2078
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
2080
2079
cJSON_AddItemToArray (rx_config , tmp_object = cJSON_CreateObject ());
2081
2080
cJSON_AddNumberToObject (tmp_object , "enabled" , cfg -> radio_cfg .rx_config [chann ].enabled );
2082
2081
cJSON_AddNumberToObject (tmp_object , "adc_high_performance_mode" ,
@@ -2100,7 +2099,7 @@ static char *profile_gen_config_to_str(struct adrv9002_config *cfg)
2100
2099
2101
2100
// radio_cfg.tx_config
2102
2101
cJSON_AddItemToObject (radio_cfg , "tx_config" , tx_config = cJSON_CreateArray ());
2103
- for (chann = 0 ; chann < CHANNEL_COUNT ; chann ++ ) {
2102
+ for (chann = 0 ; chann < ADRV9002_NUM_CHANNELS ; chann ++ ) {
2104
2103
cJSON_AddItemToArray (tx_config , tmp_object = cJSON_CreateObject ());
2105
2104
cJSON_AddNumberToObject (tmp_object , "enabled" , cfg -> radio_cfg .tx_config [chann ].enabled );
2106
2105
cJSON_AddNumberToObject (tmp_object , "sample_rate_hz" , cfg -> radio_cfg .tx_config [chann ].sample_rate_hz );
@@ -2407,8 +2406,8 @@ static void profile_gen_update_channels(GtkComboBox *self, struct plugin_private
2407
2406
GtkWidget * channel_frame ;
2408
2407
bool channel_en ;
2409
2408
unsigned long i ;
2410
- char * ch_frames [4 ] = {"frame_tx1_controls" , "frame_tx2_controls" , "frame_rx1_controls" , "frame_rx2_controls" };
2411
- char * ch_buttons [4 ] = {"cb_tx_chan1_en" , "cb_tx_chan2_en" , "cb_rx_chan1_en" , "cb_rx_chan2_en" };
2409
+ char * ch_frames [] = {"frame_tx1_controls" , "frame_tx2_controls" , "frame_rx1_controls" , "frame_rx2_controls" };
2410
+ char * ch_buttons [] = {"cb_tx_chan1_en" , "cb_tx_chan2_en" , "cb_rx_chan1_en" , "cb_rx_chan2_en" };
2412
2411
2413
2412
for (i = 0 ; i < ARRAY_SIZE (ch_frames ); i ++ ) {
2414
2413
channel_frame = GTK_WIDGET (gtk_builder_get_object (priv -> builder , ch_frames [i ]));
0 commit comments