mac_mlme_start.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /**
  2. * Copyright (c) 2016 - 2020 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh.
  3. *
  4. * All Rights Reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. *
  10. * 1. Redistributions of source code must retain the above copyright notice, this
  11. * list of conditions and the following disclaimer.
  12. *
  13. * 2. Redistributions in binary form, except as embedded into a Nordic
  14. * Semiconductor ASA integrated circuit in a product or a software update for
  15. * such product, must reproduce the above copyright notice, this list of
  16. * conditions and the following disclaimer in the documentation and/or other
  17. * materials provided with the distribution.
  18. *
  19. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * 4. This software, with or without modification, must only be used with a
  24. * Nordic Semiconductor ASA integrated circuit.
  25. *
  26. * 5. Any software provided in binary form under this license must not be reverse
  27. * engineered, decompiled, modified and/or disassembled.
  28. *
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  31. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  32. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  34. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  35. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  36. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  38. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  39. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. *
  41. */
  42. #ifndef MAC_MLME_START_H_INCLUDED
  43. #define MAC_MLME_START_H_INCLUDED
  44. #if (CONFIG_START_ENABLED == 1)
  45. #include <stdint.h>
  46. #include "mac_common.h"
  47. #include "sys_utils.h"
  48. #include "mac_task_scheduler.h"
  49. /** @file
  50. * The MAC MLME Start module declares the MAC Start primitives and necessary types
  51. * according to the MAC specification.
  52. *
  53. * @defgroup mac_start MAC MLME Start API
  54. * @ingroup mac_15_4
  55. * @{
  56. * @brief Module to declare MAC MLME Start API.
  57. * @details The MAC Start module declares MLME Start primitives and necessary types according to
  58. * the MAC specification. More specifically, MLME Start request aka mlme_start_req(), and MLME
  59. * Start confirm callback typedef aka mlme_start_conf_cb_t primitives are declared.
  60. */
  61. /**@brief MLME-Start.confirm
  62. *
  63. * @details The MLME-Start.confirm primitive reports the results of a request
  64. * to start the device.
  65. *
  66. * In accordance with IEEE Std 802.15.4-2006, section 7.1.14.1.2
  67. */
  68. typedef struct
  69. {
  70. mac_status_t status; /**< Status of operation. */
  71. } mlme_start_conf_t;
  72. /**
  73. * @brief MLME-START.request
  74. *
  75. * @details The MLME-START.request primitive allows the PAN coordinator
  76. * to initiate a new PAN or to start using a new superframe configuration.
  77. * This primitive may also be used by a device already associated with an
  78. * existing PAN to start using a new superframe configuration.
  79. *
  80. * In accordance with IEEE Std 802.15.4-2006, section 7.1.14.1.1
  81. */
  82. typedef struct
  83. {
  84. /** Do not edit this field. */
  85. mac_abstract_req_t service;
  86. /** Confirm to this request. */
  87. mlme_start_conf_t confirm;
  88. uint16_t pan_id; /**< PAN ID. */
  89. uint8_t logical_channel; /**< Logical channel. */
  90. #ifdef CONFIG_SUB_GHZ
  91. uint8_t channel_page; /**< Channel page. */
  92. #endif
  93. uint32_t start_time; /**< Start time. */
  94. uint8_t beacon_order; /**< Beacon order. */
  95. uint8_t superframe_order; /**< Superframe order. */
  96. bool pan_coordinator; /**< Is PAN Coordinator? */
  97. bool battery_life_extension; /**< Is battery life long? */
  98. bool coord_realignment; /**< Is coordinator realignment? */
  99. #if (CONFIG_SECURE == 1)
  100. /* The security parameters for the coordinator realignment are declared below. */
  101. uint8_t coord_realign_security_level; /**< Security level. */
  102. uint8_t coord_realign_key_id_mode; /**< Key ID mode. */
  103. uint64_t coord_realign_key_source; /**< Key source. */
  104. uint8_t coord_realign_key_index; /**< Key index. */
  105. /* The security parameters for the beacon are declared below. */
  106. uint8_t beacon_security_level; /**< Security level. */
  107. uint8_t beacon_key_id_mode; /**< Key ID mode. */
  108. uint64_t beacon_key_source; /**< Key source. */
  109. uint8_t beacon_key_index; /**< Key index. */
  110. #endif
  111. } mlme_start_req_t;
  112. /**
  113. * @brief Callback to the next higher layer.
  114. *
  115. * @details After request completion, passed callback
  116. * will be issued with status provided as a parameter.
  117. *
  118. * In accordance with IEEE Std 802.15.4-2006, section 7.1.14.2.2
  119. */
  120. typedef void (* mlme_start_conf_cb_t)(mlme_start_conf_t *);
  121. /**
  122. * @brief MLME-START request.
  123. *
  124. * @details Generated by the next higher layer and issued to its MLME to
  125. * request that a device starts using a new superframe configuration.
  126. *
  127. * @param[in] req MLME-START request structure.
  128. * @param[in] conf_cb pointer to user callback.
  129. *
  130. * In accordance with IEEE Std 802.15.4-2006, section 7.1.14.1.2
  131. */
  132. void mlme_start_req(mlme_start_req_t * req, mlme_start_conf_cb_t conf_cb);
  133. /** @} */
  134. #endif // (CONFIG_START_ENABLED == 1)
  135. #endif // MAC_MLME_START_H_INCLUDED