phy_plme_trx.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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_TRX_H_INCLUDED
  43. #define PHY_PLME_TRX_H_INCLUDED
  44. #include <stdint.h>
  45. #include "phy_common.h"
  46. /** @file
  47. * This file contains declarations of PHY TRX routines and necessary types.
  48. *
  49. * @defgroup phy_trx PHY TRX API
  50. * @ingroup phy_15_4
  51. * @{
  52. * @brief Module to declare PHY Transceiver State API
  53. * @details The PHY TRX module declares Transceiver state change PHY routines and necessary types according to
  54. * the PHY specification. More specifically, PHY set TRX state request plme_set_trx_state_req(),
  55. * PHY TRX state change confirm plme_set_trx_state_conf() primitives are declared. An additional
  56. * primitive not covered by the standard is declared. This is plme_set_trx_state() which is a synchronous
  57. * version of plme_set_trx_state_req().
  58. */
  59. /**
  60. * @brief PLME-SET_TRX_STATE.request parameters.
  61. *
  62. * @details The PLME-SET_TRX_STATE.request primitive is generated
  63. * by the next higher layer of a device and issued to its PLME to
  64. * set transmitter status.
  65. *
  66. * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.7.1
  67. */
  68. typedef struct
  69. {
  70. /** One of PHY_RX_ON, PHY_TRX_OFF, PHY_FORCE_TRX_OFF, PHY_TX_ON or PHY_FORCE_TX_ON. */
  71. phy_enum_t state;
  72. } plme_trx_req_t;
  73. /**
  74. * @brief PLME-TRX.confirm parameters.
  75. *
  76. * @details The PLME-TRX.confirm primitive is generated by
  77. * PLME and issued to its next higher layer in response to
  78. * an PLME-SET_TRX_STATE.request primitive.
  79. *
  80. * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.8.1
  81. */
  82. typedef struct
  83. {
  84. /** Holds result of trx state change request.
  85. *
  86. * @details Equals to PHY_SUCCESS if state changed successfully
  87. * or current PHY state in either case.
  88. */
  89. phy_enum_t status;
  90. } plme_trx_conf_t;
  91. /**@brief PLME-SET_TRX_STATE request.
  92. *
  93. * @details Request PHY to change internal operating state.
  94. * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.7
  95. *
  96. * @param[in] req Pointer to PLME-SET_TRX_STATE.request parameters.
  97. * See @ref plme_trx_req_t.
  98. */
  99. void plme_set_trx_state_req(plme_trx_req_t * req);
  100. /**@brief PLME-SET_TRX_STATE.confirm callback function, implemented by the next higher layer.
  101. *
  102. * @details The PLME-SET_TRX_STATE.confirm primitive is generated
  103. * by the PLME and issued to its next higher layer in response to
  104. * an PLME-SET_TRX_STATE.request primitive.
  105. *
  106. * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.8
  107. *
  108. * @param[out] conf Pointer to PLME-TRX.confirm parameters. See @ref plme_trx_conf_t.
  109. */
  110. void plme_set_trx_state_conf(plme_trx_conf_t * conf);
  111. /**@brief Direct (synchronous) PLME-SET_TRX_STATE access.
  112. *
  113. * @details Optional. Not covered by the standard.
  114. * @param[in] state One of PHY_RX_ON, PHY_TRX_OFF, PHY_FORCE_TRX_OFF or PHY_TX_ON.
  115. *
  116. * @return PHY_SUCCESS if state changed successfully or current PHY state
  117. * in either case.
  118. */
  119. phy_enum_t plme_set_trx_state(phy_enum_t state);
  120. /** @} */
  121. #endif // PHY_PLME_TRX_H_INCLUDED