1 /***************************************************************************//**
2  * @file
3  * @brief This file implements the radio config commands for RAILtest
4  *   applications.
5  *******************************************************************************
6  * # License
7  * <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
8  *******************************************************************************
9  *
10  * SPDX-License-Identifier: Zlib
11  *
12  * The licensor of this software is Silicon Laboratories Inc.
13  *
14  * This software is provided 'as-is', without any express or implied
15  * warranty. In no event will the authors be held liable for any damages
16  * arising from the use of this software.
17  *
18  * Permission is granted to anyone to use this software for any purpose,
19  * including commercial applications, and to alter it and redistribute it
20  * freely, subject to the following restrictions:
21  *
22  * 1. The origin of this software must not be misrepresented; you must not
23  *    claim that you wrote the original software. If you use this software
24  *    in a product, an acknowledgment in the product documentation would be
25  *    appreciated but is not required.
26  * 2. Altered source versions must be plainly marked as such, and must not be
27  *    misrepresented as being the original software.
28  * 3. This notice may not be removed or altered from any source distribution.
29  *
30  ******************************************************************************/
31 
32 #include <string.h>
33 #include <stdio.h>
34 
35 #include "rail.h"
36 #include "rail_ble.h"
37 #include "rail_ieee802154.h"
38 #include "rail_zwave.h"
39 
40 #include "sl_rail_util_protocol.h"
41 
sl_rail_util_protocol_config_proprietary(RAIL_Handle_t handle)42 static RAIL_Status_t sl_rail_util_protocol_config_proprietary(RAIL_Handle_t handle)
43 {
44   (void) RAIL_SetPtiProtocol(handle, RAIL_PTI_PROTOCOL_CUSTOM);
45   return RAIL_STATUS_NO_ERROR;
46 }
47 
48 #if RAIL_SUPPORTS_2P4GHZ_BAND && SL_RAIL_UTIL_PROTOCOL_BLE_ENABLE
sl_rail_util_protocol_config_ble(RAIL_Handle_t handle,sl_rail_util_protocol_type_t protocol)49 static RAIL_Status_t sl_rail_util_protocol_config_ble(RAIL_Handle_t handle,
50                                                       sl_rail_util_protocol_type_t protocol)
51 {
52   RAIL_Status_t status;
53   // Override BLE's default timings to get rid of the default rx search timeout
54   RAIL_StateTiming_t timings = {
55     .idleToRx = SL_RAIL_UTIL_PROTOCOL_BLE_TIMING_IDLE_TO_RX_US,
56     .txToRx = SL_RAIL_UTIL_PROTOCOL_BLE_TIMING_TX_TO_RX_US,
57     .idleToTx = SL_RAIL_UTIL_PROTOCOL_BLE_TIMING_IDLE_TO_TX_US,
58     .rxToTx = SL_RAIL_UTIL_PROTOCOL_BLE_TIMING_RX_TO_TX_US,
59     .rxSearchTimeout = SL_RAIL_UTIL_PROTOCOL_BLE_TIMING_RX_SEARCH_TIMEOUT_AFTER_IDLE_ENABLE
60                        ? SL_RAIL_UTIL_PROTOCOL_BLE_TIMING_RX_SEARCH_TIMEOUT_AFTER_IDLE_US
61                        : 0U,
62     .txToRxSearchTimeout = SL_RAIL_UTIL_PROTOCOL_BLE_TIMING_RX_SEARCH_TIMEOUT_AFTER_TX_ENABLE
63                            ? SL_RAIL_UTIL_PROTOCOL_BLE_TIMING_RX_SEARCH_TIMEOUT_AFTER_TX_US
64                            : 0U,
65   };
66 
67   RAIL_BLE_Init(handle);
68   switch (protocol) {
69     case SL_RAIL_UTIL_PROTOCOL_BLE_1MBPS:
70       status = RAIL_BLE_ConfigPhy1MbpsViterbi(handle);
71       break;
72     case SL_RAIL_UTIL_PROTOCOL_BLE_2MBPS:
73       status = RAIL_BLE_ConfigPhy2MbpsViterbi(handle);
74       break;
75     case SL_RAIL_UTIL_PROTOCOL_BLE_CODED_125KBPS:
76       status = RAIL_BLE_ConfigPhyCoded(handle, RAIL_BLE_Coding_125kbps);
77       break;
78     case SL_RAIL_UTIL_PROTOCOL_BLE_CODED_500KBPS:
79       status = RAIL_BLE_ConfigPhyCoded(handle, RAIL_BLE_Coding_500kbps);
80       break;
81     case SL_RAIL_UTIL_PROTOCOL_BLE_QUUPPA_1MBPS:
82       status = RAIL_BLE_ConfigPhyQuuppa(handle);
83       break;
84     default:
85       status = RAIL_STATUS_INVALID_PARAMETER;
86       break;
87   }
88   if (RAIL_STATUS_NO_ERROR == status) {
89     status = RAIL_SetStateTiming(handle, &timings);
90   }
91   if (RAIL_STATUS_NO_ERROR != status) {
92     RAIL_BLE_Deinit(handle);
93   }
94   return status;
95 }
96 #endif
97 
98 #if RAIL_SUPPORTS_IEEE802154_BAND_2P4 && SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ENABLE
sl_rail_util_protocol_config_ieee802154_2p4ghz(RAIL_Handle_t handle,sl_rail_util_protocol_type_t protocol)99 static RAIL_Status_t sl_rail_util_protocol_config_ieee802154_2p4ghz(RAIL_Handle_t handle,
100                                                                     sl_rail_util_protocol_type_t protocol)
101 {
102   RAIL_Status_t status;
103   RAIL_IEEE802154_Config_t config = {
104     .addresses = NULL,
105     .ackConfig = {
106       .enable = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_AUTO_ACK_ENABLE,
107       .ackTimeout = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_AUTO_ACK_TIMEOUT_US,
108       .rxTransitions = {
109         .success = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_AUTO_ACK_RX_TRANSITION_STATE,
110         .error = RAIL_RF_STATE_IDLE // this parameter ignored
111       },
112       .txTransitions = {
113         .success = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_AUTO_ACK_TX_TRANSITION_STATE,
114         .error = RAIL_RF_STATE_IDLE // this parameter ignored
115       }
116     },
117     .timings = {
118       .idleToTx = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_TIMING_IDLE_TO_TX_US,
119       .idleToRx = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_TIMING_IDLE_TO_RX_US,
120       .rxToTx = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_TIMING_RX_TO_TX_US,
121       // Make txToRx slightly lower than desired to make sure we get to
122       // RX in time.
123       .txToRx = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_TIMING_TX_TO_RX_US,
124       .rxSearchTimeout = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_TIMING_RX_SEARCH_TIMEOUT_AFTER_IDLE_ENABLE
125                          ? SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_TIMING_RX_SEARCH_TIMEOUT_AFTER_IDLE_US
126                          : 0,
127       .txToRxSearchTimeout = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_TIMING_RX_SEARCH_TIMEOUT_AFTER_TX_ENABLE
128                              ? SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_TIMING_RX_SEARCH_TIMEOUT_AFTER_TX_US
129                              : 0
130     },
131     .framesMask = 0U // enable appropriate mask bits
132                   | (SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ACCEPT_BEACON_FRAME_ENABLE
133                      ? RAIL_IEEE802154_ACCEPT_BEACON_FRAMES : 0U)
134                   | (SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ACCEPT_DATA_FRAME_ENABLE
135                      ? RAIL_IEEE802154_ACCEPT_DATA_FRAMES : 0U)
136                   | (SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ACCEPT_ACK_FRAME_ENABLE
137                      ? RAIL_IEEE802154_ACCEPT_ACK_FRAMES : 0U)
138                   | (SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ACCEPT_COMMAND_FRAME_ENABLE
139                      ? RAIL_IEEE802154_ACCEPT_COMMAND_FRAMES : 0U),
140     // Enable promiscous mode since no PANID or destination address is
141     // specified.
142     .promiscuousMode = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_PROMISCUOUS_MODE_ENABLE,
143     .isPanCoordinator = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_PAN_COORDINATOR_ENABLE,
144     .defaultFramePendingInOutgoingAcks = SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_DEFAULT_FRAME_PENDING_STATE,
145   };
146   status = RAIL_IEEE802154_Init(handle, &config);
147   if (RAIL_STATUS_NO_ERROR == status) {
148     switch (protocol) {
149       case SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ:
150         status = RAIL_IEEE802154_Config2p4GHzRadio(handle);
151         break;
152       case SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ANTDIV:
153         status = RAIL_IEEE802154_Config2p4GHzRadioAntDiv(handle);
154         break;
155       case SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_COEX:
156         status = RAIL_IEEE802154_Config2p4GHzRadioCoex(handle);
157         break;
158       case SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ANTDIV_COEX:
159         status = RAIL_IEEE802154_Config2p4GHzRadioAntDivCoex(handle);
160         break;
161       default:
162         status = RAIL_STATUS_INVALID_PARAMETER;
163         break;
164     }
165   }
166   if (RAIL_STATUS_NO_ERROR != status) {
167     (void) RAIL_IEEE802154_Deinit(handle);
168   } else {
169     (void) RAIL_SetPtiProtocol(handle, RAIL_PTI_PROTOCOL_802154);
170   }
171   return status;
172 }
173 #endif // RAIL_FEAT_2G4_RADIO
174 
175 #if RAIL_SUPPORTS_SUBGHZ_BAND && SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_ENABLE
sl_rail_util_protocol_config_ieee802154_gb868(RAIL_Handle_t handle,sl_rail_util_protocol_type_t protocol)176 static RAIL_Status_t sl_rail_util_protocol_config_ieee802154_gb868(RAIL_Handle_t handle,
177                                                                    sl_rail_util_protocol_type_t protocol)
178 {
179   RAIL_Status_t status;
180   RAIL_IEEE802154_Config_t config = {
181     .addresses = NULL,
182     .ackConfig = {
183       .enable = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_AUTO_ACK_ENABLE,
184       .ackTimeout = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_AUTO_ACK_TIMEOUT_US,
185       .rxTransitions = {
186         .success = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_AUTO_ACK_RX_TRANSITION_STATE,
187         .error = RAIL_RF_STATE_IDLE // this parameter ignored
188       },
189       .txTransitions = {
190         .success = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_AUTO_ACK_TX_TRANSITION_STATE,
191         .error = RAIL_RF_STATE_IDLE // this parameter ignored
192       }
193     },
194     .timings = {
195       .idleToTx = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_TIMING_IDLE_TO_TX_US,
196       .idleToRx = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_TIMING_IDLE_TO_RX_US,
197       .rxToTx = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_TIMING_RX_TO_TX_US,
198       // Make txToRx slightly lower than desired to make sure we get to
199       // RX in time.
200       .txToRx = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_TIMING_TX_TO_RX_US,
201       .rxSearchTimeout = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_TIMING_RX_SEARCH_TIMEOUT_AFTER_IDLE_ENABLE
202                          ? SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_TIMING_RX_SEARCH_TIMEOUT_AFTER_IDLE_US
203                          : 0,
204       .txToRxSearchTimeout = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_TIMING_RX_SEARCH_TIMEOUT_AFTER_TX_ENABLE
205                              ? SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_TIMING_RX_SEARCH_TIMEOUT_AFTER_TX_US
206                              : 0
207     },
208     .framesMask = 0U // enable appropriate mask bits
209                   | (SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_ACCEPT_BEACON_FRAME_ENABLE
210                      ? RAIL_IEEE802154_ACCEPT_BEACON_FRAMES : 0U)
211                   | (SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_ACCEPT_DATA_FRAME_ENABLE
212                      ? RAIL_IEEE802154_ACCEPT_DATA_FRAMES : 0U)
213                   | (SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_ACCEPT_ACK_FRAME_ENABLE
214                      ? RAIL_IEEE802154_ACCEPT_ACK_FRAMES : 0U)
215                   | (SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_ACCEPT_COMMAND_FRAME_ENABLE
216                      ? RAIL_IEEE802154_ACCEPT_COMMAND_FRAMES : 0U),
217     // Enable promiscous mode since no PANID or destination address is
218     // specified.
219     .promiscuousMode = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_PROMISCUOUS_MODE_ENABLE,
220     .isPanCoordinator = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_PAN_COORDINATOR_ENABLE,
221     .defaultFramePendingInOutgoingAcks = SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_DEFAULT_FRAME_PENDING_STATE,
222   };
223   status = RAIL_IEEE802154_Init(handle, &config);
224   if (RAIL_STATUS_NO_ERROR == status) {
225     switch (protocol) {
226       case SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_915MHZ:
227         status = RAIL_IEEE802154_ConfigGB915MHzRadio(handle);
228         break;
229       case SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_863MHZ:
230         status = RAIL_IEEE802154_ConfigGB863MHzRadio(handle);
231         break;
232       default:
233         status = RAIL_STATUS_INVALID_PARAMETER;
234         break;
235     }
236   }
237   if (RAIL_STATUS_NO_ERROR != status) {
238     (void) RAIL_IEEE802154_Deinit(handle);
239   } else {
240     (void) RAIL_SetPtiProtocol(handle, RAIL_PTI_PROTOCOL_802154);
241   }
242   return status;
243 }
244 #endif // RAIL_FEAT_SUBGIG_RADIO
245 
246 #if RAIL_SUPPORTS_SUBGHZ_BAND && SL_RAIL_UTIL_PROTOCOL_ZWAVE_ENABLE
sl_rail_util_protocol_config_zwave(RAIL_Handle_t handle,sl_rail_util_protocol_type_t protocol)247 static RAIL_Status_t sl_rail_util_protocol_config_zwave(RAIL_Handle_t handle,
248                                                         sl_rail_util_protocol_type_t protocol)
249 {
250   RAIL_Status_t status;
251   RAIL_ZWAVE_Config_t config = {
252     .options = 0U // enable appropriate mask bits
253                | (SL_RAIL_UTIL_PROTOCOL_ZWAVE_PROMISCUOUS_MODE_ENABLE
254                   ? RAIL_ZWAVE_OPTION_PROMISCUOUS_MODE : 0U)
255                | (SL_RAIL_UTIL_PROTOCOL_ZWAVE_DETECT_BEAM_FRAME_ENABLE
256                   ? RAIL_ZWAVE_OPTION_DETECT_BEAM_FRAMES : 0U)
257                | (SL_RAIL_UTIL_PROTOCOL_ZWAVE_NODE_ID_FILTERING_ENABLE
258                   ? RAIL_ZWAVE_OPTION_NODE_ID_FILTERING : 0U)
259                | (SL_RAIL_UTIL_PROTOCOL_ZWAVE_PROMISCUOUS_BEAM_MODE_ENABLE
260                   ? RAIL_ZWAVE_OPTION_PROMISCUOUS_BEAM_MODE : 0U),
261     .ackConfig = {
262       .enable = SL_RAIL_UTIL_PROTOCOL_ZWAVE_AUTO_ACK_ENABLE,
263       .ackTimeout = SL_RAIL_UTIL_PROTOCOL_ZWAVE_AUTO_ACK_TIMEOUT_US,
264       .rxTransitions = {
265         .success = SL_RAIL_UTIL_PROTOCOL_ZWAVE_AUTO_ACK_RX_TRANSITION_STATE,
266         .error = RAIL_RF_STATE_IDLE // this parameter ignored
267       },
268       .txTransitions = {
269         .success = SL_RAIL_UTIL_PROTOCOL_ZWAVE_AUTO_ACK_TX_TRANSITION_STATE,
270         .error = RAIL_RF_STATE_IDLE // this parameter ignored
271       }
272     },
273     .timings = {
274       .idleToTx = SL_RAIL_UTIL_PROTOCOL_ZWAVE_TIMING_IDLE_TO_TX_US,
275       .idleToRx = SL_RAIL_UTIL_PROTOCOL_ZWAVE_TIMING_IDLE_TO_RX_US,
276       .rxToTx = SL_RAIL_UTIL_PROTOCOL_ZWAVE_TIMING_RX_TO_TX_US,
277       // Make txToRx slightly lower than desired to make sure we get to
278       // RX in time.
279       .txToRx = SL_RAIL_UTIL_PROTOCOL_ZWAVE_TIMING_TX_TO_RX_US,
280       .rxSearchTimeout = SL_RAIL_UTIL_PROTOCOL_ZWAVE_TIMING_RX_SEARCH_TIMEOUT_AFTER_IDLE_ENABLE
281                          ? SL_RAIL_UTIL_PROTOCOL_ZWAVE_TIMING_RX_SEARCH_TIMEOUT_AFTER_IDLE_US
282                          : 0,
283       .txToRxSearchTimeout = SL_RAIL_UTIL_PROTOCOL_ZWAVE_TIMING_RX_SEARCH_TIMEOUT_AFTER_TX_ENABLE
284                              ? SL_RAIL_UTIL_PROTOCOL_ZWAVE_TIMING_RX_SEARCH_TIMEOUT_AFTER_TX_US
285                              : 0
286     }
287   };
288   status = RAIL_ZWAVE_Init(handle, &config);
289   if (RAIL_STATUS_NO_ERROR == status) {
290     switch (protocol) {
291       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_ANZ: // Australia
292         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_ANZ);
293         break;
294       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_CN: // China
295         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_CN);
296         break;
297       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_EU: // European Union
298         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_EU);
299         break;
300       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_HK: // Hong Kong
301         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_HK);
302         break;
303       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_IN: // India
304         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_IN);
305         break;
306       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_IL: // Israel
307         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_IL);
308         break;
309       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_JP: // Japan
310         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_JP);
311         break;
312       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_KR: // Korea
313         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_KR);
314         break;
315       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_MY: // Malaysia
316         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_MY);
317         break;
318       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_RU: // Russia
319         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_RU);
320         break;
321       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_US: // United States
322         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_US);
323         break;
324       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_US_LR1: // US, Long Range 1
325         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_US_LR1);
326         break;
327       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_US_LR2: // US, Long Range 2
328         status = RAIL_ZWAVE_ConfigRegion(handle, &RAIL_ZWAVE_REGION_US_LR2);
329         break;
330       case SL_RAIL_UTIL_PROTOCOL_ZWAVE_US_LR_END_DEVICE: // US, LR End Device
331         status = RAIL_ZWAVE_ConfigRegion(handle,
332                                          &RAIL_ZWAVE_REGION_US_LR_END_DEVICE);
333         break;
334       default:
335         status = RAIL_STATUS_INVALID_PARAMETER;
336         break;
337     }
338   }
339   if (RAIL_STATUS_NO_ERROR == status) {
340     status = RAIL_ZWAVE_SetNodeId(handle, RAIL_ZWAVE_NODE_ID_DEFAULT);
341   }
342   if (RAIL_STATUS_NO_ERROR != status) {
343     (void) RAIL_ZWAVE_Deinit(handle);
344   }
345   return status;
346 }
347 #endif // RAIL_FEAT_SUBGIG_RADIO
348 
sl_rail_util_protocol_config(RAIL_Handle_t handle,sl_rail_util_protocol_type_t protocol)349 RAIL_Status_t sl_rail_util_protocol_config(RAIL_Handle_t handle,
350                                            sl_rail_util_protocol_type_t protocol)
351 {
352   switch (protocol) {
353     case SL_RAIL_UTIL_PROTOCOL_PROPRIETARY:
354       return sl_rail_util_protocol_config_proprietary(handle);
355 #if RAIL_SUPPORTS_2P4GHZ_BAND && SL_RAIL_UTIL_PROTOCOL_BLE_ENABLE
356     case SL_RAIL_UTIL_PROTOCOL_BLE_1MBPS:
357     case SL_RAIL_UTIL_PROTOCOL_BLE_2MBPS:
358     case SL_RAIL_UTIL_PROTOCOL_BLE_CODED_125KBPS:
359     case SL_RAIL_UTIL_PROTOCOL_BLE_CODED_500KBPS:
360     case SL_RAIL_UTIL_PROTOCOL_BLE_QUUPPA_1MBPS:
361       return sl_rail_util_protocol_config_ble(handle, protocol);
362 #if RAIL_SUPPORTS_IEEE802154_BAND_2P4  && SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ENABLE
363     case SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ:
364     case SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ANTDIV:
365     case SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_COEX:
366     case SL_RAIL_UTIL_PROTOCOL_IEEE802154_2P4GHZ_ANTDIV_COEX:
367       return sl_rail_util_protocol_config_ieee802154_2p4ghz(handle, protocol);
368 #endif
369 #endif
370 #if RAIL_SUPPORTS_SUBGHZ_BAND && SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_ENABLE
371     case SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_915MHZ:
372     case SL_RAIL_UTIL_PROTOCOL_IEEE802154_GB868_863MHZ:
373       return sl_rail_util_protocol_config_ieee802154_gb868(handle, protocol);
374 #endif
375 #if RAIL_SUPPORTS_SUBGHZ_BAND && SL_RAIL_UTIL_PROTOCOL_ZWAVE_ENABLE
376     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_ANZ: // Australia
377     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_CN: // China
378     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_EU: // European Union
379     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_HK: // Hong Kong
380     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_IN: // India
381     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_IL: // Israel
382     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_JP: // Japan
383     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_KR: // Korea
384     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_MY: // Malaysia
385     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_RU: // Russia
386     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_US: // United States
387     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_US_LR1: // United States, Long Range 1
388     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_US_LR2: // United States, Long Range 2
389     case SL_RAIL_UTIL_PROTOCOL_ZWAVE_US_LR_END_DEVICE: // US, LR End Device
390       return sl_rail_util_protocol_config_zwave(handle, protocol);
391 #endif
392     default:
393       return RAIL_STATUS_INVALID_PARAMETER;
394   }
395 }
396