[posix] radio only host side driver (#2690)

This commit is contained in:
Yakun Xu
2018-06-25 16:32:32 -07:00
committed by Jonathan Hui
parent 17eace65e2
commit 1b14a36a35
42 changed files with 5842 additions and 32 deletions
+28 -4
View File
@@ -51,12 +51,24 @@ if OPENTHREAD_BUILD_TESTS
AM_CPPFLAGS = \
-DOPENTHREAD_FTD=1 \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
$(NULL)
if OPENTHREAD_EXAMPLES_POSIX
AM_CPPFLAGS += \
-I$(top_srcdir)/examples/platforms \
$(NULL)
endif
if OPENTHREAD_ENABLE_POSIX_APP
AM_CPPFLAGS += \
-DOPENTHREAD_ENABLE_POSIX_APP=1 \
-I$(top_srcdir)/src/posix/platform \
$(NULL)
endif
if OPENTHREAD_ENABLE_NCP
COMMON_LDADD = \
@@ -80,6 +92,12 @@ COMMON_LDADD += \
$(NULL)
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
if OPENTHREAD_ENABLE_POSIX_APP
COMMON_LDADD += \
-lutil
$(NULL)
endif
# Test applications that should be run when the 'check' target is run.
check_PROGRAMS = \
@@ -210,10 +228,16 @@ test_toolchain_LDADD = $(COMMON_LDADD)
test_toolchain_SOURCES = test_platform.cpp test_toolchain.cpp test_toolchain_c.c
if OPENTHREAD_ENABLE_DIAG
test_diag_LDADD = $(top_builddir)/src/diag/libopenthread-diag.a \
$(top_builddir)/examples/platforms/posix/libopenthread-posix.a \
$(NULL)
test_diag_LDADD = $(top_builddir)/src/diag/libopenthread-diag.a
test_diag_SOURCES = test_diag.cpp
if OPENTHREAD_ENABLE_POSIX_APP
test_diag_LDADD += $(top_builddir)/src/posix/platform/libopenthread-posix.a \
-lutil \
$(NULL)
endif
if OPENTHREAD_EXAMPLES_POSIX
test_diag_LDADD += $(top_builddir)/examples/platforms/posix/libopenthread-posix.a
endif
endif
PRETTY_FILES = \
+8 -3
View File
@@ -29,6 +29,8 @@
#include <openthread/diag.h>
#include <openthread/platform/radio.h>
#include <stdlib.h>
#include "utils/wrap_string.h"
#include "platform.h"
@@ -227,9 +229,12 @@ void TestDiag(void)
}};
// initialize platform layer
int argc = 2;
char *argv[8] = {(char *)"test_diag", (char *)"1"};
PlatformInit(argc, argv);
#if OPENTHREAD_ENABLE_POSIX_APP
char *argv[] = {(char *)"test_diag", getenv("RADIO_DEVICE"), (char *)"1"};
#else
char *argv[] = {(char *)"test_diag", (char *)"1"};
#endif
PlatformInit(sizeof(argv) / sizeof(char *), argv);
// initialize diagnostics module
otDiagInit(NULL);