diff options
Diffstat (limited to 'thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY')
6 files changed, 990 insertions, 0 deletions
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_common.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_common.h new file mode 100644 index 0000000..227d1ba --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_common.h @@ -0,0 +1,240 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef PHY_COMMON_H_INCLUDED +#define PHY_COMMON_H_INCLUDED + +/** @file + * This file contains declarations of commonly used PHY routines and necessary macros/types. + * + * @defgroup phy_common PHY Common API + * @ingroup phy_15_4 + * @{ + * @brief Module to declare Common PHY API + * @details The Common PHY module contains declarations of commonly used PHY routines and necessary macros/types. + */ + +/**@brief The maximum PSDU size (in octets) the PHY shall be able to receive (aMaxPHYPacketSize). + * + * @details See Table 22 - PHY constants. + */ +#define PHY_MAX_PACKET_SIZE 127 + + +/**@brief The maximum PHR size (in octets). + * + * @details See 6.3 PPDU format. + */ +#define PHY_MAX_HEADER_SIZE 1 + +/**@brief Maximum PPDU size */ +#define PHY_MAX_PPDU_SIZE (PHY_MAX_HEADER_SIZE + PHY_MAX_PACKET_SIZE) + +/**@brief Position of PHY header related to income PPDU start pointer.*/ +#define PHY_HEADER_POS (-1) + +/**@brief Size of PHY header in bytes.*/ +#define PHY_HEADER_SIZE 1 + +/**@brief Maximum channel number.*/ +#define PHY_MAX_CHANNEL_NUM 0x1Au + +/**@brief Minimum channel number.*/ +#define PHY_MIN_CHANNEL_NUM 0x0Bu + +// for 2400 MHz O-QPSK 1 octet = 2 symbols 1 symbol = 32bits chip +#define aMaxPHYPacketSize PHY_MAX_PACKET_SIZE // in octets +#define aTurnaroundTime 12 // in symbols + +#define aTurnaroundTimeUs 192 // in us + + +// Read only parameters +#define PHY_CURRENT_PAGE 0x0u +#define PHY_CHANNEL_SUPPORTED 0x07FFF800ul +#define PHY_SHR_DURATION 10u +#define PHY_MAX_FRAME_DURATION (PHY_SHR_DURATION + (int)((aMaxPHYPacketSize + 1) * PHY_SYMBOLS_PER_OCTET)) +#define PHY_SYMBOLS_PER_OCTET 2u + +// CCA values +#define PHY_TRX_CCA_MODE0 0 +#define PHY_TRX_CCA_MODE1 1 +#define PHY_TRX_CCA_MODE2 2 +#define PHY_TRX_CCA_MODE3 3 + + +/** @brief Minimum value that can be used to set radio transmit power. Equals + * to -32 dBm. + * + * This is a combination of digits which includes: + * 2 MSBs represent the tolerance on the transmit power + * 6 LSBs which may be written to, represent a signed integer in twos-complement format, + * corresponding to the nominal transmit power of the device in decibels relative to 1 mW. + * All combinations less than 0xBF are valid. + */ +#define PHY_MIN_TX_POWER 0x20 + +/** @brief Internal parameter of the PHY layer. + * + * @details Position of the sign bit inside transmit power attribute.*/ +#define PHY_TRANSMIT_POWER_SIGN_BIT_POS 5 + +/** @brief Internal parameter of the PHY layer. + * + * @details This mask hides transmit power from transmit power attribute value, + * but leaves precision bitfield. + */ +#define PHY_TRANSMIT_POWER_MASK 0xC0 + +/** @brief Internal parameter of the PHY layer. + * + * @details This mask hides precision bitfield from transmit power attribute value, + * leaving transmit power unchanged. + */ +#define PHY_TRANSMIT_POWER_MASK_INV 0x3F + +// Possible transmit power +#define DBM_11 ( 11 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_10 ( 10 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_9 ( 9 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_8 ( 8 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_7 ( 7 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_6 ( 6 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_5 ( 5 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_4 ( 4 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_3 ( 3 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_2 ( 2 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_1 ( 1 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_0 ( 0 & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_1 (( -1) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_2 (( -2) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_3 (( -3) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_4 (( -4) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_5 (( -5) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_6 (( -6) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_7 (( -7) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_8 (( -8) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_9 (( -9) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_10 ((-10) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_11 ((-11) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_12 ((-12) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_13 ((-13) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_14 ((-14) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_15 ((-15) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_16 ((-16) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_17 ((-17) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_18 ((-18) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_19 ((-19) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_20 ((-20) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_21 ((-21) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_22 ((-22) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_23 ((-23) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_24 ((-24) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_25 ((-25) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_26 ((-26) & PHY_TRANSMIT_POWER_MASK_INV) +#define DBM_MIN_27 ((-27) & PHY_TRANSMIT_POWER_MASK_INV) + + +/**@brief Common PHY enumerations description used in various PHY primitives. + * + * @details See Table 18-PHY enumerations description for detailed info on the statuses up to PHY_READ_ONLY. + * The statuses with higher numbers are implementation specific and used for synchronous API only. + */ +typedef enum +{ + /** The CCA attempt has detected a busy channel. */ + PHY_BUSY = 0x00, + + /** The transceiver is asked to change its state while receiving. */ + PHY_BUSY_RX = 0x01, + + /** The transceiver is asked to change its state while transmitting. */ + PHY_BUSY_TX = 0x02, + + /** The transceiver is to be switched off immediately. */ + PHY_FORCE_TRX_OFF = 0x03, + + /** The CCA attempt has detected an idle channel. */ + PHY_IDLE = 0x04, + + /** A SET/GET request was issued with a parameter in the primitive that is + out of the valid range. */ + PHY_INVALID_PARAMETER = 0x05, + + /** The transceiver is in or is to be configured into the receiver enabled state. */ + PHY_RX_ON = 0x06, + + /** A SET/GET, an ED operation, or a transceiver state change was successful. */ + PHY_SUCCESS = 0x07, + + /** The transceiver is in or is to be configured into the transceiver disabled state. */ + PHY_TRX_OFF = 0x08, + + /** The transceiver is in or is to be configured into the transmitter enabled state. */ + PHY_TX_ON = 0x09, + + /** A SET/GET request was issued with the identifier of an attribute that is not supported. */ + PHY_UNSUPPORTED_ATTRIBUTE = 0x0A, + + /** A SET/GET request was issued with the identifier of an attribute that is read-only.*/ + PHY_READ_ONLY = 0x0B, + + + /* Statuses out of the standard. They are used for synchronous API */ + /** Transceiver is forced to change it's state to PHY_TX_ON (potential packet drop). */ + PHY_FORCE_TX_ON = 0xFC, + + /** Data cannot be sent due to failed CCA results.*/ + PHY_CHANNEL_ACCESS_FAILURE = 0xFD, + + /** Data had been sent but ACK frame hasn't been received.*/ + PHY_NO_ACK = 0xFE, + + /** PHY is not available for synchronous access */ + PHY_IS_NOT_AVAILABLE = 0xFF +} phy_enum_t; + +/**@brief PHY status type.*/ +typedef phy_enum_t phy_status_t; + +/** @} */ + +#endif // PHY_COMMON_H_INCLUDED diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_pd_data.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_pd_data.h new file mode 100644 index 0000000..1009dc2 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_pd_data.h @@ -0,0 +1,187 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef PHY_PD_DATA_H_INCLUDED +#define PHY_PD_DATA_H_INCLUDED + + +#include <stdint.h> +#include <stdbool.h> +#include "sys_utils.h" +#include "sys_time.h" +#include "phy_common.h" +#include "mac_time.h" +#include "sys_queue.h" + +/** @file + * This file contains declarations of PHY Data transmission routines and necessary types. + * + * @defgroup phy_data PHY Data API + * @ingroup phy_15_4 + * @{ + * @brief Module to declare PHY Data API + * @details The PHY Data module declares the PHY Data transmission routines and necessary types according to + * the PHY specification. More specifically, PHY data request pd_data_req(), PHY data confirm + * pd_data_conf(), and PHY Data indication pd_data_ind() primitives are declared. + */ + +/**@brief PD-DATA.request parameters. + * + * @details See 6.2.1.1 PD-DATA.request. + * See Table 6 - PD-DATA.request parameters. + */ +typedef struct +{ + /** The set of octets forming the PSDU to be transmitted by the PHY entity. */ + uint8_t * psdu; + + /** The number of octets contained in the PSDU to be transmitted by the PHY entity. + Valid range: less or equal to @ref PHY_MAX_PACKET_SIZE. */ + uint8_t psdu_length; +} pd_data_req_t; + +/**@brief Private information which is passed with PD-DATA.confirm. + * Not covered by standard. + */ +typedef struct +{ + /** pending value to store pending bit value if frame was acknowledged. */ + bool pending; +} pd_data_conf_private_t; + +/**@brief PD-DATA.confirm parameters. + * + * @details See 6.2.1.2 PD-DATA.confirm. + * See Table 7 - PD-DATA.confirm parameters. + */ +typedef struct +{ + /** Service field. */ + pd_data_conf_private_t service; + + /** The result of the request to transmit a packet. + * Valid range: PHY_SUCCESS, PHY_RX_ON, PHY_TRX_OFF, PHY_BUSY_TX. + * See @ref phy_enum_t. + * + * When radio chip successfully transmits data, but cannot receive + * ACK in FAST_ACK mode, the result is PHY_TX_ON. + */ + phy_enum_t status; +} pd_data_conf_t; + +/**@brief Private information which is passed with PD-DATA.indication. + * Not covered by standard. + */ +typedef struct +{ + /** RSSI value, which corresponds to packet that caused this indication. */ + int8_t rssi; + + /** Buffer to store incoming frame. */ + uint8_t frame_buffer[PHY_MAX_PACKET_SIZE + PHY_MAX_HEADER_SIZE]; + + /** Timestamp of the moment when PHY header octet reception has been started. */ + mac_timestamp_t timestamp; + + /** This field allows storing instances of this structure in a queue. */ + sys_queue_item_t queue_item; +#ifdef CONFIG_PHY_CERT_CRC_HOOK + bool crc_status; +#endif +} pd_data_ind_private_t; + +/**@brief PD-DATA.indication parameters. + * + * @details See 6.2.1.3 PD-DATA.indication. + * See Table 8 - PD-DATA.indication parameters. + */ +typedef struct +{ + /** Service field. */ + pd_data_ind_private_t service; + + /** The set of octets forming the PSDU received by the PHY entity. */ + uint8_t * psdu; + + /** The number of octets contained in the PSDU received by the PHY entity. + Valid range: less or equal to @ref PHY_MAX_PACKET_SIZE. */ + uint8_t psdu_length; + + /** Link quality (LQI) value measured during reception of the PPDU (see 6.9.8). + Valid range: 0x00 - 0xFF. */ + uint8_t ppdu_link_quality; +} pd_data_ind_t; + +/**@brief PD-DATA.request primitive. + * + * @details The PD-DATA.request primitive requests the transfer of an MPDU (i.e., PSDU) + * from the MAC sublayer to the local PHY entity. + * See 6.2.1.1 PD-DATA.request. + * + * @param[in] req Pointer to PD-DATA.request parameters. See @ref pd_data_req_t. + */ +void pd_data_req(pd_data_req_t * req); + +/**@brief PD-DATA.confirm primitive. + * + * @details Callback function, implemented by the next higher layer, + * which handles the PD-DATA.confirm primitive. + * See 6.2.1.2 PD-DATA.confirm. + * + * @param[out] conf Pointer to PD-DATA.confirm parameters. See @ref pd_data_conf_t. + */ +void pd_data_conf(pd_data_conf_t * conf); + +/**@brief PD-DATA.indication primitive. + * + * @details The PD-DATA.indication primitive indicates the transfer of an MPDU (i.e., PSDU) + * from the PHY to the local MAC sublayer entity. + * See 6.2.1.3 PD-DATA.indication. + * This function must be implemented by the next higher layer. + * + * @param[out] ind Pointer to PD-DATA.indication parameters. See @ref pd_data_ind_t. + * Data are valid until next fully received packet. + */ +void pd_data_ind(pd_data_ind_t * ind); + +/** @} */ + +#endif // PHY_PD_DATA_H_INCLUDED diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_cca.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_cca.h new file mode 100644 index 0000000..2779ff1 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_cca.h @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef PHY_PLME_CCA_H_INCLUDED +#define PHY_PLME_CCA_H_INCLUDED + +#include <stdint.h> +#include "phy_common.h" + +/** @file + * This file contains declarations of Clear Channel Assessment PHY routines and necessary types. + * + * @defgroup phy_cca PHY CCA API + * @ingroup phy_15_4 + * @{ + * @brief Module to declare PHY Clear Channel Assessment API + * @details The PHY CCA module declares Clear Channel Assessment PHY routines and necessary types according to + * the PHY specification. More specifically, PHY CCA request plme_cca_req(), PHY CCA confirm + * plme_cca_conf() primitives are declared. An additional primitive not covered by the standard is declared. + * This is plme_cca() which is a synchronous version of plme_cca_req(). + */ + +/**@brief PLME-CCA.confirm parameters + * + * @details The PLME-CCA.confirm primitive is generated by + * the initiating PLME and issued to its next higher layer + * in response to an PLME-CCA.request primitive. + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.2.1 + */ +typedef struct +{ + /** One of PHY_TRX_OFF, PHY_BUSY or PHY_IDLE. */ + phy_enum_t status; +} plme_cca_conf_t; + + +/**@brief PLME-CCA.request + * + * @details Request for clear channel assessment. + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.1 + */ +void plme_cca_req(void); + + +/**@brief PLME-CCA.confirm callback function, implemented by the next higher layer. + * + * @details The PLME-CCA.confirm primitive is generated by the PLME and issued + * to its next higher layer in response to an PLME-CCA.request primitive. + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.2 + * + * @param[out] conf Pointer to PLME-CCA.confirm parameters + */ +void plme_cca_conf(plme_cca_conf_t * conf); + + +/**@brief Direct (synchronous) PLME-CCA.request + * + * @details Optional. Not covered by a standard. + * + * @return One of PHY_TRX_OFF, PHY_BUSY or PHY_IDLE, + * or implementation defined error code in case of + * unavailability of access to system resources. + */ +phy_enum_t plme_cca(void); + +/** @} */ + +#endif // PHY_PLME_CCA_H_INCLUDED diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_ed.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_ed.h new file mode 100644 index 0000000..7517bae --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_ed.h @@ -0,0 +1,110 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef PHY_PLME_ED_H_INCLUDED +#define PHY_PLME_ED_H_INCLUDED + +#include <stdint.h> +#include "phy_common.h" + +/** @file + * This file contains declarations of Energy Detection PHY routines and necessary types. + * + * @defgroup phy_ed PHY ED API + * @ingroup phy_15_4 + * @{ + * @brief Module to declare PHY Energy Detection API + * @details The PHY ED module declares Energy Detection PHY routines and necessary types according to + * the PHY specification. More specifically, PHY ED request plme_ed_req(), PHY ED confirm + * plme_ed_conf() primitives are declared. + */ + +/**@brief Describes the current state of the ED algorithm. */ +typedef enum +{ + PHY_PLME_ED_STATE_IDLE, /**< Algorithm is idle. */ + PHY_PLME_ED_STATE_BUSY /**< Currently performing ED. */ +} phy_plme_ed_state_t; + +/**@brief This structure holds static data of this module. */ +typedef struct +{ + phy_plme_ed_state_t state; +} phy_plme_ed_mem_t; + +/**@brief PLME-ED.confirm parameters. + * + * @details The PLME-ED.confirm primitive is generated by the PLME and issued + * to its next higher layer in response to an PLME-ED.request primitive. + * + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.4.1. + */ +typedef struct +{ + /** One of PHY_SUCCESS, PHY_TRX_OFF or PHY_TX_ON. */ + phy_enum_t status; + + /** Energy level for the current channel, if status is SUCCESS. */ + uint8_t energy_level; +} plme_ed_conf_t; + + +/**@brief PLME-ED.request. + * + * @details Request ED measurement for the current channel. + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.3. + */ +void plme_ed_req(void); + + +/**@brief The PLME-ED.confirm callback function, implemented by the next higher layer. + * + * @details The PLME-ED.confirm primitive is generated by the PLME and issued + * to its next higher layer in response to an PLME-ED.request primitive. + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.4. + * + * @param[out] conf Pointer to PLME-ED.confirm parameters + */ +void plme_ed_conf(plme_ed_conf_t * conf); + +/** @} */ + +#endif // PHY_PLME_ED_H_INCLUDED diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_pib.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_pib.h new file mode 100644 index 0000000..7a1f6f6 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_pib.h @@ -0,0 +1,212 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef PHY_PLME_PIB_H_INCLUDED +#define PHY_PLME_PIB_H_INCLUDED + +#include <stdint.h> +#include <stddef.h> +#include "phy_common.h" + +/** @file + * This file contains declarations of PHY Information Base routines and necessary types. + * + * @defgroup phy_pib PHY PIB API + * @ingroup phy_15_4 + * @{ + * @brief Module to declare PHY Information Base API + * @details The PHY PIB module declares PHY Information Base routines and necessary types according to + * the PHY specification. More specifically, PHY PIB Get request plme_get_req(), PHY PIB Set request + * plme_set_req(), PHY PIB Get confirm plme_get_conf(), and PHY PIB Set confirm plme_set_conf() + * primitives are declared. Two additional primitives not covered by the standard are declared. These are + * plme_get() and plme_set() which are synchronous versions of plme_get_req() and plme_set_req() accordingly. + */ + +#define PHY_TX_POWER_TOLERANCE_1DB 0x00 +#define PHY_TX_POWER_TOLERANCE_3DB 0x40 +#define PHY_TX_POWER_TOLERANCE_6DB 0x80 +#define PHY_TX_POWER_TOLERANCE_MASK 0xC0 + +/** + * @brief PHY PIB attribute identificators. + * + * @details In accordance with IEEE Std 802.15.4-2006, section 6.4.2. + */ +typedef enum +{ + PHY_CURRENT_CHANNEL_ID = 0x00, /**< Current channel. */ + PHY_CHANNELS_SUPPORTED_ID = 0x01, /**< Supported channels. @note read only. */ + PHY_TRANSMIT_POWER_ID = 0x02, /**< Transmit power. */ + PHY_CCA_MODE_ID = 0x03, /**< CCA mode. */ + PHY_CURRENT_PAGE_ID = 0x04, /**< Current page. */ + PHY_MAX_FRAME_DURATION_ID = 0X05, /**< MAX Frame duration. @note read only. */ + PHY_SHR_DURATION_ID = 0x06, /**< SHR Duration. @note read only. */ + PHY_SYMBOLS_PER_OCTET_ID = 0x07, /**< Symbols per octet. @note read only. */ +} plme_pib_attr_id_t; + + +/** + * @brief PHY PIB attribute type sizes. + * + * @details In accordance with IEEE Std 802.15.4-2006, Table 23. + */ +typedef union +{ + uint8_t phy_current_channel; /**< Current channel. */ + uint32_t phy_channels_supported; /**< Supported channels. */ + int8_t phy_transmit_power; /**< Returns one of the DBM_xxx macro values. */ + uint8_t phy_cca_mode; /**< CCA mode. */ + uint8_t phy_current_page; /**< Current page. */ + uint16_t phy_max_frame_duration; /**< MAX Frame duration. */ + uint8_t phy_shr_duration; /**< SHR Duration. */ + uint16_t phy_symbols_per_octet; /**< Symbols per octet. */ +} phy_pib_item_t; + + +/**@brief PLME-GET.request parameters. + * + * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.5. + */ +typedef struct +{ + plme_pib_attr_id_t pib_attribute; /**< PIB attribute. */ +} plme_get_req_t; + + +/**@brief PLME-GET.confirm parameters. + * + * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.6. + */ +typedef struct +{ + phy_status_t status; /**< Status of operation. */ + plme_pib_attr_id_t pib_attribute; /**< PIB attribute. */ + phy_pib_item_t pib_attribute_value; /**< Attribute value. */ +} plme_get_conf_t; + + +/**@brief PLME-SET.request parameters. + * + * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.9. + */ +typedef struct +{ + plme_pib_attr_id_t pib_attribute; /**< PIB attribute. */ + phy_pib_item_t pib_attribute_value; /**< Attribute value. */ +} plme_set_req_t; + + +/**@brief PLME-SET.confirm parameters. + * + * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.10. + */ +typedef struct +{ + phy_status_t status; /**< Status of operation. */ + plme_pib_attr_id_t pib_attribute; /**< PIB attribute. */ +} plme_set_conf_t; + + +/**@brief PLME-GET.request. + * + * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.5. + * + * @param[in] req Pointer to PLME-GET.request parameters. See @ref plme_get_req_t. + */ +void plme_get_req(plme_get_req_t * req); + + +/**@brief PLME-GET.confirm callback function, implemented by the next higher layer. + * + * @details The PLME-GET.confirm primitive is generated by the PLME and issued + * to its next higher layer in response to an PLME-GET.request primitive. + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.6. + * + * @param[out] conf Pointer to PLME-GET.confirm parameters. See @ref plme_get_conf_t. + */ +void plme_get_conf(plme_get_conf_t * conf); + + +/**@brief PLME-SET.request. + * + * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.9. + * + * @param[in] req Pointer to PLME-SET.request parameters. See @ref plme_set_req_t. + */ +void plme_set_req(plme_set_req_t * req); + + +/**@brief PLME-SET.confirm callback function, implemented by the next higher layer. + * + * @details In accordance with IEEE Std 802.15.4-2006, section 6.2.2.10. + * + * @param[out] conf Pointer to PLME-SET.confirm parameters. See @ref plme_set_conf_t. + */ +void plme_set_conf(plme_set_conf_t * conf); + +/** + * @brief Getting parameters from PIB directly (without request - confirm approach) + * + * @details Optional. Not covered by a standard. + * + * @param[in] id attribute id. + * @param[out] mem pointer to memory for parameter storing. + * + * @return status of operation. + */ +phy_status_t plme_get(plme_pib_attr_id_t id, void * mem); + + +/** + * @brief Setting parameters to PIB directly (without request - confirm approach) + * + * @details Optional. Not covered by a standard. + * + * @param[in] id attribute id. + * @param[out] mem pointer to memory for parameter storing. + * + * @return status of operation. + */ +phy_status_t plme_set(plme_pib_attr_id_t id, void * mem); + +/** @} */ + +#endif // PHY_PLME_PIB_H_INCLUDED diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_trx.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_trx.h new file mode 100644 index 0000000..075f178 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/802_15_4/api/PHY/phy_plme_trx.h @@ -0,0 +1,135 @@ +/** + * Copyright (c) 2016 - 2018 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh. + * + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef PHY_PLME_TRX_H_INCLUDED +#define PHY_PLME_TRX_H_INCLUDED + +#include <stdint.h> +#include "phy_common.h" + +/** @file + * This file contains declarations of PHY TRX routines and necessary types. + * + * @defgroup phy_trx PHY TRX API + * @ingroup phy_15_4 + * @{ + * @brief Module to declare PHY Transceiver State API + * @details The PHY TRX module declares Transceiver state change PHY routines and necessary types according to + * the PHY specification. More specifically, PHY set TRX state request plme_set_trx_state_req(), + * PHY TRX state change confirm plme_set_trx_state_conf() primitives are declared. An additional + * primitive not covered by the standard is declared. This is plme_set_trx_state() which is a synchronous + * version of plme_set_trx_state_req(). + */ + +/** + * @brief PLME-SET_TRX_STATE.request parameters. + * + * @details The PLME-SET_TRX_STATE.request primitive is generated + * by the next higher layer of a device and issued to its PLME to + * set transmitter status. + * + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.7.1 + */ +typedef struct +{ + /** One of PHY_RX_ON, PHY_TRX_OFF, PHY_FORCE_TRX_OFF, PHY_TX_ON or PHY_FORCE_TX_ON. */ + phy_enum_t state; +} plme_trx_req_t; + + +/** + * @brief PLME-TRX.confirm parameters. + * + * @details The PLME-TRX.confirm primitive is generated by + * PLME and issued to its next higher layer in response to + * an PLME-SET_TRX_STATE.request primitive. + * + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.8.1 + */ +typedef struct +{ + /** Holds result of trx state change request. + * + * @details Equals to PHY_SUCCESS if state changed successfully + * or current PHY state in either case. + */ + phy_enum_t status; +} plme_trx_conf_t; + + +/**@brief PLME-SET_TRX_STATE request. + * + * @details Request PHY to change internal operating state. + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.7 + * + * @param[in] req Pointer to PLME-SET_TRX_STATE.request parameters. + * See @ref plme_trx_req_t. + */ +void plme_set_trx_state_req(plme_trx_req_t * req); + + +/**@brief PLME-SET_TRX_STATE.confirm callback function, implemented by the next higher layer. + * + * @details The PLME-SET_TRX_STATE.confirm primitive is generated + * by the PLME and issued to its next higher layer in response to + * an PLME-SET_TRX_STATE.request primitive. + * + * In accordance with IEEE Std 802.15.4-2006, section 6.2.2.8 + * + * @param[out] conf Pointer to PLME-TRX.confirm parameters. See @ref plme_trx_conf_t. + */ +void plme_set_trx_state_conf(plme_trx_conf_t * conf); + + +/**@brief Direct (synchronous) PLME-SET_TRX_STATE access. + * + * @details Optional. Not covered by the standard. + + * @param[in] state One of PHY_RX_ON, PHY_TRX_OFF, PHY_FORCE_TRX_OFF or PHY_TX_ON. + * + * @return PHY_SUCCESS if state changed successfully or current PHY state + * in either case. + */ +phy_enum_t plme_set_trx_state(phy_enum_t state); + +/** @} */ + +#endif // PHY_PLME_TRX_H_INCLUDED |