Skip to content

Commit e90993b

Browse files
committed
samples: radio_test: code cleanups
- cleaned up doxygen comments; - removed CONFIG_HAS_HW_NRF_RADIO_IEEE802154 and CONFIG_HAS_HW_NRF_RADIO_BLE_CODED since the radio dts node was removed in ncs-bm. Both Coded PHY and IEEE802.15.4 are supported by all of the NCS-BM Bluetooth SoCs so it is safe to remove corresponding ifdefs completely and always build the code Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
1 parent e07f55a commit e90993b

4 files changed

Lines changed: 11 additions & 52 deletions

File tree

samples/peripherals/radio_test/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
mainmenu "Nordic Radio test sample"
88

99
config RADIO_TEST_RX_TIMEOUT
10-
int "RX packet reception timeout"
10+
int "RX packet reception timeout in seconds"
1111
default 10
1212
help
1313
Specifies the time in seconds that the application waits for the first packet to be

samples/peripherals/radio_test/src/radio_cmd.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ static struct radio_test_config test_config;
7272
/* If true, RX sweep, TX sweep or duty cycle test is performed. */
7373
static bool test_in_progress;
7474

75-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
7675
static void ieee_channel_check(const struct shell *shell, uint8_t channel)
7776
{
7877
if (config.mode == NRF_RADIO_MODE_IEEE802154_250KBIT) {
@@ -90,7 +89,6 @@ static void ieee_channel_check(const struct shell *shell, uint8_t channel)
9089

9190
}
9291
}
93-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
9492

9593
static int cmd_start_channel_set(const struct shell *shell, size_t argc,
9694
char **argv)
@@ -211,9 +209,7 @@ static int cmd_tx_carrier_start(const struct shell *shell, size_t argc,
211209
test_in_progress = false;
212210
}
213211

214-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
215212
ieee_channel_check(shell, config.channel_start);
216-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
217213

218214
memset(&test_config, 0, sizeof(test_config));
219215
test_config.type = UNMODULATED_TX;
@@ -263,9 +259,7 @@ static int cmd_tx_modulated_carrier_start(const struct shell *shell,
263259
test_in_progress = false;
264260
}
265261

266-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
267262
ieee_channel_check(shell, config.channel_start);
268-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
269263

270264
if (argc > 2) {
271265
shell_error(shell, "%s: bad parameters count.", argv[0]);
@@ -314,9 +308,7 @@ static int cmd_duty_cycle_set(const struct shell *shell, size_t argc,
314308

315309
config.duty_cycle = duty_cycle;
316310

317-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
318311
ieee_channel_check(shell, config.channel_start);
319-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
320312

321313
memset(&test_config, 0, sizeof(test_config));
322314
test_config.type = MODULATED_TX_DUTY_CYCLE;
@@ -488,7 +480,6 @@ static int cmd_print(const struct shell *shell, size_t argc, char **argv)
488480
STRINGIFY(NRF_RADIO_MODE_BLE_2MBIT));
489481
break;
490482

491-
#if CONFIG_HAS_HW_NRF_RADIO_BLE_CODED
492483
case NRF_RADIO_MODE_BLE_LR125KBIT:
493484
shell_print(shell,
494485
"Data rate: %s",
@@ -500,15 +491,12 @@ static int cmd_print(const struct shell *shell, size_t argc, char **argv)
500491
"Data rate: %s",
501492
STRINGIFY(NRF_RADIO_MODE_BLE_LR500KBIT));
502493
break;
503-
#endif /* CONFIG_HAS_HW_NRF_RADIO_BLE_CODED */
504494

505-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
506495
case NRF_RADIO_MODE_IEEE802154_250KBIT:
507496
shell_print(shell,
508497
"Data rate: %s",
509498
STRINGIFY(NRF_RADIO_MODE_IEEE802154_250KBIT));
510499
break;
511-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
512500

513501
default:
514502
shell_print(shell,
@@ -607,9 +595,7 @@ static int cmd_rx_start(const struct shell *shell, size_t argc, char **argv)
607595
return -EINVAL;
608596
}
609597

610-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
611598
ieee_channel_check(shell, config.channel_start);
612-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
613599

614600
memset(&test_config, 0, sizeof(test_config));
615601
test_config.type = RX;
@@ -980,7 +966,6 @@ static int cmd_ble_2mbit(const struct shell *shell, size_t argc, char **argv)
980966
return 0;
981967
}
982968

983-
#if CONFIG_HAS_HW_NRF_RADIO_BLE_CODED
984969
static int cmd_ble_lr125kbit(const struct shell *shell, size_t argc,
985970
char **argv)
986971
{
@@ -1000,9 +985,7 @@ static int cmd_ble_lr500kbit(const struct shell *shell, size_t argc,
1000985

1001986
return 0;
1002987
}
1003-
#endif /* CONFIG_HAS_HW_NRF_RADIO_BLE_CODED */
1004988

1005-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
1006989
static int cmd_ble_ieee(const struct shell *shell, size_t argc, char **argv)
1007990
{
1008991
config.mode = NRF_RADIO_MODE_IEEE802154_250KBIT;
@@ -1011,7 +994,6 @@ static int cmd_ble_ieee(const struct shell *shell, size_t argc, char **argv)
1011994

1012995
return 0;
1013996
}
1014-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
1015997

1016998
static int cmd_pattern_random(const struct shell *shell, size_t argc,
1017999
char **argv)
@@ -1087,20 +1069,16 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_data_rate,
10871069
SHELL_CMD(ble_2Mbit, NULL, "2 Mbit/s Bluetooth Low Energy",
10881070
cmd_ble_2mbit),
10891071

1090-
#if CONFIG_HAS_HW_NRF_RADIO_BLE_CODED
10911072
SHELL_CMD(ble_lr125Kbit, NULL,
10921073
"Long range 125 kbit/s TX, 125 kbit/s and 500 kbit/s RX",
10931074
cmd_ble_lr125kbit),
10941075

10951076
SHELL_CMD(ble_lr500Kbit, NULL,
10961077
"Long range 500 kbit/s TX, 125 kbit/s and 500 kbit/s RX",
10971078
cmd_ble_lr500kbit),
1098-
#endif /* CONFIG_HAS_HW_NRF_RADIO_BLE_CODED */
10991079

1100-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
11011080
SHELL_CMD(ieee802154_250Kbit, NULL, "IEEE 802.15.4-2006 250 kbit/s",
11021081
cmd_ble_ieee),
1103-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
11041082

11051083
SHELL_SUBCMD_SET_END
11061084
);

samples/peripherals/radio_test/src/radio_test.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ static void rx_timeout_schedule(int32_t delay_ms)
117117

118118
static uint16_t channel_to_frequency(nrf_radio_mode_t mode, uint8_t channel)
119119
{
120-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
121120
if (mode == NRF_RADIO_MODE_IEEE802154_250KBIT) {
122121
if ((channel >= IEEE_MIN_CHANNEL) &&
123122
(channel <= IEEE_MAX_CHANNEL)) {
@@ -128,9 +127,6 @@ static uint16_t channel_to_frequency(nrf_radio_mode_t mode, uint8_t channel)
128127
} else {
129128
return CHAN_TO_FREQ(channel);
130129
}
131-
#else
132-
return CHAN_TO_FREQ(channel);
133-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
134130
}
135131

136132
static nrf_radio_txpower_t dbm_to_nrf_radio_txpower(int8_t tx_power)
@@ -441,7 +437,6 @@ static void radio_config(nrf_radio_mode_t mode, enum transmit_pattern pattern)
441437
packet_conf.whiteen = true;
442438

443439
switch (mode) {
444-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
445440
case NRF_RADIO_MODE_IEEE802154_250KBIT:
446441
/* Packet configuration:
447442
* S1 size = 0 bits,
@@ -457,9 +452,7 @@ static void radio_config(nrf_radio_mode_t mode, enum transmit_pattern pattern)
457452
/* preamble, address (BALEN + PREFIX), lflen and payload */
458453
total_payload_size = 4 + (packet_conf.balen + 1) + 1 + packet_conf.maxlen;
459454
break;
460-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
461455

462-
#if CONFIG_HAS_HW_NRF_RADIO_BLE_CODED
463456
case NRF_RADIO_MODE_BLE_LR500KBIT:
464457
case NRF_RADIO_MODE_BLE_LR125KBIT:
465458
/* Packet configuration:
@@ -484,8 +477,6 @@ static void radio_config(nrf_radio_mode_t mode, enum transmit_pattern pattern)
484477
packet_conf.termlen + packet_conf.maxlen + RADIO_CRCCNF_LEN_Three;
485478
break;
486479

487-
#endif /* CONFIG_HAS_HW_NRF_RADIO_BLE_CODED */
488-
489480
case NRF_RADIO_MODE_BLE_2MBIT:
490481
/* Packet configuration:
491482
* S1 size = 0 bits,
@@ -575,15 +566,11 @@ static void generate_modulated_rf_packet(uint8_t mode,
575566
radio_config(mode, pattern);
576567

577568
/* One byte used for size, actual size is SIZE-1 */
578-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
579569
if (mode == NRF_RADIO_MODE_IEEE802154_250KBIT) {
580570
tx_packet[0] = IEEE_MAX_PAYLOAD_LEN - 1;
581571
} else {
582572
tx_packet[0] = sizeof(tx_packet) - 1;
583573
}
584-
#else
585-
tx_packet[0] = sizeof(tx_packet) - 1;
586-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
587574

588575
switch (pattern) {
589576
case TRANSMIT_PATTERN_RANDOM:
@@ -622,13 +609,9 @@ static void radio_disable(void)
622609

623610
static void mltpan_6(nrf_radio_mode_t mode)
624611
{
625-
#if defined(NRF54L_SERIES) && CONFIG_HAS_HW_NRF_RADIO_IEEE802154
626612
if (mode == NRF_RADIO_MODE_IEEE802154_250KBIT) {
627613
*((volatile uint32_t *)0x5008A810) = 2;
628614
}
629-
#else
630-
ARG_UNUSED(mode);
631-
#endif /* defined(NRF54L_SERIES) && CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
632615
}
633616

634617
static void radio_mode_set(NRF_RADIO_Type *reg, nrf_radio_mode_t mode)
@@ -661,7 +644,6 @@ static void radio_modulated_tx_carrier(uint8_t mode, int8_t txpower, uint8_t cha
661644
generate_modulated_rf_packet(mode, pattern);
662645

663646
switch (mode) {
664-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154 || CONFIG_HAS_HW_NRF_RADIO_BLE_CODED
665647
case NRF_RADIO_MODE_IEEE802154_250KBIT:
666648
case NRF_RADIO_MODE_BLE_LR125KBIT:
667649
case NRF_RADIO_MODE_BLE_LR500KBIT:
@@ -670,8 +652,6 @@ static void radio_modulated_tx_carrier(uint8_t mode, int8_t txpower, uint8_t cha
670652
nrf_radio_int_enable(NRF_RADIO, NRF_RADIO_INT_PHYEND_MASK);
671653
break;
672654

673-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 || CONFIG_HAS_HW_NRF_RADIO_BLE_CODED */
674-
675655
case NRF_RADIO_MODE_BLE_1MBIT:
676656
case NRF_RADIO_MODE_BLE_2MBIT:
677657
case NRF_RADIO_MODE_NRF_1MBIT:
@@ -886,7 +866,6 @@ void radio_rx_stats_get(struct radio_rx_stats *rx_stats)
886866
{
887867
size_t size;
888868

889-
#if CONFIG_HAS_HW_NRF_RADIO_IEEE802154
890869
nrf_radio_mode_t radio_mode;
891870

892871
radio_mode = nrf_radio_mode_get(NRF_RADIO);
@@ -895,10 +874,6 @@ void radio_rx_stats_get(struct radio_rx_stats *rx_stats)
895874
} else {
896875
size = sizeof(rx_packet);
897876
}
898-
#else
899-
size = sizeof(rx_packet);
900-
#endif /* CONFIG_HAS_HW_NRF_RADIO_IEEE802154 */
901-
902877
rx_stats->last_packet.buf = rx_packet;
903878
rx_stats->last_packet.len = size;
904879
rx_stats->packet_cnt = rx_packet_cnt;

samples/peripherals/radio_test/src/radio_test.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/** IEEE 802.15.4 maximum channel. */
2020
#define IEEE_MAX_CHANNEL 26
2121

22-
/**@brief Radio transmit and address pattern. */
22+
/** @brief Radio transmit and address pattern. */
2323
enum transmit_pattern {
2424
/** Random pattern. */
2525
TRANSMIT_PATTERN_RANDOM,
@@ -31,7 +31,7 @@ enum transmit_pattern {
3131
TRANSMIT_PATTERN_11001100,
3232
};
3333

34-
/**@brief Radio test mode. */
34+
/** @brief Radio test mode. */
3535
enum radio_test_mode {
3636
/** TX carrier. */
3737
UNMODULATED_TX,
@@ -52,7 +52,7 @@ enum radio_test_mode {
5252
MODULATED_TX_DUTY_CYCLE,
5353
};
5454

55-
/**@brief Radio test configuration. */
55+
/** @brief Radio test configuration. */
5656
struct radio_test_config {
5757
/** Radio test type. */
5858
enum radio_test_mode type;
@@ -61,6 +61,7 @@ struct radio_test_config {
6161
nrf_radio_mode_t mode;
6262

6363
union {
64+
/** @brief Configuration for the unmodulated TX mode. */
6465
struct {
6566
/** Radio output power. */
6667
int8_t txpower;
@@ -69,6 +70,7 @@ struct radio_test_config {
6970
uint8_t channel;
7071
} unmodulated_tx;
7172

73+
/** @brief Configuration for the modulated TX mode. */
7274
struct {
7375
/** Radio output power. */
7476
int8_t txpower;
@@ -89,6 +91,7 @@ struct radio_test_config {
8991
void (*cb)(void);
9092
} modulated_tx;
9193

94+
/** @brief Configuration for the RX mode. */
9295
struct {
9396
/** Radio transmission pattern. */
9497
enum transmit_pattern pattern;
@@ -106,6 +109,7 @@ struct radio_test_config {
106109
void (*cb)(void);
107110
} rx;
108111

112+
/** @brief Configuration for the TX sweep mode. */
109113
struct {
110114
/** Radio output power. */
111115
int8_t txpower;
@@ -120,6 +124,7 @@ struct radio_test_config {
120124
uint32_t delay_ms;
121125
} tx_sweep;
122126

127+
/** @brief Configuration for the RX sweep mode. */
123128
struct {
124129
/** Radio start channel (frequency). */
125130
uint8_t channel_start;
@@ -131,6 +136,7 @@ struct radio_test_config {
131136
uint32_t delay_ms;
132137
} rx_sweep;
133138

139+
/** @brief Configuration for the modulated TX duty cycle mode. */
134140
struct {
135141
/** Radio output power. */
136142
int8_t txpower;
@@ -147,7 +153,7 @@ struct radio_test_config {
147153
} params;
148154
};
149155

150-
/**@brief Radio RX statistics. */
156+
/** @brief Radio RX statistics. */
151157
struct radio_rx_stats {
152158
/** Content of the last packet. */
153159
struct {

0 commit comments

Comments
 (0)