Import Mbed OS hard-float snapshot
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
/***************************************************************************//**
|
||||
* @brief RAIL Configuration
|
||||
* @copyright Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com
|
||||
******************************************************************************/
|
||||
//=============================================================================
|
||||
//
|
||||
// WARNING: Auto-Generated Radio Config - DO NOT EDIT
|
||||
//
|
||||
//=============================================================================
|
||||
#include <stdint.h>
|
||||
|
||||
const uint32_t ieee802154_config_863[] = {
|
||||
0x01010FF4UL, 0x00000000UL,
|
||||
0x01010FF8UL, 0x0003C000UL,
|
||||
0x01010FFCUL, 0x0003C008UL,
|
||||
0x00010004UL, 0x00157001UL,
|
||||
0x00010008UL, 0x0000007FUL,
|
||||
0x00010018UL, 0x00000000UL,
|
||||
0x0001001CUL, 0x00000000UL,
|
||||
0x00010028UL, 0x00000000UL,
|
||||
0x0001002CUL, 0x00000000UL,
|
||||
0x00010030UL, 0x00000000UL,
|
||||
0x00010034UL, 0x00000000UL,
|
||||
0x0001003CUL, 0x00000000UL,
|
||||
0x00010040UL, 0x000007A0UL,
|
||||
0x00010048UL, 0x00000000UL,
|
||||
0x00010054UL, 0x00000000UL,
|
||||
0x00010058UL, 0x00000000UL,
|
||||
0x000100A0UL, 0x00004000UL,
|
||||
0x000100A4UL, 0x00004CFFUL,
|
||||
0x000100A8UL, 0x00004100UL,
|
||||
0x000100ACUL, 0x00004DFFUL,
|
||||
0x00012000UL, 0x00000704UL,
|
||||
0x00012010UL, 0x00000000UL,
|
||||
0x00012018UL, 0x00008408UL,
|
||||
0x00013008UL, 0x0000AC3FUL,
|
||||
0x0001302CUL, 0x021EB000UL,
|
||||
0x00013030UL, 0x00108000UL,
|
||||
0x00013034UL, 0x00000003UL,
|
||||
0x0001303CUL, 0x00014000UL,
|
||||
0x00013040UL, 0x00000000UL,
|
||||
0x000140A0UL, 0x0F00277AUL,
|
||||
0x000140F4UL, 0x00001020UL,
|
||||
0x00014134UL, 0x00000880UL,
|
||||
0x00014138UL, 0x000087F6UL,
|
||||
0x00014140UL, 0x00880048UL,
|
||||
0x00014144UL, 0x1153E6C0UL,
|
||||
0x00016014UL, 0x00000010UL,
|
||||
0x00016018UL, 0x04127920UL,
|
||||
0x0001601CUL, 0x0051C007UL,
|
||||
0x00016020UL, 0x000000C2UL,
|
||||
0x00016024UL, 0x00000000UL,
|
||||
0x00016028UL, 0x03000000UL,
|
||||
0x0001602CUL, 0x00000000UL,
|
||||
0x00016030UL, 0x00FF0BF4UL,
|
||||
0x00016034UL, 0x00000C20UL,
|
||||
0x00016038UL, 0x0102000AUL,
|
||||
0x0001603CUL, 0x00080430UL,
|
||||
0x00016040UL, 0x000000A7UL,
|
||||
0x00016044UL, 0x00000000UL,
|
||||
0x00016048UL, 0x04602123UL,
|
||||
0x0001604CUL, 0x0000A47CUL,
|
||||
0x00016050UL, 0x00000018UL,
|
||||
0x00016054UL, 0x00000000UL,
|
||||
0x00016058UL, 0x00000000UL,
|
||||
0x0001605CUL, 0x30100101UL,
|
||||
0x00016060UL, 0x7F7F7050UL,
|
||||
0x00016064UL, 0x00000000UL,
|
||||
0x00017014UL, 0x000270F1UL,
|
||||
0x00017018UL, 0x00001700UL,
|
||||
0x0001701CUL, 0x82840000UL,
|
||||
0x00017028UL, 0x00000000UL,
|
||||
0x00017048UL, 0x0000383EUL,
|
||||
0x0001704CUL, 0x000025BCUL,
|
||||
0x00017070UL, 0x00010103UL,
|
||||
0x00017074UL, 0x00000442UL,
|
||||
0x00017078UL, 0x006D8480UL,
|
||||
0xFFFFFFFFUL,
|
||||
};
|
||||
const uint32_t ieee802154_config_863_min[] = {
|
||||
0xFFFFFFFFUL,
|
||||
};
|
||||
|
||||
const uint32_t ieee802154_config_915[] = {
|
||||
0x01010FF4UL, 0x00000000UL,
|
||||
0x01010FF8UL, 0x0003C000UL,
|
||||
0x01010FFCUL, 0x0003C008UL,
|
||||
0x00010004UL, 0x00157001UL,
|
||||
0x00010008UL, 0x0000007FUL,
|
||||
0x00010018UL, 0x00000000UL,
|
||||
0x0001001CUL, 0x00000000UL,
|
||||
0x00010028UL, 0x00000000UL,
|
||||
0x0001002CUL, 0x00000000UL,
|
||||
0x00010030UL, 0x00000000UL,
|
||||
0x00010034UL, 0x00000000UL,
|
||||
0x0001003CUL, 0x00000000UL,
|
||||
0x00010040UL, 0x000007A0UL,
|
||||
0x00010048UL, 0x00000000UL,
|
||||
0x00010054UL, 0x00000000UL,
|
||||
0x00010058UL, 0x00000000UL,
|
||||
0x000100A0UL, 0x00004000UL,
|
||||
0x000100A4UL, 0x00004CFFUL,
|
||||
0x000100A8UL, 0x00004100UL,
|
||||
0x000100ACUL, 0x00004DFFUL,
|
||||
0x00012000UL, 0x00000704UL,
|
||||
0x00012010UL, 0x00000000UL,
|
||||
0x00012018UL, 0x00008408UL,
|
||||
0x00013008UL, 0x0000AC3FUL,
|
||||
0x0001302CUL, 0x02364000UL,
|
||||
0x00013030UL, 0x00108000UL,
|
||||
0x00013034UL, 0x00000003UL,
|
||||
0x0001303CUL, 0x00014000UL,
|
||||
0x00013040UL, 0x00000000UL,
|
||||
0x000140A0UL, 0x0F00277AUL,
|
||||
0x000140F4UL, 0x00001020UL,
|
||||
0x00014134UL, 0x00000880UL,
|
||||
0x00014138UL, 0x000087F6UL,
|
||||
0x00014140UL, 0x00880048UL,
|
||||
0x00014144UL, 0x1153E6C0UL,
|
||||
0x00016014UL, 0x00000010UL,
|
||||
0x00016018UL, 0x04127920UL,
|
||||
0x0001601CUL, 0x0051C007UL,
|
||||
0x00016020UL, 0x000000C2UL,
|
||||
0x00016024UL, 0x00000000UL,
|
||||
0x00016028UL, 0x03000000UL,
|
||||
0x0001602CUL, 0x00000000UL,
|
||||
0x00016030UL, 0x00FF04C8UL,
|
||||
0x00016034UL, 0x000008A2UL,
|
||||
0x00016038UL, 0x0100000AUL,
|
||||
0x0001603CUL, 0x00080430UL,
|
||||
0x00016040UL, 0x000000A7UL,
|
||||
0x00016044UL, 0x00000000UL,
|
||||
0x00016048UL, 0x0AC02123UL,
|
||||
0x0001604CUL, 0x0000A47CUL,
|
||||
0x00016050UL, 0x00000018UL,
|
||||
0x00016054UL, 0x00000000UL,
|
||||
0x00016058UL, 0x00000000UL,
|
||||
0x0001605CUL, 0x30100101UL,
|
||||
0x00016060UL, 0x7F7F7050UL,
|
||||
0x00016064UL, 0x00000000UL,
|
||||
0x00017014UL, 0x000270F1UL,
|
||||
0x00017018UL, 0x00001700UL,
|
||||
0x0001701CUL, 0x82840000UL,
|
||||
0x00017028UL, 0x00000000UL,
|
||||
0x00017048UL, 0x0000383EUL,
|
||||
0x0001704CUL, 0x000025BCUL,
|
||||
0x00017070UL, 0x00010103UL,
|
||||
0x00017074UL, 0x00000442UL,
|
||||
0x00017078UL, 0x006D8480UL,
|
||||
0xFFFFFFFFUL,
|
||||
};
|
||||
const uint32_t ieee802154_config_915_min[] = {
|
||||
0xFFFFFFFFUL,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
/***************************************************************************//**
|
||||
* @file ieee802154_gb868_efr32xg1_configurator_out.h
|
||||
* @brief IEEE802154 GB868_Configuration
|
||||
* @copyright Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __IEEE802154_GB868_EFR32XG1_CONFIGURATOR_OUT_H__
|
||||
#define __IEEE802154_GB868_EFR32XG1_CONFIGURATOR_OUT_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define IEEE802154_863_RADIO_CONFIG_BASE_FREQUENCY 868300000UL
|
||||
#define IEEE802154_863_RADIO_CONFIG_XTAL_FREQUENCY 38400000UL
|
||||
#define IEEE802154_863_RADIO_CONFIG_BITRATE "100kbps"
|
||||
#define IEEE802154_863_RADIO_CONFIG_MODULATION_TYPE "OQPSK"
|
||||
#define IEEE802154_863_RADIO_CONFIG_DEVIATION "333.3kHz"
|
||||
|
||||
extern const uint32_t ieee802154_config_863[];
|
||||
extern const uint32_t ieee802154_config_863_min[];
|
||||
|
||||
#define IEEE802154_915_RADIO_CONFIG_BASE_FREQUENCY 906000000UL
|
||||
#define IEEE802154_915_RADIO_CONFIG_XTAL_FREQUENCY 38400000UL
|
||||
#define IEEE802154_915_RADIO_CONFIG_BITRATE "250kbps"
|
||||
#define IEEE802154_915_RADIO_CONFIG_MODULATION_TYPE "OQPSK"
|
||||
#define IEEE802154_915_RADIO_CONFIG_DEVIATION "333.3kHz"
|
||||
|
||||
extern const uint32_t ieee802154_config_915[];
|
||||
extern const uint32_t ieee802154_config_915_min[];
|
||||
|
||||
#endif // __IEEE802154_GB868_EFR32XG1_CONFIGURATOR_OUT_H__
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,239 @@
|
||||
/***************************************************************************//**
|
||||
* @file rail_ble.h
|
||||
* @brief The BLE specific header file for the RAIL library.
|
||||
* @copyright Copyright 2016 Silicon Laboratories, Inc. www.silabs.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __RAIL_BLE_H__
|
||||
#define __RAIL_BLE_H__
|
||||
|
||||
// Get the standard include types
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// Get the RAIL specific structures and types
|
||||
#include "rail_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// @addtogroup BLE
|
||||
/// @ingroup Protocol_Specific
|
||||
/// Accelerator routines for Bluetooth Low Energy (BLE).
|
||||
///
|
||||
/// The APIs in this module help take care of configuring the radio for BLE
|
||||
/// operation and provide some additional helper routines necessary for
|
||||
/// normal BLE send/receive that aren't available directly in RAIL. All normal
|
||||
/// RAIL APIs should be used to setup the application; however,
|
||||
/// RAIL_ConfigChannels() and RAIL_ConfigRadio() should not be called to setup
|
||||
/// the PHY. Instead, the RAIL_BLE_Config* APIs should be used to setup the
|
||||
/// 1Mbps, 2Mbps, or Coded PHY configuration needed by the application. These
|
||||
/// APIs will configure the hardware and also configure the set of valid BLE
|
||||
/// channels.
|
||||
///
|
||||
/// To implement a standard BLE link layer you will also need to handle tight
|
||||
/// turnaround times and send packets at specific instants. This can all be
|
||||
/// managed through general RAIL functions like RAIL_ScheduleTx(),
|
||||
/// RAIL_ScheduleRx(), and RAIL_SetStateTiming(). See the full RAIL API for more
|
||||
/// useful functions.
|
||||
///
|
||||
/// A simple example of how to setup your application to be in BLE mode is shown
|
||||
/// below. Note that this will put the radio on the first advertising channel
|
||||
/// with the advertising Access Address. In any full featured BLE application you
|
||||
/// will need to use the RAIL_BLE_ConfigChannelRadioParams() function to change
|
||||
/// the sync word and other parameters as needed based on your connection.
|
||||
///
|
||||
/// @code{.c}
|
||||
///
|
||||
/// // RAIL Handle set at init time
|
||||
/// static RAIL_Handle_t railHandle = NULL;
|
||||
///
|
||||
/// // Put the radio into receive on the first BLE advertising channel
|
||||
/// int bleAdvertiseEnable(void)
|
||||
/// {
|
||||
/// // Call the BLE initialization function to load the right radio config
|
||||
/// RAIL_BLE_Init(railHandle);
|
||||
///
|
||||
/// // Always choose the Viterbi PHY configuration if available on your chip
|
||||
/// // for performance reasons.
|
||||
/// RAIL_BLE_ConfigPhy1MbpsViterbi(railHandle);
|
||||
///
|
||||
/// // Configure us for the first advertising channel (Physical: 0, Logical: 37)
|
||||
/// // The CRC init value and Access Address come from the BLE specification.
|
||||
/// RAIL_BLE_ConfigChannelRadioParams(railHandle,
|
||||
/// 0x555555,
|
||||
/// 0x8E89BED6,
|
||||
/// 37,
|
||||
/// false);
|
||||
///
|
||||
/// // Start receiving on physical channel 0 (logical channel 37)
|
||||
/// RAIL_StartRx(railHandle, 0, NULL);
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// @{
|
||||
|
||||
/**
|
||||
* @enum RAIL_BLE_Coding_t
|
||||
* @brief The variant of the BLE Coded PHY
|
||||
*/
|
||||
RAIL_ENUM(RAIL_BLE_Coding_t) {
|
||||
RAIL_BLE_Coding_125kbps = 0,
|
||||
RAIL_BLE_Coding_125kbps_DSA = 1,
|
||||
RAIL_BLE_Coding_500kbps = 2,
|
||||
RAIL_BLE_Coding_500kbps_DSA = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct RAIL_BLE_State_t
|
||||
* @brief State structure for BLE.
|
||||
*
|
||||
* This structure must be allocated in application global read-write memory
|
||||
* that persists for the duration of BLE usage. It cannot be allocated
|
||||
* in read-only memory or on the call stack.
|
||||
*/
|
||||
typedef struct RAIL_BLE_State {
|
||||
uint32_t crcInit; /**< The value used for CRC initialization. */
|
||||
uint32_t accessAddress; /**< The access address used for the connection. */
|
||||
uint16_t channel; /**< The logical channel used. */
|
||||
bool disableWhitening; /**< Whether the whitening engine should be off. */
|
||||
} RAIL_BLE_State_t;
|
||||
|
||||
/**
|
||||
* Configure RAIL to run in BLE mode.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* This function will change your radio and channel configuration and other
|
||||
* parameters to match what is needed for BLE. If you need to switch back to a
|
||||
* default RAIL mode then you must call RAIL_BLE_Deinit() first. This function
|
||||
* will configure the protocol output on PTI to \ref RAIL_PTI_PROTOCOL_BLE.
|
||||
*/
|
||||
void RAIL_BLE_Init(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Take RAIL out of BLE mode.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* This function will undo some of the configuration that happens when you call
|
||||
* RAIL_BLE_Init(). After this you can safely run your normal radio
|
||||
* initialization code to use a non-BLE configuration. This function will \b
|
||||
* not change back your radio or channel configurations so you must do this by
|
||||
* manually reinitializing. This also resets the protocol output on PTI to \ref
|
||||
* RAIL_PTI_PROTOCOL_CUSTOM.
|
||||
*/
|
||||
void RAIL_BLE_Deinit(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Determine whether BLE mode is enabled or not.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* @return True if BLE mode is enabled and false otherwise.
|
||||
* This function returns the current status of RAIL's BLE mode. It is enabled by
|
||||
* a call to RAIL_BLE_Init() and disabled by a call to RAIL_BLE_Deinit().
|
||||
*/
|
||||
bool RAIL_BLE_IsEnabled(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Switch the Viterbi 1Mbps BLE PHY.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* You can use this function to switch back to the defualt BLE 1Mbps PHY if you
|
||||
* have switched to the 2Mbps or another configuration. You may only call this
|
||||
* function after initializing BLE and while the radio is idle.
|
||||
*/
|
||||
RAIL_Status_t RAIL_BLE_ConfigPhy1MbpsViterbi(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Switch the legacy non-Viterbi 1Mbps BLE PHY.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* You can use this function to switch back to the legacy BLE 1Mbps PHY if you
|
||||
* have switched to the 2Mbps or another configuration. You may only call this
|
||||
* function after initializing BLE and while the radio is idle.
|
||||
*/
|
||||
RAIL_Status_t RAIL_BLE_ConfigPhy1Mbps(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Switch the Viterbi 2Mbps BLE PHY.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* You can use this function to switch back to the BLE 2Mbps PHY from the
|
||||
* default 1Mbps option. You may only call this function after initializing BLE
|
||||
* and while the radio is idle.
|
||||
*
|
||||
* @note Not all chips support the 2Mbps PHY. Consult your part's reference
|
||||
* manual to be sure that it does before trying this.
|
||||
*/
|
||||
RAIL_Status_t RAIL_BLE_ConfigPhy2MbpsViterbi(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Switch the legacy non-Viterbi 2Mbps BLE PHY.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* You can use this function to switch back to legacy BLE 2Mbps PHY from the
|
||||
* default 1Mbps option. You may only call this function after initializing BLE
|
||||
* and while the radio is idle.
|
||||
*
|
||||
* @note Not all chips support the 2Mbps PHY. Consult your part's reference
|
||||
* manual to be sure that it does before trying this.
|
||||
*/
|
||||
RAIL_Status_t RAIL_BLE_ConfigPhy2Mbps(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Switch to the BLE Coded PHY.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* @param[in] bleCoding The RAIL_BLE_Coding_t to use
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* You can use this function to switch back to BLE Coded PHY from the default
|
||||
* 1Mbps option. You may only call this function after initializing BLE and
|
||||
* while the radio is idle. When using a BLE Coded PHY, the subPhy in
|
||||
* RAIL_AppendedInfo_t marks the coding of the received packet. A subPhy of 0
|
||||
* marks a 500kbps packet, and a subPhy of 1 marks a 125kbps packet.
|
||||
*
|
||||
* @note Not all chips support the BLE Coded PHY. Consult your part's reference
|
||||
* manual to be sure that it does before trying this.
|
||||
*/
|
||||
RAIL_Status_t RAIL_BLE_ConfigPhyCoded(RAIL_Handle_t railHandle,
|
||||
RAIL_BLE_Coding_t bleCoding);
|
||||
|
||||
/**
|
||||
* Helper function to change BLE radio parameters.
|
||||
*
|
||||
* @param[in] railHandle Handle for RAIL instance.
|
||||
* @param[in] crcInit The value to use for CRC initialization.
|
||||
* @param[in] accessAddress The access address to use for the connection.
|
||||
* @param[in] channel The logical channel that you're changing to. This is used to
|
||||
* initialize the whitener if you're using whitening.
|
||||
* @param[in] disableWhitening This can turn off the whitening engine and is useful
|
||||
* for sending BLE test mode packets that don't have this turned on.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* This function can be used to switch radio parameters on every connection
|
||||
* and/or channel change. It is BLE-aware and will set the access address,
|
||||
* preamble, CRC initialization value, and whitening configuration without
|
||||
* requiring you to load a new radio config.
|
||||
*/
|
||||
RAIL_Status_t RAIL_BLE_ConfigChannelRadioParams(RAIL_Handle_t railHandle,
|
||||
uint32_t crcInit,
|
||||
uint32_t accessAddress,
|
||||
uint16_t channel,
|
||||
bool disableWhitening);
|
||||
|
||||
/** @} */ // end of BLE
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __RAIL_BLE_H__
|
||||
@@ -0,0 +1,487 @@
|
||||
/***************************************************************************//**
|
||||
* @file rail_ieee802154.h
|
||||
* @brief The IEEE 802.15.4 specific header file for the RAIL library.
|
||||
* @copyright Copyright 2016 Silicon Laboratories, Inc. www.silabs.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __RAIL_IEEE802154_H__
|
||||
#define __RAIL_IEEE802154_H__
|
||||
|
||||
#include "rail_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// @addtogroup IEEE802_15_4 IEEE 802.15.4
|
||||
/// @ingroup Protocol_Specific
|
||||
/// @brief IEEE 802.15.4 configuration routines
|
||||
///
|
||||
/// The functions in this group configure RAIL IEEE 802.15.4 hardware
|
||||
/// acceleration which includes IEEE 802.15.4 format filtering, address
|
||||
/// filtering, acking, and filtering based on the frame type.
|
||||
///
|
||||
/// To configure IEEE 802.15.4 functionality, the application must first setup
|
||||
/// a RAIL instance as normal with RAIL_Init() and other setup functions.
|
||||
/// Instead of RAIL_ConfigChannels() and RAIL_ConfigRadio(), however, an
|
||||
/// application may use RAIL_IEEE802154_Config2p4GHzRadio() to setup the
|
||||
/// official IEEE 2.4GHz 802.15.4 PHY. This configuration is shown below.
|
||||
///
|
||||
/// @code{.c}
|
||||
/// static RAIL_Handle_t railHandle = NULL; // Initialized somewhere else
|
||||
///
|
||||
/// static const RAIL_IEEE802154_Config_t rail154Config = {
|
||||
/// .addresses = NULL,
|
||||
/// .ackConfig = {
|
||||
/// .enable = true, // Turn on auto ACK for IEEE 802.15.4
|
||||
/// .ackTimeout = 864, // 54 symbols * 16 us/symbol = 864 us
|
||||
/// .rxTransitions = {
|
||||
/// .success = RAIL_RF_STATE_TX, // Go to Tx to send the ACK
|
||||
/// .error = RAIL_RF_STATE_RX, // For an always on device stay in Rx
|
||||
/// },
|
||||
/// .txTransitions = {
|
||||
/// .success = RAIL_RF_STATE_RX, // Go to Rx for receiving the ACK
|
||||
/// .error = RAIL_RF_STATE_RX, // For an always on device stay in Rx
|
||||
/// },
|
||||
/// },
|
||||
/// .timings = {
|
||||
/// .idleToRx = 100,
|
||||
/// .idleToTx = 100,
|
||||
/// .rxToTx = 192, // 12 symbols * 16 us/symbol = 192 us
|
||||
/// .txToRx = 192, // 12 symbols * 16 us/symbol = 192 us
|
||||
/// .rxSearchTimeout = 0, // not used
|
||||
/// .txToRxSearchTimeout = 0, // not used
|
||||
/// },
|
||||
/// .framesMask = RAIL_IEEE802154_ACCEPT_STANDARD_FRAMES,
|
||||
/// .promiscuousMode = false, // Enable format and address filtering
|
||||
/// .isPanCoordinator = false,
|
||||
/// };
|
||||
///
|
||||
/// void config154(void)
|
||||
/// {
|
||||
/// // Configure the radio and channels for 2.4GHz IEEE 802.15.4
|
||||
/// RAIL_IEEE802154_Config2p4GHzRadio(railHandle);
|
||||
/// // Initialize the IEEE 802.15.4 config using the static config above
|
||||
/// RAIL_IEEE802154_Init(railHandle, &rail154Config);
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// To configure address filtering the application can call
|
||||
/// RAIL_IEEE802154_SetAddresses() with a structure containing all addresses or
|
||||
/// can call the individual RAIL_IEEE802154_SetPanId(),
|
||||
/// RAIL_IEEE802154_SetShortAddress(), and RAIL_IEEE802154_SetLongAddress()
|
||||
/// APIs. RAIL supports \ref RAIL_IEEE802154_MAX_ADDRESSES number of address
|
||||
/// pairs for situations where you want to receive packets from multiple IEEE
|
||||
/// 802.15.4 networks at the same time. Broadcast addresses are supported by
|
||||
/// default without any additional configuration so they do not consume one of
|
||||
/// these slots. If the application does not require all address pairs be sure
|
||||
/// to set unused ones to the proper disabled value for each type. These can
|
||||
/// be found in the \ref RAIL_IEEE802154_AddrConfig_t documentation. Below is
|
||||
/// an example of setting filtering for one set of addresses.
|
||||
///
|
||||
/// @code{.c}
|
||||
/// // PanID OTA value of 0x34 0x12
|
||||
/// // Short Address OTA byte order of 0x78 0x56
|
||||
/// // Long address with OTA byte order of 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88
|
||||
///
|
||||
/// // Setup all address simultaneously
|
||||
/// RAIL_Status_t setup1(void)
|
||||
/// {
|
||||
/// RAIL_IEEE802154_AddrConfig_t nodeAddress = {
|
||||
/// { 0x1234, 0xFFFF, 0xFFFF },
|
||||
/// { 0x5678, 0xFFFF, 0xFFFF },
|
||||
/// { { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 },
|
||||
/// { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
/// { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
|
||||
/// };
|
||||
/// return RAIL_IEEE802154_SetAddresses(railHandle, &nodeAddress);
|
||||
/// }
|
||||
///
|
||||
/// // Alternatively the addresses can be setup individually as follows:
|
||||
/// RAIL_Status_t setup2(void)
|
||||
/// {
|
||||
/// RAIL_Status_t status;
|
||||
/// const uint8_t longAddress[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 };
|
||||
///
|
||||
/// status = RAIL_IEEE802154_SetPanId(railHandle, 0x1234, 0);
|
||||
/// if (status != RAIL_STATUS_NO_ERROR) {
|
||||
/// return status
|
||||
/// }
|
||||
/// status = RAIL_IEEE802154_SetShortAddress(railHandle, 0x5678, 0);
|
||||
/// if (status != RAIL_STATUS_NO_ERROR) {
|
||||
/// return status
|
||||
/// }
|
||||
/// status = RAIL_IEEE802154_SetLongAddress(railHandle, longAddress, 0);
|
||||
/// if (status != RAIL_STATUS_NO_ERROR) {
|
||||
/// return status
|
||||
/// }
|
||||
///
|
||||
/// return RAIL_STATUS_NO_ERROR;
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// Address filtering will be enabled except when in promiscuous mode which can
|
||||
/// be set with RAIL_IEEE802154_SetPromiscuousMode(). The addresses may be
|
||||
/// changed at runtime but if you are receiving a packet while reconfiguring the
|
||||
/// address filters you may get undesired behavior so it's safest to do this
|
||||
/// while not in receive.
|
||||
///
|
||||
/// Auto ACK is controlled by the ackConfig and timings fields passed to
|
||||
/// RAIL_IEEE802154_Init(). After initialization though they may be controlled
|
||||
/// using the normal \ref Auto_Ack and \ref State_Transitions APIs. When in IEEE
|
||||
/// 802.15.4 mode the ACK will have a 5 byte length, the frame type will be set
|
||||
/// to ack, and the frame pending bit will be set if
|
||||
/// RAIL_IEEE802154_SetFramePending() is called when the \ref
|
||||
/// RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND event is triggered. This event
|
||||
/// must be turned on by the user and will fire whenever a data request is being
|
||||
/// received so that the stack can determine whether there is pending data. Be
|
||||
/// aware that the frame pending bit must be set quickly after receiving the
|
||||
/// event or the ACK may already have been transmitted. Check the return code of
|
||||
/// RAIL_IEEE802154_SetFramePending() to be sure that the bit was set in time.
|
||||
///
|
||||
/// Transmit and receive operations are all done using the standard RAIL APIs in
|
||||
/// IEEE 802.15.4 mode. To send packets using the correct CSMA configuration
|
||||
/// there is a \ref RAIL_CSMA_CONFIG_802_15_4_2003_2p4_GHz_OQPSK_CSMA define
|
||||
/// that can initialize the csmaConfig structure passed to \ref
|
||||
/// RAIL_StartCcaCsmaTx().
|
||||
/// @{
|
||||
|
||||
/**
|
||||
* @enum RAIL_IEEE802154_AddressLength_t
|
||||
* @brief Different lengths that an 802.15.4 address can have
|
||||
*/
|
||||
RAIL_ENUM(RAIL_IEEE802154_AddressLength_t) {
|
||||
RAIL_IEEE802154_ShortAddress = 2, /**< 2 byte short address. */
|
||||
RAIL_IEEE802154_LongAddress = 3, /**< 8 byte extended address. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct RAIL_IEEE802154_Address_t
|
||||
* @brief Representation of 802.15.4 address
|
||||
* This structure is only used for a received address, which needs to be parsed
|
||||
* to discover the type.
|
||||
*/
|
||||
typedef struct RAIL_IEEE802154_Address{
|
||||
/** Convenient storage for different address types */
|
||||
union {
|
||||
uint16_t shortAddress; /**< Present for 2 byte addresses. */
|
||||
uint8_t longAddress[8]; /**< Present for 8 byte addresses. */
|
||||
};
|
||||
/**
|
||||
* Enum of the received address length
|
||||
*/
|
||||
RAIL_IEEE802154_AddressLength_t length;
|
||||
} RAIL_IEEE802154_Address_t;
|
||||
|
||||
/** The maximum number of allowed addresses of each type. */
|
||||
#define RAIL_IEEE802154_MAX_ADDRESSES 3
|
||||
|
||||
/**
|
||||
* @struct RAIL_IEEE802154_AddrConfig_t
|
||||
* @brief Configuration structure for IEEE 802.15.4 Address Filtering. The
|
||||
* broadcast addresses are handled separately, and do not need to be specified
|
||||
* here. Any address to be ignored should be set with all bits high.
|
||||
*
|
||||
* This structure allows configuration of dual-PAN functionality, by specifying
|
||||
* multiple PAN IDs and short addresses. A packet will be received if it
|
||||
* matches either PAN ID and the long address. The short addresses are specific
|
||||
* to a given PAN, so the first short address goes with the first PAN ID, and
|
||||
* not with the second PAN ID. The broadcast PAN ID and address will work with
|
||||
* any address or PAN ID, respectively.
|
||||
*/
|
||||
typedef struct RAIL_IEEE802154_AddrConfig{
|
||||
/**
|
||||
* PAN IDs for destination filtering. Both must be specified.
|
||||
* To disable a PAN ID, set it to the broadcast value, 0xFFFF.
|
||||
*/
|
||||
uint16_t panId[RAIL_IEEE802154_MAX_ADDRESSES];
|
||||
/**
|
||||
* Short network addresses for destination filtering. Both must be specified.
|
||||
* To disable a short address, set it to the broadcast value, 0xFFFF.
|
||||
*/
|
||||
uint16_t shortAddr[RAIL_IEEE802154_MAX_ADDRESSES];
|
||||
/**
|
||||
* 64 bit address for destination filtering. Both must be specified.
|
||||
* This field is parsed in over-the-air (OTA) byte order. To disable a long
|
||||
* address, set it to the reserved value of 0x00 00 00 00 00 00 00 00.
|
||||
*/
|
||||
uint8_t longAddr[RAIL_IEEE802154_MAX_ADDRESSES][8];
|
||||
} RAIL_IEEE802154_AddrConfig_t;
|
||||
|
||||
/**
|
||||
* @struct RAIL_IEEE802154_Config_t
|
||||
* @brief Configuration structure for IEEE 802.15.4 in RAIL
|
||||
*/
|
||||
typedef struct RAIL_IEEE802154_Config {
|
||||
/**
|
||||
* Configure the RAIL Address Filter to allow the given destination
|
||||
* addresses. If addresses is NULL, defer destination address configuration.
|
||||
* If a member of addresses is NULL, defer configuration of just that member.
|
||||
* This can be overridden via RAIL_IEEE802154_SetAddresses(), or the
|
||||
* individual members can be changed via RAIL_IEEE802154_SetPanId(),
|
||||
* RAIL_IEEE802154_SetShortAddress(), and RAIL_IEEE802154_SetLongAddress().
|
||||
*/
|
||||
const RAIL_IEEE802154_AddrConfig_t *addresses;
|
||||
/**
|
||||
* Defines the acking configuration for the IEEE 802.15.4 implementation
|
||||
*/
|
||||
RAIL_AutoAckConfig_t ackConfig;
|
||||
/**
|
||||
* Defines state timings for the IEEE 802.15.4 implementation
|
||||
*/
|
||||
RAIL_StateTiming_t timings;
|
||||
/**
|
||||
* Set which 802.15.4 frame types will be received, of Beacon, Data, Ack, and
|
||||
* Command. This setting can be overridden via RAIL_IEEE802154_AcceptFrames().
|
||||
*/
|
||||
uint8_t framesMask;
|
||||
/**
|
||||
* Enable promiscuous mode during configuration. This can be overridden via
|
||||
* RAIL_IEEE802154_SetPromiscuousMode() afterwards.
|
||||
*/
|
||||
bool promiscuousMode;
|
||||
/**
|
||||
* Set whether the device is a PAN Coordinator during configuration. This can
|
||||
* be overridden via RAIL_IEEE802154_SetPanCoordinator() afterwards.
|
||||
*/
|
||||
bool isPanCoordinator;
|
||||
} RAIL_IEEE802154_Config_t;
|
||||
|
||||
/**
|
||||
* Initialize RAIL for IEEE802.15.4 features
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @param[in] fifteenFourConfig IEEE802154 configuration struct
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* This function calls the following RAIL functions to configure the radio for
|
||||
* IEEE802.15.4 features.
|
||||
*
|
||||
* Initializes the following:
|
||||
* - Enables IEEE802154 hardware acceleration
|
||||
* - Configures RAIL Auto Ack functionality
|
||||
* - Configures RAIL Address Filter for 802.15.4 address filtering
|
||||
*
|
||||
* It calls the following functions:
|
||||
* - RAIL_ConfigAutoAck()
|
||||
* - RAIL_SetRxTransitions()
|
||||
* - RAIL_SetTxTransitions()
|
||||
* - RAIL_SetStateTiming()
|
||||
* - RAIL_ConfigAddressFilter()
|
||||
* - RAIL_EnableAddressFilter()
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_Init(RAIL_Handle_t railHandle,
|
||||
const RAIL_IEEE802154_Config_t *fifteenFourConfig);
|
||||
|
||||
/**
|
||||
* Configures the radio for 2.4GHz 802.15.4 operation
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* This initializes the radio for 2.4GHz operation. It takes the place of
|
||||
* calling \ref RAIL_ConfigRadio and \ref RAIL_ConfigChannels. After this call,
|
||||
* channels 11-26 will be available, giving the frequencies of those channels
|
||||
* on channel page 0, as defined by IEEE 802.15.4-2011 section 8.1.2.2.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_Config2p4GHzRadio(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* De-initializes IEEE802.15.4 hardware acceleration
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* Disables and resets all IEE802.15.4 hardware acceleration features. This
|
||||
* function should only be called when the radio is IDLE. This calls the
|
||||
* following:
|
||||
* - RAIL_SetStateTiming(), to reset all timings to 100 us
|
||||
* - RAIL_EnableAddressFilter(false)
|
||||
* - RAIL_ResetAddressFilter()
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_Deinit(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Return whether IEEE802.15.4 hardware acceleration is currently enabled.
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @return True if IEEE802.15.4 hardware acceleration was enabled to start with
|
||||
* and false otherwise
|
||||
*/
|
||||
bool RAIL_IEEE802154_IsEnabled(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Configure the RAIL Address Filter for 802.15.4 filtering
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @param[in] addresses The address information that should be used
|
||||
* @return Status code indicating success of the function call. If this returns
|
||||
* an error, then the 802.15.4 address filter is in an undefined state.
|
||||
*
|
||||
* Set up the 802.15.4 address filter to accept messages to the given
|
||||
* addresses. This will return false if any of the addresses failed to be set.
|
||||
* If NULL is passed in for addresses, then all addresses will be set to their
|
||||
* reset value.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_SetAddresses(RAIL_Handle_t railHandle,
|
||||
const RAIL_IEEE802154_AddrConfig_t *addresses);
|
||||
|
||||
/**
|
||||
* Set a PAN ID for 802.15.4 address filtering
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @param[in] panId The 16-bit PAN ID information.
|
||||
* This will be matched against the destination PAN ID of incoming messages.
|
||||
* The PAN ID is sent little endian over the air meaning panId[7:0] is first in
|
||||
* the payload followed by panId[15:8]. Set to 0xFFFF to disable for this index.
|
||||
* @param[in] index Which PAN ID to set. Must be below
|
||||
* RAIL_IEEE802154_MAX_ADDRESSES.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* Set up the 802.15.4 address filter to accept messages to the given PAN ID.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_SetPanId(RAIL_Handle_t railHandle,
|
||||
uint16_t panId,
|
||||
uint8_t index);
|
||||
|
||||
/**
|
||||
* Set a short address for 802.15.4 address filtering
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @param[in] shortAddr 16 bit short address value. This will be matched against the
|
||||
* destination short address of incoming messages. The short address is sent
|
||||
* little endian over the air meaning shortAddr[7:0] is first in the payload
|
||||
* followed by shortAddr[15:8]. Set to 0xFFFF to disable for this index.
|
||||
* @param[in] index Which short address to set. Must be below
|
||||
* RAIL_IEEE802154_MAX_ADDRESSES.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* Set up the 802.15.4 address filter to accept messages to the given short
|
||||
* address.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_SetShortAddress(RAIL_Handle_t railHandle,
|
||||
uint16_t shortAddr,
|
||||
uint8_t index);
|
||||
|
||||
/**
|
||||
* Set a long address for 802.15.4 address filtering
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @param[in] longAddr Pointer to a 8 byte array containing the long address
|
||||
* information. The long address must be in over the air byte order. This will
|
||||
* be matched against the destination long address of incoming messages. Set to
|
||||
* 0x00 00 00 00 00 00 00 00 to disable for this index.
|
||||
* @param[in] index Which long address to set. Must be below
|
||||
* RAIL_IEEE802154_MAX_ADDRESSES.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* Set up the 802.15.4 address filter to accept messages to the given long
|
||||
* address.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_SetLongAddress(RAIL_Handle_t railHandle,
|
||||
const uint8_t *longAddr,
|
||||
uint8_t index);
|
||||
|
||||
/**
|
||||
* Set whether the current node is a PAN coordinator
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @param[in] isPanCoordinator True if this device is a PAN coordinator
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* If the device is a PAN Coordinator, then it will accept data and command
|
||||
* frames with no destination address. This function will fail if 802.15.4
|
||||
* hardware acceleration is not currently enabled. This setting may be changed
|
||||
* at any time when 802.15.4 hardware acceleration is enabled.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_SetPanCoordinator(RAIL_Handle_t railHandle,
|
||||
bool isPanCoordinator);
|
||||
|
||||
/**
|
||||
* Set whether to enable 802.15.4 promiscuous mode
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @param[in] enable True if all frames and addresses should be accepted
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* If promiscuous mode is enabled, then no frame or address filtering steps
|
||||
* will be performed, other than checking the CRC. This function will fail if
|
||||
* 802.15.4 hardware acceleration is not currently enabled. This setting may be
|
||||
* changed at any time when 802.15.4 hardware acceleration is enabled.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_SetPromiscuousMode(RAIL_Handle_t railHandle,
|
||||
bool enable);
|
||||
|
||||
/// When receiving packets, accept 802.15.4 BEACON frame types
|
||||
#define RAIL_IEEE802154_ACCEPT_BEACON_FRAMES (0x01)
|
||||
/// When receiving packets, accept 802.15.4 DATA frame types
|
||||
#define RAIL_IEEE802154_ACCEPT_DATA_FRAMES (0x02)
|
||||
/// When receiving packets, accept 802.15.4 ACK frame types
|
||||
/// If this is not enabled, ACK frame types will only be accepted while waiting
|
||||
/// for an ack
|
||||
#define RAIL_IEEE802154_ACCEPT_ACK_FRAMES (0x04)
|
||||
/// When receiving packets, accept 802.15.4 COMMAND frame types
|
||||
#define RAIL_IEEE802154_ACCEPT_COMMAND_FRAMES (0x08)
|
||||
|
||||
/// In standard operation, accept BEACON, DATA and COMMAND frames.
|
||||
/// Only receive ACK frames while waiting for ack
|
||||
#define RAIL_IEEE802154_ACCEPT_STANDARD_FRAMES (RAIL_IEEE802154_ACCEPT_BEACON_FRAMES \
|
||||
| RAIL_IEEE802154_ACCEPT_DATA_FRAMES \
|
||||
| RAIL_IEEE802154_ACCEPT_COMMAND_FRAMES)
|
||||
|
||||
/**
|
||||
* Set which 802.15.4 frame types to accept
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @param[in] framesMask Mask containing which 802.15.4 frame types to receive
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* This function will fail if 802.15.4 hardware acceleration is not currently
|
||||
* enabled. This setting may be changed at any time when 802.15.4 hardware
|
||||
* acceleration is enabled. Only Beacon, Data, Ack, and Command frames may
|
||||
* be received. The RAIL_IEEE802154_ACCEPT_XXX_FRAMES defines may be combined
|
||||
* to create a bitmask to pass into this function.
|
||||
*
|
||||
* \ref RAIL_IEEE802154_ACCEPT_ACK_FRAMES behaves slightly different than the
|
||||
* other defines. If \ref RAIL_IEEE802154_ACCEPT_ACK_FRAMES is set, the radio
|
||||
* will accept an ACK frame during normal packet reception. If \ref
|
||||
* RAIL_IEEE802154_ACCEPT_ACK_FRAMES is not set, ACK frames will be filtered
|
||||
* unless the radio is waiting for an ACK.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_AcceptFrames(RAIL_Handle_t railHandle,
|
||||
uint8_t framesMask);
|
||||
|
||||
/**
|
||||
* Set the frame pending bit on the outgoing ACK
|
||||
*
|
||||
* @param[in] railHandle Handle of RAIL instance
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* This function should be called after receiving \ref
|
||||
* RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND, if the given source address has
|
||||
* a pending frame. This will return \ref RAIL_STATUS_INVALID_STATE if it is
|
||||
* too late to modify the ACK.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_SetFramePending(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* Get the source address of the incoming data request.
|
||||
*
|
||||
* @param[in] railHandle A RAIL instance handle.
|
||||
* @param[out] pAddress Pointer to \ref RAIL_IEEE802154_Address_t structure
|
||||
* to populate with address information.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* This function should only be called when handling the \ref
|
||||
* RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND event.
|
||||
*/
|
||||
RAIL_Status_t RAIL_IEEE802154_GetAddress(RAIL_Handle_t railHandle,
|
||||
RAIL_IEEE802154_Address_t *pAddress);
|
||||
|
||||
/** @} */ // end of IEEE802.15.4
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __RAIL_IEEE802154_H__
|
||||
@@ -0,0 +1,243 @@
|
||||
/***************************************************************************//**
|
||||
* @file pa.h
|
||||
* @brief RADIO PA API
|
||||
*******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2015 Silicon Labs, www.silabs.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
|
||||
* obligation to support this Software. Silicon Labs is providing the
|
||||
* Software "AS IS", with no express or implied warranties of any kind,
|
||||
* including, but not limited to, any implied warranties of merchantability
|
||||
* or fitness for any particular purpose or warranties against infringement
|
||||
* of any proprietary rights of a third party.
|
||||
*
|
||||
* Silicon Labs will not be liable for any consequential, incidental, or
|
||||
* special damages, or any other relief, or for any claim by any third party,
|
||||
* arising from your use of this Software.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __RADIO_PA_H
|
||||
#define __RADIO_PA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "timing_state.h"
|
||||
#include "rail_chip_specific.h"
|
||||
|
||||
// Once this is a RAIL API this code can be removed as rail-types.h does this
|
||||
#ifndef RAIL_ENUM
|
||||
#ifdef DOXYGEN_SHOULD_SKIP_THIS
|
||||
/// The RAIL library does not use actual enums because the ARM EABI leaves their
|
||||
/// size ambiguous. This ambiguity causes problems if the application is built
|
||||
/// with different flags than the library. To work around this we use uint8_t
|
||||
/// typedefs in compiled code for all enums. For documentation purposes this is
|
||||
/// converted to an actual enum since it's much easier to read in Doxygen.
|
||||
#define RAIL_ENUM(name) enum name
|
||||
#else
|
||||
/// Define used for the actual RAIL library which sets each enum to a uint8_t
|
||||
/// typedef and creates a named enum structure for the enumeration values.
|
||||
#define RAIL_ENUM(name) typedef uint8_t name; enum name##_enum
|
||||
// For debugging use the following define to turn this back into a proper enum
|
||||
// #define RAIL_ENUM(name) typedef enum name##_enum name; enum name##_enum
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup Chip_Specific
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup EFR32xG1x_PA
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
****************************** PROTOTYPES *********************************
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Initilize the PA settings based on the settings provided in the paInit
|
||||
* structure.
|
||||
*
|
||||
* @param[in] paConfig
|
||||
* Pointer to a structure containing the desired PA configuration settings.
|
||||
*
|
||||
* @param[in] timings
|
||||
* Pointer to a structure containing the current state transition timings.
|
||||
*
|
||||
* @return
|
||||
* RAIL_Status_t indicating success
|
||||
*
|
||||
* @warning
|
||||
* The radio should not be transmitting when this function is called!
|
||||
*/
|
||||
RAIL_Status_t PA_Config(const RAIL_TxPowerConfig_t *paConfig,
|
||||
const StateTimings_t *timings);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Get the current PA settings in use
|
||||
*
|
||||
* @param[out] config
|
||||
* Pointer to memory location into which the configuration will be
|
||||
* copied
|
||||
*
|
||||
* @return
|
||||
* RAIL_Status_t indicating success
|
||||
*/
|
||||
RAIL_Status_t PA_GetTxPowerConfig(RAIL_TxPowerConfig_t *config);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Returns the current power level of transmit power
|
||||
*
|
||||
* @return
|
||||
* Current power level in deci-dBm
|
||||
*/
|
||||
RAIL_TxPowerLevel_t PA_GetPowerLevel(void);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Return the current ramp time in microseconds
|
||||
*
|
||||
* @return
|
||||
* Current ramp time in microseconds
|
||||
*/
|
||||
uint32_t PA_GetRampTime(void);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Sets up the ramp configuration so that it best matches the given ramp time
|
||||
*
|
||||
* @details
|
||||
* Each PA has a distinct ramp level and ramp rate that can be used to
|
||||
* achieve various ramp times. This API will pick the ramp rate that closest
|
||||
* approximates the desired ramp time.
|
||||
*
|
||||
* @param[in] ramptime
|
||||
* Desired ramp time in microseconds
|
||||
|
||||
* @param[in] timings
|
||||
* Pointer to a structure containing the current state transition timings.
|
||||
*
|
||||
* @return
|
||||
* The actual ramp time that was set in microseconds.
|
||||
*
|
||||
* @warning
|
||||
* The radio should not be transmitting when this function is called!
|
||||
*/
|
||||
uint32_t PA_SetRampTime(uint32_t rampTime, const StateTimings_t *timings);
|
||||
|
||||
/**
|
||||
* Enable/Disable PA calibration
|
||||
*
|
||||
* @param[in] enable Enables/Disables PA calibration
|
||||
* @return void
|
||||
*
|
||||
* Enabling this will ensure that the PA power remains constant chip to chip.
|
||||
* By default this feature is disabled after reset.
|
||||
*/
|
||||
void PA_EnableCal(bool enable);
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup EFR32xG1x_PA_Advanced
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Set PACTUNE value for TX and RX mode.
|
||||
*
|
||||
* This value can vary depending on band and match and board design.
|
||||
*
|
||||
* @param[in] txPaCtuneValue
|
||||
* Transmit value for pa ctune
|
||||
* @param[in] rxPaCtuneValue
|
||||
* Receive value for pa ctune
|
||||
*
|
||||
* @note PACTUNE will reset to default values when PA_Config() or
|
||||
* RAIL_ConfigRadio() are called.
|
||||
*
|
||||
* @warning
|
||||
* The radio should not be transmitting when this function is called!
|
||||
*/
|
||||
void PA_SetCTune(uint8_t txPaCtuneValue, uint8_t rxPaCtuneValue);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Set the output power level based on power steps available in the chosen PA.
|
||||
*
|
||||
* @details
|
||||
* Each PA has distinct maximum power, minimum power, and power step sizes.
|
||||
* This API allows direct access to these power steps to tune between the
|
||||
* maximum and minimum output power the selected PA is capable of.
|
||||
*
|
||||
* @param[in] pwrLevel
|
||||
* Output power level. Note that the maximum power level will change
|
||||
* depending on PA selection.
|
||||
*
|
||||
* @return
|
||||
* Power level set in the current PA.
|
||||
*
|
||||
* @warning
|
||||
* The radio should not be transmitting when this function is called!
|
||||
*/
|
||||
RAIL_TxPowerLevel_t PA_SetPowerLevel(RAIL_TxPowerLevel_t powerLevel);
|
||||
|
||||
/** @} (end addtogroup EFR32xG1x_PA_Advanced) */
|
||||
/** @} (end addtogroup EFR32xG1x_PA) */
|
||||
/** @} (end addtogroup Chip_Specific) */
|
||||
|
||||
/**
|
||||
* Non RAIL functions.
|
||||
*
|
||||
* The following functions can only be safely used by customers not yet on the
|
||||
* RAIL platform yet. For those on RAIL, please see RAIL_ConvertDbmToRaw and
|
||||
* RAIL_ConvertRawToDbm.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function used to convert deci-dBm values to raw values that can be used in
|
||||
* SetTxPower.
|
||||
*
|
||||
* @param[in] power deci-dBm value that should be converted to the appropriate
|
||||
* raw power for the current PA
|
||||
* @return equivalent raw power for the deci-dBm value supplied, for the active
|
||||
* PA.
|
||||
*/
|
||||
RAIL_TxPowerLevel_t PA_ConvertDbmToRaw(RAIL_TxPower_t power);
|
||||
|
||||
/**
|
||||
* Function to convert the raw power levels returned from GetTxPower to
|
||||
* the equivalent deci-dBm value for the current PA.
|
||||
*
|
||||
* @param[in] powerLevel Raw PA power level that should be converted into
|
||||
* the equivalent deci-dBm value for the active PA
|
||||
* @return equivalent deci-dBm value for the raw power level passed in.
|
||||
*/
|
||||
RAIL_TxPower_t PA_ConvertRawToDbm(RAIL_TxPowerLevel_t powerLevel);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RADIO_PA_H */
|
||||
@@ -0,0 +1,91 @@
|
||||
/***************************************************************************//**
|
||||
* @file pti.h
|
||||
* @brief This header file contains information for working with the packet
|
||||
* trace APIs.
|
||||
* @copyright Copyright 2015 Silicon Laboratories, Inc. www.silabs.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __RADIO_PTI_H
|
||||
#define __RADIO_PTI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "em_gpio.h"
|
||||
|
||||
#include "rail_chip_specific.h"
|
||||
|
||||
// Once this is a RAIL API this code can be removed as rail-types.h does this
|
||||
#ifndef RAIL_ENUM
|
||||
#ifdef DOXYGEN_SHOULD_SKIP_THIS
|
||||
/// The RAIL library does not use actual enums because the ARM EABI leaves their
|
||||
/// size ambiguous. This ambiguity causes problems if the application is built
|
||||
/// with different flags than the library. To work around this we use uint8_t
|
||||
/// typedefs in compiled code for all enums. For documentation purposes this is
|
||||
/// converted to an actual enum since it's much easier to read in Doxygen.
|
||||
#define RAIL_ENUM(name) enum name
|
||||
#else
|
||||
/// Define used for the actual RAIL library which sets each enum to a uint8_t
|
||||
/// typedef and creates a named enum structure for the enumeration values.
|
||||
#define RAIL_ENUM(name) typedef uint8_t name; enum name##_enum
|
||||
// For debugging use the following define to turn this back into a proper enum
|
||||
// #define RAIL_ENUM(name) typedef enum name##_enum name; enum name##_enum
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup Chip_Specific
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup EFR32xG1x_PTI
|
||||
* @{
|
||||
* @brief EFR32 Packet Trace Interface (PTI) setup and configuration
|
||||
******************************************************************************/
|
||||
|
||||
/************************* FUNCTION PROTOTYPES *****************************/
|
||||
|
||||
/**
|
||||
* Initialize the PTI interface
|
||||
*
|
||||
* @param ptiInit The structure that defines what pins and modes to use for
|
||||
* packet trace.
|
||||
*
|
||||
* This API will initialize the packet trace interface. It allows you to
|
||||
* configure what mode and pins to use for packet trace output. You must call
|
||||
* this API either before RAIL initialization or before an explicit call to
|
||||
* \ref PTI_Enable() to properly initialize PTI.
|
||||
*/
|
||||
RAIL_Status_t PTI_Config(const RAIL_PtiConfig_t *config);
|
||||
|
||||
/**
|
||||
* Enable or disable the PTI interface
|
||||
*
|
||||
* This API will turn on or off the packet trace interface (PTI). By default
|
||||
* this is turned on already during init time. Note that you must call \ref
|
||||
* RADIO_PTI_Init() with a valid initialization structure before calling this
|
||||
* API or PTI will not actually turn on.
|
||||
*/
|
||||
RAIL_Status_t PTI_Enable(bool enable);
|
||||
|
||||
/**
|
||||
* Get the current state of the PTI
|
||||
*
|
||||
* This function will return a pointer to a copy of the PTI state. If you
|
||||
* actually want to change the settings, the referenced structure must be
|
||||
* updated and then passed back to \ref RADIO_PTI_Config
|
||||
*/
|
||||
RAIL_Status_t PTI_GetConfig(RAIL_PtiConfig_t *ptiConfig);
|
||||
|
||||
/** @} (end addtogroup EFR32xG1x_PTI) */
|
||||
/** @} (end addtogroup Chip_Specific) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //__RADIO_PTI_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,146 @@
|
||||
/***************************************************************************//**
|
||||
* @file rail_assert_error_codes.h
|
||||
* @brief Definition of error codes that occur in rail for use in
|
||||
* RAILCb_AssertFailed. This file is purely informational and optional -
|
||||
* it need not be included even if rail_assert libraries are included.
|
||||
* @copyright Copyright 2017 Silicon Laboratories, Inc. www.silabs.com
|
||||
******************************************************************************/
|
||||
#ifndef __RAIL_ASSERT_ERROR_CODES_H__
|
||||
#define __RAIL_ASSERT_ERROR_CODES_H__
|
||||
|
||||
#include "rail_types.h"
|
||||
|
||||
/**
|
||||
* @addtogroup Assertions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enumeration of all possible error codes from RAIL_ASSERT
|
||||
*/
|
||||
RAIL_ENUM_GENERIC(RAIL_AssertErrorCodes_t, uint32_t)
|
||||
{
|
||||
RAIL_ASSERT_FAILED_APPENDED_INFO_MISSING = 0,
|
||||
RAIL_ASSERT_FAILED_RX_FIFO_BYTES = 1,
|
||||
RAIL_ASSERT_FAILED_RX_FIFO_ZERO_BYTES_READ = 2,
|
||||
RAIL_ASSERT_FAILED_ILLEGAL_RXLEN_ENTRY_STATUS = 3,
|
||||
RAIL_ASSERT_FAILED_BAD_PACKET_LENGTH = 4,
|
||||
RAIL_ASSERT_FAILED_SYNTH_DIVCTRL_ENUM_CONVERSION_ERROR = 5,
|
||||
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_RX_FIFO = 6,
|
||||
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_RXLEN_FIFO = 7,
|
||||
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_TX_FIFO = 8,
|
||||
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_TXACK_FIFO = 9,
|
||||
RAIL_ASSERT_FAILED_PBUFFER_NOT_DEFINED = 10,
|
||||
RAIL_ASSERT_FAILED_INSUFFICIENT_BYTES_IN_RX_PACKET = 11,
|
||||
RAIL_ASSERT_FAILED_CLOCK_PRESCALER = 12,
|
||||
RAIL_ASSERT_FAILED_RTCC_POST_WAKEUP = 13,
|
||||
RAIL_ASSERT_FAILED_SYNTH_VCO_FREQUENCY = 14,
|
||||
RAIL_ASSERT_FAILED_RAC_STATE = 15,
|
||||
RAIL_ASSERT_FAILED_RETIME_LIMIT = 16,
|
||||
RAIL_ASSERT_FAILED_NESTED_SEQUENCER_LOCK = 17,
|
||||
RAIL_ASSERT_FAILED_RSSI_AVERAGE_DONE = 18,
|
||||
RAIL_ASSERT_FAILED_DFL_BITS_SIZE = 19,
|
||||
RAIL_ASSERT_FAILED_PROTIMER_RANDOM_SEED = 20,
|
||||
RAIL_ASSERT_FAILED_EFR32XG1_REGISTER_SIZE = 21,
|
||||
RAIL_ASSERT_FAILED_PROTIMER_CHANNEL = 22,
|
||||
RAIL_ASSERT_FAILED_TIMER_REQUIRES_WRAP = 23,
|
||||
RAIL_ASSERT_FAILED_BASECNTTOP = 24,
|
||||
RAIL_ASSERT_FAILED_DEPRECATED_LBTRETRY = 25,
|
||||
RAIL_ASSERT_FAILED_RTCC_SYNC_MISSED = 26,
|
||||
RAIL_ASSERT_FAILED_CLOCK_SOURCE_NOT_READY = 27,
|
||||
RAIL_ASSERT_FAILED_TIMINGS_INVALID = 28,
|
||||
RAIL_ASSERT_NULL_HANDLE = 29,
|
||||
RAIL_ASSERT_FAILED_SCHED_TIMER_NOT_RUNNING = 30,
|
||||
RAIL_ASSERT_FAILED_NO_ACTIVE_CONFIG = 31,
|
||||
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SWITCH = 32,
|
||||
RAIL_ASSERT_FAILED_RFINIT = 33,
|
||||
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SCHEDRX = 34,
|
||||
RAIL_ASSERT_FAILED_INVALID_HANDLE_SCHEDTX = 35,
|
||||
RAIL_ASSERT_FAILED_INACTIVE_HANDLE_SCHEDTX = 36,
|
||||
RAIL_ASSERT_FAILED_CONFIG_INDEX_INVALID = 37,
|
||||
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SINGLEPROTOCOL = 38,
|
||||
RAIL_ASSERT_DEPRECATED_FUNCTION = 39,
|
||||
RAIL_ASSERT_MULTIPROTOCOL_NO_EVENT = 40,
|
||||
RAIL_ASSERT_FAILED_INVALID_INTERRUPT_ENABLED = 41,
|
||||
RAIL_ASSERT_CONVERSION_CURVES_NOT_INITIALIZED = 42,
|
||||
RAIL_ASSERT_DIVISION_BY_ZERO = 43,
|
||||
RAIL_ASSERT_CANT_USE_HARDWARE = 44,
|
||||
};
|
||||
|
||||
/// Use this define to create an array of error messages that map to the codes
|
||||
/// in \ref RAIL_AssertErrorCodes_t. You can use these to print slightly more
|
||||
/// detailed error strings related to a particular assert error code if desired.
|
||||
/// For example, you could implement your assert failed callback as follows to
|
||||
/// make use of this.
|
||||
///
|
||||
/// @code{.c}
|
||||
/// void RAILCb_AssertFailed(RAIL_Handle_t railHandle, uint32_t errorCode)
|
||||
/// {
|
||||
/// static const char* railErrorMessages[] = RAIL_ASSERT_ERROR_MESSAGES;
|
||||
/// const char *errorMessage = "Unknown";
|
||||
///
|
||||
/// // If this error code is within the range of known error messages then use
|
||||
/// // the appropriate error message.
|
||||
/// if (errorCode < (sizeof(railErrorMessages) / sizeof(char*))) {
|
||||
/// errorMessage = railErrorMessages[errorCode];
|
||||
/// }
|
||||
/// printf(errorMessage);
|
||||
///
|
||||
/// // Reset the chip since an assert is a fatal error
|
||||
/// NVIC_SystemReset();
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
#define RAIL_ASSERT_ERROR_MESSAGES { \
|
||||
/* 0*/ "Appended info missing from Rx packet", \
|
||||
/* 1*/ "Payload bytes missing from Rx packet", \
|
||||
/* 2*/ "Error reading back packet payload", \
|
||||
/* 3*/ "Receive fifo entry has invalid status", \
|
||||
/* 4*/ "Receive fifo entry bad packet length", \
|
||||
/* 5*/ "Unable to configure radio for IR calibration", \
|
||||
/* 6*/ "Reached unexpected state while handling Rx fifo events", \
|
||||
/* 7*/ "Reached unexpected state while handling RXLEN fifo events", \
|
||||
/* 8*/ "Reached unexpected state while handling Tx fifo events", \
|
||||
/* 9*/ "Reached unexpected state while handling Tx ACK fifo events", \
|
||||
/*10*/ "No memory to store receive packet", \
|
||||
/*11*/ "Packet length longer than the receive FIFO size", \
|
||||
/*12*/ "Invalid radio clock prescaler", \
|
||||
/*13*/ "Error synchronizing the RAIL timebase after sleep", \
|
||||
/*14*/ "VCO frequency outside supported range", \
|
||||
/*15*/ "Radio active while changing channels", \
|
||||
/*16*/ "Unable to configure DCDC retiming", \
|
||||
/*17*/ "Nested attempt to lock the sequencer", \
|
||||
/*18*/ "RSSI averaging enabled without a valid callback", \
|
||||
/*19*/ "Invalid dynamic frame length setting provided (dflBits)", \
|
||||
/*20*/ "Unable to seed radio pseudo random number generator", \
|
||||
/*21*/ "Timeout exceeds EFR32XG1 register size", \
|
||||
/*22*/ "Invalid timer channel specified", \
|
||||
/*23*/ "Timer value larger than RAIL timebase", \
|
||||
/*24*/ "LBT config exceeds EFR32XG1 register size", \
|
||||
/*25*/ "Deprecated CSMA/LBT retry callback unexpectedly called", \
|
||||
/*26*/ "Could not synchronize RAIL timebase with the RTC", \
|
||||
/*27*/ "Clock source not ready", \
|
||||
/*28*/ "Attempted to set RAIL timings to invalid value", \
|
||||
/*29*/ "NULL was supplied as a RAIL_Handle_t argument", \
|
||||
/*30*/ "Scheduled timer not running", \
|
||||
/*31*/ "No active config to switch from", \
|
||||
/*32*/ "No active handle after switch", \
|
||||
/*33*/ "RfInit failed to configure active state", \
|
||||
/*34*/ "No active handle for scheduled rx", \
|
||||
/*35*/ "Invalid handle for scheduled tx", \
|
||||
/*36*/ "Inactive handle for scheduled tx", \
|
||||
/*37*/ "Invalid config index to switch to", \
|
||||
/*38*/ "No active handle for single protocol", \
|
||||
/*39*/ "This function is deprecated and must not be called", \
|
||||
/*40*/ "Multiprotocol task started with no event to run", \
|
||||
/*41*/ "Invalid interrupt enabled", \
|
||||
/*42*/ "Power conversion functions called before curves were initialized", \
|
||||
/*43*/ "Division by zero", \
|
||||
/*44*/ "Function cannot be called without access to the hardware", \
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // __RAIL_ASSERT_ERROR_CODES_H__
|
||||
@@ -0,0 +1,427 @@
|
||||
/***************************************************************************//**
|
||||
* @file rail_chip_specific.h
|
||||
* @brief This file contains the type definitions for EFR32 chip specific
|
||||
* aspects of RAIL.
|
||||
* @copyright Copyright 2015 Silicon Laboratories, Inc. www.silabs.com
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __RAIL_CHIP_SPECIFIC_H_
|
||||
#define __RAIL_CHIP_SPECIFIC_H_
|
||||
|
||||
// Include standard type headers to help define structures
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "em_gpio.h"
|
||||
|
||||
#include "rail_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Multiprotocol
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
* @addtogroup Multiprotocol_EFR32 EFR32
|
||||
* @{
|
||||
* @brief EFR32 Specific multiprotocol support defines
|
||||
* @ingroup Multiprotocol
|
||||
*/
|
||||
|
||||
/**
|
||||
* Placeholder for a chip specific RAIL handle. Using NULL as a RAIL handle is
|
||||
* frowned upon, so we use another value that can't be de-referenced.
|
||||
*/
|
||||
#define RAIL_EFR32_HANDLE ((RAIL_Handle_t)0xFFFFFFFFUL)
|
||||
|
||||
/** @} */ // end of group Multiprotocol_EFR32
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Calibration
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
* @addtogroup Calibration_EFR32 EFR32
|
||||
* @{
|
||||
* @brief EFR32 Specific Calibrations
|
||||
* @ingroup Calibration
|
||||
*
|
||||
* The EFR32 has two supported calibrations. There is the Image Rejection (IR)
|
||||
* calibration and a temperature dependent calibration. The IR calibration is
|
||||
* something that can be computed once and stored off or computed each time at
|
||||
* startup. It is PHY specific and provides sensitivity improvements so we
|
||||
* highly recommend using it. The IR calibration should only be run when the
|
||||
* radio is IDLE.
|
||||
*
|
||||
* The temperature dependent calibrations are used to recalibrate the synth if
|
||||
* the temperature crosses 0C or the temperature delta since the last
|
||||
* calibration exceeds 70C while sitting in receive. RAIL will run VCO
|
||||
* calibration automatically upon entering receive state so the application can
|
||||
* omit this calibration if the stack will re-enter receive with enough
|
||||
* frequency to not hit this temperature delta. If the application does not
|
||||
* calibrate for temperature, it's possible to miss receive packets due to
|
||||
* drift in the carrier frequency.
|
||||
*/
|
||||
|
||||
/** EFR32 specific temperature calibration bit */
|
||||
#define RAIL_CAL_TEMP_VCO (0x00000001U)
|
||||
/** EFR32 specific IR calibration bit */
|
||||
#define RAIL_CAL_ONETIME_IRCAL (0x00010000U)
|
||||
|
||||
/** Mask to run temperature dependent calibrations */
|
||||
#define RAIL_CAL_TEMP (RAIL_CAL_TEMP_VCO)
|
||||
/** Mask to run one time calibrations */
|
||||
#define RAIL_CAL_ONETIME (RAIL_CAL_ONETIME_IRCAL)
|
||||
/** Mask to run optional performance calibrations */
|
||||
#define RAIL_CAL_PERF (0)
|
||||
/** Mask for calibrations that require the radio to be off */
|
||||
#define RAIL_CAL_OFFLINE (RAIL_CAL_ONETIME_IRCAL)
|
||||
/** Mask to run all possible calibrations for this chip */
|
||||
#define RAIL_CAL_ALL (RAIL_CAL_TEMP | RAIL_CAL_ONETIME)
|
||||
/** Mask to run all pending calibrations */
|
||||
#define RAIL_CAL_ALL_PENDING (0x00000000U)
|
||||
/** Invalid calibration value */
|
||||
#define RAIL_CAL_INVALID_VALUE (0xFFFFFFFFU)
|
||||
|
||||
/**
|
||||
* Applies a given image rejection calibration value.
|
||||
*
|
||||
* @param[in] railHandle A RAIL instance handle.
|
||||
* @param[in] imageRejection The image rejection value to apply.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* Take an image rejection calibration value and apply it. This value should be
|
||||
* determined from a previous run of \ref RAIL_CalibrateIr on the same
|
||||
* physical device with the same radio configuration. The imageRejection value
|
||||
* will also be stored to the \ref RAIL_ChannelConfigEntry_t::attr, if possible.
|
||||
*
|
||||
* If multiple protocols are used, this function will return
|
||||
* \ref RAIL_STATUS_INVALID_STATE if it is called and the given railHandle is
|
||||
* not active. The caller must attempt to re-call this function later, in that
|
||||
* case.
|
||||
*/
|
||||
RAIL_Status_t RAIL_ApplyIrCalibration(RAIL_Handle_t railHandle,
|
||||
uint32_t imageRejection);
|
||||
|
||||
/**
|
||||
* Run the image rejection calibration
|
||||
*
|
||||
* @param[in] railHandle A RAIL instance handle.
|
||||
* @param[out] imageRejection The result of the image rejection calibration.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* Run the image rejection calibration, and apply the resulting value. If the
|
||||
* imageRejection parameter is non-NULL, then also store the value at that
|
||||
* location. The imageRejection value will also be stored to the
|
||||
* \ref RAIL_ChannelConfigEntry_t::attr, if possible. This is a long-running
|
||||
* calibration that adds significant code space when run, and can be run with a
|
||||
* separate firmware image on each device in order to save code space in the
|
||||
* final image.
|
||||
*
|
||||
* If multiple protocols are used, this function will return
|
||||
* \ref RAIL_STATUS_INVALID_STATE if it is called and the given railHandle is
|
||||
* not active. The caller must attempt to re-call this function later, in that
|
||||
* case.
|
||||
*/
|
||||
RAIL_Status_t RAIL_CalibrateIr(RAIL_Handle_t railHandle,
|
||||
uint32_t *imageRejection);
|
||||
|
||||
/**
|
||||
* Run the temperature calibration
|
||||
*
|
||||
* @param[in] railHandle A RAIL instance handle.
|
||||
* @return Status code indicating success of the function call.
|
||||
*
|
||||
* Run the temperature calibration, which needs to recalibrate the synth if
|
||||
* the temperature crosses 0C or the temperature delta since the last
|
||||
* calibration exceeds 70C while sitting in receive. RAIL will run VCO
|
||||
* calibration automatically upon entering receive state so the application can
|
||||
* omit this calibration if the stack will re-enter receive with enough
|
||||
* frequency to not hit this temperature delta. If the application does not
|
||||
* calibrate for temperature, it's possible to miss receive packets due to
|
||||
* drift in the carrier frequency.
|
||||
*
|
||||
* If multiple protocols are used, this function will return
|
||||
* \ref RAIL_STATUS_INVALID_STATE if it is called and the given railHandle is
|
||||
* not active. In that case the calibration will be automatically performed the
|
||||
* next time the radio enters receive.
|
||||
*/
|
||||
RAIL_Status_t RAIL_CalibrateTemp(RAIL_Handle_t railHandle);
|
||||
|
||||
/**
|
||||
* @struct RAIL_CalValues_t
|
||||
* @brief Calibration value structure
|
||||
*
|
||||
* This structure contains the set of persistent calibration values for the
|
||||
* EFR32. You can set these before hand and apply them at startup to save the
|
||||
* time required to compute them. Any of these values may be set to
|
||||
* RAIL_CAL_INVALID_VALUE to force the code to compute that calibration value.
|
||||
*/
|
||||
typedef struct RAIL_CalValues {
|
||||
uint32_t imageRejection; /**< Image Rejection (IR) calibration value */
|
||||
} RAIL_CalValues_t;
|
||||
|
||||
/**
|
||||
* A define to set all RAIL_CalValues_t values to uninitialized.
|
||||
*
|
||||
* This define can be used when you have no data to pass to the calibration
|
||||
* routines but wish to compute and save all possible calibrations.
|
||||
*/
|
||||
#define RAIL_CALVALUES_UNINIT (RAIL_CalValues_t){ \
|
||||
RAIL_CAL_INVALID_VALUE, \
|
||||
}
|
||||
|
||||
/** @} */ // end of group Calibration_EFR32
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Diagnostic
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
* @addtogroup Diagnostic_EFR32 EFR32
|
||||
* @{
|
||||
* @brief Types specific to the EFR32 for the diagnostic routines.
|
||||
* @ingroup Diagnostic
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef RAIL_FrequencyOffset_t
|
||||
* @brief Chip-specific type that represents the number of Frequency Offset
|
||||
* units. It is used with \ref RAIL_GetRxFreqOffset() and
|
||||
* \ref RAIL_SetFreqOffset().
|
||||
*
|
||||
* The units on this chip are radio synthesizer resolution steps (synthTicks).
|
||||
* On EFR32 (at least for now), the frequency offset is limited to 15 bits
|
||||
* (size of SYNTH_CALOFFSET). A value of \ref RAIL_FREQUENCY_OFFSET_INVALID
|
||||
* means that this value is invalid.
|
||||
*/
|
||||
typedef int16_t RAIL_FrequencyOffset_t;
|
||||
|
||||
/**
|
||||
* Specifies an invalid frequency offset value. This will be returned if you
|
||||
* call \ref RAIL_GetRxFreqOffset() at an invalid time.
|
||||
*/
|
||||
#define RAIL_FREQUENCY_OFFSET_INVALID ((int16_t)0xFFFF)
|
||||
|
||||
/** @} */ // end of group Diagnostic_EFR32
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Radio Configuration
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
* @addtogroup Radio_Configuration_EFR32 EFR32
|
||||
* @{
|
||||
* @ingroup Radio_Configuration
|
||||
* @brief Types specific to the EFR32 for radio configuration.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Radio Configuration structure
|
||||
*
|
||||
* The radio configuration is generated in order to properly configure the
|
||||
* radio for operation on a protocol. These configurations should not be
|
||||
* created or edited by hand.
|
||||
*/
|
||||
typedef const uint32_t *RAIL_RadioConfig_t;
|
||||
|
||||
/** @} */ // end of group Radio_Configuration_EFR32
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Transmit
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
* @addtogroup PA_EFR32 EFR32
|
||||
* @{
|
||||
* @ingroup PA
|
||||
* @brief Types specific to the EFR32 for dealing with the on chip PAs.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Raw power levels used directly by the RAIL_Get/SetTxPower API where a higher
|
||||
* numerical value corresponds to a higher output power. These are referred to
|
||||
* as 'raw (values/units)'. On the EFR32 they can range from one of \ref
|
||||
* RAIL_TX_POWER_LEVEL_LP_MIN, \ref RAIL_TX_POWER_LEVEL_HP_MIN, or
|
||||
* \ref RAIL_TX_POWER_LEVEL_SUBGIG_MIN to one of \ref
|
||||
* RAIL_TX_POWER_LEVEL_LP_MAX, \ref RAIL_TX_POWER_LEVEL_HP_MAX, and \ref
|
||||
* RAIL_TX_POWER_LEVEL_SUBGIG_MAX, respectively, depending on the selected \ref
|
||||
* RAIL_TxPowerMode_t.
|
||||
*/
|
||||
typedef uint8_t RAIL_TxPowerLevel_t;
|
||||
|
||||
/**
|
||||
* The maximum valid value for the \ref RAIL_TxPowerLevel_t when in \ref
|
||||
* RAIL_TX_POWER_MODE_2P4_LP mode.
|
||||
*/
|
||||
#define RAIL_TX_POWER_LEVEL_LP_MAX 7
|
||||
/**
|
||||
* The maximum valid value for the \ref RAIL_TxPowerLevel_t when in \ref
|
||||
* RAIL_TX_POWER_MODE_2P4_HP mode.
|
||||
*/
|
||||
#define RAIL_TX_POWER_LEVEL_HP_MAX 252
|
||||
/**
|
||||
* The maximum valid value for the \ref RAIL_TxPowerLevel_t when in \ref
|
||||
* RAIL_TX_POWER_MODE_SUBGIG mode.
|
||||
*/
|
||||
#define RAIL_TX_POWER_LEVEL_SUBGIG_MAX 248
|
||||
/**
|
||||
* The minimum valid value for the \ref RAIL_TxPowerLevel_t when in \ref
|
||||
* RAIL_TX_POWER_MODE_2P4_LP mode.
|
||||
*/
|
||||
#define RAIL_TX_POWER_LEVEL_HP_MIN 0
|
||||
/**
|
||||
* The minimum valid value for the \ref RAIL_TxPowerLevel_t when in \ref
|
||||
* RAIL_TX_POWER_MODE_2P4_HP mode.
|
||||
*/
|
||||
#define RAIL_TX_POWER_LEVEL_LP_MIN 1
|
||||
/**
|
||||
* The minimum valid value for the \ref RAIL_TxPowerLevel_t when in \ref
|
||||
* RAIL_TX_POWER_MODE_SUBGIG mode.
|
||||
*/
|
||||
#define RAIL_TX_POWER_LEVEL_SUBGIG_MIN 0
|
||||
/**
|
||||
* Invalid RAIL_TxPowerLevel_t value returned when there is an error
|
||||
* with RAIL_GetTxPower
|
||||
*/
|
||||
#define RAIL_TX_POWER_LEVEL_INVALID 255
|
||||
|
||||
/**
|
||||
* @enum RAIL_TxPowerMode_t
|
||||
* @brief Enumeration of the EFR32 power modes.
|
||||
*
|
||||
* The power modes on the EFR32 correspond to the different on-chip PA's that
|
||||
* are available. For more information about the power and performance
|
||||
* characteristics of a given amplifier, please consult the data sheet.
|
||||
*/
|
||||
RAIL_ENUM(RAIL_TxPowerMode_t) {
|
||||
/** High power amplifier, up to 20dBm, raw values: 0-252 */
|
||||
RAIL_TX_POWER_MODE_2P4_HP,
|
||||
/** Low power amplifier, up to 0dBm, raw values: 1-7 */
|
||||
RAIL_TX_POWER_MODE_2P4_LP,
|
||||
/** SubGig amplifier, up to 20dBm, raw values: 0-248 */
|
||||
RAIL_TX_POWER_MODE_SUBGIG,
|
||||
/** Invalid amplifier Selection */
|
||||
RAIL_TX_POWER_MODE_NONE
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct RAIL_TxPowerConfig_t
|
||||
*
|
||||
* @brief Structure containing values used to initialize the power amplifiers.
|
||||
*/
|
||||
typedef struct RAIL_TxPowerConfig {
|
||||
/** Tx power mode */
|
||||
RAIL_TxPowerMode_t mode;
|
||||
/** Power amplifier supply voltage in mV, generally:
|
||||
* DCDC supply ~ 1800mV (1.8V)
|
||||
* Battery supply ~ 3300mV (3.3V)
|
||||
*/
|
||||
uint16_t voltage;
|
||||
/** The amount of time to spend ramping for Tx in uS. */
|
||||
uint16_t rampTime;
|
||||
} RAIL_TxPowerConfig_t;
|
||||
|
||||
/** @} */ // end of group PA_EFR32
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// PTI
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
* @addtogroup PTI_EFR32 EFR32
|
||||
* @{
|
||||
* @brief EFR32 PTI functionality
|
||||
* @ingroup PTI
|
||||
*
|
||||
* These enums and structures are used with RAIL PTI API. EFR32 supports
|
||||
* SPI and UART PTI, and is configurable in terms of baud rates and pin PTI
|
||||
* pin locations.
|
||||
*/
|
||||
|
||||
/** Channel type enumeration. */
|
||||
RAIL_ENUM(RAIL_PtiMode_t) {
|
||||
/** Turn PTI off entirely */
|
||||
RAIL_PTI_MODE_DISABLED,
|
||||
/** SPI mode. */
|
||||
RAIL_PTI_MODE_SPI,
|
||||
/** UART mode. */
|
||||
RAIL_PTI_MODE_UART,
|
||||
/** 9bit UART mode. */
|
||||
RAIL_PTI_MODE_UART_ONEWIRE
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct RAIL_PtiConfig_t
|
||||
* @brief Configuration for PTI.
|
||||
*/
|
||||
typedef struct RAIL_PtiConfig {
|
||||
/** Packet Trace mode (UART or SPI) */
|
||||
RAIL_PtiMode_t mode;
|
||||
/** Output baudrate for PTI in Hz */
|
||||
uint32_t baud;
|
||||
/** Data output (DOUT) location for pin/port */
|
||||
uint8_t doutLoc;
|
||||
/** Data output (DOUT) GPIO port */
|
||||
GPIO_Port_TypeDef doutPort;
|
||||
/** Data output (DOUT) GPIO pin */
|
||||
uint8_t doutPin;
|
||||
/** Data clock (DCLK) location for pin/port. Only used in SPI mode */
|
||||
uint8_t dclkLoc;
|
||||
/** Data clock (DCLK) GPIO port. Only used in SPI mode */
|
||||
GPIO_Port_TypeDef dclkPort;
|
||||
/** Data clock (DCLK) GPIO pin. Only used in SPI mode */
|
||||
uint8_t dclkPin;
|
||||
/** Data frame (DFRAME) location for pin/port. Only used for */
|
||||
uint8_t dframeLoc;
|
||||
/** Data frame (DFRAME) GPIO port */
|
||||
GPIO_Port_TypeDef dframePort;
|
||||
/** Data frame (DFRAME) GPIO pin */
|
||||
uint8_t dframePin;
|
||||
} RAIL_PtiConfig_t;
|
||||
|
||||
/** @} */ // end of group PTI_EFR32
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Antenna Control
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
* @addtogroup Antenna_Control_EFR32 EFR32
|
||||
* @{
|
||||
* @brief EFR32 Antenna Control functionality
|
||||
* @ingroup Antenna
|
||||
*
|
||||
* These enums and structures are used with RAIL Antenna Control API. EFR32 supports
|
||||
* up to two antennas and with configurable pin locations.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @struct RAIL_AntennaConfig_t
|
||||
* @brief Configuration for Antenna switch pins.
|
||||
*/
|
||||
typedef struct RAIL_AntennaConfig {
|
||||
/** MODEM_ROUTEPEN fields */
|
||||
/** Antenna 0 Pin Enable */
|
||||
bool ant0PinEn;
|
||||
/** Antenna 1 Pin Enable */
|
||||
bool ant1PinEn;
|
||||
/** MODEM_ROUTELOC1 fields */
|
||||
/** Antenna 0 location for pin/port */
|
||||
uint8_t ant0Loc;
|
||||
/** Antenna 0 output GPIO port */
|
||||
GPIO_Port_TypeDef ant0Port;
|
||||
/** Antenna 0 output GPIO pin */
|
||||
uint8_t ant0Pin;
|
||||
/** Antenna 1 location for pin/port */
|
||||
uint8_t ant1Loc;
|
||||
/** Antenna 1 output GPIO port */
|
||||
GPIO_Port_TypeDef ant1Port;
|
||||
/** Antenna 1 output GPIO pin */
|
||||
uint8_t ant1Pin;
|
||||
} RAIL_AntennaConfig_t;
|
||||
|
||||
/** @} */ // end of group Antenna_Control_EFR32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
/***************************************************************************//**
|
||||
* @file timing_state.h
|
||||
* @brief RADIO API Abstraction layer for setting state timing information
|
||||
* @version INTERNAL
|
||||
*******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2017 Silicon Labs, www.silabs.com</b>
|
||||
******************************************************************************/
|
||||
#ifndef __TIMING_STATE_H
|
||||
#define __TIMING_STATE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "em_device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
******************************* STRUCTS ***********************************
|
||||
******************************************************************************/
|
||||
|
||||
// All the timing information for state transitions
|
||||
typedef struct StateTimings {
|
||||
int32_t rxChainDelayNs;
|
||||
#if (_SILICON_LABS_32B_SERIES_1_CONFIG == 1) \
|
||||
|| (_SILICON_LABS_32B_SERIES_1_CONFIG == 4)
|
||||
// On Dumbo the RX2TX time is based on the RXDONE time, which is stable enough
|
||||
// for our purposes. However, the timestamp is still based on FRAMEDET, so we
|
||||
// need two delays, one for the chain delay (FRAMEDET delay), and the second
|
||||
// for the RXDONE delay, which we use for RX2TX transitions only.
|
||||
|
||||
// On Nixi the RX2TX time and the timestamp are based on RXDONE. The chain
|
||||
// delay for RX only calculates how long we need to stay in RX to get SYNC,
|
||||
// which does not need to be precise. (And hard to measure.)
|
||||
int32_t rxDoneDelayNs;
|
||||
#endif
|
||||
#if _SILICON_LABS_32B_SERIES_1_CONFIG >= 2
|
||||
// The viterbi phy needs extra time to power up the receive path during
|
||||
// TX2RX in order to receive low RSSI packets. This flag indicates to
|
||||
// turn on that extra time
|
||||
bool viterbiPhy;
|
||||
#endif
|
||||
int32_t txChainDelayNs;
|
||||
uint16_t rxSearch;
|
||||
uint16_t txToRxSearch;
|
||||
uint16_t rxWarm;
|
||||
uint16_t rxToTx;
|
||||
uint16_t rxFrameToTx;
|
||||
uint16_t txWarm;
|
||||
uint16_t txToRx;
|
||||
uint16_t txToTx;
|
||||
} StateTimings_t;
|
||||
|
||||
/** @} (end addtogroup TIMING) */
|
||||
/** @} (end addtogroup RF_Library) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TIMING_STATE_H */
|
||||
Reference in New Issue
Block a user