mac_mlme_rx_enable.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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_RX_ENABLE_H_INCLUDED
  43. #define MAC_MLME_RX_ENABLE_H_INCLUDED
  44. #if (CONFIG_RXE_ENABLED == 1)
  45. #include <stdint.h>
  46. #include <stdbool.h>
  47. #include "mac_common.h"
  48. #include "mac_task_scheduler.h"
  49. /** @file
  50. * The MAC MLME RX-Enable module declares the MAC RX-Enable primitives and necessary types
  51. * according to the MAC specification.
  52. *
  53. * @defgroup mac_rx_enable MAC MLME RX-Enable API
  54. * @ingroup mac_15_4
  55. * @{
  56. * @brief Module to declare MAC MLME RX-Enable API.
  57. * @details The MAC RX-Enable module declares MLME RX-Enable primitives and necessary types according to
  58. * the MAC specification. More specifically, MLME RX-Enable request aka mlme_rx_enable_req(),
  59. * and MLME RX-Enable confirm callback typedef aka mlme_rx_enable_conf_cb_t primitives are
  60. * declared. One additional primitive not covered by the standard is declared. This is
  61. * mlme_rx_enable() which is synchronous (i.e. does not require confirmation) version of
  62. * mlme_rx_enable_req().
  63. */
  64. /**
  65. * @brief MLME-RX-ENABLE.confirm
  66. *
  67. * @details The MLME-RX-ENABLE.confirm primitive reports the results of an attempt
  68. * to enable or disable the receiver.
  69. *
  70. * In accordance with IEEE Std 802.15.4-2006, section 7.1.10.2
  71. */
  72. typedef struct
  73. {
  74. mac_status_t status; /**< Status of operation. */
  75. } mlme_rx_enable_conf_t;
  76. /**
  77. * @brief MLME-RX-ENABLE.request
  78. *
  79. * @details The MLME-RX-ENABLE.request primitive allows the next higher layer
  80. * to request that the receiver is either enabled for a finite period of time or disabled.
  81. *
  82. * In accordance with IEEE Std 802.15.4-2006, section 7.1.10.1
  83. */
  84. typedef struct
  85. {
  86. /** Do not edit this field. */
  87. mac_abstract_req_t service;
  88. /** Confirm to this request. */
  89. mlme_rx_enable_conf_t confirm;
  90. /**
  91. * @details
  92. * TRUE if the requested operation can be deferred until the next superframe
  93. * if the requested time has already passed.
  94. * FALSE if the requested operation is only to be attempted in the current superframe.
  95. *
  96. * If the issuing device is the PAN coordinator, the term superframe refers to its own
  97. * superframe. Otherwise, the term refers to the superframe of the coordinator through
  98. * which the issuing device is associated.
  99. *
  100. * @note This parameter is ignored for nonbeacon-enabled PANs.
  101. */
  102. bool defer_permit;
  103. /**
  104. * @details
  105. * The number of symbols measured from the start of the superframe before the receiver is
  106. * to be enabled or disabled.
  107. * This is a 24-bit value, and the precision of this value shall be a minimum of 20 bits,
  108. * with the lowest 4 bits being the least significant.
  109. *
  110. * If the issuing device is the PAN coordinator, the term superframe refers to its own
  111. * superframe. Otherwise, the term refers to the superframe of the coordinator through
  112. * which the issuing device is associated.
  113. *
  114. * @note This parameter is ignored for nonbeacon-enabled PANs.
  115. */
  116. uint32_t rx_on_time;
  117. /**
  118. * The number of symbols the receiver is to be enabled for.
  119. *
  120. * If this parameter is equal to 0x000000, the receiver is to be disabled.
  121. */
  122. uint32_t rx_on_duration;
  123. } mlme_rx_enable_req_t;
  124. /**
  125. * @brief Customer's function of confirmation.
  126. *
  127. * @details The MLME-RX-ENABLE.confirm primitive is generated by the MLME and issued to
  128. * its next higher layer in response to an MLME-RX-ENABLE.request primitive.
  129. *
  130. * @param pointer to a confirmation primitive.
  131. */
  132. typedef void (* mlme_rx_enable_conf_cb_t)(mlme_rx_enable_conf_t *);
  133. /**
  134. * @brief MLME-RX-ENABLE.request service
  135. *
  136. * @details The MLME-RX-ENABLE.request primitive is generated by the next higher layer and
  137. * issued to the MLME to enable the receiver for a fixed duration, at a time relative to the
  138. * start of the current or next superframe on a beacon-enabled PAN or immediately on a
  139. * nonbeacon-enabled PAN. This primitive may also be generated to cancel a previously generated
  140. * request to enable the receiver. After request completion, user callback will be issued with
  141. * valid data stored in structure mlme_rx_enable_conf_t.
  142. *
  143. * @note The receiver is enabled or disabled exactly once per primitive request.
  144. *
  145. * @param[in] req pointer to MLME-RX-ENABLE request structure.
  146. * @param[in] conf_cb - pointer to confirm function (user callback).
  147. *
  148. * In accordance with IEEE Std 802.15.4-2006, section 7.1.10.1
  149. */
  150. void mlme_rx_enable_req(mlme_rx_enable_req_t * req, mlme_rx_enable_conf_cb_t conf_cb);
  151. /**
  152. * @brief Enables permission for receiving.
  153. *
  154. * @details Optional. Not covered by a standard.
  155. *
  156. * @param[in] req pointer to MLME-RX-ENABLE request structure.
  157. *
  158. * @return status of operation.
  159. */
  160. mac_status_t mlme_rx_enable(mlme_rx_enable_req_t * req);
  161. /** @} */
  162. #endif // (CONFIG_RXE_ENABLED == 1)
  163. #endif // MAC_MLME_RX_ENABLE_H_INCLUDED