Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: wifi: radio_test: Add command to configure PTA #19918

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions samples/wifi/radio_test/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CONFIG_WIFI=y
CONFIG_WIFI_NRF70=y
CONFIG_NRF70_RADIO_TEST=y

CONFIG_NRF70_SR_COEX=y

#CONFIG_INIT_STACKS=y

# Memories
Expand Down
8 changes: 7 additions & 1 deletion samples/wifi/radio_test/radio_test_subcommands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,13 @@ Wi-Fi radio test subcommands
- 0
- Configuration
- If the channel is an edge channel, the value of <val> is subtracted from the transmit power.

* - config_pta
- | <val> - Wi-Fi operating band 0: 2.4 GHz, 1: 5 GHz
| <val> - Antenna mode 0: Shared, 1: Separate
| <val> - SR protocol 0: Thread, 1: Bluetooth® LE
- 0
- Configuration
- Allows configuration of PTA for different Wi-Fi operating bands, antenna modes, and Short-Range protocols.

.. _wifi_radio_test_stats:

Expand Down
91 changes: 90 additions & 1 deletion samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#include <nrf_wifi_radio_test_shell.h>
#include <util.h>
#include "fmac_api_common.h"

#ifdef CONFIG_NRF70_SR_COEX
#include <coex.h>
muraliThokala marked this conversation as resolved.
Show resolved Hide resolved
#endif
extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep;
struct nrf_wifi_ctx_zep *ctx = &rpu_drv_priv_zep.rpu_ctx_zep;

Expand Down Expand Up @@ -1396,6 +1398,81 @@ static int nrf_wifi_radio_test_sr_ant_switch_ctrl(const struct shell *shell,
}
#endif /* CONFIG_NRF70_SR_COEX_RF_SWITCH */

#ifdef CONFIG_NRF70_SR_COEX
static int nrf_wifi_radio_test_config_pta(const struct shell *shell,
size_t argc,
const char *argv[])
{
bool wlan_band;
bool separate_antennas;
bool is_sr_protocol_ble;
int result_non_pta = 0;
int result_pta = 0;
int result = 0;

if (argc < 4) {
shell_fprintf(shell,
SHELL_ERROR,
"invalid # of args : %d\n", argc);
shell_fprintf(shell,
SHELL_ERROR,
"Usage: config_pta wlan_band");
shell_fprintf(shell,
SHELL_ERROR,
" separate_antennas is_sr_protocol_ble\n");
shell_fprintf(shell,
SHELL_ERROR,
"wlan_band: 0 for 2.4GHz, 1 for 5GHz\n");
shell_fprintf(shell,
SHELL_ERROR,
"is_sep_antennas: 0 for shared antenna,");
shell_fprintf(shell,
SHELL_ERROR,
" 1 for separate antennas\n");
shell_fprintf(shell,
SHELL_ERROR,
"is_sr_ble: 0 for Thread, 1 for Bluetooth\n");
return -ENOEXEC;
}

wlan_band = strtoul(argv[1], NULL, 0);
separate_antennas = strtoul(argv[2], NULL, 0);
is_sr_protocol_ble = strtoul(argv[3], NULL, 0);
muraliThokala marked this conversation as resolved.
Show resolved Hide resolved

if (wlan_band > 1) {
shell_fprintf(shell,
SHELL_ERROR,
"Invalid wlan_band(%lu).\n",
wlan_band);
shell_help(shell);
return -ENOEXEC;
}

if (separate_antennas > 1) {
shell_fprintf(shell,
SHELL_ERROR,
"Invalid separate_antennas(%lu).\n",
separate_antennas);
shell_help(shell);
return -ENOEXEC;
}

if (is_sr_protocol_ble > 1) {
shell_fprintf(shell,
SHELL_ERROR,
"Invalid is_sr_protocol_ble(%lu).\n",
is_sr_protocol_ble);
shell_help(shell);
return -ENOEXEC;
}

result_non_pta = nrf_wifi_coex_config_non_pta(separate_antennas, is_sr_protocol_ble);
result_pta = nrf_wifi_coex_config_pta(wlan_band, separate_antennas, is_sr_protocol_ble);
result = result_non_pta & result_pta;
muraliThokala marked this conversation as resolved.
Show resolved Hide resolved
return result;
}
#endif /* CONFIG_NRF70_SR_COEX */

static int nrf_wifi_radio_test_rx_cap(const struct shell *shell,
size_t argc,
const char *argv[])
Expand Down Expand Up @@ -2358,6 +2435,18 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
2,
0),
#endif /* CONFIG_NRF70_SR_COEX_RF_SWITCH */

#ifdef CONFIG_NRF70_SR_COEX
SHELL_CMD_ARG(config_pta,
NULL,
" - <val> - Wi-Fi operating band 0: 2.4GHz, 1: 5GHz\n"
" - <val> - Antenna mode 0: Shared, 1: Separate\n"
" - <val> - SR protocol 0: Thread, 1: Bluetooth LE\n",
nrf_wifi_radio_test_config_pta,
4,
0),
#endif /* CONFIG_NRF70_SR_COEX */

SHELL_CMD_ARG(rx_lna_gain,
NULL,
"<val> - LNA gain to be configured.\n"
Expand Down