phy_plme_pib.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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 PHY_PLME_PIB_H_INCLUDED
  43. #define PHY_PLME_PIB_H_INCLUDED
  44. #include <stdint.h>
  45. #include <stddef.h>
  46. #include "phy_common.h"
  47. /** @file
  48. * This file contains declarations of PHY Information Base routines and necessary types.
  49. *
  50. * @defgroup phy_pib PHY PIB API
  51. * @ingroup phy_15_4
  52. * @{
  53. * @brief Module to declare PHY Information Base API
  54. * @details The PHY PIB module declares PHY Information Base routines and necessary types according to
  55. * the PHY specification. More specifically, PHY PIB Get request plme_get_req(), PHY PIB Set request
  56. * plme_set_req(), PHY PIB Get confirm plme_get_conf(), and PHY PIB Set confirm plme_set_conf()
  57. * primitives are declared. Two additional primitives not covered by the standard are declared. These are
  58. * plme_get() and plme_set() which are synchronous versions of plme_get_req() and plme_set_req() accordingly.
  59. */
  60. #define PHY_TX_POWER_TOLERANCE_1DB 0x00
  61. #define PHY_TX_POWER_TOLERANCE_3DB 0x40
  62. #define PHY_TX_POWER_TOLERANCE_6DB 0x80
  63. #define PHY_TX_POWER_TOLERANCE_MASK 0xC0
  64. /**
  65. * @brief PHY PIB attribute identificators.
  66. *
  67. * @details In accordance with IEEE Std 802.15.4-2006, section 6.4.2.
  68. */
  69. typedef enum
  70. {
  71. PHY_CURRENT_CHANNEL_ID = 0x00, /**< Current channel. */
  72. PHY_CHANNELS_SUPPORTED_ID = 0x01, /**< Supported channels. @note read only. */
  73. PHY_TRANSMIT_POWER_ID = 0x02, /**< Transmit power. */
  74. PHY_CCA_MODE_ID = 0x03, /**< CCA mode. */
  75. PHY_CURRENT_PAGE_ID = 0x04, /**< Current page. */
  76. PHY_MAX_FRAME_DURATION_ID = 0X05, /**< MAX Frame duration. @note read only. */
  77. PHY_SHR_DURATION_ID = 0x06, /**< SHR Duration. @note read only. */
  78. PHY_SYMBOLS_PER_OCTET_ID = 0x07, /**< Symbols per octet. @note read only. */
  79. } plme_pib_attr_id_t;
  80. /**
  81. * @brief PHY PIB attribute type sizes.
  82. *
  83. * @details In accordance with IEEE Std 802.15.4-2006, Table 23.
  84. */
  85. typedef union
  86. {
  87. uint8_t phy_current_channel; /**< Current channel. */
  88. uint32_t phy_channels_supported; /**< Supported channels. */
  89. int8_t phy_transmit_power; /**< Returns one of the DBM_xxx macro values. */
  90. uint8_t phy_cca_mode; /**< CCA mode. */
  91. uint8_t phy_current_page; /**< Current page. */
  92. uint16_t phy_max_frame_duration; /**< MAX Frame duration. */
  93. uint8_t phy_shr_duration; /**< SHR Duration. */
  94. uint16_t phy_symbols_per_octet; /**< Symbols per octet. */
  95. } phy_pib_item_t;
  96. /**@brief PLME-GET.request parameters.
  97. *
  98. * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.5.
  99. */
  100. typedef struct
  101. {
  102. plme_pib_attr_id_t pib_attribute; /**< PIB attribute. */
  103. } plme_get_req_t;
  104. /**@brief PLME-GET.confirm parameters.
  105. *
  106. * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.6.
  107. */
  108. typedef struct
  109. {
  110. phy_status_t status; /**< Status of operation. */
  111. plme_pib_attr_id_t pib_attribute; /**< PIB attribute. */
  112. phy_pib_item_t pib_attribute_value; /**< Attribute value. */
  113. } plme_get_conf_t;
  114. /**@brief PLME-SET.request parameters.
  115. *
  116. * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.9.
  117. */
  118. typedef struct
  119. {
  120. plme_pib_attr_id_t pib_attribute; /**< PIB attribute. */
  121. phy_pib_item_t pib_attribute_value; /**< Attribute value. */
  122. } plme_set_req_t;
  123. /**@brief PLME-SET.confirm parameters.
  124. *
  125. * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.10.
  126. */
  127. typedef struct
  128. {
  129. phy_status_t status; /**< Status of operation. */
  130. plme_pib_attr_id_t pib_attribute; /**< PIB attribute. */
  131. } plme_set_conf_t;
  132. /**@brief PLME-GET.request.
  133. *
  134. * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.5.
  135. *
  136. * @param[in] req Pointer to PLME-GET.request parameters. See @ref plme_get_req_t.
  137. */
  138. void plme_get_req(plme_get_req_t * req);
  139. /**@brief PLME-GET.confirm callback function, implemented by the next higher layer.
  140. *
  141. * @details The PLME-GET.confirm primitive is generated by the PLME and issued
  142. * to its next higher layer in response to an PLME-GET.request primitive.
  143. * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.6.
  144. *
  145. * @param[out] conf Pointer to PLME-GET.confirm parameters. See @ref plme_get_conf_t.
  146. */
  147. void plme_get_conf(plme_get_conf_t * conf);
  148. /**@brief PLME-SET.request.
  149. *
  150. * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.9.
  151. *
  152. * @param[in] req Pointer to PLME-SET.request parameters. See @ref plme_set_req_t.
  153. */
  154. void plme_set_req(plme_set_req_t * req);
  155. /**@brief PLME-SET.confirm callback function, implemented by the next higher layer.
  156. *
  157. * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.10.
  158. *
  159. * @param[out] conf Pointer to PLME-SET.confirm parameters. See @ref plme_set_conf_t.
  160. */
  161. void plme_set_conf(plme_set_conf_t * conf);
  162. /**
  163. * @brief Getting parameters from PIB directly (without request - confirm approach)
  164. *
  165. * @details Optional. Not covered by a standard.
  166. *
  167. * @param[in] id attribute id.
  168. * @param[out] mem pointer to memory for parameter storing.
  169. *
  170. * @return status of operation.
  171. */
  172. phy_status_t plme_get(plme_pib_attr_id_t id, void * mem);
  173. /**
  174. * @brief Setting parameters to PIB directly (without request - confirm approach)
  175. *
  176. * @details Optional. Not covered by a standard.
  177. *
  178. * @param[in] id attribute id.
  179. * @param[out] mem pointer to memory for parameter storing.
  180. *
  181. * @return status of operation.
  182. */
  183. phy_status_t plme_set(plme_pib_attr_id_t id, void * mem);
  184. /** @} */
  185. #endif // PHY_PLME_PIB_H_INCLUDED