Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
lora_phy_ds.h
00001 /** 00002 * @file lora_phy_ds.h 00003 * 00004 * @brief Data structures relating to PHY layer 00005 * 00006 * \code 00007 * ______ _ 00008 * / _____) _ | | 00009 * ( (____ _____ ____ _| |_ _____ ____| |__ 00010 * \____ \| ___ | (_ _) ___ |/ ___) _ \ 00011 * _____) ) ____| | | || |_| ____( (___| | | | 00012 * (______/|_____)_|_|_| \__)_____)\____)_| |_| 00013 * (C)2013 Semtech 00014 * ___ _____ _ ___ _ _____ ___ ___ ___ ___ 00015 * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| 00016 * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| 00017 * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| 00018 * embedded.connectivity.solutions=============== 00019 * 00020 * \endcode 00021 * 00022 * License: Revised BSD License, see LICENSE.TXT file include in the project 00023 * 00024 * Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE ) 00025 * 00026 * Copyright (c) 2017, Arm Limited and affiliates. 00027 * SPDX-License-Identifier: BSD-3-Clause 00028 * 00029 */ 00030 00031 #ifndef MBED_OS_LORA_PHY_DATASTRUCTURES_ 00032 #define MBED_OS_LORA_PHY_DATASTRUCTURES_ 00033 00034 #include "lorawan/system/lorawan_data_structures.h" 00035 00036 /*! 00037 * \brief Returns the minimum value between a and b. 00038 * 00039 * \param [in] a The first value. 00040 * \param [in] b The second value. 00041 * \retval minValue The minimum value. 00042 */ 00043 #ifndef MIN 00044 #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) 00045 #endif 00046 00047 /*! 00048 * \brief Returns the maximum value between a and b 00049 * 00050 * \param [in] a The first value. 00051 * \param [in] b The second value. 00052 * \retval maxValue The maximum value. 00053 */ 00054 #ifndef MAX 00055 #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) 00056 #endif 00057 00058 /** 00059 * LoRaMac maximum number of channels. 00060 */ 00061 #define LORA_MAX_NB_CHANNELS 16 00062 00063 /*! 00064 * Macro to compute bit of a channel index. 00065 */ 00066 #define LC( channelIndex ) ( uint16_t )( 1 << ( channelIndex - 1 ) ) 00067 00068 /*! 00069 * Region | SF 00070 * ------------ | :-----: 00071 * AS923 | SF12 - BW125 00072 * AU915 | SF10 - BW125 00073 * CN470 | SF12 - BW125 00074 * CN779 | SF12 - BW125 00075 * EU433 | SF12 - BW125 00076 * EU868 | SF12 - BW125 00077 * IN865 | SF12 - BW125 00078 * KR920 | SF12 - BW125 00079 * US915 | SF10 - BW125 00080 * US915_HYBRID | SF10 - BW125 00081 */ 00082 #define DR_0 0 00083 00084 /*! 00085 * Region | SF 00086 * ------------ | :-----: 00087 * AS923 | SF11 - BW125 00088 * AU915 | SF9 - BW125 00089 * CN470 | SF11 - BW125 00090 * CN779 | SF11 - BW125 00091 * EU433 | SF11 - BW125 00092 * EU868 | SF11 - BW125 00093 * IN865 | SF11 - BW125 00094 * KR920 | SF11 - BW125 00095 * US915 | SF9 - BW125 00096 * US915_HYBRID | SF9 - BW125 00097 */ 00098 #define DR_1 1 00099 00100 /*! 00101 * Region | SF 00102 * ------------ | :-----: 00103 * AS923 | SF10 - BW125 00104 * AU915 | SF8 - BW125 00105 * CN470 | SF10 - BW125 00106 * CN779 | SF10 - BW125 00107 * EU433 | SF10 - BW125 00108 * EU868 | SF10 - BW125 00109 * IN865 | SF10 - BW125 00110 * KR920 | SF10 - BW125 00111 * US915 | SF8 - BW125 00112 * US915_HYBRID | SF8 - BW125 00113 */ 00114 #define DR_2 2 00115 00116 /*! 00117 * Region | SF 00118 * ------------ | :-----: 00119 * AS923 | SF9 - BW125 00120 * AU915 | SF7 - BW125 00121 * CN470 | SF9 - BW125 00122 * CN779 | SF9 - BW125 00123 * EU433 | SF9 - BW125 00124 * EU868 | SF9 - BW125 00125 * IN865 | SF9 - BW125 00126 * KR920 | SF9 - BW125 00127 * US915 | SF7 - BW125 00128 * US915_HYBRID | SF7 - BW125 00129 */ 00130 #define DR_3 3 00131 00132 /*! 00133 * Region | SF 00134 * ------------ | :-----: 00135 * AS923 | SF8 - BW125 00136 * AU915 | SF8 - BW500 00137 * CN470 | SF8 - BW125 00138 * CN779 | SF8 - BW125 00139 * EU433 | SF8 - BW125 00140 * EU868 | SF8 - BW125 00141 * IN865 | SF8 - BW125 00142 * KR920 | SF8 - BW125 00143 * US915 | SF8 - BW500 00144 * US915_HYBRID | SF8 - BW500 00145 */ 00146 #define DR_4 4 00147 00148 /*! 00149 * Region | SF 00150 * ------------ | :-----: 00151 * AS923 | SF7 - BW125 00152 * AU915 | RFU 00153 * CN470 | SF7 - BW125 00154 * CN779 | SF7 - BW125 00155 * EU433 | SF7 - BW125 00156 * EU868 | SF7 - BW125 00157 * IN865 | SF7 - BW125 00158 * KR920 | SF7 - BW125 00159 * US915 | RFU 00160 * US915_HYBRID | RFU 00161 */ 00162 #define DR_5 5 00163 00164 /*! 00165 * Region | SF 00166 * ------------ | :-----: 00167 * AS923 | SF7 - BW250 00168 * AU915 | RFU 00169 * CN470 | SF12 - BW125 00170 * CN779 | SF7 - BW250 00171 * EU433 | SF7 - BW250 00172 * EU868 | SF7 - BW250 00173 * IN865 | SF7 - BW250 00174 * KR920 | RFU 00175 * US915 | RFU 00176 * US915_HYBRID | RFU 00177 */ 00178 #define DR_6 6 00179 00180 /*! 00181 * Region | SF 00182 * ------------ | :-----: 00183 * AS923 | FSK 00184 * AU915 | RFU 00185 * CN470 | SF12 - BW125 00186 * CN779 | FSK 00187 * EU433 | FSK 00188 * EU868 | FSK 00189 * IN865 | FSK 00190 * KR920 | RFU 00191 * US915 | RFU 00192 * US915_HYBRID | RFU 00193 */ 00194 #define DR_7 7 00195 00196 /*! 00197 * Region | SF 00198 * ------------ | :-----: 00199 * AS923 | RFU 00200 * AU915 | SF12 - BW500 00201 * CN470 | RFU 00202 * CN779 | RFU 00203 * EU433 | RFU 00204 * EU868 | RFU 00205 * IN865 | RFU 00206 * KR920 | RFU 00207 * US915 | SF12 - BW500 00208 * US915_HYBRID | SF12 - BW500 00209 */ 00210 #define DR_8 8 00211 00212 /*! 00213 * Region | SF 00214 * ------------ | :-----: 00215 * AS923 | RFU 00216 * AU915 | SF11 - BW500 00217 * CN470 | RFU 00218 * CN779 | RFU 00219 * EU433 | RFU 00220 * EU868 | RFU 00221 * IN865 | RFU 00222 * KR920 | RFU 00223 * US915 | SF11 - BW500 00224 * US915_HYBRID | SF11 - BW500 00225 */ 00226 #define DR_9 9 00227 00228 /*! 00229 * Region | SF 00230 * ------------ | :-----: 00231 * AS923 | RFU 00232 * AU915 | SF10 - BW500 00233 * CN470 | RFU 00234 * CN779 | RFU 00235 * EU433 | RFU 00236 * EU868 | RFU 00237 * IN865 | RFU 00238 * KR920 | RFU 00239 * US915 | SF10 - BW500 00240 * US915_HYBRID | SF10 - BW500 00241 */ 00242 #define DR_10 10 00243 00244 /*! 00245 * Region | SF 00246 * ------------ | :-----: 00247 * AS923 | RFU 00248 * AU915 | SF9 - BW500 00249 * CN470 | RFU 00250 * CN779 | RFU 00251 * EU433 | RFU 00252 * EU868 | RFU 00253 * IN865 | RFU 00254 * KR920 | RFU 00255 * US915 | SF9 - BW500 00256 * US915_HYBRID | SF9 - BW500 00257 */ 00258 #define DR_11 11 00259 00260 /*! 00261 * Region | SF 00262 * ------------ | :-----: 00263 * AS923 | RFU 00264 * AU915 | SF8 - BW500 00265 * CN470 | RFU 00266 * CN779 | RFU 00267 * EU433 | RFU 00268 * EU868 | RFU 00269 * IN865 | RFU 00270 * KR920 | RFU 00271 * US915 | SF8 - BW500 00272 * US915_HYBRID | SF8 - BW500 00273 */ 00274 #define DR_12 12 00275 00276 /*! 00277 * Region | SF 00278 * ------------ | :-----: 00279 * AS923 | RFU 00280 * AU915 | SF7 - BW500 00281 * CN470 | RFU 00282 * CN779 | RFU 00283 * EU433 | RFU 00284 * EU868 | RFU 00285 * IN865 | RFU 00286 * KR920 | RFU 00287 * US915 | SF7 - BW500 00288 * US915_HYBRID | SF7 - BW500 00289 */ 00290 #define DR_13 13 00291 00292 /*! 00293 * Region | SF 00294 * ------------ | :-----: 00295 * AS923 | RFU 00296 * AU915 | RFU 00297 * CN470 | RFU 00298 * CN779 | RFU 00299 * EU433 | RFU 00300 * EU868 | RFU 00301 * IN865 | RFU 00302 * KR920 | RFU 00303 * US915 | RFU 00304 * US915_HYBRID | RFU 00305 */ 00306 #define DR_14 14 00307 00308 /*! 00309 * Region | SF 00310 * ------------ | :-----: 00311 * AS923 | RFU 00312 * AU915 | RFU 00313 * CN470 | RFU 00314 * CN779 | RFU 00315 * EU433 | RFU 00316 * EU868 | RFU 00317 * IN865 | RFU 00318 * KR920 | RFU 00319 * US915 | RFU 00320 * US915_HYBRID | RFU 00321 */ 00322 #define DR_15 15 00323 00324 00325 00326 /*! 00327 * Region | dBM 00328 * ------------ | :-----: 00329 * AS923 | Max EIRP 00330 * AU915 | Max EIRP 00331 * CN470 | Max EIRP 00332 * CN779 | Max EIRP 00333 * EU433 | Max EIRP 00334 * EU868 | Max EIRP 00335 * IN865 | Max EIRP 00336 * KR920 | Max EIRP 00337 * US915 | Max ERP 00338 * US915_HYBRID | Max ERP 00339 */ 00340 #define TX_POWER_0 0 00341 00342 /*! 00343 * Region | dBM 00344 * ------------ | :-----: 00345 * AS923 | Max EIRP - 2 00346 * AU915 | Max EIRP - 2 00347 * CN470 | Max EIRP - 2 00348 * CN779 | Max EIRP - 2 00349 * EU433 | Max EIRP - 2 00350 * EU868 | Max EIRP - 2 00351 * IN865 | Max EIRP - 2 00352 * KR920 | Max EIRP - 2 00353 * US915 | Max ERP - 2 00354 * US915_HYBRID | Max ERP - 2 00355 */ 00356 #define TX_POWER_1 1 00357 00358 /*! 00359 * Region | dBM 00360 * ------------ | :-----: 00361 * AS923 | Max EIRP - 4 00362 * AU915 | Max EIRP - 4 00363 * CN470 | Max EIRP - 4 00364 * CN779 | Max EIRP - 4 00365 * EU433 | Max EIRP - 4 00366 * EU868 | Max EIRP - 4 00367 * IN865 | Max EIRP - 4 00368 * KR920 | Max EIRP - 4 00369 * US915 | Max ERP - 4 00370 * US915_HYBRID | Max ERP - 4 00371 */ 00372 #define TX_POWER_2 2 00373 00374 /*! 00375 * Region | dBM 00376 * ------------ | :-----: 00377 * AS923 | Max EIRP - 6 00378 * AU915 | Max EIRP - 6 00379 * CN470 | Max EIRP - 6 00380 * CN779 | Max EIRP - 6 00381 * EU433 | Max EIRP - 6 00382 * EU868 | Max EIRP - 6 00383 * IN865 | Max EIRP - 6 00384 * KR920 | Max EIRP - 6 00385 * US915 | Max ERP - 6 00386 * US915_HYBRID | Max ERP - 6 00387 */ 00388 #define TX_POWER_3 3 00389 00390 /*! 00391 * Region | dBM 00392 * ------------ | :-----: 00393 * AS923 | Max EIRP - 8 00394 * AU915 | Max EIRP - 8 00395 * CN470 | Max EIRP - 8 00396 * CN779 | Max EIRP - 8 00397 * EU433 | Max EIRP - 8 00398 * EU868 | Max EIRP - 8 00399 * IN865 | Max EIRP - 8 00400 * KR920 | Max EIRP - 8 00401 * US915 | Max ERP - 8 00402 * US915_HYBRID | Max ERP - 8 00403 */ 00404 #define TX_POWER_4 4 00405 00406 /*! 00407 * Region | dBM 00408 * ------------ | :-----: 00409 * AS923 | Max EIRP - 10 00410 * AU915 | Max EIRP - 10 00411 * CN470 | Max EIRP - 10 00412 * CN779 | Max EIRP - 10 00413 * EU433 | Max EIRP - 10 00414 * EU868 | Max EIRP - 10 00415 * IN865 | Max EIRP - 10 00416 * KR920 | Max EIRP - 10 00417 * US915 | Max ERP - 10 00418 * US915_HYBRID | Max ERP - 10 00419 */ 00420 #define TX_POWER_5 5 00421 00422 /*! 00423 * Region | dBM 00424 * ------------ | :-----: 00425 * AS923 | Max EIRP - 12 00426 * AU915 | Max EIRP - 12 00427 * CN470 | Max EIRP - 12 00428 * CN779 | - 00429 * EU433 | - 00430 * EU868 | Max EIRP - 12 00431 * IN865 | Max EIRP - 12 00432 * KR920 | Max EIRP - 12 00433 * US915 | Max ERP - 12 00434 * US915_HYBRID | Max ERP - 12 00435 */ 00436 #define TX_POWER_6 6 00437 00438 /*! 00439 * Region | dBM 00440 * ------------ | :-----: 00441 * AS923 | Max EIRP - 14 00442 * AU915 | Max EIRP - 14 00443 * CN470 | Max EIRP - 14 00444 * CN779 | - 00445 * EU433 | - 00446 * EU868 | Max EIRP - 14 00447 * IN865 | Max EIRP - 14 00448 * KR920 | Max EIRP - 14 00449 * US915 | Max ERP - 14 00450 * US915_HYBRID | Max ERP - 14 00451 */ 00452 #define TX_POWER_7 7 00453 00454 /*! 00455 * Region | dBM 00456 * ------------ | :-----: 00457 * AS923 | - 00458 * AU915 | Max EIRP - 16 00459 * CN470 | - 00460 * CN779 | - 00461 * EU433 | - 00462 * EU868 | - 00463 * IN865 | Max EIRP - 16 00464 * KR920 | - 00465 * US915 | Max ERP - 16 00466 * US915_HYBRID | Max ERP -16 00467 */ 00468 #define TX_POWER_8 8 00469 00470 /*! 00471 * Region | dBM 00472 * ------------ | :-----: 00473 * AS923 | - 00474 * AU915 | Max EIRP - 18 00475 * CN470 | - 00476 * CN779 | - 00477 * EU433 | - 00478 * EU868 | - 00479 * IN865 | Max EIRP - 18 00480 * KR920 | - 00481 * US915 | Max ERP - 16 00482 * US915_HYBRID | Max ERP - 16 00483 */ 00484 #define TX_POWER_9 9 00485 00486 /*! 00487 * Region | dBM 00488 * ------------ | :-----: 00489 * AS923 | - 00490 * AU915 | Max EIRP - 20 00491 * CN470 | - 00492 * CN779 | - 00493 * EU433 | - 00494 * EU868 | - 00495 * IN865 | Max EIRP - 20 00496 * KR920 | - 00497 * US915 | Max ERP - 10 00498 * US915_HYBRID | Max ERP - 10 00499 */ 00500 #define TX_POWER_10 10 00501 00502 /*! 00503 * RFU 00504 */ 00505 #define TX_POWER_11 11 00506 00507 /*! 00508 * RFU 00509 */ 00510 #define TX_POWER_12 12 00511 00512 /*! 00513 * RFU 00514 */ 00515 #define TX_POWER_13 13 00516 00517 /*! 00518 * RFU 00519 */ 00520 #define TX_POWER_14 14 00521 00522 /*! 00523 * RFU 00524 */ 00525 #define TX_POWER_15 15 00526 00527 /*! 00528 * Enumeration of PHY attributes. 00529 */ 00530 typedef enum phy_attributes__e 00531 { 00532 /*! 00533 * The minimum RX datarate. 00534 */ 00535 PHY_MIN_RX_DR , 00536 /*! 00537 * The minimum TX datarate. 00538 */ 00539 PHY_MIN_TX_DR , 00540 /*! 00541 * The maximum RX datarate. 00542 */ 00543 PHY_MAX_RX_DR , 00544 /*! 00545 * The maximum TX datarate. 00546 */ 00547 PHY_MAX_TX_DR , 00548 /*! 00549 * The TX datarate. 00550 */ 00551 PHY_TX_DR , 00552 /*! 00553 * The default TX datarate. 00554 */ 00555 PHY_DEF_TX_DR , 00556 /*! 00557 * The RX datarate. 00558 */ 00559 PHY_RX_DR , 00560 /*! 00561 * The TX power. 00562 */ 00563 PHY_TX_POWER , 00564 /*! 00565 * The default TX power. 00566 */ 00567 PHY_DEF_TX_POWER , 00568 /*! 00569 * Maximum payload possible. 00570 */ 00571 PHY_MAX_PAYLOAD , 00572 /*! 00573 * Maximum payload possible when the repeater support is enabled. 00574 */ 00575 PHY_MAX_PAYLOAD_REPEATER , 00576 /*! 00577 * The duty cycle. 00578 */ 00579 PHY_DUTY_CYCLE , 00580 /*! 00581 * The maximum receive window duration. 00582 */ 00583 PHY_MAX_RX_WINDOW , 00584 /*! 00585 * The receive delay for window 1. 00586 */ 00587 PHY_RECEIVE_DELAY1 , 00588 /*! 00589 * The receive delay for window 2. 00590 */ 00591 PHY_RECEIVE_DELAY2 , 00592 /*! 00593 * The join accept delay for window 1. 00594 */ 00595 PHY_JOIN_ACCEPT_DELAY1 , 00596 /*! 00597 * The join accept delay for window 2. 00598 */ 00599 PHY_JOIN_ACCEPT_DELAY2 , 00600 /*! 00601 * The maximum frame counter gap. 00602 */ 00603 PHY_MAX_FCNT_GAP , 00604 /*! 00605 * The acknowledgement time out. 00606 */ 00607 PHY_ACK_TIMEOUT , 00608 /*! 00609 * The default datarate offset for window 1. 00610 */ 00611 PHY_DEF_DR1_OFFSET , 00612 /*! 00613 * The default receive window 2 frequency. 00614 */ 00615 PHY_DEF_RX2_FREQUENCY , 00616 /*! 00617 * The default receive window 2 datarate. 00618 */ 00619 PHY_DEF_RX2_DR , 00620 /*! 00621 * The channels mask. 00622 */ 00623 PHY_CHANNEL_MASK , 00624 /*! 00625 * The default channel mask. 00626 */ 00627 PHY_DEFAULT_CHANNEL_MASK , 00628 /*! 00629 * The maximum number of supported channels. 00630 */ 00631 PHY_MAX_NB_CHANNELS , 00632 /*! 00633 * The channels. 00634 */ 00635 PHY_CHANNELS , 00636 /*! 00637 * The PHYs that support dynamic channel plan (non-custom) 00638 * support do not let the user add/remove to the channel plan. 00639 * The network guides the device for the plan. So only 00640 * EU like regions support custom channel planning. 00641 */ 00642 PHY_CUSTOM_CHANNEL_PLAN_SUPPORT , 00643 /*! 00644 * The default value of the uplink dwell time. 00645 */ 00646 PHY_DEF_UPLINK_DWELL_TIME , 00647 /*! 00648 * The default value of the downlink dwell time. 00649 */ 00650 PHY_DEF_DOWNLINK_DWELL_TIME , 00651 /*! 00652 * The default value of the MaxEIRP. 00653 */ 00654 PHY_DEF_MAX_EIRP , 00655 /*! 00656 * The default value of the antenna gain. 00657 */ 00658 PHY_DEF_ANTENNA_GAIN , 00659 /*! 00660 * The value for the number of join trials. 00661 */ 00662 PHY_NB_JOIN_TRIALS , 00663 /*! 00664 * The default value for the number of join trials. 00665 */ 00666 PHY_DEF_NB_JOIN_TRIALS , 00667 /*! 00668 * The next lower datarate. 00669 */ 00670 PHY_NEXT_LOWER_TX_DR 00671 } phy_attributes_t ; 00672 00673 /*! 00674 * Keeps value in response to a call to 00675 * get_phy_params() API. 00676 */ 00677 typedef union phy_param_u 00678 { 00679 /*! 00680 * A parameter value. 00681 */ 00682 uint32_t value ; 00683 /*! 00684 * A floating point value. 00685 */ 00686 float f_value ; 00687 /*! 00688 * A pointer to the channels mask. 00689 */ 00690 uint16_t* channel_mask ; 00691 /*! 00692 * A pointer to the channels. 00693 */ 00694 channel_params_t * channel_params ; 00695 } phy_param_t ; 00696 00697 /** 00698 * The parameter structure for the function RegionGetPhyParam. 00699 */ 00700 typedef struct 00701 { 00702 /** 00703 * Set up the parameter to get. 00704 */ 00705 phy_attributes_t attribute; 00706 00707 /** 00708 * The parameter is needed for the following queries: 00709 * PHY_MAX_PAYLOAD, PHY_MAX_PAYLOAD_REPEATER, PHY_NEXT_LOWER_TX_DR. 00710 */ 00711 int8_t datarate; 00712 00713 } get_phy_params_t; 00714 00715 /** 00716 * The parameter structure for the function RegionSetBandTxDone. 00717 */ 00718 typedef struct 00719 { 00720 /** 00721 * The channel to update. 00722 */ 00723 uint8_t channel; 00724 /** 00725 * Joined set to true, if the node has joined the network. 00726 */ 00727 bool joined; 00728 /** 00729 * The last TX done time. 00730 */ 00731 lorawan_time_t last_tx_done_time; 00732 } set_band_txdone_params_t; 00733 00734 /** 00735 * The parameter verification structure. 00736 */ 00737 typedef union 00738 { 00739 /** 00740 * The TX power to verify. 00741 */ 00742 int8_t tx_power; 00743 /** 00744 * Set to true, if the duty cycle is enabled, otherwise false. 00745 */ 00746 bool duty_cycle; 00747 /** 00748 * The number of join trials. 00749 */ 00750 uint8_t nb_join_trials; 00751 /** 00752 * The datarate to verify. 00753 */ 00754 int8_t datarate; 00755 00756 } verification_params_t; 00757 00758 /** 00759 * The parameter structure for the function RegionApplyCFList. 00760 */ 00761 typedef struct 00762 { 00763 /** 00764 * The payload containing the CF list. 00765 */ 00766 uint8_t* payload; 00767 /** 00768 * The size of the payload. 00769 */ 00770 uint8_t size; 00771 } cflist_params_t; 00772 00773 /** 00774 * TX configuration parameters. 00775 */ 00776 typedef struct 00777 { 00778 /** 00779 * The TX channel. 00780 */ 00781 uint8_t channel; 00782 /** 00783 * The TX datarate. 00784 */ 00785 int8_t datarate; 00786 /** 00787 * The TX power. 00788 */ 00789 int8_t tx_power; 00790 /** 00791 * The Max EIRP, if applicable. 00792 */ 00793 float max_eirp; 00794 /** 00795 * The antenna gain, if applicable. 00796 */ 00797 float antenna_gain; 00798 /** 00799 * The frame length to set up. 00800 */ 00801 uint16_t pkt_len; 00802 } tx_config_params_t; 00803 00804 /** 00805 * This structure contains parameters for ADR request coming from 00806 * network server. 00807 */ 00808 typedef struct 00809 { 00810 /*! 00811 * A pointer to the payload containing the MAC commands. 00812 */ 00813 uint8_t* payload ; 00814 /*! 00815 * The size of the payload. 00816 */ 00817 uint8_t payload_size ; 00818 /*! 00819 * The uplink dwell time. 00820 */ 00821 uint8_t ul_dwell_time ; 00822 /*! 00823 * Set to true, if ADR is enabled. 00824 */ 00825 bool adr_enabled ; 00826 /*! 00827 * The current datarate. 00828 */ 00829 int8_t current_datarate ; 00830 /*! 00831 * The current TX power. 00832 */ 00833 int8_t current_tx_power ; 00834 /*! 00835 * The current number of repetitions. 00836 */ 00837 uint8_t current_nb_rep ; 00838 } adr_req_params_t; 00839 00840 /** 00841 * Structure containing data for local ADR settings 00842 */ 00843 typedef struct link_adr_params_s 00844 { 00845 /** 00846 * The number of repetitions. 00847 */ 00848 uint8_t nb_rep; 00849 /** 00850 * Datarate. 00851 */ 00852 int8_t datarate; 00853 /** 00854 * TX power. 00855 */ 00856 int8_t tx_power; 00857 /** 00858 * Channels mask control field. 00859 */ 00860 uint8_t ch_mask_ctrl; 00861 /** 00862 * Channels mask field. 00863 */ 00864 uint16_t channel_mask; 00865 } link_adr_params_t; 00866 00867 /** 00868 * Structure used to store ADR values received from network 00869 * for verification (legality) purposes. 00870 */ 00871 typedef struct verify_adr_params_s 00872 { 00873 /*! 00874 * The current status of the AdrLinkRequest. 00875 */ 00876 uint8_t status ; 00877 /*! 00878 * Set to true, if ADR is enabled. 00879 */ 00880 bool adr_enabled ; 00881 /*! 00882 * The datarate the AdrLinkRequest wants to set. 00883 */ 00884 int8_t datarate ; 00885 /*! 00886 * The TX power the AdrLinkRequest wants to set. 00887 */ 00888 int8_t tx_power ; 00889 /*! 00890 * The number of repetitions the AdrLinkRequest wants to set. 00891 */ 00892 uint8_t nb_rep ; 00893 /*! 00894 * The current datarate the node is using. 00895 */ 00896 int8_t current_datarate ; 00897 /*! 00898 * The current TX power the node is using. 00899 */ 00900 int8_t current_tx_power ; 00901 /*! 00902 * The current number of repetitions the node is using. 00903 */ 00904 int8_t current_nb_rep ; 00905 00906 /*! 00907 * A pointer to the first element of the channels mask. 00908 */ 00909 uint16_t* channel_mask ; 00910 } verify_adr_params_t; 00911 00912 /** 00913 * Contains rx parameter setup request coming from 00914 * network server. 00915 */ 00916 typedef struct rx_param_setup_req_s 00917 { 00918 /** 00919 * The datarate to set up. 00920 */ 00921 int8_t datarate; 00922 /** 00923 * The datarate offset. 00924 */ 00925 int8_t dr_offset; 00926 /** 00927 * The frequency to set up. 00928 */ 00929 uint32_t frequency; 00930 } rx_param_setup_req_t; 00931 00932 /** 00933 * Contains tx parameter setup request coming from 00934 * network server. 00935 */ 00936 typedef struct tx_param_setup_req_s 00937 { 00938 /** 00939 * The uplink dwell time. 00940 */ 00941 uint8_t ul_dwell_time; 00942 /** 00943 * The downlink dwell time. 00944 */ 00945 uint8_t dl_dwell_time; 00946 /** 00947 * The max EIRP. 00948 */ 00949 uint8_t max_eirp; 00950 } tx_param_setup_req_t; 00951 00952 /** 00953 * A structure that holds new channel parameters coming 00954 * from the network server. 00955 */ 00956 typedef struct new_channel_req_params_s 00957 { 00958 /** 00959 * A pointer to the new channel's parameters. 00960 */ 00961 channel_params_t * new_channel; 00962 /** 00963 * The channel ID. 00964 */ 00965 int8_t channel_id; 00966 00967 } new_channel_req_params_t; 00968 00969 /** 00970 * The parameter structure for the function RegionDlChannelReq. 00971 */ 00972 typedef struct dl_channel_req_params_s 00973 { 00974 /** 00975 * The channel ID to add the frequency. 00976 */ 00977 uint8_t channel_id; 00978 /** 00979 * The alternative frequency for the Rx1 window. 00980 */ 00981 uint32_t rx1_frequency; 00982 } dl_channel_req_params_t; 00983 00984 /*! 00985 * The parameter structure for the function RegionCalcBackOff. 00986 */ 00987 typedef struct backoff_params_s 00988 { 00989 /** 00990 * Set to true, if the node has already joined a network, otherwise false. 00991 */ 00992 bool joined; 00993 /** 00994 * set to true, if the last uplink was a join request. 00995 */ 00996 bool last_tx_was_join_req; 00997 /** 00998 * Set to true, if the duty cycle is enabled, otherwise false. 00999 */ 01000 bool dc_enabled; 01001 /** 01002 * The current channel index. 01003 */ 01004 uint8_t channel; 01005 /** 01006 * Elapsed time since the start of the node. 01007 */ 01008 lorawan_time_t elapsed_time; 01009 /** 01010 * Time-on-air of the last transmission. 01011 */ 01012 lorawan_time_t tx_toa; 01013 01014 } backoff_params_t ; 01015 01016 /** 01017 * The parameter structure for the function RegionNextChannel. 01018 */ 01019 typedef struct channel_selection_params_s 01020 { 01021 /** 01022 * The aggregated time-off time. 01023 */ 01024 lorawan_time_t aggregate_timeoff; 01025 /** 01026 * The time of the last aggregated TX. 01027 */ 01028 lorawan_time_t last_aggregate_tx_time; 01029 /** 01030 * The current datarate. 01031 */ 01032 int8_t current_datarate; 01033 /** 01034 * Set to true, if the node has already joined a network, otherwise false. 01035 */ 01036 bool joined; 01037 /** 01038 * Set to true, if the duty cycle is enabled, otherwise false. 01039 */ 01040 bool dc_enabled; 01041 } channel_selection_params_t; 01042 01043 /*! 01044 * The parameter structure for the function RegionContinuousWave. 01045 */ 01046 typedef struct continuous_wave_mode_params_s 01047 { 01048 /*! 01049 * The current channel index. 01050 */ 01051 uint8_t channel ; 01052 /*! 01053 * The datarate. Used to limit the TX power. 01054 */ 01055 int8_t datarate ; 01056 /*! 01057 * The TX power to set up. 01058 */ 01059 int8_t tx_power ; 01060 /*! 01061 * The max EIRP, if applicable. 01062 */ 01063 float max_eirp ; 01064 /*! 01065 * The antenna gain, if applicable. 01066 */ 01067 float antenna_gain ; 01068 /*! 01069 * Specifies the time the radio will stay in CW mode. 01070 */ 01071 uint16_t timeout ; 01072 } cw_mode_params_t ; 01073 01074 typedef struct { 01075 void *table; 01076 uint8_t size; 01077 } loraphy_table_t; 01078 01079 typedef struct { 01080 channel_params_t *channel_list; 01081 uint8_t channel_list_size; 01082 01083 uint16_t *mask; 01084 uint16_t *default_mask; 01085 uint8_t mask_size; 01086 01087 } loraphy_channels_t; 01088 01089 typedef struct { 01090 bool duty_cycle_enabled; 01091 bool accept_tx_param_setup_req; 01092 bool fsk_supported; 01093 bool cflist_supported; 01094 bool custom_channelplans_supported; 01095 bool dl_channel_req_supported; 01096 01097 uint8_t default_channel_cnt; 01098 uint8_t cflist_channel_cnt; 01099 uint8_t max_channel_cnt; 01100 uint8_t min_tx_power; 01101 uint8_t max_tx_power; 01102 uint8_t default_tx_power; 01103 uint8_t adr_ack_limit; 01104 uint8_t adr_ack_delay; 01105 01106 uint8_t min_tx_datarate; 01107 uint8_t max_tx_datarate; 01108 uint8_t min_rx_datarate; 01109 uint8_t max_rx_datarate; 01110 uint8_t default_datarate; 01111 uint8_t default_max_datarate; 01112 uint8_t min_rx1_dr_offset; 01113 uint8_t max_rx1_dr_offset; 01114 uint8_t default_rx1_dr_offset; 01115 uint8_t dwell_limit_datarate; 01116 01117 uint16_t max_rx_window; 01118 uint16_t recv_delay1; 01119 uint16_t recv_delay2; 01120 uint16_t join_accept_delay1; 01121 uint16_t join_accept_delay2; 01122 uint16_t join_channel_mask; 01123 uint16_t max_fcnt_gap; 01124 uint16_t ack_timeout; 01125 uint16_t ack_timeout_rnd; 01126 01127 float default_max_eirp; 01128 float default_antenna_gain; 01129 01130 uint8_t rx_window2_datarate; 01131 uint32_t rx_window2_frequency; 01132 01133 loraphy_table_t bands; 01134 loraphy_table_t bandwidths; 01135 loraphy_table_t datarates; 01136 loraphy_table_t payloads; 01137 loraphy_table_t payloads_with_repeater; 01138 01139 loraphy_channels_t channels; 01140 01141 01142 unsigned ul_dwell_time_setting : 1; 01143 unsigned dl_dwell_time_setting : 1; 01144 01145 } loraphy_params_t; 01146 01147 01148 #endif /* MBED_OS_LORA_PHY_DATASTRUCTURES_ */
Generated on Tue Jul 12 2022 13:30:21 by
