phy_plme_ed.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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_ED_H_INCLUDED
  43. #define PHY_PLME_ED_H_INCLUDED
  44. #include <stdint.h>
  45. #include "phy_common.h"
  46. /** @file
  47. * This file contains declarations of Energy Detection PHY routines and necessary types.
  48. *
  49. * @defgroup phy_ed PHY ED API
  50. * @ingroup phy_15_4
  51. * @{
  52. * @brief Module to declare PHY Energy Detection API
  53. * @details The PHY ED module declares Energy Detection PHY routines and necessary types according to
  54. * the PHY specification. More specifically, PHY ED request plme_ed_req(), PHY ED confirm
  55. * plme_ed_conf() primitives are declared.
  56. */
  57. /**@brief Describes the current state of the ED algorithm. */
  58. typedef enum
  59. {
  60. PHY_PLME_ED_STATE_IDLE, /**< Algorithm is idle. */
  61. PHY_PLME_ED_STATE_BUSY /**< Currently performing ED. */
  62. } phy_plme_ed_state_t;
  63. /**@brief This structure holds static data of this module. */
  64. typedef struct
  65. {
  66. phy_plme_ed_state_t state;
  67. } phy_plme_ed_mem_t;
  68. /**@brief PLME-ED.confirm parameters.
  69. *
  70. * @details The PLME-ED.confirm primitive is generated by the PLME and issued
  71. * to its next higher layer in response to an PLME-ED.request primitive.
  72. *
  73. * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.4.1.
  74. */
  75. typedef struct
  76. {
  77. /** One of PHY_SUCCESS, PHY_TRX_OFF or PHY_TX_ON. */
  78. phy_enum_t status;
  79. /** Energy level for the current channel, if status is SUCCESS. */
  80. uint8_t energy_level;
  81. } plme_ed_conf_t;
  82. /**@brief PLME-ED.request.
  83. *
  84. * @details Request ED measurement for the current channel.
  85. * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.3.
  86. */
  87. void plme_ed_req(void);
  88. /**@brief The PLME-ED.confirm callback function, implemented by the next higher layer.
  89. *
  90. * @details The PLME-ED.confirm primitive is generated by the PLME and issued
  91. * to its next higher layer in response to an PLME-ED.request primitive.
  92. * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.4.
  93. *
  94. * @param[out] conf Pointer to PLME-ED.confirm parameters
  95. */
  96. void plme_ed_conf(plme_ed_conf_t * conf);
  97. /** @} */
  98. #endif // PHY_PLME_ED_H_INCLUDED