Mistake on this page?
Report an issue in GitHub or email us
lora_phy_ds.h
Go to the documentation of this file.
1 /**
2  * @file lora_phy_ds.h
3  *
4  * @brief Data structures relating to PHY layer
5  *
6  * \code
7  * ______ _
8  * / _____) _ | |
9  * ( (____ _____ ____ _| |_ _____ ____| |__
10  * \____ \| ___ | (_ _) ___ |/ ___) _ \
11  * _____) ) ____| | | || |_| ____( (___| | | |
12  * (______/|_____)_|_|_| \__)_____)\____)_| |_|
13  * (C)2013 Semtech
14  * ___ _____ _ ___ _ _____ ___ ___ ___ ___
15  * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
16  * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
17  * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
18  * embedded.connectivity.solutions===============
19  *
20  * \endcode
21  *
22  * License: Revised BSD License, see LICENSE.TXT file include in the project
23  *
24  * Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
25  *
26  * Copyright (c) 2017, Arm Limited and affiliates.
27  * SPDX-License-Identifier: BSD-3-Clause
28  *
29  */
30 
31 #ifndef MBED_OS_LORA_PHY_DATASTRUCTURES_
32 #define MBED_OS_LORA_PHY_DATASTRUCTURES_
33 
35 
36 /*!
37  * \brief Returns the minimum value between a and b.
38  *
39  * \param [in] a The first value.
40  * \param [in] b The second value.
41  * \retval minValue The minimum value.
42  */
43 #ifndef MIN
44 #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
45 #endif
46 
47 /*!
48  * \brief Returns the maximum value between a and b
49  *
50  * \param [in] a The first value.
51  * \param [in] b The second value.
52  * \retval maxValue The maximum value.
53  */
54 #ifndef MAX
55 #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
56 #endif
57 
58 /**
59  * LoRaMac maximum number of channels.
60  */
61 #define LORA_MAX_NB_CHANNELS 16
62 
63 /*!
64  * Macro to compute bit of a channel index.
65  */
66 #define LC( channelIndex ) ( uint16_t )( 1 << ( channelIndex - 1 ) )
67 
68 
69 
70 
71 /*!
72  * Region | dBM
73  * ------------ | :-----:
74  * AS923 | Max EIRP
75  * AU915 | Max EIRP
76  * CN470 | Max EIRP
77  * CN779 | Max EIRP
78  * EU433 | Max EIRP
79  * EU868 | Max EIRP
80  * IN865 | Max EIRP
81  * KR920 | Max EIRP
82  * US915 | Max ERP
83  * US915_HYBRID | Max ERP
84  */
85 #define TX_POWER_0 0
86 
87 /*!
88  * Region | dBM
89  * ------------ | :-----:
90  * AS923 | Max EIRP - 2
91  * AU915 | Max EIRP - 2
92  * CN470 | Max EIRP - 2
93  * CN779 | Max EIRP - 2
94  * EU433 | Max EIRP - 2
95  * EU868 | Max EIRP - 2
96  * IN865 | Max EIRP - 2
97  * KR920 | Max EIRP - 2
98  * US915 | Max ERP - 2
99  * US915_HYBRID | Max ERP - 2
100  */
101 #define TX_POWER_1 1
102 
103 /*!
104  * Region | dBM
105  * ------------ | :-----:
106  * AS923 | Max EIRP - 4
107  * AU915 | Max EIRP - 4
108  * CN470 | Max EIRP - 4
109  * CN779 | Max EIRP - 4
110  * EU433 | Max EIRP - 4
111  * EU868 | Max EIRP - 4
112  * IN865 | Max EIRP - 4
113  * KR920 | Max EIRP - 4
114  * US915 | Max ERP - 4
115  * US915_HYBRID | Max ERP - 4
116  */
117 #define TX_POWER_2 2
118 
119 /*!
120  * Region | dBM
121  * ------------ | :-----:
122  * AS923 | Max EIRP - 6
123  * AU915 | Max EIRP - 6
124  * CN470 | Max EIRP - 6
125  * CN779 | Max EIRP - 6
126  * EU433 | Max EIRP - 6
127  * EU868 | Max EIRP - 6
128  * IN865 | Max EIRP - 6
129  * KR920 | Max EIRP - 6
130  * US915 | Max ERP - 6
131  * US915_HYBRID | Max ERP - 6
132  */
133 #define TX_POWER_3 3
134 
135 /*!
136  * Region | dBM
137  * ------------ | :-----:
138  * AS923 | Max EIRP - 8
139  * AU915 | Max EIRP - 8
140  * CN470 | Max EIRP - 8
141  * CN779 | Max EIRP - 8
142  * EU433 | Max EIRP - 8
143  * EU868 | Max EIRP - 8
144  * IN865 | Max EIRP - 8
145  * KR920 | Max EIRP - 8
146  * US915 | Max ERP - 8
147  * US915_HYBRID | Max ERP - 8
148  */
149 #define TX_POWER_4 4
150 
151 /*!
152  * Region | dBM
153  * ------------ | :-----:
154  * AS923 | Max EIRP - 10
155  * AU915 | Max EIRP - 10
156  * CN470 | Max EIRP - 10
157  * CN779 | Max EIRP - 10
158  * EU433 | Max EIRP - 10
159  * EU868 | Max EIRP - 10
160  * IN865 | Max EIRP - 10
161  * KR920 | Max EIRP - 10
162  * US915 | Max ERP - 10
163  * US915_HYBRID | Max ERP - 10
164  */
165 #define TX_POWER_5 5
166 
167 /*!
168  * Region | dBM
169  * ------------ | :-----:
170  * AS923 | Max EIRP - 12
171  * AU915 | Max EIRP - 12
172  * CN470 | Max EIRP - 12
173  * CN779 | -
174  * EU433 | -
175  * EU868 | Max EIRP - 12
176  * IN865 | Max EIRP - 12
177  * KR920 | Max EIRP - 12
178  * US915 | Max ERP - 12
179  * US915_HYBRID | Max ERP - 12
180  */
181 #define TX_POWER_6 6
182 
183 /*!
184  * Region | dBM
185  * ------------ | :-----:
186  * AS923 | Max EIRP - 14
187  * AU915 | Max EIRP - 14
188  * CN470 | Max EIRP - 14
189  * CN779 | -
190  * EU433 | -
191  * EU868 | Max EIRP - 14
192  * IN865 | Max EIRP - 14
193  * KR920 | Max EIRP - 14
194  * US915 | Max ERP - 14
195  * US915_HYBRID | Max ERP - 14
196  */
197 #define TX_POWER_7 7
198 
199 /*!
200  * Region | dBM
201  * ------------ | :-----:
202  * AS923 | -
203  * AU915 | Max EIRP - 16
204  * CN470 | -
205  * CN779 | -
206  * EU433 | -
207  * EU868 | -
208  * IN865 | Max EIRP - 16
209  * KR920 | -
210  * US915 | Max ERP - 16
211  * US915_HYBRID | Max ERP -16
212  */
213 #define TX_POWER_8 8
214 
215 /*!
216  * Region | dBM
217  * ------------ | :-----:
218  * AS923 | -
219  * AU915 | Max EIRP - 18
220  * CN470 | -
221  * CN779 | -
222  * EU433 | -
223  * EU868 | -
224  * IN865 | Max EIRP - 18
225  * KR920 | -
226  * US915 | Max ERP - 16
227  * US915_HYBRID | Max ERP - 16
228  */
229 #define TX_POWER_9 9
230 
231 /*!
232  * Region | dBM
233  * ------------ | :-----:
234  * AS923 | -
235  * AU915 | Max EIRP - 20
236  * CN470 | -
237  * CN779 | -
238  * EU433 | -
239  * EU868 | -
240  * IN865 | Max EIRP - 20
241  * KR920 | -
242  * US915 | Max ERP - 10
243  * US915_HYBRID | Max ERP - 10
244  */
245 #define TX_POWER_10 10
246 
247 /*!
248  * RFU
249  */
250 #define TX_POWER_11 11
251 
252 /*!
253  * RFU
254  */
255 #define TX_POWER_12 12
256 
257 /*!
258  * RFU
259  */
260 #define TX_POWER_13 13
261 
262 /*!
263  * RFU
264  */
265 #define TX_POWER_14 14
266 
267 /*!
268  * RFU
269  */
270 #define TX_POWER_15 15
271 
272 /**
273  * TX configuration parameters.
274  */
275 typedef struct {
276  /**
277  * The TX channel.
278  */
279  uint8_t channel;
280  /**
281  * The TX datarate.
282  */
283  int8_t datarate;
284  /**
285  * The TX power.
286  */
287  int8_t tx_power;
288  /**
289  * The Max EIRP, if applicable.
290  */
291  float max_eirp;
292  /**
293  * The antenna gain, if applicable.
294  */
296  /**
297  * The frame length to set up.
298  */
299  uint16_t pkt_len;
301 
302 /**
303  * This structure contains parameters for ADR request coming from
304  * network server.
305  */
306 typedef struct {
307  /*!
308  * A pointer to the payload containing the MAC commands.
309  */
310  const uint8_t *payload;
311  /*!
312  * The size of the payload.
313  */
314  uint8_t payload_size;
315  /*!
316  * The uplink dwell time.
317  */
318  uint8_t ul_dwell_time;
319  /*!
320  * Set to true, if ADR is enabled.
321  */
323  /*!
324  * The current datarate.
325  */
327  /*!
328  * The current TX power.
329  */
331  /*!
332  * The current number of repetitions for obtaining a QOS level set by
333  * NS (applicable only to unconfirmed messages).
334  */
337 
338 /**
339  * Structure containing data for local ADR settings
340  */
341 typedef struct link_adr_params_s {
342  /**
343  * The number of repetitions.
344  */
345  uint8_t nb_rep;
346  /**
347  * Datarate.
348  */
349  int8_t datarate;
350  /**
351  * TX power.
352  */
353  int8_t tx_power;
354  /**
355  * Channels mask control field.
356  */
357  uint8_t ch_mask_ctrl;
358  /**
359  * Channels mask field.
360  */
361  uint16_t channel_mask;
363 
364 /**
365  * Structure used to store ADR values received from network
366  * for verification (legality) purposes.
367  */
368 typedef struct verify_adr_params_s {
369  /*!
370  * The current status of the AdrLinkRequest.
371  */
372  uint8_t status;
373  /*!
374  * Set to true, if ADR is enabled.
375  */
377  /*!
378  * The datarate the AdrLinkRequest wants to set.
379  */
380  int8_t datarate;
381  /*!
382  * The TX power the AdrLinkRequest wants to set.
383  */
384  int8_t tx_power;
385  /*!
386  * The number of repetitions the AdrLinkRequest wants to set.
387  */
388  uint8_t nb_rep;
389  /*!
390  * The current datarate the node is using.
391  */
393  /*!
394  * The current TX power the node is using.
395  */
397  /*!
398  * The current number of repetitions the node is using.
399  */
401 
402  /*!
403  * A pointer to the first element of the channels mask.
404  */
405  uint16_t *channel_mask;
407 
408 /**
409  * Contains rx parameter setup request coming from
410  * network server.
411  */
412 typedef struct rx_param_setup_req_s {
413  /**
414  * The datarate to set up.
415  */
416  int8_t datarate;
417  /**
418  * The datarate offset.
419  */
420  int8_t dr_offset;
421  /**
422  * The frequency to set up.
423  */
424  uint32_t frequency;
426 
427 /**
428  * The parameter structure for the function RegionNextChannel.
429  */
431  /**
432  * The aggregated time-off time.
433  */
435  /**
436  * The time of the last aggregated TX.
437  */
439  /**
440  * The current datarate.
441  */
443  /**
444  * Set to true, if the node has already joined a network, otherwise false.
445  */
446  bool joined;
447  /**
448  * Set to true, if the duty cycle is enabled, otherwise false.
449  */
452 
453 /*!
454  * The parameter structure for the function RegionContinuousWave.
455  */
457  /*!
458  * The current channel index.
459  */
460  uint8_t channel;
461  /*!
462  * The datarate. Used to limit the TX power.
463  */
464  int8_t datarate;
465  /*!
466  * The TX power to set up.
467  */
468  int8_t tx_power;
469  /*!
470  * The max EIRP, if applicable.
471  */
472  float max_eirp;
473  /*!
474  * The antenna gain, if applicable.
475  */
477  /*!
478  * Specifies the time the radio will stay in CW mode.
479  */
480  uint16_t timeout;
482 
483 /*!
484  * Template for a table
485  */
486 typedef struct {
487  void *table;
488  uint8_t size;
490 
491 /*!
492  * Contains information regarding channel configuration of
493  * a given PHY
494  */
495 typedef struct {
496  uint8_t channel_list_size;
497  uint8_t mask_size;
498  uint16_t *mask;
499  uint16_t *default_mask;
500  channel_params_t *channel_list;
502 
503 /*!
504  * Global configuration parameters of a given PHY
505  */
506 typedef struct {
507  bool duty_cycle_enabled;
508  bool accept_tx_param_setup_req;
509  bool fsk_supported;
510  bool cflist_supported;
511  bool custom_channelplans_supported;
512  bool dl_channel_req_supported;
513 
514  uint8_t default_channel_cnt;
515  uint8_t cflist_channel_cnt;
516  uint8_t max_channel_cnt;
517  uint8_t min_tx_power;
518  uint8_t max_tx_power;
519  uint8_t default_tx_power;
520  uint8_t adr_ack_limit;
521  uint8_t adr_ack_delay;
522 
523  uint8_t min_tx_datarate;
524  uint8_t max_tx_datarate;
525  uint8_t min_rx_datarate;
526  uint8_t max_rx_datarate;
527  uint8_t default_datarate;
528  uint8_t default_max_datarate;
529  uint8_t min_rx1_dr_offset;
530  uint8_t max_rx1_dr_offset;
531  uint8_t default_rx1_dr_offset;
532  uint8_t dwell_limit_datarate;
533 
534  uint16_t max_rx_window;
535  uint16_t recv_delay1;
536  uint16_t recv_delay2;
537  uint16_t join_accept_delay1;
538  uint16_t join_accept_delay2;
539  uint16_t join_channel_mask;
540  uint16_t max_fcnt_gap;
541  uint16_t ack_timeout;
542  uint16_t ack_timeout_rnd;
543 
544  float default_max_eirp;
545  float default_antenna_gain;
546 
547  uint8_t rx_window2_datarate;
548  uint32_t rx_window2_frequency;
549 
550  loraphy_table_t bands;
551  loraphy_table_t bandwidths;
552  loraphy_table_t datarates;
553  loraphy_table_t payloads;
554  loraphy_table_t payloads_with_repeater;
555 
556  loraphy_channels_t channels;
557 
558 
559  unsigned ul_dwell_time_setting : 1;
560  unsigned dl_dwell_time_setting : 1;
561 
563 
564 
565 #endif /* MBED_OS_LORA_PHY_DATASTRUCTURES_ */
TX configuration parameters.
Definition: lora_phy_ds.h:275
uint16_t * channel_mask
Definition: lora_phy_ds.h:405
bool joined
Set to true, if the node has already joined a network, otherwise false.
Definition: lora_phy_ds.h:446
struct continuous_wave_mode_params_s cw_mode_params_t
int8_t dr_offset
The datarate offset.
Definition: lora_phy_ds.h:420
struct link_adr_params_s link_adr_params_t
Structure containing data for local ADR settings.
float antenna_gain
The antenna gain, if applicable.
Definition: lora_phy_ds.h:295
uint32_t lorawan_time_t
Timer time variable definition.
Structure used to store ADR values received from network for verification (legality) purposes...
Definition: lora_phy_ds.h:368
lorawan_time_t last_aggregate_tx_time
The time of the last aggregated TX.
Definition: lora_phy_ds.h:438
int8_t max_tx_power
Maximum transmit power in dBm supported by the Controller.
Definition: shci.h:560
int8_t datarate
The datarate to set up.
Definition: lora_phy_ds.h:416
uint8_t current_nb_trans
Definition: lora_phy_ds.h:335
uint16_t pkt_len
The frame length to set up.
Definition: lora_phy_ds.h:299
int8_t datarate
The TX datarate.
Definition: lora_phy_ds.h:283
int8_t current_datarate
The current datarate.
Definition: lora_phy_ds.h:442
uint32_t frequency
The frequency to set up.
Definition: lora_phy_ds.h:424
struct channel_selection_params_s channel_selection_params_t
The parameter structure for the function RegionNextChannel.
int8_t current_datarate
Definition: lora_phy_ds.h:326
int8_t min_tx_power
Minimum transmit power in dBm supported by the Controller.
Definition: shci.h:554
bool dc_enabled
Set to true, if the duty cycle is enabled, otherwise false.
Definition: lora_phy_ds.h:450
const uint8_t * payload
Definition: lora_phy_ds.h:310
uint8_t ul_dwell_time
Definition: lora_phy_ds.h:318
The parameter structure for the function RegionNextChannel.
Definition: lora_phy_ds.h:430
Contains rx parameter setup request coming from network server.
Definition: lora_phy_ds.h:412
struct verify_adr_params_s verify_adr_params_t
Structure used to store ADR values received from network for verification (legality) purposes...
Contains common data structures used by Mbed-OS LoRaWAN mplementation.
uint8_t payload_size
Definition: lora_phy_ds.h:314
This structure contains parameters for ADR request coming from network server.
Definition: lora_phy_ds.h:306
int8_t current_tx_power
Definition: lora_phy_ds.h:330
uint8_t channel
The TX channel.
Definition: lora_phy_ds.h:279
lorawan_time_t aggregate_timeoff
The aggregated time-off time.
Definition: lora_phy_ds.h:434
DO NOT MODIFY, WILL BREAK THE API!
float max_eirp
The Max EIRP, if applicable.
Definition: lora_phy_ds.h:291
struct rx_param_setup_req_s rx_param_setup_req_t
Contains rx parameter setup request coming from network server.
int8_t tx_power
The TX power.
Definition: lora_phy_ds.h:287
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.