From ef9de651179e92a4633339420a9a68ddb6e34dde Mon Sep 17 00:00:00 2001 From: Marcin K Szczodrak Date: Wed, 1 Jun 2016 16:01:22 -0700 Subject: [PATCH] reorg apps and platforms (#89) --- README.md | 3 +- configure.ac | 9 ++-- examples/Makefile.am | 11 ++-- examples/posix/Makefile.am | 52 +++++++++++++++++++ examples/{platform => posix/app}/Makefile.am | 8 +-- examples/{ => posix/app}/cli/Makefile.am | 5 +- examples/{ => posix/app}/cli/README.md | 4 +- examples/{ => posix/app}/cli/main.cpp | 6 +-- examples/{ => posix/app}/ncp/Makefile.am | 5 +- examples/{ => posix/app}/ncp/main.cpp | 6 +-- .../posix => posix/platform}/Makefile.am | 9 ++-- .../posix => posix/platform}/alarm.c | 7 +-- .../posix => posix/platform}/logging.c | 0 .../posix => posix/platform}/platform.c | 25 +++++---- examples/posix/platform/posix-platform.c | 38 ++++++++++++++ .../platform/posix-platform.h} | 38 ++++++-------- .../posix => posix/platform}/radio.cpp | 9 ++-- .../posix => posix/platform}/random.c | 4 +- .../posix => posix/platform}/serial.c | 6 +-- tests/scripts/thread-cert/node.py | 2 +- tests/unit/Makefile.am | 2 +- 21 files changed, 164 insertions(+), 85 deletions(-) create mode 100644 examples/posix/Makefile.am rename examples/{platform => posix/app}/Makefile.am (90%) rename examples/{ => posix/app}/cli/Makefile.am (92%) rename examples/{ => posix/app}/cli/README.md (95%) rename examples/{ => posix/app}/cli/main.cpp (95%) rename examples/{ => posix/app}/ncp/Makefile.am (92%) rename examples/{ => posix/app}/ncp/main.cpp (95%) rename examples/{platform/posix => posix/platform}/Makefile.am (92%) rename examples/{platform/posix => posix/platform}/alarm.c (94%) rename examples/{platform/posix => posix/platform}/logging.c (100%) rename examples/{platform/posix => posix/platform}/platform.c (82%) create mode 100644 examples/posix/platform/posix-platform.c rename examples/{platform/posix/platform.h => posix/platform/posix-platform.h} (81%) rename examples/{platform/posix => posix/platform}/radio.cpp (98%) rename examples/{platform/posix => posix/platform}/random.c (97%) rename examples/{platform/posix => posix/platform}/serial.c (97%) diff --git a/README.md b/README.md index 93e6f9336..1ce9a77bd 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,8 @@ contributing to the ongoing development of OpenThread. # Getting Started # The easiest way to get started is to run the CLI example in -`/examples/cli`. See the [CLI example README](examples/cli/README.md) +`/examples/posix/app/cli`. See the +[CLI example README](examples/posix/app/cli/README.md) for more details. diff --git a/configure.ac b/configure.ac index aa7e592d1..ca5c51e43 100644 --- a/configure.ac +++ b/configure.ac @@ -434,10 +434,11 @@ src/core/Makefile third_party/Makefile third_party/mbedtls/Makefile examples/Makefile -examples/platform/Makefile -examples/platform/posix/Makefile -examples/cli/Makefile -examples/ncp/Makefile +examples/posix/Makefile +examples/posix/app/Makefile +examples/posix/app/cli/Makefile +examples/posix/app/ncp/Makefile +examples/posix/platform/Makefile tests/Makefile tests/scripts/Makefile tests/unit/Makefile diff --git a/examples/Makefile.am b/examples/Makefile.am index 0fac8e3a0..9aee34b15 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -31,24 +31,19 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am # Always package (e.g. for 'make dist') these subdirectories. DIST_SUBDIRS = \ - platform \ - cli \ - ncp \ + posix \ $(NULL) # Always build (e.g. for 'make all') these subdirectories. SUBDIRS = \ - platform \ - cli \ - ncp \ + posix \ $(NULL) # Always pretty (e.g. for 'make pretty') these subdirectories. PRETTY_SUBDIRS = \ - platform \ - cli \ + posix \ $(NULL) include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/examples/posix/Makefile.am b/examples/posix/Makefile.am new file mode 100644 index 000000000..8c44607d3 --- /dev/null +++ b/examples/posix/Makefile.am @@ -0,0 +1,52 @@ +# +# Copyright (c) 2016, Nest Labs, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +include $(abs_top_nlbuild_autotools_dir)/automake/pre.am + +# Always package (e.g. for 'make dist') these subdirectories. + +DIST_SUBDIRS = \ + platform \ + app \ + $(NULL) + +# Always build (e.g. for 'make all') these subdirectories. + +SUBDIRS = \ + platform \ + app \ + $(NULL) + +# Always pretty (e.g. for 'make pretty') these subdirectories. + +PRETTY_SUBDIRS = \ + platform \ + app \ + $(NULL) + +include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/examples/platform/Makefile.am b/examples/posix/app/Makefile.am similarity index 90% rename from examples/platform/Makefile.am rename to examples/posix/app/Makefile.am index 9aee34b15..7d3648d7e 100644 --- a/examples/platform/Makefile.am +++ b/examples/posix/app/Makefile.am @@ -31,19 +31,21 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am # Always package (e.g. for 'make dist') these subdirectories. DIST_SUBDIRS = \ - posix \ + cli \ + ncp \ $(NULL) # Always build (e.g. for 'make all') these subdirectories. SUBDIRS = \ - posix \ + cli \ + ncp \ $(NULL) # Always pretty (e.g. for 'make pretty') these subdirectories. PRETTY_SUBDIRS = \ - posix \ + cli \ $(NULL) include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/examples/cli/Makefile.am b/examples/posix/app/cli/Makefile.am similarity index 92% rename from examples/cli/Makefile.am rename to examples/posix/app/cli/Makefile.am index 7a247e714..c5ba8680f 100644 --- a/examples/cli/Makefile.am +++ b/examples/posix/app/cli/Makefile.am @@ -34,15 +34,14 @@ soc_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/core \ - -I$(top_srcdir)/examples \ - -I$(top_srcdir)/examples/platform/posix \ + -I$(top_srcdir)/examples/posix/platform \ $(OPENTHREAD_TARGET_DEFINES) \ $(NULL) soc_LDADD = \ $(top_builddir)/src/core/libopenthread.a \ $(top_builddir)/src/cli/libopenthread-cli.a \ - $(top_builddir)/examples/platform/posix/libopenthread-posix.a \ + $(top_builddir)/examples/posix/platform/libopenthread-posix.a \ $(top_builddir)/third_party/mbedtls/libmbedcrypto.a \ $(NULL) diff --git a/examples/cli/README.md b/examples/posix/app/cli/README.md similarity index 95% rename from examples/cli/README.md rename to examples/posix/app/cli/README.md index 2e9cdf2f1..94ea4c1dc 100644 --- a/examples/cli/README.md +++ b/examples/posix/app/cli/README.md @@ -19,7 +19,7 @@ $ make Spawn the process: ```bash -$ cd openthread/examples/cli +$ cd openthread/examples/posix/app/cli $ ./soc 1 ``` @@ -54,7 +54,7 @@ Done Spawn the process: ```bash -$ cd openthread/examples/cli +$ cd openthread/examples/posix/app/cli $ ./soc 2 ``` diff --git a/examples/cli/main.cpp b/examples/posix/app/cli/main.cpp similarity index 95% rename from examples/cli/main.cpp rename to examples/posix/app/cli/main.cpp index 0442d4970..b85edf950 100644 --- a/examples/cli/main.cpp +++ b/examples/posix/app/cli/main.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include Thread::Cli::Serial sCliServer; @@ -47,14 +47,14 @@ int main(int argc, char *argv[]) NODE_ID = atoi(argv[1]); - PlatformInit(); + posixPlatformInit(); otInit(); sCliServer.Start(); while (1) { otProcessNextTasklet(); - PlatformProcessDrivers(); + posixPlatformProcessDrivers(); } return 0; diff --git a/examples/ncp/Makefile.am b/examples/posix/app/ncp/Makefile.am similarity index 92% rename from examples/ncp/Makefile.am rename to examples/posix/app/ncp/Makefile.am index 56a689307..5c31b5644 100644 --- a/examples/ncp/Makefile.am +++ b/examples/posix/app/ncp/Makefile.am @@ -34,8 +34,7 @@ ncp_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/core \ - -I$(top_srcdir)/examples \ - -I$(top_srcdir)/examples/platform/posix \ + -I$(top_srcdir)/examples/posix/platform \ -I$(top_srcdir)/third_party \ $(OPENTHREAD_TARGET_DEFINES) \ $(NULL) @@ -43,7 +42,7 @@ ncp_CPPFLAGS = \ ncp_LDADD = \ $(top_builddir)/src/ncp/libopenthread-ncp.a \ $(top_builddir)/src/core/libopenthread.a \ - $(top_builddir)/examples/platform/posix/libopenthread-posix.a \ + $(top_builddir)/examples/posix/platform/libopenthread-posix.a \ $(top_builddir)/third_party/mbedtls/libmbedcrypto.a \ $(NULL) diff --git a/examples/ncp/main.cpp b/examples/posix/app/ncp/main.cpp similarity index 95% rename from examples/ncp/main.cpp rename to examples/posix/app/ncp/main.cpp index 9da3aa18a..c402cc067 100644 --- a/examples/ncp/main.cpp +++ b/examples/posix/app/ncp/main.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include Thread::Ncp sNcp; @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) } NODE_ID = atoi(argv[1]); - PlatformInit(); + posixPlatformInit(); otInit(); sNcp.Start(); @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) while (1) { otProcessNextTasklet(); - PlatformProcessDrivers(); + posixPlatformProcessDrivers(); } return 0; diff --git a/examples/platform/posix/Makefile.am b/examples/posix/platform/Makefile.am similarity index 92% rename from examples/platform/posix/Makefile.am rename to examples/posix/platform/Makefile.am index 05d043657..c19edc74c 100644 --- a/examples/platform/posix/Makefile.am +++ b/examples/posix/platform/Makefile.am @@ -34,8 +34,7 @@ libopenthread_posix_a_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/core \ - -I$(top_srcdir)/examples \ - -I$(top_srcdir)/examples/platform/posix \ + -I$(top_srcdir)/examples/posix/platform \ $(OPENTHREAD_TARGET_DEFINES) \ -D_BSD_SOURCE \ -D_GNU_SOURCE \ @@ -45,8 +44,7 @@ libopenthread_posix_a_CXXFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/core \ - -I$(top_srcdir)/examplse \ - -I$(top_srcdir)/examples/platform/posix \ + -I$(top_srcdir)/examples/posix/platform \ $(OPENTHREAD_TARGET_DEFINES) \ $(NULL) @@ -54,13 +52,14 @@ libopenthread_posix_a_SOURCES = \ alarm.c \ logging.c \ platform.c \ + posix-platform.c \ radio.cpp \ random.c \ serial.c \ $(NULL) include_HEADERS = \ - platform.h \ + posix-platform.h \ $(NULL) install-headers: install-includeHEADERS diff --git a/examples/platform/posix/alarm.c b/examples/posix/platform/alarm.c similarity index 94% rename from examples/platform/posix/alarm.c rename to examples/posix/platform/alarm.c index 46248bc31..60c38dff0 100644 --- a/examples/platform/posix/alarm.c +++ b/examples/posix/platform/alarm.c @@ -32,12 +32,13 @@ #include #include +#include static bool s_is_running = false; static uint32_t s_alarm = 0; static struct timeval s_start; -void PlatformAlarmInit(void) +void posixPlatformAlarmInit(void) { gettimeofday(&s_start, NULL); } @@ -63,7 +64,7 @@ void otPlatAlarmStop(void) s_is_running = false; } -void PlatformAlarmUpdateTimeout(struct timeval *aTimeout) +void posixPlatformAlarmUpdateTimeout(struct timeval *aTimeout) { int32_t remaining; @@ -94,7 +95,7 @@ void PlatformAlarmUpdateTimeout(struct timeval *aTimeout) } } -void PlatformAlarmProcess(void) +void posixPlatformAlarmProcess(void) { int32_t remaining; diff --git a/examples/platform/posix/logging.c b/examples/posix/platform/logging.c similarity index 100% rename from examples/platform/posix/logging.c rename to examples/posix/platform/logging.c diff --git a/examples/platform/posix/platform.c b/examples/posix/platform/platform.c similarity index 82% rename from examples/platform/posix/platform.c rename to examples/posix/platform/platform.c index e913e0162..9c884c8a9 100644 --- a/examples/platform/posix/platform.c +++ b/examples/posix/platform/platform.c @@ -40,20 +40,19 @@ #include #include - -#include "platform.h" +#include uint32_t NODE_ID = 1; uint32_t WELLKNOWN_NODE_ID = 34; -void PlatformInit(void) +void posixPlatformInit(void) { - PlatformAlarmInit(); - PlatformRadioInit(); - PlatformRandomInit(); + posixPlatformAlarmInit(); + posixPlatformRadioInit(); + posixPlatformRandomInit(); } -void PlatformProcessDrivers(void) +void posixPlatformProcessDrivers(void) { fd_set read_fds; fd_set write_fds; @@ -64,9 +63,9 @@ void PlatformProcessDrivers(void) FD_ZERO(&read_fds); FD_ZERO(&write_fds); - PlatformSerialUpdateFdSet(&read_fds, &write_fds, &max_fd); - PlatformRadioUpdateFdSet(&read_fds, &write_fds, &max_fd); - PlatformAlarmUpdateTimeout(&timeout); + posixPlatformSerialUpdateFdSet(&read_fds, &write_fds, &max_fd); + posixPlatformRadioUpdateFdSet(&read_fds, &write_fds, &max_fd); + posixPlatformAlarmUpdateTimeout(&timeout); if (!otAreTaskletsPending()) { @@ -74,8 +73,8 @@ void PlatformProcessDrivers(void) assert(rval >= 0 && errno != ETIME); } - PlatformSerialProcess(); - PlatformRadioProcess(); - PlatformAlarmProcess(); + posixPlatformSerialProcess(); + posixPlatformRadioProcess(); + posixPlatformAlarmProcess(); } diff --git a/examples/posix/platform/posix-platform.c b/examples/posix/platform/posix-platform.c new file mode 100644 index 000000000..000b1711a --- /dev/null +++ b/examples/posix/platform/posix-platform.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016, Nest Labs, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes the platform-specific initializers. + */ + +#include + +uint32_t NODE_ID = 1; + diff --git a/examples/platform/posix/platform.h b/examples/posix/platform/posix-platform.h similarity index 81% rename from examples/platform/posix/platform.h rename to examples/posix/platform/posix-platform.h index b5bc4368d..11db426fe 100644 --- a/examples/platform/posix/platform.h +++ b/examples/posix/platform/posix-platform.h @@ -29,11 +29,11 @@ /** * @file * @brief - * This file includes the platform-specific initializers. + * This file includes the posix platform-specific initializers. */ -#ifndef PLATFORM_H_ -#define PLATFORM_H_ +#ifndef POSIX_PLATFORM_H_ +#define POSIX_PLATFORM_H_ #include #include @@ -44,7 +44,7 @@ extern "C" { #endif /** - * Unique ID used by a simulated node. + * Unique node ID. * */ extern uint32_t NODE_ID; @@ -59,19 +59,19 @@ extern uint32_t WELLKNOWN_NODE_ID; * This method performs all platform-specific initialization. * */ -void PlatformInit(void); +void posixPlatformInit(void); /** * This method performs all platform-specific processing. * */ -void PlatformProcessDrivers(void); +void posixPlatformProcessDrivers(void); /** * This method initializes the alarm service used by OpenThread. * */ -void PlatformAlarmInit(void); +void posixPlatformAlarmInit(void); /** * This method retrieves the time remaining until the alarm fires. @@ -79,19 +79,19 @@ void PlatformAlarmInit(void); * @param[out] aTimeval A pointer to the timeval struct. * */ -void PlatformAlarmUpdateTimeout(struct timeval *tv); +void posixPlatformAlarmUpdateTimeout(struct timeval *tv); /** * This method performs alarm driver processing. * */ -void PlatformAlarmProcess(void); +void posixPlatformAlarmProcess(void); /** * This method initializes the radio service used by OpenThread. * */ -void PlatformRadioInit(void); +void posixPlatformRadioInit(void); /** * This method updates the file descriptor sets with file descriptors used by the radio driver. @@ -101,19 +101,19 @@ void PlatformRadioInit(void); * @param[inout] aMaxFd A pointer to the max file descriptor. * */ -void PlatformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd); +void posixPlatformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd); /** * This method performs radio driver processing. * */ -void PlatformRadioProcess(void); +void posixPlatformRadioProcess(void); /** * This method initializes the random number service used by OpenThread. * */ -void PlatformRandomInit(void); +void posixPlatformRandomInit(void); /** * This method updates the file descriptor sets with file descriptors used by the serial driver. @@ -123,22 +123,16 @@ void PlatformRandomInit(void); * @param[inout] aMaxFd A pointer to the max file descriptor. * */ -void PlatformSerialUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd); +void posixPlatformSerialUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd); /** * This method performs radio driver processing. * */ -void PlatformSerialProcess(void); - -/** - * This method puts the thread executing OpenThread to sleep. - * - */ -void PlatformSleep(void); +void posixPlatformSerialProcess(void); #ifdef __cplusplus } // extern "C" #endif -#endif // PLATFORM_H_ +#endif // POSIX_PLATFORM_H_ diff --git a/examples/platform/posix/radio.cpp b/examples/posix/platform/radio.cpp similarity index 98% rename from examples/platform/posix/radio.cpp rename to examples/posix/platform/radio.cpp index 8c5da7c54..cc0cc178f 100644 --- a/examples/platform/posix/radio.cpp +++ b/examples/posix/platform/radio.cpp @@ -42,8 +42,7 @@ #include #include #include - -#include "platform.h" +#include #ifdef __cplusplus extern "C" { @@ -110,7 +109,7 @@ ThreadError otPlatRadioSetShortAddress(uint16_t address) return kThreadError_None; } -void PlatformRadioInit(void) +void posixPlatformRadioInit(void) { struct sockaddr_in sockaddr; memset(&sockaddr, 0, sizeof(sockaddr)); @@ -370,7 +369,7 @@ int radioTransmit(void) return rval; } -void PlatformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd) +void posixPlatformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd) { if (aReadFdSet != NULL && (s_state == kStateDisabled || s_state == kStateSleep || s_state == kStateListen || s_state == kStateAckWait)) @@ -394,7 +393,7 @@ void PlatformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMax } } -void PlatformRadioProcess(void) +void posixPlatformRadioProcess(void) { const int flags = POLLRDNORM | POLLERR | POLLNVAL | POLLHUP; struct pollfd pollfd = { s_sockfd, flags, 0 }; diff --git a/examples/platform/posix/random.c b/examples/posix/platform/random.c similarity index 97% rename from examples/platform/posix/random.c rename to examples/posix/platform/random.c index 69816e006..bed03486d 100644 --- a/examples/platform/posix/random.c +++ b/examples/posix/platform/random.c @@ -35,11 +35,11 @@ */ #include -#include "platform.h" +#include static uint32_t s_state = 1; -void PlatformRandomInit(void) +void posixPlatformRandomInit(void) { s_state = NODE_ID; } diff --git a/examples/platform/posix/serial.c b/examples/posix/platform/serial.c similarity index 97% rename from examples/platform/posix/serial.c rename to examples/posix/platform/serial.c index 632616c24..8150b6864 100644 --- a/examples/platform/posix/serial.c +++ b/examples/posix/platform/serial.c @@ -35,7 +35,7 @@ #include #include -#include "platform.h" +#include #ifdef OPENTHREAD_TARGET_LINUX int posix_openpt(int oflag); @@ -162,7 +162,7 @@ exit: return error; } -void PlatformSerialUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd) +void posixPlatformSerialUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd) { if (aReadFdSet != NULL) { @@ -185,7 +185,7 @@ void PlatformSerialUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMa } } -void PlatformSerialProcess(void) +void posixPlatformSerialProcess(void) { const int flags = POLLRDNORM | POLLERR | POLLNVAL | POLLHUP; struct pollfd pollfd = { s_in_fd, flags, 0 }; diff --git a/tests/scripts/thread-cert/node.py b/tests/scripts/thread-cert/node.py index 5386c47b6..dc0c57164 100755 --- a/tests/scripts/thread-cert/node.py +++ b/tests/scripts/thread-cert/node.py @@ -54,7 +54,7 @@ class Node: """ Initialize a simulation node. """ if "top_builddir" in os.environ.keys(): srcdir = os.environ['top_builddir'] - cmd = '%s/examples/cli/soc' % srcdir + cmd = '%s/examples/posix/app/cli/soc' % srcdir else: cmd = './soc' cmd += ' %d' % nodeid diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 68081f88d..163433f7d 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -55,7 +55,7 @@ AM_CPPFLAGS = \ COMMON_LDADD = \ $(top_builddir)/src/core/libopenthread.a \ - $(top_builddir)/examples/platform/posix/libopenthread-posix.a \ + $(top_builddir)/examples/posix/platform/libopenthread-posix.a \ $(top_builddir)/third_party/mbedtls/libmbedcrypto.a \ -lpthread \ $(NULL)