1 /*
2  * Copyright (c) 2025 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /**
8  * @brief PHY init config parameters. These are passed to phy at init.
9  */
10 
11 #ifndef _PHY_RF_PARAMS_RT_H_
12 #define _PHY_RF_PARAMS_RT_H_
13 #include "common/phy_rf_params_common.h"
14 
15 #define NRF_WIFI_RT_DEF_RF_PARAMS "007077003F032424001000002800323500000C0008087D8105010071630300EED501001F6F00003B350100F52E0000E35E0000B7B6000066EFFEFFB5F60000896200007A840200E28FFCFF080808080408120100000000A1A10178000000080050003B020726181818181A120A140E0600"
16 #define MAX_TX_PWR_SYS_TEST 30
17 #define MAX_TX_PWR_RADIO_TEST 24
18 
19 #define MAX_CAPTURE_LEN 16383
20 #define MIN_CAPTURE_LEN 0
21 #define RX_CAPTURE_TIMEOUT_CONST 11
22 #define CAPTURE_DURATION_IN_SEC 600
23 
24 enum nrf_wifi_rf_test {
25 	NRF_WIFI_RF_TEST_RX_ADC_CAP,
26 	NRF_WIFI_RF_TEST_RX_STAT_PKT_CAP,
27 	NRF_WIFI_RF_TEST_RX_DYN_PKT_CAP,
28 	NRF_WIFI_RF_TEST_TX_TONE,
29 	NRF_WIFI_RF_TEST_DPD,
30 	NRF_WIFI_RF_TEST_RF_RSSI,
31 	NRF_WIFI_RF_TEST_SLEEP,
32 	NRF_WIFI_RF_TEST_GET_TEMPERATURE,
33 	NRF_WIFI_RF_TEST_XO_CALIB,
34 	NRF_WIFI_RF_TEST_XO_TUNE,
35 	NRF_WIFI_RF_TEST_MAX,
36 };
37 
38 enum nrf_wifi_rf_test_event {
39 	NRF_WIFI_RF_TEST_EVENT_RX_ADC_CAP,
40 	NRF_WIFI_RF_TEST_EVENT_RX_STAT_PKT_CAP,
41 	NRF_WIFI_RF_TEST_EVENT_RX_DYN_PKT_CAP,
42 	NRF_WIFI_RF_TEST_EVENT_TX_TONE_START,
43 	NRF_WIFI_RF_TEST_EVENT_DPD_ENABLE,
44 	NRF_WIFI_RF_TEST_EVENT_RF_RSSI,
45 	NRF_WIFI_RF_TEST_EVENT_SLEEP,
46 	NRF_WIFI_RF_TEST_EVENT_TEMP_MEAS,
47 	NRF_WIFI_RF_TEST_EVENT_XO_CALIB,
48 	NRF_WIFI_RF_TEST_EVENT_MAX,
49 };
50 
51 /* Holds the RX capture related info */
52 struct nrf_wifi_rf_test_capture_params {
53 	unsigned char test;
54 
55 	/* Number of samples to be captured. */
56 	unsigned short int cap_len;
57 
58 	/* Capture timeout in seconds. */
59 	unsigned short int cap_time;
60 
61 	/* Capture status codes:
62 	 *0: Capture successful after WLAN packet detection
63 	 *1: Capture failed after WLAN packet detection
64 	 *2: Capture timedout as no WLAN packets are detected
65 	 */
66 	unsigned char capture_status;
67 
68 	/* LNA Gain to be configured. It is a 3 bit value. The mapping is,
69 	 * '0' = 24dB
70 	 * '1' = 18dB
71 	 * '2' = 12dB
72 	 * '3' = 0dB
73 	 * '4' = -12dB
74 	 */
75 	unsigned char lna_gain;
76 
77 	/* Baseband Gain to be configured. It is a 5 bit value.
78 	 * It supports 64dB range.The increment happens lineraly 2dB/step
79 	 */
80 	unsigned char bb_gain;
81 } __NRF_WIFI_PKD;
82 
83 /* Struct to hold the events from RF test SW. */
84 struct nrf_wifi_rf_test_capture_meas {
85 	unsigned char test;
86 
87 	/* Mean of I samples. Format: Q.11 */
88 	signed short mean_I;
89 
90 	/* Mean of Q samples. Format: Q.11 */
91 	signed short mean_Q;
92 
93 	/* RMS of I samples */
94 	unsigned int rms_I;
95 
96 	/* RMS of Q samples */
97 	unsigned int rms_Q;
98 } __NRF_WIFI_PKD;
99 
100 /* Holds the transmit related info */
101 struct nrf_wifi_rf_test_tx_params {
102 	unsigned char test;
103 
104 	/* Desired tone frequency in MHz in steps of 1 MHz from -10 MHz to +10 MHz. */
105 	signed char tone_freq;
106 
107 	/* Desired TX power in the range -16 dBm to +24 dBm.
108 	 * in steps of 2 dBm
109 	 */
110 	signed char tx_pow;
111 
112 	/* Set 1 for staring tone transmission. */
113 	unsigned char enabled;
114 } __NRF_WIFI_PKD;
115 
116 struct nrf_wifi_rf_test_dpd_params {
117 	unsigned char test;
118 	unsigned char enabled;
119 
120 } __NRF_WIFI_PKD;
121 
122 struct nrf_wifi_temperature_params {
123 	unsigned char test;
124 
125 	/** Current measured temperature */
126 	signed int temperature;
127 
128 	/** Temperature measurment status.
129 	 * 0: Reading successful
130 	 * 1: Reading failed
131 	 */
132 	unsigned int readTemperatureStatus;
133 } __NRF_WIFI_PKD;
134 
135 struct nrf_wifi_rf_get_rf_rssi {
136 	unsigned char test;
137 	unsigned char lna_gain;
138 	unsigned char bb_gain;
139 	unsigned char agc_status_val;
140 } __NRF_WIFI_PKD;
141 
142 struct nrf_wifi_rf_test_xo_calib {
143 	unsigned char test;
144 
145 	/* XO value in the range between 0 to 127 */
146 	unsigned char xo_val;
147 
148 } __NRF_WIFI_PKD;
149 
150 struct nrf_wifi_rf_get_xo_value {
151 	unsigned char test;
152 
153 	/* Optimal XO value computed. */
154 	unsigned char xo_value;
155 } __NRF_WIFI_PKD;
156 
157 #endif /* _PHY_RF_PARAMS_RT_H_ */
158