1 /***************************************************************************//**
2  * @file
3  * @brief The Z-Wave specific header file for the RAIL library.
4  *******************************************************************************
5  * # License
6  * <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
7  *******************************************************************************
8  *
9  * SPDX-License-Identifier: Zlib
10  *
11  * The licensor of this software is Silicon Laboratories Inc.
12  *
13  * This software is provided 'as-is', without any express or implied
14  * warranty. In no event will the authors be held liable for any damages
15  * arising from the use of this software.
16  *
17  * Permission is granted to anyone to use this software for any purpose,
18  * including commercial applications, and to alter it and redistribute it
19  * freely, subject to the following restrictions:
20  *
21  * 1. The origin of this software must not be misrepresented; you must not
22  *    claim that you wrote the original software. If you use this software
23  *    in a product, an acknowledgment in the product documentation would be
24  *    appreciated but is not required.
25  * 2. Altered source versions must be plainly marked as such, and must not be
26  *    misrepresented as being the original software.
27  * 3. This notice may not be removed or altered from any source distribution.
28  *
29  ******************************************************************************/
30 
31 #ifndef __RAIL_ZWAVE_H__
32 #define __RAIL_ZWAVE_H__
33 
34 #include "rail_types.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /// @addtogroup Z_Wave Z-Wave
41 /// @ingroup Protocol_Specific
42 /// @brief Z-Wave configuration routines
43 ///
44 /// The functions in this group configure RAIL Z-Wave hardware
45 /// acceleration features.
46 ///
47 /// To configure Z-Wave functionality, the application must first set up
48 /// a RAIL instance with \ref RAIL_Init() and other setup functions.
49 /// @code{.c}
50 /// RAIL_ZWAVE_NodeId_t gRecentBeamNodeId;
51 /// uint8_t gRecentBeamChannelIndex;
52 ///
53 /// // Main RAIL_EVENT callback
54 /// static void RAILCb_Event(RAIL_Handle_t railHandle, RAIL_Events_t events)
55 /// {
56 ///   // Get beam Node Id and channel index from beam packet
57 ///   if (events & RAIL_EVENT_ZWAVE_BEAM) {
58 ///     if (RAIL_ZWAVE_IsEnabled(railHandle)) {
59 ///       if ((RAIL_ZWAVE_GetBeamNodeId(railHandle, &gRecentBeamNodeId)
60 ///            != RAIL_STATUS_NO_ERROR)
61 ///           || (RAIL_ZWAVE_GetBeamChannelIndex(railHandle, &gRecentBeamChannelIndex)
62 ///               != RAIL_STATUS_NO_ERROR)) {
63 ///         return;
64 ///       }
65 ///     }
66 ///   }
67 /// }
68 ///
69 /// static const RAIL_ZWAVE_Config_t zwaveConfig = {
70 ///   .options = RAIL_ZWAVE_OPTIONS_DEFAULT
71 /// };
72 ///
73 /// RAIL_Status_t zwaveInit(void)
74 /// {
75 ///   // initialize Z-Wave
76 ///   RAIL_Status_t status = RAIL_ZWAVE_Init(railHandle, &zwaveConfig);
77 ///
78 ///   if (status != RAIL_STATUS_NO_ERROR) {
79 ///     return status;
80 ///   }
81 ///
82 ///   uint8_t myHomeId[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
83 ///   RAIL_ZWAVE_SetNodeId(railHandle, RAIL_ZWAVE_NODE_ID_DEFAULT);
84 ///   RAIL_ZWAVE_SetHomeId(railHandle, myHomeId, RAIL_ZWAVE_HOME_ID_HASH_DONT_CARE);
85 ///
86 ///   // configure region to EU(European Union)
87 ///   return RAIL_ZWAVE_ConfigRegion(railHandle, RAIL_ZWAVE_REGION_EU);
88 /// }
89 /// @endcode
90 ///
91 /// @{
92 
93 /**
94  * @enum RAIL_ZWAVE_Options_t
95  * @brief Z-Wave options.
96  */
RAIL_ENUM_GENERIC(RAIL_ZWAVE_Options_t,uint32_t)97 RAIL_ENUM_GENERIC(RAIL_ZWAVE_Options_t, uint32_t) {
98   /** Shift position of \ref RAIL_ZWAVE_OPTION_PROMISCUOUS_MODE bit. */
99   RAIL_ZWAVE_OPTION_PROMISCUOUS_MODE_SHIFT = 0,
100   /** Shift position of \ref RAIL_ZWAVE_OPTION_DETECT_BEAM_FRAMES bit. */
101   RAIL_ZWAVE_OPTION_DETECT_BEAM_FRAMES_SHIFT = 1,
102   /** Shift position of \ref RAIL_ZWAVE_OPTION_NODE_ID_FILTERING bit. */
103   RAIL_ZWAVE_OPTION_NODE_ID_FILTERING_SHIFT = 2,
104   /** Shift position of \ref RAIL_ZWAVE_OPTION_PROMISCUOUS_BEAM_MODE bit. */
105   RAIL_ZWAVE_OPTION_PROMISCUOUS_BEAM_MODE_SHIFT = 3,
106 };
107 
108 /** A value representing no options */
109 #define RAIL_ZWAVE_OPTIONS_NONE 0U
110 
111 /** All options are disabled by default. */
112 #define RAIL_ZWAVE_OPTIONS_DEFAULT RAIL_ZWAVE_OPTIONS_NONE
113 
114 /**
115  * An option to configure promiscuous mode, accepting non-beam packets
116  * regardless of their Home Id. By default packets are filtered by their Home Id.
117  * When true, such filtering is disabled.
118  */
119 #define RAIL_ZWAVE_OPTION_PROMISCUOUS_MODE \
120   (1u << RAIL_ZWAVE_OPTION_PROMISCUOUS_MODE_SHIFT)
121 
122 /**
123  * An option to filter non-beam packets based on their Node Id when
124  * \ref RAIL_ZWAVE_OPTION_PROMISCUOUS_MODE is disabled.
125  *
126  * @note This option has no effect when
127  *   \ref RAIL_ZWAVE_OPTION_PROMISCUOUS_MODE is enabled.
128  */
129 #define RAIL_ZWAVE_OPTION_NODE_ID_FILTERING \
130   (1u << RAIL_ZWAVE_OPTION_NODE_ID_FILTERING_SHIFT)
131 
132 /**
133  * An option to configure beam frame recognition. By default beams are not
134  * considered special and will be received as if they were normal Z-Wave
135  * frames, assuredly triggering \ref RAIL_EVENT_RX_FRAME_ERROR.
136  * When true, beam frames that are broadcast or match the Node Id and
137  * Home Id hash values will trigger \ref RAIL_EVENT_ZWAVE_BEAM event.
138  * (All beams additionally trigger \ref RAIL_EVENT_RX_PACKET_ABORTED
139  * regardless of Node Id / Home Id hash values.)
140  *
141  * @note This option takes precedence over \ref
142  *   RAIL_ZWAVE_OPTION_PROMISCUOUS_MODE when receiving a beam frame.
143  *   For promiscuous beam handling see related
144  *   \ref RAIL_ZWAVE_OPTION_PROMISCUOUS_BEAM_MODE option.
145  */
146 #define RAIL_ZWAVE_OPTION_DETECT_BEAM_FRAMES \
147   (1u << RAIL_ZWAVE_OPTION_DETECT_BEAM_FRAMES_SHIFT)
148 
149 /**
150  * An option to receive all beams promiscuously when \ref
151  * RAIL_ZWAVE_OPTION_DETECT_BEAM_FRAMES is enabled.
152  * When true, beam frames are received regardless of their Node Id or Home Id hash
153  * resulting in \ref RAIL_EVENT_ZWAVE_BEAM (and also \ref
154  * RAIL_EVENT_RX_PACKET_ABORTED) for each beam frame.
155  *
156  * @note This option has no effect when
157  *   \ref RAIL_ZWAVE_OPTION_DETECT_BEAM_FRAMES is disabled.
158  */
159 #define RAIL_ZWAVE_OPTION_PROMISCUOUS_BEAM_MODE \
160   (1u << RAIL_ZWAVE_OPTION_PROMISCUOUS_BEAM_MODE_SHIFT)
161 
162 /** A value representing all options */
163 #define RAIL_ZWAVE_OPTIONS_ALL 0xFFFFFFFFU
164 
165 /**
166  * @enum RAIL_ZWAVE_NodeId_t
167  * @brief A Z-Wave Node Id.
168  *
169  * This data type is 12 bits wide when using the ZWave Long Range PHY, and
170  * 8 bits wide otherwise.
171  *
172  * @note When using the Long Range PHY, values 0xFA1..0xFFE are reserved.
173  *   Otherwise, values 0xE9..0xFE are reserved.
174  */
RAIL_ENUM_GENERIC(RAIL_ZWAVE_NodeId_t,uint16_t)175 RAIL_ENUM_GENERIC(RAIL_ZWAVE_NodeId_t, uint16_t) {
176   /** The unknown Node Id for uninitialized nodes. */
177   RAIL_ZWAVE_NODE_ID_NONE = 0x00U,
178   /** The broadcast Node Id. */
179   RAIL_ZWAVE_NODE_ID_BROADCAST = 0xFFU,
180   /** Default to the broadcast Node Id. */
181   RAIL_ZWAVE_NODE_ID_DEFAULT = RAIL_ZWAVE_NODE_ID_BROADCAST,
182   // All other values between 0x00 and 0xFE are valid Node Ids normally
183   /** The Long Range broadcast Node Id. */
184   RAIL_ZWAVE_NODE_ID_BROADCAST_LONGRANGE = 0xFFFU,
185   /** Default to the Long Range broadcast Node Id. */
186   RAIL_ZWAVE_NODE_ID_DEFAULT_LONGRANGE = RAIL_ZWAVE_NODE_ID_BROADCAST_LONGRANGE,
187   // All values from 0x001 to 0xFA1 are valid Node Ids with a Long Range PHY.
188 };
189 
190 #ifndef DOXYGEN_SHOULD_SKIP_THIS
191 // Self-referencing defines minimize compiler complaints when using RAIL_ENUM
192 #define RAIL_ZWAVE_NODE_ID_NONE                ((RAIL_ZWAVE_NodeId_t) RAIL_ZWAVE_NODE_ID_NONE)
193 #define RAIL_ZWAVE_NODE_ID_BROADCAST           ((RAIL_ZWAVE_NodeId_t) RAIL_ZWAVE_NODE_ID_BROADCAST)
194 #define RAIL_ZWAVE_NODE_ID_DEFAULT             ((RAIL_ZWAVE_NodeId_t) RAIL_ZWAVE_NODE_ID_DEFAULT)
195 #define RAIL_ZWAVE_NODE_ID_BROADCAST_LONGRANGE ((RAIL_ZWAVE_NodeId_t) RAIL_ZWAVE_NODE_ID_BROADCAST_LONGRANGE)
196 #define RAIL_ZWAVE_NODE_ID_DEFAULT_LONGRANGE   ((RAIL_ZWAVE_NodeId_t) RAIL_ZWAVE_NODE_ID_DEFAULT_LONGRANGE)
197 #endif //DOXYGEN_SHOULD_SKIP_THIS
198 
199 #ifndef DOXYGEN_SHOULD_SKIP_THIS
200 /** Defines for \ref RAIL_RxPacketDetails_t::subPhyId field. */
201 #define RAIL_ZWAVE_RX_SUBPHY_ID_0     (0U)
202 #define RAIL_ZWAVE_RX_SUBPHY_ID_1     (1U)
203 #define RAIL_ZWAVE_RX_SUBPHY_ID_2     (2U)
204 #define RAIL_ZWAVE_RX_SUBPHY_ID_3     (3U)
205 #endif //DOXYGEN_SHOULD_SKIP_THIS
206 
207 /**
208  * @enum RAIL_ZWAVE_HomeId_t
209  * @brief A Z-Wave Home Id.
210  *
211  * @note Home Ids in the range 0x54000000..0x55FFFFFF are illegal.
212  */
RAIL_ENUM_GENERIC(RAIL_ZWAVE_HomeId_t,uint32_t)213 RAIL_ENUM_GENERIC(RAIL_ZWAVE_HomeId_t, uint32_t) {
214   /** The unknown Home Id. */
215   RAIL_ZWAVE_HOME_ID_UNKNOWN = 0x00000000U,
216   /** An impossible and unlikely Home Id. */
217   RAIL_ZWAVE_HOME_ID_DEFAULT = 0x54545454U,
218 };
219 
220 #ifndef DOXYGEN_SHOULD_SKIP_THIS
221 // Self-referencing defines minimize compiler complaints when using RAIL_ENUM
222 #define RAIL_ZWAVE_HOME_ID_UNKNOWN ((RAIL_ZWAVE_HomeId_t) RAIL_ZWAVE_HOME_ID_UNKNOWN)
223 #define RAIL_ZWAVE_HOME_ID_DEFAULT ((RAIL_ZWAVE_HomeId_t) RAIL_ZWAVE_HOME_ID_DEFAULT)
224 #endif //DOXYGEN_SHOULD_SKIP_THIS
225 
226 /**
227  * @enum RAIL_ZWAVE_HomeIdHash_t
228  * @brief A Z-Wave Home Id hash.
229  *
230  * @note Certain values (as shown) are illegal.
231  */
RAIL_ENUM(RAIL_ZWAVE_HomeIdHash_t)232 RAIL_ENUM(RAIL_ZWAVE_HomeIdHash_t) {
233   /** An illegal Home Id hash value. */
234   RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_1 = 0x0AU,
235   /** An illegal Home Id hash value. */
236   RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_2 = 0x4AU,
237   /** An illegal Home Id hash value. */
238   RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_3 = 0x55U,
239   /**
240    * Illegal Home Id hash value that suppresses checking the
241    * Home Id hash field of beam packets.
242    */
243   RAIL_ZWAVE_HOME_ID_HASH_DONT_CARE = 0x55U,
244   /** Default to don't care. */
245   RAIL_ZWAVE_HOME_ID_HASH_DEFAULT = RAIL_ZWAVE_HOME_ID_HASH_DONT_CARE,
246 };
247 
248 #ifndef DOXYGEN_SHOULD_SKIP_THIS
249 // Self-referencing defines minimize compiler complaints when using RAIL_ENUM
250 #define RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_1 ((RAIL_ZWAVE_HomeIdHash_t) RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_1)
251 #define RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_2 ((RAIL_ZWAVE_HomeIdHash_t) RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_2)
252 #define RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_3 ((RAIL_ZWAVE_HomeIdHash_t) RAIL_ZWAVE_HOME_ID_HASH_ILLEGAL_3)
253 #define RAIL_ZWAVE_HOME_ID_HASH_DONT_CARE ((RAIL_ZWAVE_HomeIdHash_t) RAIL_ZWAVE_HOME_ID_HASH_DONT_CARE)
254 #define RAIL_ZWAVE_HOME_ID_HASH_DEFAULT   ((RAIL_ZWAVE_HomeIdHash_t) RAIL_ZWAVE_HOME_ID_HASH_DEFAULT)
255 #endif //DOXYGEN_SHOULD_SKIP_THIS
256 
257 /**
258  * @struct RAIL_ZWAVE_Config_t
259  * @brief A configuration structure for Z-Wave in RAIL.
260  */
261 typedef struct RAIL_ZWAVE_Config {
262   /**
263    * Defines Z-Wave options.
264    */
265   RAIL_ZWAVE_Options_t options;
266   /**
267    * Defines Z-Wave Acking configuration.
268    */
269   RAIL_AutoAckConfig_t ackConfig;
270   /**
271    * Defines state timings for Z-Wave.
272    */
273   RAIL_StateTiming_t timings;
274 } RAIL_ZWAVE_Config_t;
275 
276 /**
277  * @enum RAIL_ZWAVE_Baud_t
278  * @brief Z-Wave supported baud rates or PHYs.
279  */
RAIL_ENUM(RAIL_ZWAVE_Baud_t)280 RAIL_ENUM(RAIL_ZWAVE_Baud_t) {
281   /** 9.6 kbps baud rate. */
282   RAIL_ZWAVE_BAUD_9600,
283   /** 40 kbps baud rate. */
284   RAIL_ZWAVE_BAUD_40K,
285   /** 100 kbps baud rate. */
286   RAIL_ZWAVE_BAUD_100K,
287   /** Long Range PHY. */
288   RAIL_ZWAVE_LR,
289   /** Energy detection PHY. */
290   RAIL_ZWAVE_ENERGY_DETECT = RAIL_ZWAVE_LR,
291   /** Sentinel value for invalid baud rate. Must be last. */
292   RAIL_ZWAVE_BAUD_INVALID
293 };
294 
295 #ifndef DOXYGEN_SHOULD_SKIP_THIS
296 // Self-referencing defines minimize compiler complaints when using RAIL_ENUM
297 #define RAIL_ZWAVE_BAUD_9600     ((RAIL_ZWAVE_Baud_t) RAIL_ZWAVE_BAUD_9600)
298 #define RAIL_ZWAVE_BAUD_40K      ((RAIL_ZWAVE_Baud_t) RAIL_ZWAVE_BAUD_40K)
299 #define RAIL_ZWAVE_BAUD_100K     ((RAIL_ZWAVE_Baud_t) RAIL_ZWAVE_BAUD_100K)
300 #define RAIL_ZWAVE_LR            ((RAIL_ZWAVE_Baud_t) RAIL_ZWAVE_LR)
301 #define RAIL_ZWAVE_ENERGY_DETECT ((RAIL_ZWAVE_Baud_t) RAIL_ZWAVE_ENERGY_DETECT)
302 #define RAIL_ZWAVE_INVALID       ((RAIL_ZWAVE_Baud_t) RAIL_ZWAVE_INVALID)
303 #endif //DOXYGEN_SHOULD_SKIP_THIS
304 
305 #ifndef DOXYGEN_SHOULD_SKIP_THIS
306 /**
307  * @enum RAIL_ZWAVE_RegionOptions_t
308  * @brief Region Specific Physical
309  */
310 
RAIL_ENUM(RAIL_ZWAVE_RegionOptions_t)311 RAIL_ENUM(RAIL_ZWAVE_RegionOptions_t) {
312   /** Bit shift for US Long Range 3 */
313   RAIL_ZWAVE_REGION_LONG_RANGE_3_SHIFT = 0,
314   /** Bit shift for special low side config, mostly for Japan and Korea */
315   RAIL_ZWAVE_REGION_LOW_SIDE_SHIFT = 1,
316   /** Bit shift for US long range range configurations */
317   RAIL_ZWAVE_REGION_LONG_RANGE_SHIFT = 2,
318 };
319 
320 /**
321  * RAIL_ZWAVE_RegionOptions_t bitmasks
322  */
323 /** A value representing US Long Range regions  */
324 #define RAIL_ZWAVE_REGION_LONG_RANGE_MASK  (1u << RAIL_ZWAVE_REGION_LONG_RANGE_SHIFT)
325 /** A value representing lowside configurations: JP and KR */
326 #define RAIL_ZWAVE_REGION_LOW_SIDE_MASK (1u << RAIL_ZWAVE_REGION_LOW_SIDE_SHIFT)
327 /** A value representing Long Range 3 (end device) region */
328 #define RAIL_ZWAVE_REGION_LONG_RANGE_3_MASK (1u << RAIL_ZWAVE_REGION_LONG_RANGE_3_SHIFT)
329 /** @deprecated Backwards compatible name. */
330 #define RAIL_ZWAVE_REGION_LONG_RANGE_END_MASK RAIL_ZWAVE_REGION_LONG_RANGE_3_MASK
331 /** A value representing No bit to be enabled */
332 #define RAIL_ZWAVE_REGION_SPECIFIC_NONE 0u
333 #endif // DOXYGEN SHOULD SKIP THIS
334 
335 /**
336  * Sentinel value to indicate that a channel (and thus its frequency)
337  * are invalid.
338  */
339 #define RAIL_ZWAVE_FREQ_INVALID 0xFFFFFFFFUL
340 
341 /**
342  * @enum RAIL_ZWAVE_RegionId_t
343  * @brief Z-Wave region identifications.
344  */
RAIL_ENUM(RAIL_ZWAVE_RegionId_t)345 RAIL_ENUM(RAIL_ZWAVE_RegionId_t) {
346   /** Unknown/Invalid. */
347   RAIL_ZWAVE_REGIONID_UNKNOWN = 0,
348   /** European Union. */
349   RAIL_ZWAVE_REGIONID_EU = 1,
350   /** United States. */
351   RAIL_ZWAVE_REGIONID_US = 2,
352   /** Australia/New Zealand. */
353   RAIL_ZWAVE_REGIONID_ANZ = 3,
354   /** Hong Kong. */
355   RAIL_ZWAVE_REGIONID_HK = 4,
356   /** Malaysia. */
357   RAIL_ZWAVE_REGIONID_MY = 5,
358   /** India. */
359   RAIL_ZWAVE_REGIONID_IN = 6,
360   /** Japan. */
361   RAIL_ZWAVE_REGIONID_JP = 7,
362   /** Russian Federation. */
363   RAIL_ZWAVE_REGIONID_RU = 8,
364   /** Israel. */
365   RAIL_ZWAVE_REGIONID_IL = 9,
366   /** Korea. */
367   RAIL_ZWAVE_REGIONID_KR = 10,
368   /** China. */
369   RAIL_ZWAVE_REGIONID_CN = 11,
370   /** United States, with first long range PHY. */
371   RAIL_ZWAVE_REGIONID_US_LR1 = 12,
372   /** United States, with second long range PHY. */
373   RAIL_ZWAVE_REGIONID_US_LR2 = 13,
374   /** United States, with third long range PHY. */
375   RAIL_ZWAVE_REGIONID_US_LR3 = 14,
376   /** @deprecated Backwards compatible name. */
377   RAIL_ZWAVE_REGIONID_US_LR_END_DEVICE = RAIL_ZWAVE_REGIONID_US_LR3,
378   /** European Union, with first long range PHY. */
379   RAIL_ZWAVE_REGIONID_EU_LR1 = 15,
380   /** European Union, with second long range PHY. */
381   RAIL_ZWAVE_REGIONID_EU_LR2 = 16,
382   /** European Union, with third long range PHY. */
383   RAIL_ZWAVE_REGIONID_EU_LR3 = 17,
384   /** @deprecated Backwards compatible name. */
385   RAIL_ZWAVE_REGIONID_EU_LR_END_DEVICE = RAIL_ZWAVE_REGIONID_EU_LR3,
386   /** Count of known regions. Must be last. */
387   RAIL_ZWAVE_REGIONID_COUNT
388 };
389 
390 #ifndef DOXYGEN_SHOULD_SKIP_THIS
391 // Self-referencing defines minimize compiler complaints when using RAIL_ENUM
392 #define RAIL_ZWAVE_REGIONID_UNKNOWN ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_UNKNOWN)
393 #define RAIL_ZWAVE_REGIONID_EU      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_EU)
394 #define RAIL_ZWAVE_REGIONID_US      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_US)
395 #define RAIL_ZWAVE_REGIONID_ANZ     ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_ANZ)
396 #define RAIL_ZWAVE_REGIONID_HK      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_HK)
397 #define RAIL_ZWAVE_REGIONID_MY      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_MY)
398 #define RAIL_ZWAVE_REGIONID_IN      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_IN)
399 #define RAIL_ZWAVE_REGIONID_JP      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_JP)
400 #define RAIL_ZWAVE_REGIONID_RU      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_RU)
401 #define RAIL_ZWAVE_REGIONID_IL      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_IL)
402 #define RAIL_ZWAVE_REGIONID_KR      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_KR)
403 #define RAIL_ZWAVE_REGIONID_CN      ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_CN)
404 #define RAIL_ZWAVE_REGIONID_US_LR1  ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_US_LR1)
405 #define RAIL_ZWAVE_REGIONID_US_LR2  ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_US_LR2)
406 #define RAIL_ZWAVE_REGIONID_US_LR3  ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_US_LR3)
407 #define RAIL_ZWAVE_REGIONID_US_LR_END_DEVICE ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_US_LR_END_DEVICE)
408 #define RAIL_ZWAVE_REGIONID_EU_LR1  ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_EU_LR1)
409 #define RAIL_ZWAVE_REGIONID_EU_LR2  ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_EU_LR2)
410 #define RAIL_ZWAVE_REGIONID_EU_LR3  ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_EU_LR3)
411 #define RAIL_ZWAVE_REGIONID_EU_LR_END_DEVICE ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_EU_LR_END_DEVICE)
412 #define RAIL_ZWAVE_REGIONID_COUNT   ((RAIL_ZWAVE_RegionId_t) RAIL_ZWAVE_REGIONID_COUNT)
413 #endif //DOXYGEN_SHOULD_SKIP_THIS
414 
415 #ifndef DOXYGEN_SHOULD_SKIP_THIS
416 // Largest Ack timeout period based on
417 // aPhyTurnaroundTimeRxTx (1 ms max)+ (aMacTransferAckTimeTX (168 bits)* (1/data rate))
418 // For slowest Data Rate R1 (19.6 kbit/s)
419 #define RAIL_ZWAVE_MAX_ACK_TIMEOUT_US        (9600U)
420 
421 // Defines for Transition timing
422 #define RAIL_ZWAVE_TIME_IDLE_TO_RX_US        (100U)
423 #define RAIL_ZWAVE_TIME_TX_TO_RX_US          (0U)
424 #define RAIL_ZWAVE_TIME_IDLE_TO_TX_US        (0U)
425 #define RAIL_ZWAVE_TIME_RX_TO_TX_US          (1000U)
426 #endif //DOXYGEN_SHOULD_SKIP_THIS
427 
428 /**
429  * Invalid beam TX power value returned when \ref RAIL_ZWAVE_GetLrBeamTxPower()
430  * is called after receiving a regular non-long-range beam.
431  */
432 #define RAIL_ZWAVE_LR_BEAM_TX_POWER_INVALID  (0xFFU)
433 
434 /**
435  * @struct RAIL_ZWAVE_LrAckData_t
436  * @brief Configuration structure for Z-Wave Long Range Ack.
437  */
438 typedef struct RAIL_ZWAVE_LrAckData {
439   /// Radio noise level measured on the channel the frame is transmitted on.
440   int8_t noiseFloorDbm;
441   /// Transmit power used to transmit the ongoing Z-Wave Long Range Ack.
442   int8_t txPowerDbm;
443   /// Signal strength measured while receiving the Z-Wave Long Range frame.
444   int8_t receiveRssiDbm;
445 } RAIL_ZWAVE_LrAckData_t;
446 
447 /**
448  * @struct RAIL_ZWAVE_BeamRxConfig_t
449  * @brief Configuration structure for Z-Wave beam detection.
450  *
451  * @warning This structure should not be used without direct instruction
452  *   by Silicon Labs. Appropriate defaults for this are built into
453  *   the RAIL library.
454  */
455 typedef struct RAIL_ZWAVE_BeamRxConfig {
456   /// Channel hopping pattern to use for beam detection.
457   RAIL_RxChannelHoppingConfig_t channelHoppingConfig;
458   /// Amount of time to spend trying to receive a beam once detected.
459   /// 100kbps only
460   RAIL_RxDutyCycleConfig_t receiveConfig_100;
461   /// Amount of time to spend trying to receive a beam once detected.
462   /// 40kbps only
463   RAIL_RxDutyCycleConfig_t receiveConfig_40;
464 } RAIL_ZWAVE_BeamRxConfig_t;
465 
466 /**
467  * Number of channels in each of Z-Wave's region-based PHYs.
468  */
469 #define RAIL_NUM_ZWAVE_CHANNELS (4U)
470 
471 /**
472  * @struct RAIL_ZWAVE_RegionConfig_t
473  * @brief Each Z-Wave region supports 3 channels.
474  */
475 typedef struct RAIL_ZWAVE_RegionConfig {
476   /** Channel frequency in hertz. */
477   uint32_t frequency[RAIL_NUM_ZWAVE_CHANNELS];
478   /** The maximum power allowed on the channel, in dBm. */
479   RAIL_TxPower_t maxPower[RAIL_NUM_ZWAVE_CHANNELS];
480   /** Channel baud rate index. */
481   RAIL_ZWAVE_Baud_t baudRate[RAIL_NUM_ZWAVE_CHANNELS];
482   /** Identification number for the region. */
483   RAIL_ZWAVE_RegionId_t regionId;
484   /** Encapsulates region-specific options. */
485   RAIL_ZWAVE_RegionOptions_t regionSpecific;
486 } RAIL_ZWAVE_RegionConfig_t;
487 
488 /**
489  * @struct RAIL_ZWAVE_IrcalVal_t
490  * @brief Structure for Z-Wave Image Rejection Calibration.
491  *
492  * @note Index 0 will hold the low side image rejection calibration value (channel 0),
493  *   while index 1 will hold the high side image rejection value (channel 1).
494  */
495 typedef struct RAIL_ZWAVE_IrcalVal {
496   /** Low side and high side image rejection values. */
497   RAIL_IrCalValues_t imageRejection[2];
498 } RAIL_ZWAVE_IrcalVal_t;
499 
500 /**
501  * @typedef RAIL_RxChannelHoppingParameters_t
502  * @brief Rx channel hopping on-channel time for all Z-Wave channels in a region
503  */
504 typedef RAIL_RxChannelHoppingParameter_t RAIL_RxChannelHoppingParameters_t[RAIL_NUM_ZWAVE_CHANNELS];
505 
506 /**
507  * Switch the Z-Wave region.
508  *
509  * @param[in] railHandle A RAIL instance handle.
510  * @param[in] regionCfg A pointer to a Z-Wave channel configuration for the selected region.
511  * @return Status code indicating success of the function call.
512  *
513  * @note Setting a new Z-Wave Region will default any Low Power values to
514  *   Normal Power values for the region.
515  *   Z-Wave Region configuration must always be followed by a Low Power setup
516  *   in case one desires to have the Low Power Acking functionality.
517  */
518 RAIL_Status_t RAIL_ZWAVE_ConfigRegion(RAIL_Handle_t railHandle,
519                                       const RAIL_ZWAVE_RegionConfig_t *regionCfg);
520 
521 /**
522  * Perform image rejection calibration on all valid channels of a
523  * Z-Wave region.
524  *
525  * @param[in] railHandle A RAIL instance handle.
526  * @param[in,out] pIrCalVals An application-provided pointer of
527  *   type \ref RAIL_ZWAVE_IrcalVal_t. This is populated with image rejection
528  *   calibration values, if not NULL or initialized with
529  *   \ref RAIL_CAL_INVALID_VALUE or if forceIrcal is true.
530  * @param[in] forceIrcal If true, will always perform image rejection calibration
531  *   and not use previously cached values.
532  * @return Status code indicating success of the function call.
533  *
534  * @note This function also calibrates for beam detection and should be
535  *   called before \ref RAIL_ZWAVE_ReceiveBeam() and after the Z-Wave region
536  *   has been configured via \ref RAIL_ZWAVE_ConfigRegion().
537  *   Channel hopping must be disabled otherwise this function will return
538  *   \ref RAIL_STATUS_INVALID_CALL.
539  */
540 RAIL_Status_t RAIL_ZWAVE_PerformIrcal(RAIL_Handle_t railHandle,
541                                       RAIL_ZWAVE_IrcalVal_t *pIrCalVals,
542                                       bool forceIrcal);
543 
544 /**
545  * Initialize RAIL for Z-Wave features.
546  *
547  * @param[in] railHandle A RAIL instance handle.
548  * @param[in] config A pointer to a Z-Wave configuration structure.
549  * @return Status code indicating success of the function call.
550  *
551  * This function is the entry point for working with Z-Wave within
552  * RAIL. It sets up relevant hardware acceleration for Z-Wave-specific
553  * features, such as Home Id filtering and beam packets (as
554  * specified in the configuration) and allows users to select the
555  * relevant Z-Wave region-specific PHY via \ref RAIL_ZWAVE_ConfigRegion().
556  */
557 RAIL_Status_t RAIL_ZWAVE_Init(RAIL_Handle_t railHandle,
558                               const RAIL_ZWAVE_Config_t *config);
559 
560 /**
561  * De-initialize Z-Wave hardware acceleration.
562  *
563  * @param[in] railHandle A RAIL instance handle.
564  * @return Status code indicating success of the function call.
565  *
566  * Disables and resets all Z-Wave hardware acceleration features. This
567  * function should only be called when the radio is idle.
568  */
569 RAIL_Status_t RAIL_ZWAVE_Deinit(RAIL_Handle_t railHandle);
570 
571 /**
572  * Return whether Z-Wave hardware acceleration is currently enabled.
573  *
574  * @param[in] railHandle A RAIL instance handle.
575  * @return true if Z-Wave hardware acceleration was enabled to start with
576  *   and false otherwise.
577  */
578 bool RAIL_ZWAVE_IsEnabled(RAIL_Handle_t railHandle);
579 
580 /**
581  * Configure Z-Wave options.
582  *
583  * @param[in] railHandle A RAIL instance handle.
584  * @param[in] mask A bitmask containing which options should be modified.
585  * @param[in] options A bitmask containing desired configuration settings.
586  *   Bit positions for each option are found in the \ref RAIL_ZWAVE_Options_t.
587  * @return Status code indicating success of the function call.
588  */
589 RAIL_Status_t RAIL_ZWAVE_ConfigOptions(RAIL_Handle_t railHandle,
590                                        RAIL_ZWAVE_Options_t mask,
591                                        RAIL_ZWAVE_Options_t options);
592 
593 /**
594  * Inform RAIL of the Z-Wave node's Node Id for receive filtering.
595  *
596  * @param[in] railHandle A RAIL instance handle.
597  * @param[in] nodeId A Z-Wave Node Id.
598  * @return Status code indicating success of the function call.
599  *
600  * @note Until this API is called, RAIL will assume the Node Id is
601  *   \ref RAIL_ZWAVE_NODE_ID_DEFAULT.
602  */
603 RAIL_Status_t RAIL_ZWAVE_SetNodeId(RAIL_Handle_t railHandle,
604                                    RAIL_ZWAVE_NodeId_t nodeId);
605 
606 /**
607  * Inform RAIL of the Z-Wave node's Home Id and its hash for receive filtering.
608  *
609  * @param[in] railHandle A RAIL instance handle.
610  * @param[in] homeId A Z-Wave Home Id.
611  * @param[in] homeIdHash The hash of the Home Id expected in beam frames.
612  *   If this is \ref RAIL_ZWAVE_HOME_ID_HASH_DONT_CARE, beam frame detection
613  *   will not check the Home Id hash in a received beam frame at all, and
614  *   \ref RAIL_EVENT_ZWAVE_BEAM will trigger based solely on the Node Id
615  *   in the beam frame.
616  * @return Status code indicating success of the function call.
617  *
618  * @note Until this API is called, RAIL will assume the Home Id is an
619  *   illegal one of \ref RAIL_ZWAVE_HOME_ID_DEFAULT, and its hash is \ref
620  *   RAIL_ZWAVE_HOME_ID_HASH_DONT_CARE.
621  */
622 RAIL_Status_t RAIL_ZWAVE_SetHomeId(RAIL_Handle_t railHandle,
623                                    RAIL_ZWAVE_HomeId_t homeId,
624                                    RAIL_ZWAVE_HomeIdHash_t homeIdHash);
625 
626 /**
627  * Get the Node Id of the most recently seen beam frame that triggered
628  * \ref RAIL_EVENT_ZWAVE_BEAM.
629  *
630  * @param[in] railHandle A RAIL instance handle.
631  * @param[out] pNodeId A pointer to \ref RAIL_ZWAVE_NodeId_t to populate.
632  * @return Status code indicating success of the function call.
633  *
634  * @note This is best called while handling the \ref RAIL_EVENT_ZWAVE_BEAM
635  *   event; if multiple beams are received only the most recent beam's NodeId
636  *   is provided.
637  */
638 RAIL_Status_t RAIL_ZWAVE_GetBeamNodeId(RAIL_Handle_t railHandle,
639                                        RAIL_ZWAVE_NodeId_t *pNodeId);
640 
641 /**
642  * Get the Home Id hash of the most recently seen beam frame that triggered
643  * \ref RAIL_EVENT_ZWAVE_BEAM.
644  *
645  * @param[in] railHandle A RAIL instance handle.
646  * @param[out] pBeamHomeIdHash A pointer to \ref RAIL_ZWAVE_HomeIdHash_t to populate.
647  * @return Status code indicating success of the function call.
648  *
649  * @note This is best called while handling the \ref RAIL_EVENT_ZWAVE_BEAM
650  *   event; if multiple beams are received only the most recent beam's Home Id hash
651  *   is provided.
652  */
653 RAIL_Status_t RAIL_ZWAVE_GetBeamHomeIdHash(RAIL_Handle_t railHandle,
654                                            RAIL_ZWAVE_HomeIdHash_t *pBeamHomeIdHash);
655 
656 /**
657  * Get the channel hopping index of the most recently seen beam frame that
658  * triggered \ref RAIL_EVENT_ZWAVE_BEAM.
659  *
660  * @param[in] railHandle A RAIL instance handle.
661  * @param[out] pChannelIndex A pointer to a uint8_t to populate with
662  *   the channel hopping index. If channel-hopping was off at the time
663  *   the beam packet was received, \ref RAIL_CHANNEL_HOPPING_INVALID_INDEX
664  *   is provided.
665  * @return Status code indicating success of the function call.
666  *
667  * @note This is best called while handling the \ref RAIL_EVENT_ZWAVE_BEAM
668  *   event; if multiple beams are received only the most recent beam's
669  *   channel hopping index is provided.
670  */
671 RAIL_Status_t RAIL_ZWAVE_GetBeamChannelIndex(RAIL_Handle_t railHandle,
672                                              uint8_t *pChannelIndex);
673 
674 /**
675  * Get the TX power used by the transmitter of the most recently seen
676  * long range beam frame that triggered \ref RAIL_EVENT_ZWAVE_BEAM.
677  *
678  * @param[in] railHandle A RAIL instance handle.
679  * @param[out] pLrBeamTxPower An application provided pointer to a uint8_t to
680  *   be populated with the TX power of the latest long range beam. This will
681  *   be set to \ref RAIL_ZWAVE_LR_BEAM_TX_POWER_INVALID if this API is called
682  *   after receiving a regular non-long-range beam.
683  * @return Status code indicating success of the function call. This function
684  *   will return \ref RAIL_STATUS_INVALID_STATE if called after receiving a
685  *   regular (non-long-range) beam.
686  *
687  * @note This is best called while handling the \ref RAIL_EVENT_ZWAVE_BEAM
688  *   event; if multiple beams are received only the most recent long range
689  *   beam's TX power is provided.
690  *
691  * @note The following table shows long range beam TX power value to dBm
692  *   value mapping:
693  *
694  * <table>
695  * <tr><th>Tx Power Value <th>Description
696  * <tr><td>0 <td>-6 dBm
697  * <tr><td>1 <td>-2 dBm
698  * <tr><td>2 <td>+2 dBm
699  * <tr><td>3 <td>+6 dBm
700  * <tr><td>4 <td>+10 dBm
701  * <tr><td>5 <td>+13 dBm
702  * <tr><td>6 <td>+16 dBm
703  * <tr><td>7 <td>+19 dBm
704  * <tr><td>8 <td>+21 dBm
705  * <tr><td>9 <td>+23 dBm
706  * <tr><td>10 <td>+25 dBm
707  * <tr><td>11 <td>+26 dBm
708  * <tr><td>12 <td>+27 dBm
709  * <tr><td>13 <td>+28 dBm
710  * <tr><td>14 <td>+29 dBm
711  * <tr><td>15 <td>+30 dBm
712  * </table>
713  */
714 RAIL_Status_t RAIL_ZWAVE_GetLrBeamTxPower(RAIL_Handle_t railHandle,
715                                           uint8_t *pLrBeamTxPower);
716 
717 /**
718  * Get the RSSI of the received beam frame.
719  *
720  * @param[in] railHandle A RAIL instance handle.
721  * @param[out] pBeamRssi An application provided pointer to a int8_t to
722  *   be populated with the latest beam's RSSI, in dBm.
723  * @return Status code indicating success of the function call. This function
724  *  will return \ref RAIL_STATUS_INVALID_STATE if called without ever
725  *  having received a beam.
726  *
727  * @note This is best called while handling the \ref RAIL_EVENT_ZWAVE_BEAM
728  *   event; if multiple beams are received only the most recent beam's
729  *   RSSI is provided.
730  */
731 RAIL_Status_t RAIL_ZWAVE_GetBeamRssi(RAIL_Handle_t railHandle,
732                                      int8_t *pBeamRssi);
733 
734 /**
735  * Set the Raw Low Power settings.
736  *
737  * @param[in] railHandle A RAIL instance handle.
738  * @param[in] powerLevel Desired low power raw level.
739  * @return Status code indicating success of the function call.
740  *
741  * Low Power settings are required during Ack transmissions when
742  * the Low Power Bit is set. This setting is only valid for one
743  * subsequent transmission, after which all transmissions will be
744  * at the nominal power setting, until re-invoked.
745  */
746 RAIL_Status_t RAIL_ZWAVE_SetTxLowPower(RAIL_Handle_t railHandle,
747                                        uint8_t powerLevel);
748 
749 /**
750  * Set the Low Power settings in deci-dBm.
751  *
752  * @param[in] railHandle A RAIL instance handle.
753  * @param[in] powerLevel Desired low power level deci-dBm.
754  * @return Status code indicating success of the function call.
755  *
756  * Low Power settings are required during Ack transmissions when
757  * the Low Power Bit is set. This setting is only valid for one
758  * subsequent transmission, after which all transmissions will be
759  * at the nominal power setting, until re-invoked.
760  */
761 RAIL_Status_t RAIL_ZWAVE_SetTxLowPowerDbm(RAIL_Handle_t railHandle,
762                                           RAIL_TxPower_t powerLevel);
763 
764 /**
765  * Get the TX low power in raw units (see \ref rail_chip_specific.h for
766  * value ranges).
767  *
768  * @param[in] railHandle A RAIL instance handle.
769  * @return The chip-specific \ref RAIL_TxPowerLevel_t raw value of the low
770  *   transmit power.
771  *
772  * This API returns the low raw power value that was set by
773  * \ref RAIL_ZWAVE_SetTxLowPower().
774  *
775  * Calling this function before configuring the Low Power PA
776  * (i.e., before a successful
777  * call to \ref RAIL_ZWAVE_SetTxLowPowerDbm() or \ref RAIL_ZWAVE_SetTxLowPower())
778  * will return a low power value that is the same as the nominal power.
779  * Also, calling this function before configuring the PA
780  * (i.e., before a successful call to \ref RAIL_ConfigTxPower()) will return
781  * \ref RAIL_TX_POWER_LEVEL_INVALID.
782  */
783 RAIL_TxPowerLevel_t RAIL_ZWAVE_GetTxLowPower(RAIL_Handle_t railHandle);
784 
785 /**
786  * Get the TX low power in terms of deci-dBm instead of raw power level.
787  *
788  * @param[in] railHandle A RAIL instance handle.
789  * @return The chip-specific \ref RAIL_TxPower_t value of the low
790  *   transmit power in deci-dBm.
791  */
792 RAIL_TxPower_t RAIL_ZWAVE_GetTxLowPowerDbm(RAIL_Handle_t railHandle);
793 
794 /**
795  * Implement beam detection and reception algorithms.
796  *
797  * @param[in] railHandle A RAIL instance handle.
798  * @param[out] beamDetectIndex A pointer to an indicator of whether or not a beam was detected
799  *   at all, regardless of if it was received, generally for use only by instruction
800  *   from Silicon Labs. Can be NULL.
801  * @param[in] schedulerInfo A pointer to information to allow the radio scheduler to place
802  *   this operation appropriately. This is only used in multiprotocol version of
803  *   RAIL and may be set to NULL in all other versions.
804  *   Note that Z-Wave currently does not support multiprotocol, so this
805  *   scheduler info exists to future proof the API for when it does.
806  * @return Status code indicating success of the function call.
807  *   Reasons for failure include an un-idled radio or a non-Japan non-Korea
808  *   region configured before calling this function.
809  *
810  * This function takes care of all configuration and radio setup to
811  * detect and receive beams in the current Z-Wave region.
812  * If a beam is detected, RAIL will provide
813  * the usual \ref RAIL_EVENT_ZWAVE_BEAM event during which time users can
814  * process the beam as expected. However, normal packets may also be
815  * received during this time (also triggering \ref RAIL_EVENTS_RX_COMPLETION
816  * events), in which case, this API may need to be re-called to receive
817  * a beam. Users should also listen for
818  * \ref RAIL_EVENT_RX_CHANNEL_HOPPING_COMPLETE, which will indicate
819  * that no beam is heard. At that point, the radio will be automatically idled.
820  * Until one of these events is received, users should not try to
821  * reconfigure radio settings or start another radio operation. If an application
822  * needs to do some other operation or configuration, it must first call
823  * \ref RAIL_Idle() and wait for the radio to idle.
824  *
825  * @note: The radio must be idle before calling this function.
826  *
827  * @note: \ref RAIL_ConfigRxChannelHopping() must have been called successfully
828  *   in Z-Wave before this function is called to provide a valid memory buffer
829  *   for internal use (see \ref RAIL_RxChannelHoppingConfig_t::buffer).
830  *
831  * @note: This function alters radio functionality substantially. After calling
832  *   it, the user should call \ref RAIL_ZWAVE_ConfigRegion(),
833  *   \ref RAIL_ConfigRxChannelHopping(), \ref RAIL_EnableRxChannelHopping(),
834  *   and \ref RAIL_SetRxTransitions() to reset these parameters to whatever
835  *   behaviors were desired before calling this function. Additionally,
836  *   this function will idle the radio upon on exit.
837  */
838 RAIL_Status_t RAIL_ZWAVE_ReceiveBeam(RAIL_Handle_t railHandle,
839                                      uint8_t *beamDetectIndex,
840                                      const RAIL_SchedulerInfo_t *schedulerInfo);
841 
842 /**
843  * Configure the receive algorithm used in \ref RAIL_ZWAVE_ReceiveBeam().
844  *
845  * @param[in] railHandle A RAIL instance handle.
846  * @param[in] config A pointer to a configuration for the beam detection algorithm.
847  * @return Status code indicating success of the function call.
848  *
849  * @warning This function should not be used without direct instruction by Silicon Labs.
850  */
851 RAIL_Status_t RAIL_ZWAVE_ConfigBeamRx(RAIL_Handle_t railHandle,
852                                       RAIL_ZWAVE_BeamRxConfig_t *config);
853 
854 /**
855  * Set the default RX beam configuration.
856  *
857  * @param[in] railHandle A RAIL instance handle.
858  * @return Status code indicating success of the function call.
859  *
860  * @note This function resets any changes made to the beam configuration via
861  *   \ref RAIL_ZWAVE_ConfigBeamRx() and the default beam configuration will be in effect
862  *   on subsequent call(s) to \ref RAIL_ZWAVE_ReceiveBeam().
863  */
864 RAIL_Status_t RAIL_ZWAVE_SetDefaultRxBeamConfig(RAIL_Handle_t railHandle);
865 
866 /**
867  * Get the current RX beam configuration.
868  *
869  * @param[out] pConfig A pointer to \ref RAIL_ZWAVE_BeamRxConfig_t to be
870  *   populated with the current beam configuration.
871  * @return Status code indicating success of the function call.
872  */
873 RAIL_Status_t RAIL_ZWAVE_GetRxBeamConfig(RAIL_ZWAVE_BeamRxConfig_t *pConfig);
874 
875 /**
876  * Configure the channel hop timings for use in Z-Wave RX channel hop configuration.
877  *
878  * @param[in] railHandle A RAIL instance handle.
879  * @param[in,out] config A pointer to a configuration for Z-Wave RX channel hopping.
880  *   This structure must be allocated in application global read-write memory.
881  *   RAIL will populate fields within or referenced by this structure during its
882  *   operation. Be sure to allocate \ref RAIL_RxChannelHoppingConfigEntry_t
883  *   entries[] for \ref RAIL_NUM_ZWAVE_CHANNELS. Be sure to set \ref
884  *   RAIL_RxChannelHoppingConfig_t::numberOfChannels to the desired number of
885  *   channels.
886  * @return Status code indicating success of the function call.
887  *
888  * @warning This function should not be used without direct instruction by Silicon Labs.
889  *
890  * @note: This API must be called before \ref RAIL_EnableRxChannelHopping(). This
891  *   API must never be called while the radio is on with RX Duty Cycle or Channel
892  *   Hopping enabled.
893  */
894 RAIL_Status_t RAIL_ZWAVE_ConfigRxChannelHopping(RAIL_Handle_t railHandle,
895                                                 RAIL_RxChannelHoppingConfig_t *config);
896 
897 /**
898  * Get the Z-Wave region.
899  *
900  * @param[in] railHandle A RAIL instance handle.
901  * @return The \ref RAIL_ZWAVE_RegionId_t value.
902  *
903  * @note \ref RAIL_ZWAVE_ConfigRegion() must have been called successfully
904  *   before this function is called. Otherwise, \ref RAIL_ZWAVE_REGIONID_UNKNOWN
905  *   is returned.
906  */
907 RAIL_ZWAVE_RegionId_t RAIL_ZWAVE_GetRegion(RAIL_Handle_t railHandle);
908 
909 /**
910  * Write the Auto-Ack FIFO for the next outgoing Z-Wave Long Range Ack.
911  *
912  * @param[in] railHandle A RAIL instance handle.
913  * @param[in] pLrAckData An application provided pointer to a const
914  *   \ref RAIL_ZWAVE_LrAckData_t to populate the noise floor, TX power and receive
915  *   rssi bytes of the outgoing Z-Wave Long Range Ack packet.
916  * @return Status code indicating success of the function call.
917  *
918  * This function sets the Auto-Ack data to use in acknowledging the frame
919  * being received. It must only be called while processing the \ref
920  * RAIL_EVENT_ZWAVE_LR_ACK_REQUEST_COMMAND.
921  * This will return \ref RAIL_STATUS_INVALID_STATE if it is too late to
922  * write the outgoing Ack. When successful, the ackData will
923  * only be sent once. Subsequent packets needing an Z-Wave Long Range Ack will
924  * each need to call this function to write the Ack information.
925  */
926 RAIL_Status_t RAIL_ZWAVE_SetLrAckData(RAIL_Handle_t railHandle,
927                                       const RAIL_ZWAVE_LrAckData_t *pLrAckData);
928 
929 /** EU-European Union */
930 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_EU;
931 
932 /** US-United States */
933 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_US;
934 
935 /** ANZ-Australia/New Zealand */
936 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_ANZ;
937 
938 /** HK-Hong Kong */
939 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_HK;
940 
941 /** MY-Malaysia */
942 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_MY;
943 
944 /** IN-India */
945 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_IN;
946 
947 /** JP-Japan */
948 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_JP;
949 
950 /** JP-Japan Energy-Detect */
951 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_JPED;
952 
953 /** RU-Russia */
954 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_RU;
955 
956 /** IL-Israel */
957 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_IL;
958 
959 /** KR-Korea */
960 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_KR;
961 
962 /** KR-Korea Energy-Detect */
963 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_KRED;
964 
965 /** CN-China */
966 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_CN;
967 
968 /** US-Long Range 1 */
969 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_US_LR1;
970 
971 /** US-Long Range 2 */
972 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_US_LR2;
973 
974 /** US-Long Range 3 */
975 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_US_LR3;
976 /** Backwards-compatible define */
977 #define RAIL_ZWAVE_REGION_US_LR_END_DEVICE RAIL_ZWAVE_REGION_US_LR3
978 
979 /** EU-Long Range 1 */
980 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_EU_LR1;
981 
982 /** EU-Long Range 2 */
983 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_EU_LR2;
984 
985 /** EU-Long Range 3 */
986 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_EU_LR3;
987 /** Backwards-compatible define */
988 #define RAIL_ZWAVE_REGION_EU_LR_END_DEVICE RAIL_ZWAVE_REGION_EU_LR3
989 
990 /** Invalid Region */
991 extern const RAIL_ZWAVE_RegionConfig_t RAIL_ZWAVE_REGION_INVALID;
992 
993 /** @} */ // end of Z_Wave
994 
995 #ifdef __cplusplus
996 }
997 #endif
998 
999 #endif // __RAIL_ZWAVE_H__
1000