From 1af2933449c4d35692cdee88dfbc3e61d9a1c99f Mon Sep 17 00:00:00 2001 From: Zhanglong Xia Date: Fri, 15 Mar 2019 00:44:35 +0800 Subject: [PATCH] [efr32] enable BRD4170A to support 915MHz and 2.4GHz by default (#3664) --- .../platforms/efr32/brd4161a/board_config.h | 2 +- .../platforms/efr32/brd4166a/board_config.h | 2 +- .../platforms/efr32/brd4170a/board_config.h | 4 ++-- .../platforms/efr32/brd4304a/board_config.h | 2 +- .../efr32/openthread-core-efr32-config.h | 21 ++++++++++++++++++ examples/platforms/efr32/radio.c | 22 ++++++------------- examples/platforms/efr32/rail_config.h | 2 +- 7 files changed, 34 insertions(+), 21 deletions(-) diff --git a/examples/platforms/efr32/brd4161a/board_config.h b/examples/platforms/efr32/brd4161a/board_config.h index 0112b4719..b8f86f622 100644 --- a/examples/platforms/efr32/brd4161a/board_config.h +++ b/examples/platforms/efr32/brd4161a/board_config.h @@ -35,6 +35,6 @@ #ifndef __BOARD_CONFIG_H__ #define __BOARD_CONFIG_H__ -#define RADIO_SUPPORT_2P4GHZ_OQPSK 1 ///< Dev board suppports OQPSK modulation in 2.4GHz band. +#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 ///< Dev board suppports OQPSK modulation in 2.4GHz band. #endif // __BOARD_CONFIG_H__ diff --git a/examples/platforms/efr32/brd4166a/board_config.h b/examples/platforms/efr32/brd4166a/board_config.h index 0112b4719..b8f86f622 100644 --- a/examples/platforms/efr32/brd4166a/board_config.h +++ b/examples/platforms/efr32/brd4166a/board_config.h @@ -35,6 +35,6 @@ #ifndef __BOARD_CONFIG_H__ #define __BOARD_CONFIG_H__ -#define RADIO_SUPPORT_2P4GHZ_OQPSK 1 ///< Dev board suppports OQPSK modulation in 2.4GHz band. +#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 ///< Dev board suppports OQPSK modulation in 2.4GHz band. #endif // __BOARD_CONFIG_H__ diff --git a/examples/platforms/efr32/brd4170a/board_config.h b/examples/platforms/efr32/brd4170a/board_config.h index b71741781..b58b37c19 100644 --- a/examples/platforms/efr32/brd4170a/board_config.h +++ b/examples/platforms/efr32/brd4170a/board_config.h @@ -35,7 +35,7 @@ #ifndef __BOARD_CONFIG_H__ #define __BOARD_CONFIG_H__ -#define RADIO_SUPPORT_2P4GHZ_OQPSK 1 ///< Dev board suppports OQPSK modulation in 2.4GHz band. -#define RADIO_SUPPORT_915MHZ_OQPSK 1 ///< Dev board suppports OQPSK modulation in 915MHz band. +#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 ///< Dev board suppports OQPSK modulation in 2.4GHz band. +#define RADIO_CONFIG_915MHZ_OQPSK_SUPPORT 1 ///< Dev board suppports OQPSK modulation in 915MHz band. #endif // __BOARD_CONFIG_H__ diff --git a/examples/platforms/efr32/brd4304a/board_config.h b/examples/platforms/efr32/brd4304a/board_config.h index 0112b4719..b8f86f622 100644 --- a/examples/platforms/efr32/brd4304a/board_config.h +++ b/examples/platforms/efr32/brd4304a/board_config.h @@ -35,6 +35,6 @@ #ifndef __BOARD_CONFIG_H__ #define __BOARD_CONFIG_H__ -#define RADIO_SUPPORT_2P4GHZ_OQPSK 1 ///< Dev board suppports OQPSK modulation in 2.4GHz band. +#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 ///< Dev board suppports OQPSK modulation in 2.4GHz band. #endif // __BOARD_CONFIG_H__ diff --git a/examples/platforms/efr32/openthread-core-efr32-config.h b/examples/platforms/efr32/openthread-core-efr32-config.h index 4cf938506..f21326b37 100644 --- a/examples/platforms/efr32/openthread-core-efr32-config.h +++ b/examples/platforms/efr32/openthread-core-efr32-config.h @@ -32,6 +32,7 @@ * for OpenThread. */ +#include "board_config.h" #include "em_msc.h" #ifndef OPENTHREAD_CORE_EFR32_CONFIG_H_ @@ -46,6 +47,26 @@ #define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED #endif +/* + * @def OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT + * + * Define to 1 if you want to enable physical layer to support OQPSK modulation in 915MHz band. + * + */ +#ifdef RADIO_CONFIG_915MHZ_OQPSK_SUPPORT +#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 1 +#endif + +/* + * @def OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT + * + * Define to 1 if you want to enable physical layer to support OQPSK modulation in 2.4GHz band. + * + */ +#ifdef RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT +#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 1 +#endif + /** * @def OPENTHREAD_CONFIG_PLATFORM_INFO * diff --git a/examples/platforms/efr32/radio.c b/examples/platforms/efr32/radio.c index a289b0630..98c9de279 100644 --- a/examples/platforms/efr32/radio.c +++ b/examples/platforms/efr32/radio.c @@ -64,14 +64,6 @@ enum IEEE802154_DSN_OFFSET = 2, }; -enum -{ - EFR32_915MHZ_OQPSK_CHANNEL_MIN = 1, - EFR32_915MHZ_OQPSK_CHANNEL_MAX = 10, - EFR32_2P4GHZ_OQPSK_CHANNEL_MIN = 11, - EFR32_2P4GHZ_OQPSK_CHANNEL_MAX = 26, -}; - enum { EFR32_RECEIVE_SENSITIVITY = -100, // dBm @@ -88,7 +80,7 @@ enum enum { -#if RADIO_SUPPORT_2P4GHZ_OQPSK && RADIO_SUPPORT_915MHZ_OQPSK +#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT && RADIO_CONFIG_915MHZ_OQPSK_SUPPORT EFR32_NUM_BAND_CONFIGS = 2, #else EFR32_NUM_BAND_CONFIGS = 1, @@ -278,25 +270,25 @@ void efr32BandConfigInit(void (*aEventCallback)(RAIL_Handle_t railHandle, RAIL_E { uint8_t index = 0; -#if RADIO_SUPPORT_2P4GHZ_OQPSK +#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT sBandConfigs[index].mRailConfig.eventsCallback = aEventCallback; sBandConfigs[index].mRailConfig.protocol = NULL; sBandConfigs[index].mRailConfig.scheduler = &sBandConfigs[index].mRailSchedState; sBandConfigs[index].mChannelConfig = NULL; - sBandConfigs[index].mChannelMin = EFR32_2P4GHZ_OQPSK_CHANNEL_MIN; - sBandConfigs[index].mChannelMax = EFR32_2P4GHZ_OQPSK_CHANNEL_MAX; + sBandConfigs[index].mChannelMin = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN; + sBandConfigs[index].mChannelMax = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX; assert((sBandConfigs[index].mRailHandle = efr32RailConfigInit(&sBandConfigs[index])) != NULL); index++; #endif -#if RADIO_SUPPORT_915MHZ_OQPSK +#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT sBandConfigs[index].mRailConfig.eventsCallback = aEventCallback; sBandConfigs[index].mRailConfig.protocol = NULL; sBandConfigs[index].mRailConfig.scheduler = &sBandConfigs[index].mRailSchedState; sBandConfigs[index].mChannelConfig = channelConfigs[0]; - sBandConfigs[index].mChannelMin = EFR32_915MHZ_OQPSK_CHANNEL_MIN; - sBandConfigs[index].mChannelMax = EFR32_915MHZ_OQPSK_CHANNEL_MAX; + sBandConfigs[index].mChannelMin = OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN; + sBandConfigs[index].mChannelMax = OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX; assert((sBandConfigs[index].mRailHandle = efr32RailConfigInit(&sBandConfigs[index])) != NULL); #endif diff --git a/examples/platforms/efr32/rail_config.h b/examples/platforms/efr32/rail_config.h index 9e493100d..0b99e5a30 100644 --- a/examples/platforms/efr32/rail_config.h +++ b/examples/platforms/efr32/rail_config.h @@ -7,7 +7,7 @@ #define RADIO_CONFIG_XTAL_FREQUENCY 38400000UL -#if RADIO_SUPPORT_915MHZ_OQPSK +#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT extern const RAIL_ChannelConfig_t *channelConfigs[]; #endif