Skip to content

Commit cf2ce9a

Browse files
krish2718nordicjm
authored andcommitted
samples: wifi: shell: Add playout/cap shell
Add a shell to configure playout/capture module in non-RF environments. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent ca7a7b0 commit cf2ce9a

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

samples/wifi/shell/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ cmake_minimum_required(VERSION 3.20.0)
99
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1010
project(nrf_wifi_shell)
1111

12+
target_sources_ifdef(CONFIG_SOC_NRF7120_PREENG
13+
app
14+
PRIVATE
15+
src/wifi_pocap_shell.c)
16+
1217
target_sources_ifdef(CONFIG_NRF70_RAW_DATA_TX
1318
app
1419
PRIVATE
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/**
8+
* @file
9+
* @brief WiFi pre-silicon testing shell
10+
*/
11+
12+
#include <zephyr/sys/printk.h>
13+
#include <zephyr/kernel.h>
14+
#include <zephyr/shell/shell.h>
15+
#include <zephyr/posix/unistd.h>
16+
#include <zephyr/logging/log.h>
17+
#include <soc.h>
18+
19+
LOG_MODULE_REGISTER(pocap_mode, CONFIG_LOG_DEFAULT_LEVEL);
20+
21+
static int cmd_wifi_pocap(const struct shell *sh, size_t argc, char *argv[])
22+
{
23+
uint32_t rx_mode = 0, tx_mode = 0, rx_holdoff = 0, rx_wrap = 0, b2b_mode = 0;
24+
int opt;
25+
26+
optind = 1;
27+
28+
while ((opt = getopt(argc, argv, "r:t:h:w:b:")) != -1) {
29+
switch (opt) {
30+
case 'r':
31+
rx_mode = (uint32_t)atoi(optarg);
32+
break;
33+
case 't':
34+
tx_mode = (uint32_t)atoi(optarg);
35+
break;
36+
case 'h':
37+
rx_holdoff = (uint32_t)atoi(optarg);
38+
break;
39+
case 'w':
40+
rx_wrap = (uint32_t)atoi(optarg);
41+
break;
42+
case 'b':
43+
b2b_mode = (uint32_t)atoi(optarg);
44+
break;
45+
default:
46+
shell_print(
47+
sh,
48+
"Usage: wifi_pocap [-b b2b_mode] [other opts]\n"
49+
"b2b_mode=0: -r rx_mode -t tx_mode -h rx_holdoff_len -w "
50+
"rx_wrap_len\n"
51+
"Defaults: rx_mode=0 tx_mode=0 rx_holdoff=0 rx_wrap=0 b2b_mode=0");
52+
return -EINVAL;
53+
}
54+
}
55+
56+
if (b2b_mode) {
57+
shell_print(sh, "Config: back_to_back_mode=%u (others ignored in B2B mode)",
58+
b2b_mode);
59+
configure_playout_capture(0, 0, 0, 0, b2b_mode);
60+
} else {
61+
shell_print(sh, "Config: rx=%u tx=%u holdoff=%u wrap=%u b2b=%u", rx_mode, tx_mode,
62+
rx_holdoff, rx_wrap, b2b_mode);
63+
configure_playout_capture(rx_mode, tx_mode, rx_holdoff, rx_wrap, 0);
64+
}
65+
66+
return 0;
67+
}
68+
69+
SHELL_CMD_REGISTER(wifi_pocap, NULL, "Configure RF Playout Capture", cmd_wifi_pocap);

0 commit comments

Comments
 (0)