From 2d0baf8fc56b97013d24b38f9f499325db8eef34 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Thu, 30 Aug 2018 00:57:46 +0800 Subject: [PATCH] [ncp] remove diags module from radio only ncp (#3002) The diags module runs on host side, radio only ncp will only act as transceiver and support platform specific diags features. --- examples/apps/ncp/Makefile.am | 9 ++++++++- src/core/api/link_raw_api.cpp | 36 ++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/examples/apps/ncp/Makefile.am b/examples/apps/ncp/Makefile.am index 802e814e2..df3a96cc6 100644 --- a/examples/apps/ncp/Makefile.am +++ b/examples/apps/ncp/Makefile.am @@ -54,6 +54,9 @@ SOURCES_COMMON += \ LDADD_MBEDTLS = \ $(NULL) +LDADD_DIAG = \ + $(NULL) + if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS LDADD_MBEDTLS += \ $(top_builddir)/third_party/mbedtls/libmbedcrypto.a \ @@ -61,7 +64,7 @@ LDADD_MBEDTLS += \ endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS if OPENTHREAD_ENABLE_DIAG -LDADD_COMMON += \ +LDADD_DIAG += \ $(top_builddir)/src/diag/libopenthread-diag.a \ $(NULL) endif @@ -87,9 +90,11 @@ ot_ncp_ftd_LDADD = \ $(top_builddir)/src/core/libopenthread-ftd.a \ $(LDADD_COMMON) \ $(LDADD_MBEDTLS) \ + $(LDADD_DIAG) \ $(top_builddir)/src/core/libopenthread-ftd.a \ $(LDADD_COMMON) \ $(LDADD_MBEDTLS) \ + $(LDADD_DIAG) \ $(NULL) ot_ncp_ftd_LDFLAGS = \ @@ -119,9 +124,11 @@ ot_ncp_mtd_LDADD = \ $(top_builddir)/src/core/libopenthread-mtd.a \ $(LDADD_COMMON) \ $(LDADD_MBEDTLS) \ + $(LDADD_DIAG) \ $(top_builddir)/src/core/libopenthread-mtd.a \ $(LDADD_COMMON) \ $(LDADD_MBEDTLS) \ + $(LDADD_DIAG) \ $(NULL) ot_ncp_mtd_LDFLAGS = \ diff --git a/src/core/api/link_raw_api.cpp b/src/core/api/link_raw_api.cpp index 67dd6f0f4..14ff849d0 100644 --- a/src/core/api/link_raw_api.cpp +++ b/src/core/api/link_raw_api.cpp @@ -33,6 +33,8 @@ #include "openthread-core-config.h" +#include + #include "common/debug.hpp" #include "common/instance.hpp" #include "common/logging.hpp" @@ -763,8 +765,40 @@ uint16_t otLinkGetShortAddress(otInstance *aInstance) return static_cast(aInstance)->GetLinkRaw().GetShortAddress(); } +#if OPENTHREAD_ENABLE_DIAG +void otDiagInit(otInstance *aInstance) +{ + (void)aInstance; +} + +const char *otDiagProcessCmdLine(const char *aInput) +{ + (void)aInput; + return NULL; +} + +extern "C" void otPlatDiagAlarmFired(otInstance *aInstance) +{ + (void)aInstance; +} + +extern "C" void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError) +{ + (void)aInstance; + (void)aFrame; + (void)aError; +} + +extern "C" void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError) +{ + (void)aInstance; + (void)aFrame; + (void)aError; +} +#endif // OPENTHREAD_ENABLE_DIAG + #if OPENTHREAD_CONFIG_HEADER_IE_SUPPORT -void otPlatRadioFrameUpdated(otInstance *aInstance, otRadioFrame *aFrame) +extern "C" void otPlatRadioFrameUpdated(otInstance *aInstance, otRadioFrame *aFrame) { // Note: For now this functionality is not supported in Radio Only mode. (void)aInstance;