From ae2631e47199220ea8a61af231585cbbbc88a157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Tue, 27 Aug 2019 11:45:31 +0200 Subject: [PATCH] px4_middleware: remove that header and move px4::init to px4_init.h delete include: for i in $(grep -rl 'px4_middleware.h' src platforms); do sed -i '/#include -#include #include +#include #include int PX4_MAIN(int argc, char **argv) diff --git a/platforms/common/work_queue/wqueue_test/wqueue_main.cpp b/platforms/common/work_queue/wqueue_test/wqueue_main.cpp index 9f693c62a922..fb222df24c68 100644 --- a/platforms/common/work_queue/wqueue_test/wqueue_main.cpp +++ b/platforms/common/work_queue/wqueue_test/wqueue_main.cpp @@ -40,7 +40,6 @@ #include "wqueue_test.h" #include -#include #include #include diff --git a/platforms/nuttx/src/px4/common/px4_nuttx_impl.cpp b/platforms/nuttx/src/px4/common/px4_nuttx_impl.cpp index e760cee5e9b9..30780b11d70f 100644 --- a/platforms/nuttx/src/px4/common/px4_nuttx_impl.cpp +++ b/platforms/nuttx/src/px4/common/px4_nuttx_impl.cpp @@ -38,7 +38,6 @@ */ #include -#include #include namespace px4 @@ -49,9 +48,4 @@ void init(int argc, char *argv[], const char *process_name) printf("process: %s\n", process_name); } -uint64_t get_time_micros() -{ - return hrt_absolute_time(); -} - } diff --git a/platforms/posix/src/px4/common/main.cpp b/platforms/posix/src/px4/common/main.cpp index 21763ae2afa4..016969031a22 100644 --- a/platforms/posix/src/px4/common/main.cpp +++ b/platforms/posix/src/px4/common/main.cpp @@ -64,14 +64,13 @@ #include #include +#include #include #include #include #include "apps.h" -#include "px4_middleware.h" #include "DriverFramework.hpp" -#include "px4_middleware.h" #include "px4_daemon/client.h" #include "px4_daemon/server.h" #include "px4_daemon/pxh.h" diff --git a/platforms/posix/src/px4/common/px4_posix_impl.cpp b/platforms/posix/src/px4/common/px4_posix_impl.cpp index 9c1cf6504214..3b31c6169869 100644 --- a/platforms/posix/src/px4/common/px4_posix_impl.cpp +++ b/platforms/posix/src/px4/common/px4_posix_impl.cpp @@ -38,7 +38,6 @@ */ #include -#include #include #include #include @@ -98,10 +97,5 @@ void init(int argc, char *argv[], const char *app_name) #endif } -uint64_t get_time_micros() -{ - return hrt_absolute_time(); -} - } diff --git a/platforms/posix/src/px4/common/px4_sem.cpp b/platforms/posix/src/px4/common/px4_sem.cpp index e579c9222f64..d303f8e66ce1 100644 --- a/platforms/posix/src/px4/common/px4_sem.cpp +++ b/platforms/posix/src/px4/common/px4_sem.cpp @@ -38,7 +38,6 @@ */ #include -#include #include #include #include diff --git a/platforms/qurt/src/px4/common/main.cpp b/platforms/qurt/src/px4/common/main.cpp index 2fe6b57aac50..8f2aac9323ea 100644 --- a/platforms/qurt/src/px4/common/main.cpp +++ b/platforms/qurt/src/px4/common/main.cpp @@ -38,10 +38,10 @@ * @author Julian Oes */ -#include #include #include #include +#include #include #include #include diff --git a/platforms/qurt/src/px4/common/px4_qurt_impl.cpp b/platforms/qurt/src/px4/common/px4_qurt_impl.cpp index 699f0c9ee506..41e5c6556690 100644 --- a/platforms/qurt/src/px4/common/px4_qurt_impl.cpp +++ b/platforms/qurt/src/px4/common/px4_qurt_impl.cpp @@ -39,7 +39,6 @@ #include #include -#include #include #include #include diff --git a/src/drivers/pwm_out_sim/PWMSim.hpp b/src/drivers/pwm_out_sim/PWMSim.hpp index a8d9ec7ecf01..81d26e8b63ab 100644 --- a/src/drivers/pwm_out_sim/PWMSim.hpp +++ b/src/drivers/pwm_out_sim/PWMSim.hpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/src/drivers/qshell/qurt/qshell.cpp b/src/drivers/qshell/qurt/qshell.cpp index d159be1bc811..9a7c55417ac6 100644 --- a/src/drivers/qshell/qurt/qshell.cpp +++ b/src/drivers/qshell/qurt/qshell.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include diff --git a/src/drivers/qshell/qurt/qshell_main.cpp b/src/drivers/qshell/qurt/qshell_main.cpp index 95da6bbbb764..ecf966f1aba8 100644 --- a/src/drivers/qshell/qurt/qshell_main.cpp +++ b/src/drivers/qshell/qurt/qshell_main.cpp @@ -38,9 +38,9 @@ * @author Nicolas de Palezieux */ -#include #include #include +#include #include "qshell.h" extern "C" __EXPORT int qshell_entry(int argc, char **argv); diff --git a/src/drivers/qurt/tests/hello/hello_main.cpp b/src/drivers/qurt/tests/hello/hello_main.cpp index 35e72e8b364d..e8ed25bab8d5 100644 --- a/src/drivers/qurt/tests/hello/hello_main.cpp +++ b/src/drivers/qurt/tests/hello/hello_main.cpp @@ -37,9 +37,9 @@ * * @author Mark Charlebois */ -#include #include #include +#include #include "hello_example.h" #include diff --git a/src/drivers/qurt/tests/muorb/muorb_test_main.cpp b/src/drivers/qurt/tests/muorb/muorb_test_main.cpp index c6818a9270fb..fc172f7a909c 100644 --- a/src/drivers/qurt/tests/muorb/muorb_test_main.cpp +++ b/src/drivers/qurt/tests/muorb/muorb_test_main.cpp @@ -37,9 +37,9 @@ * * @author Mark Charlebois */ -#include #include #include +#include #include "muorb_test_example.h" extern "C" __EXPORT int muorb_test_entry(int argc, char **argv); diff --git a/src/drivers/qurt/tests/muorb/muorb_test_start_qurt.cpp b/src/drivers/qurt/tests/muorb/muorb_test_start_qurt.cpp index ba44169ec3a0..0eef795ca34f 100644 --- a/src/drivers/qurt/tests/muorb/muorb_test_start_qurt.cpp +++ b/src/drivers/qurt/tests/muorb/muorb_test_start_qurt.cpp @@ -39,6 +39,7 @@ #include "muorb_test_example.h" #include #include +#include #include #include #include diff --git a/src/examples/hello/hello_main.cpp b/src/examples/hello/hello_main.cpp index 75bff11cd167..227bc0ebc52d 100644 --- a/src/examples/hello/hello_main.cpp +++ b/src/examples/hello/hello_main.cpp @@ -40,8 +40,8 @@ #include "hello_example.h" -#include #include +#include #include int PX4_MAIN(int argc, char **argv) diff --git a/src/lib/cdev/test/cdevtest_main.cpp b/src/lib/cdev/test/cdevtest_main.cpp index cf4c05a42d39..e642e80b9e9e 100644 --- a/src/lib/cdev/test/cdevtest_main.cpp +++ b/src/lib/cdev/test/cdevtest_main.cpp @@ -39,8 +39,8 @@ */ #include "cdevtest_example.h" -#include #include +#include #include int PX4_MAIN(int argc, char **argv) diff --git a/src/modules/muorb/adsp/px4muorb.cpp b/src/modules/muorb/adsp/px4muorb.cpp index 6b27cb742f6b..b791ebb9830c 100644 --- a/src/modules/muorb/adsp/px4muorb.cpp +++ b/src/modules/muorb/adsp/px4muorb.cpp @@ -35,7 +35,6 @@ #include "uORBFastRpcChannel.hpp" #include "uORBManager.hpp" -#include #include #include #include diff --git a/src/modules/muorb/test/muorb_test_main.cpp b/src/modules/muorb/test/muorb_test_main.cpp index 2d83e8e20174..995cc49da1f1 100644 --- a/src/modules/muorb/test/muorb_test_main.cpp +++ b/src/modules/muorb/test/muorb_test_main.cpp @@ -37,9 +37,9 @@ * * @author Mark Charlebois */ -#include #include #include +#include #include "muorb_test_example.h" #include #include "uORB/uORBManager.hpp" diff --git a/src/platforms/px4_common.h b/src/platforms/px4_common.h deleted file mode 100644 index 384b1bca656b..000000000000 --- a/src/platforms/px4_common.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef __PX4_QURT -#include -size_t strnlen(const char *s, size_t maxlen); - -#endif diff --git a/src/platforms/px4_init.h b/src/platforms/px4_init.h index 77cebfadf45d..a0bf68a1d291 100644 --- a/src/platforms/px4_init.h +++ b/src/platforms/px4_init.h @@ -36,3 +36,19 @@ __BEGIN_DECLS int px4_platform_init(void); __END_DECLS + +#ifdef __cplusplus + +namespace px4 +{ + +/** + * Startup init method. It has no specific functionality, just prints a welcome + * message and sets the thread name + */ +__EXPORT void init(int argc, char *argv[], const char *process_name); + +} // namespace px4 + +#endif /* __cplusplus */ + diff --git a/src/platforms/px4_middleware.h b/src/platforms/px4_middleware.h deleted file mode 100644 index 393074848799..000000000000 --- a/src/platforms/px4_middleware.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2014 PX4 Development Team. 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 PX4 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 OWNER 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 px4_middleware.h - * - * PX4 generic middleware wrapper - */ - -#pragma once - -#include -#include - -namespace px4 -{ - -__EXPORT void init(int argc, char *argv[], const char *process_name); - -__EXPORT uint64_t get_time_micros(); - -#if defined(__PX4_NUTTX) -extern bool task_should_exit; -/** - * Returns true if the app/task should continue to run - */ -__EXPORT inline bool ok() { return !task_should_exit; } -#elif defined(__PX4_QURT) -// FIXME - usleep not supported by DSPAL -inline void usleep(uint64_t sleep_interval) { } -#else -/** - * Linux needs to have globally unique checks for thread/task status - */ -#endif - -} // namespace px4 diff --git a/src/systemcmds/tests/hrt_test/hrt_test_main.cpp b/src/systemcmds/tests/hrt_test/hrt_test_main.cpp index d90cffba4093..3509142d2448 100644 --- a/src/systemcmds/tests/hrt_test/hrt_test_main.cpp +++ b/src/systemcmds/tests/hrt_test/hrt_test_main.cpp @@ -42,8 +42,8 @@ #include -#include #include +#include int PX4_MAIN(int argc, char **argv) { diff --git a/src/systemcmds/topic_listener/generate_listener.py b/src/systemcmds/topic_listener/generate_listener.py index 8b7ca12344b6..d0f7adf5763a 100755 --- a/src/systemcmds/topic_listener/generate_listener.py +++ b/src/systemcmds/topic_listener/generate_listener.py @@ -89,7 +89,6 @@ */ #include -#include #include #include #include diff --git a/src/systemcmds/topic_listener/topic_listener.hpp b/src/systemcmds/topic_listener/topic_listener.hpp index ce856bd8e80b..be1b94077214 100644 --- a/src/systemcmds/topic_listener/topic_listener.hpp +++ b/src/systemcmds/topic_listener/topic_listener.hpp @@ -40,7 +40,6 @@ #include #include -#include #include #include #include