|
| 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