[efr32] bug fixes, UART API changes (#6329)

- OPENTHREAD_CONFIG_NCP_UART_ENABLE is now OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
- Pull in cli_uart.cpp UART API interface for sleepy-demo apps.
- Fix some erroneous ifdefs that affect 1.2 SoC builds and 1.1 builds.
- Add OT_RADIO_CAPS_SLEEP_TO_TX to radio capabilities (fixes #5819).
This commit is contained in:
suveshpratapa
2021-03-24 09:11:17 -07:00
committed by GitHub
parent 0cb70ce49d
commit 846fffed61
7 changed files with 36 additions and 5 deletions
@@ -27,6 +27,7 @@
#
add_executable(sleepy-demo-ftd
${PROJECT_SOURCE_DIR}/examples/apps/cli/cli_uart.cpp
main.c
)
@@ -38,11 +38,13 @@ bin_PROGRAMS =
CPPFLAGS_COMMON += \
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
-Wno-sign-compare \
-I$(top_srcdir)/examples/apps/cli \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/examples/platforms/efr32/$(PLATFORM_LOWERCASE)/$(BOARD_LOWERCASE) \
-I$(top_srcdir)/examples/platforms/efr32/$(PLATFORM_LOWERCASE) \
-I$(top_srcdir)/examples/platforms/efr32/src \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/third_party/silabs/rail_config \
$(SILABS_GSDK_CPPFLAGS) \
@@ -60,6 +62,7 @@ LIBTOOLFLAGS_COMMON +=
$(NULL)
SOURCES_COMMON += \
../../../../apps/cli/cli_uart.cpp \
main.c \
$(NULL)
@@ -71,6 +71,14 @@ void initUdp(void);
void applicationTick(void);
void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
/**
* This function initializes the CLI app.
*
* @param[in] aInstance The OpenThread instance structure.
*
*/
extern void otAppCliInit(otInstance *aInstance);
// Variables
static otInstance * instance;
static otUdpSocket sFtdSocket;
@@ -93,7 +101,7 @@ int main(int argc, char *argv[])
instance = otInstanceInitSingle();
assert(instance);
otCliUartInit(instance);
otAppCliInit(instance);
otCliOutputFormat("sleepy-demo-ftd started\r\n");
setNetworkConfiguration(instance);
@@ -27,6 +27,7 @@
#
add_executable(sleepy-demo-mtd
${PROJECT_SOURCE_DIR}/examples/apps/cli/cli_uart.cpp
main.c
)
@@ -38,11 +38,13 @@ bin_PROGRAMS =
CPPFLAGS_COMMON += \
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
-Wno-sign-compare \
-I$(top_srcdir)/examples/apps/cli \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/examples/platforms/efr32/$(PLATFORM_LOWERCASE)/$(BOARD_LOWERCASE) \
-I$(top_srcdir)/examples/platforms/efr32/$(PLATFORM_LOWERCASE) \
-I$(top_srcdir)/examples/platforms/efr32/src \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/third_party/silabs/rail_config \
$(SILABS_GSDK_CPPFLAGS) \
@@ -60,6 +62,7 @@ LIBTOOLFLAGS_COMMON +=
$(NULL)
SOURCES_COMMON += \
../../../../apps/cli/cli_uart.cpp \
main.c \
$(NULL)
@@ -76,6 +76,14 @@ void initUdp(void);
void applicationTick(void);
void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
/**
* This function initializes the CLI app.
*
* @param[in] aInstance The OpenThread instance structure.
*
*/
extern void otAppCliInit(otInstance *aInstance);
// Variables
static otInstance * instance;
static otUdpSocket sMtdSocket;
@@ -97,7 +105,7 @@ int main(int argc, char *argv[])
instance = otInstanceInitSingle();
assert(instance);
otCliUartInit(instance);
otAppCliInit(instance);
otLinkSetPollPeriod(instance, SLEEPY_POLL_PERIOD_MS);
setNetworkConfiguration(instance);
+10 -3
View File
@@ -944,6 +944,7 @@ void txCurrentPacket(void)
frameLength = (uint8_t)sTxFrame->mLength;
#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
// Update IE data in the 802.15.4 header with the newest CSL period / phase
if (sCslPeriod > 0)
@@ -952,7 +953,9 @@ void txCurrentPacket(void)
}
#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
#if OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
bool processSecurity = false;
#endif
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
// Seek the time sync offset and update the rendezvous time
@@ -970,11 +973,13 @@ void txCurrentPacket(void)
*(++timeIe) = (uint8_t)(time & 0xff);
}
#if OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
processSecurity = true;
#endif
}
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
#if OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
if (otMacFrameIsSecurityEnabled(sTxFrame) && otMacFrameIsKeyIdMode1(sTxFrame) &&
!sTxFrame->mInfo.mTxInfo.mIsSecurityProcessed)
{
@@ -988,12 +993,13 @@ void txCurrentPacket(void)
processSecurity = true;
}
#endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
if (processSecurity)
{
otMacFrameProcessTransmitAesCcm(sTxFrame, &sExtAddress);
}
#endif // OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
#endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
RAIL_WriteTxFifo(gRailHandle, &frameLength, sizeof frameLength, true);
RAIL_WriteTxFifo(gRailHandle, sTxFrame->mPsdu, frameLength - 2, false);
@@ -1122,7 +1128,8 @@ otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
otRadioCaps capabilities = (OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_ENERGY_SCAN);
otRadioCaps capabilities = (OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_ENERGY_SCAN |
OT_RADIO_CAPS_SLEEP_TO_TX);
#if OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
capabilities |= OT_RADIO_CAPS_TRANSMIT_SEC;