mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 10:53:34 +08:00
Merge branch 'master' of github.com:PX4/Firmware into control_state
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
set(depends
|
||||
msg_gen
|
||||
prebuild_targets
|
||||
git_mavlink
|
||||
git_uavcan
|
||||
)
|
||||
|
||||
if(${OS} STREQUAL "posix" OR ${BOARD} STREQUAL "sim")
|
||||
list(APPEND depends git_eigen)
|
||||
endif()
|
||||
|
||||
px4_add_module(
|
||||
MODULE platforms__common
|
||||
SRCS
|
||||
px4_getopt.c
|
||||
DEPENDS
|
||||
${depends}
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,42 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__nuttx
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
px4_nuttx_impl.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__nuttx__px4_layer
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
px4_nuttx_tasks.c
|
||||
../../posix/px4_layer/px4_log.c
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -50,7 +50,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef CONFIG_ARCH_BOARD_SIM
|
||||
#include <stm32_pwr.h>
|
||||
#endif
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
|
||||
@@ -61,7 +63,9 @@ void
|
||||
px4_systemreset(bool to_bootloader)
|
||||
{
|
||||
if (to_bootloader) {
|
||||
#ifndef CONFIG_ARCH_BOARD_SIM
|
||||
stm32_pwr_enablebkp();
|
||||
#endif
|
||||
|
||||
/* XXX wow, this is evil - write a magic number into backup register zero */
|
||||
*(uint32_t *)0x40002850 = 0xb007b007;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__drivers__accelsim
|
||||
MAIN accelsim
|
||||
SRCS
|
||||
accelsim.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -448,6 +448,9 @@ ACCELSIM::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
|
||||
struct mag_report mrp = {};
|
||||
struct accel_report arp = {};
|
||||
|
||||
/* do SIM init first */
|
||||
if (VDev::init() != OK) {
|
||||
PX4_WARN("SIM init failed");
|
||||
@@ -478,7 +481,6 @@ ACCELSIM::init()
|
||||
measure();
|
||||
|
||||
/* advertise sensor topic, measure manually to initialize valid report */
|
||||
struct mag_report mrp;
|
||||
_mag_reports->get(&mrp);
|
||||
|
||||
/* measurement will have generated a report, publish */
|
||||
@@ -493,7 +495,6 @@ ACCELSIM::init()
|
||||
_accel_class_instance = register_class_devname(ACCEL_BASE_DEVICE_PATH);
|
||||
|
||||
/* advertise sensor topic, measure manually to initialize valid report */
|
||||
struct accel_report arp;
|
||||
_accel_reports->get(&arp);
|
||||
|
||||
/* measurement will have generated a report, publish */
|
||||
@@ -1014,7 +1015,7 @@ ACCELSIM::measure()
|
||||
} raw_accel_report;
|
||||
#pragma pack(pop)
|
||||
|
||||
accel_report accel_report;
|
||||
accel_report accel_report = {};
|
||||
|
||||
/* start the performance counter */
|
||||
perf_begin(_accel_sample_perf);
|
||||
@@ -1023,7 +1024,7 @@ ACCELSIM::measure()
|
||||
memset(&raw_accel_report, 0, sizeof(raw_accel_report));
|
||||
raw_accel_report.cmd = DIR_READ | ACC_READ;
|
||||
|
||||
if(OK != transfer((uint8_t *)&raw_accel_report, (uint8_t *)&raw_accel_report, sizeof(raw_accel_report))) {
|
||||
if (OK != transfer((uint8_t *)&raw_accel_report, (uint8_t *)&raw_accel_report, sizeof(raw_accel_report))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__drivers__adcsim
|
||||
MAIN adcsim
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
adcsim.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,44 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__drivers__airspeedsim
|
||||
MAIN measairspeedsim
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
airspeedsim.cpp
|
||||
meas_airspeed_sim.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -354,12 +354,6 @@ MEASAirspeedSim::voltage_correction(float &diff_press_pa, float &temperature)
|
||||
namespace meas_airspeed_sim
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
MEASAirspeedSim *g_dev = nullptr;
|
||||
|
||||
int start(int i2c_bus);
|
||||
@@ -589,7 +583,7 @@ measairspeedsim_main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Start/load the driver.
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__drivers__barosim
|
||||
MAIN barosim
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
baro.cpp
|
||||
baro_sim.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -72,12 +72,6 @@ enum BAROSIM_BUS {
|
||||
BAROSIM_BUS_SIM_EXTERNAL
|
||||
};
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
/* helper macro for handling report buffer indices */
|
||||
#define INCREMENT(_x, _lim) do { __typeof__(_x) _tmp = _x+1; if (_tmp >= _lim) _tmp = 0; _x = _tmp; } while(0)
|
||||
|
||||
|
||||
@@ -80,5 +80,5 @@ extern bool crc4(uint16_t *n_prom);
|
||||
} /* namespace */
|
||||
|
||||
/* interface factories */
|
||||
extern device::Device *BAROSIM_sim_interface(barosim::prom_u &prom_buf, uint8_t busnum) __attribute__((weak));
|
||||
extern device::Device *BAROSIM_sim_interface(barosim::prom_u &prom_buf, uint8_t busnum);
|
||||
typedef device::Device *(*BAROSIM_constructor)(barosim::prom_u &prom_buf, uint8_t busnum);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__drivers__gpssim
|
||||
MAIN gpssim
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
gpssim.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -37,7 +37,8 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__drivers__gyrosim
|
||||
MAIN gyrosim
|
||||
STACK 1200
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
gyrosim.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -52,7 +52,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <semaphore.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
@@ -419,6 +418,9 @@ GYROSIM::init()
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct accel_report arp = {};
|
||||
struct gyro_report grp = {};
|
||||
|
||||
/* allocate basic report buffers */
|
||||
_accel_reports = new ringbuffer::RingBuffer(2, sizeof(accel_report));
|
||||
if (_accel_reports == nullptr) {
|
||||
@@ -466,7 +468,6 @@ GYROSIM::init()
|
||||
measure();
|
||||
|
||||
/* advertise sensor topic, measure manually to initialize valid report */
|
||||
struct accel_report arp;
|
||||
_accel_reports->get(&arp);
|
||||
|
||||
/* measurement will have generated a report, publish */
|
||||
@@ -482,7 +483,6 @@ GYROSIM::init()
|
||||
|
||||
|
||||
/* advertise sensor topic, measure manually to initialize valid report */
|
||||
struct gyro_report grp;
|
||||
_gyro_reports->get(&grp);
|
||||
|
||||
_gyro->_gyro_topic = orb_advertise_multi(ORB_ID(sensor_gyro), &grp,
|
||||
@@ -511,8 +511,10 @@ GYROSIM::transfer(uint8_t *send, uint8_t *recv, unsigned len)
|
||||
if (cmd == MPUREAD) {
|
||||
// Get data from the simulator
|
||||
Simulator *sim = Simulator::getInstance();
|
||||
if (sim == NULL)
|
||||
if (sim == NULL) {
|
||||
PX4_WARN("failed accessing simulator");
|
||||
return ENODEV;
|
||||
}
|
||||
|
||||
// FIXME - not sure what interrupt status should be
|
||||
recv[1] = 0;
|
||||
@@ -529,6 +531,7 @@ GYROSIM::transfer(uint8_t *send, uint8_t *recv, unsigned len)
|
||||
if (recv)
|
||||
memcpy(&recv[1], &_regdata[reg-MPUREG_PRODUCT_ID], len-1);
|
||||
}
|
||||
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
@@ -765,8 +768,9 @@ GYROSIM::ioctl(device::file_t *filp, int cmd, unsigned long arg)
|
||||
bool want_start = (_call_interval == 0);
|
||||
|
||||
/* if we need to start the poll state machine, do it */
|
||||
if (want_start)
|
||||
if (want_start) {
|
||||
start();
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -1012,7 +1016,7 @@ GYROSIM::measure()
|
||||
x++;
|
||||
}
|
||||
#endif
|
||||
struct MPUReport mpu_report;
|
||||
struct MPUReport mpu_report = {};
|
||||
|
||||
/* start measuring */
|
||||
perf_begin(_sample_perf);
|
||||
@@ -1031,8 +1035,8 @@ GYROSIM::measure()
|
||||
/*
|
||||
* Report buffers.
|
||||
*/
|
||||
accel_report arb;
|
||||
gyro_report grb;
|
||||
accel_report arb = {};
|
||||
gyro_report grb = {};
|
||||
|
||||
// for now use local time but this should be the timestamp of the simulator
|
||||
grb.timestamp = hrt_absolute_time();
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__drivers__tonealrmsim
|
||||
MAIN tone_alarm
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
tone_alarm.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -32,6 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_log.h>
|
||||
#include <px4_posix.h>
|
||||
#include <semaphore.h>
|
||||
#include <px4_workqueue.h>
|
||||
|
||||
@@ -39,7 +40,7 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern sem_t _hrt_work_lock;
|
||||
extern px4_sem_t _hrt_work_lock;
|
||||
extern struct wqueue_s g_hrt_work;
|
||||
|
||||
void hrt_work_queue_init(void);
|
||||
@@ -49,15 +50,13 @@ void hrt_work_cancel(struct work_s *work);
|
||||
static inline void hrt_work_lock(void);
|
||||
static inline void hrt_work_lock()
|
||||
{
|
||||
//PX4_INFO("hrt_work_lock");
|
||||
sem_wait(&_hrt_work_lock);
|
||||
px4_sem_wait(&_hrt_work_lock);
|
||||
}
|
||||
|
||||
static inline void hrt_work_unlock(void);
|
||||
static inline void hrt_work_unlock()
|
||||
{
|
||||
//PX4_INFO("hrt_work_unlock");
|
||||
sem_post(&_hrt_work_lock);
|
||||
px4_sem_post(&_hrt_work_lock);
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
|
||||
@@ -61,16 +61,21 @@ extern "C" {
|
||||
void _SigIntHandler(int sig_num);
|
||||
void _SigIntHandler(int sig_num)
|
||||
{
|
||||
_ExitFlag = true;
|
||||
cout.flush();
|
||||
cout << endl << "Exiting.." << endl;
|
||||
cout.flush();
|
||||
_exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_prompt()
|
||||
{
|
||||
cout.flush();
|
||||
cout << "pxh> ";
|
||||
cout.flush();
|
||||
}
|
||||
|
||||
static void run_cmd(const vector<string> &appargs)
|
||||
static void run_cmd(const vector<string> &appargs, bool exit_on_fail)
|
||||
{
|
||||
// command is appargs[0]
|
||||
string command = appargs[0];
|
||||
@@ -86,7 +91,11 @@ static void run_cmd(const vector<string> &appargs)
|
||||
}
|
||||
|
||||
arg[i] = (char *)0;
|
||||
apps[command](i, (char **)arg);
|
||||
int retval = apps[command](i, (char **)arg);
|
||||
|
||||
if (exit_on_fail && retval) {
|
||||
exit(retval);
|
||||
}
|
||||
usleep(65000);
|
||||
|
||||
} else if (command.compare("help") == 0) {
|
||||
@@ -113,13 +122,13 @@ static void usage()
|
||||
cout << " -h - help/usage information" << std::endl;
|
||||
}
|
||||
|
||||
static void process_line(string &line)
|
||||
static void process_line(string &line, bool exit_on_fail)
|
||||
{
|
||||
vector<string> appargs(8);
|
||||
|
||||
stringstream(line) >> appargs[0] >> appargs[1] >> appargs[2] >> appargs[3] >> appargs[4] >> appargs[5] >> appargs[6] >>
|
||||
appargs[7];
|
||||
run_cmd(appargs);
|
||||
run_cmd(appargs, exit_on_fail);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@@ -175,7 +184,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (infile.is_open()) {
|
||||
for (string line; getline(infile, line, '\n');) {
|
||||
process_line(line);
|
||||
process_line(line, false);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -198,7 +207,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (ret > 0) {
|
||||
getline(cin, mystr);
|
||||
process_line(mystr);
|
||||
process_line(mystr, !daemon_mode);
|
||||
mystr = "";
|
||||
}
|
||||
}
|
||||
@@ -212,10 +221,10 @@ int main(int argc, char **argv)
|
||||
if (px4_task_is_running("muorb")) {
|
||||
// sending muorb stop is needed if it is running to exit cleanly
|
||||
vector<string> muorb_stop_cmd = { "muorb", "stop" };
|
||||
run_cmd(muorb_stop_cmd);
|
||||
run_cmd(muorb_stop_cmd, !daemon_mode);
|
||||
}
|
||||
|
||||
vector<string> shutdown_cmd = { "shutdown" };
|
||||
run_cmd(shutdown_cmd);
|
||||
run_cmd(shutdown_cmd, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__px4_layer
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
px4_posix_impl.cpp
|
||||
px4_posix_tasks.cpp
|
||||
px4_sem.cpp
|
||||
lib_crc32.c
|
||||
drv_hrt.c
|
||||
px4_log.c
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -37,12 +37,15 @@
|
||||
* High-resolution timer with callouts and timekeeping.
|
||||
*/
|
||||
|
||||
#include <px4_time.h>
|
||||
#include <px4_workqueue.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <semaphore.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include "hrt_work.h"
|
||||
|
||||
static struct sq_queue_s callout_queue;
|
||||
@@ -59,7 +62,7 @@ static void hrt_call_reschedule(void);
|
||||
#define HRT_INTERVAL_MIN 50
|
||||
#define HRT_INTERVAL_MAX 50000000
|
||||
|
||||
static sem_t _hrt_lock;
|
||||
static px4_sem_t _hrt_lock;
|
||||
static struct work_s _hrt_work;
|
||||
static hrt_abstime px4_timestart = 0;
|
||||
|
||||
@@ -70,14 +73,12 @@ __EXPORT hrt_abstime hrt_reset(void);
|
||||
|
||||
static void hrt_lock(void)
|
||||
{
|
||||
//printf("hrt_lock\n");
|
||||
sem_wait(&_hrt_lock);
|
||||
px4_sem_wait(&_hrt_lock);
|
||||
}
|
||||
|
||||
static void hrt_unlock(void)
|
||||
{
|
||||
//printf("hrt_unlock\n");
|
||||
sem_post(&_hrt_lock);
|
||||
px4_sem_post(&_hrt_lock);
|
||||
}
|
||||
|
||||
#ifdef __PX4_DARWIN
|
||||
@@ -86,32 +87,38 @@ static void hrt_unlock(void)
|
||||
#define MAC_NANO (+1.0E-9)
|
||||
#define MAC_GIGA UINT64_C(1000000000)
|
||||
#define CLOCK_MONOTONIC 1
|
||||
#define clockid_t int
|
||||
#define HRT_LOCK_NAME "/hrt_lock"
|
||||
|
||||
static double px4_timebase = 0.0;
|
||||
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *t)
|
||||
int px4_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
if (clk_id != CLOCK_MONOTONIC) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// XXX multithreading locking
|
||||
if (!px4_timestart) {
|
||||
mach_timebase_info_data_t tb = { 0 };
|
||||
mach_timebase_info_data_t tb = {};
|
||||
mach_timebase_info(&tb);
|
||||
px4_timebase = tb.numer;
|
||||
px4_timebase /= tb.denom;
|
||||
px4_timestart = mach_absolute_time();
|
||||
// px4_timestart = mach_absolute_time();
|
||||
}
|
||||
|
||||
memset(t, 0, sizeof(*t));
|
||||
memset(tp, 0, sizeof(*tp));
|
||||
|
||||
double diff = (mach_absolute_time() - px4_timestart) * px4_timebase;
|
||||
t->tv_sec = diff * MAC_NANO;
|
||||
t->tv_nsec = diff - (t->tv_sec * MAC_GIGA);
|
||||
double diff = mach_absolute_time() * px4_timebase;
|
||||
tp->tv_sec = diff * MAC_NANO;
|
||||
tp->tv_nsec = diff - (tp->tv_sec * MAC_GIGA);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_clock_settime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
/* do nothing right now */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -122,11 +129,11 @@ hrt_abstime hrt_absolute_time(void)
|
||||
struct timespec ts;
|
||||
|
||||
if (!px4_timestart) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
px4_clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
px4_timestart = ts_to_abstime(&ts);
|
||||
}
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
px4_clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return ts_to_abstime(&ts) - px4_timestart;
|
||||
}
|
||||
|
||||
@@ -227,9 +234,13 @@ void hrt_call_delay(struct hrt_call *entry, hrt_abstime delay)
|
||||
*/
|
||||
void hrt_init(void)
|
||||
{
|
||||
//printf("hrt_init\n");
|
||||
sq_init(&callout_queue);
|
||||
sem_init(&_hrt_lock, 0, 1);
|
||||
|
||||
int sem_ret = px4_sem_init(&_hrt_lock, 0, 1);
|
||||
if (sem_ret) {
|
||||
PX4_ERR("SEM INIT FAIL: %s", strerror(errno));
|
||||
}
|
||||
|
||||
memset(&_hrt_work, 0, sizeof(_hrt_work));
|
||||
}
|
||||
|
||||
@@ -335,7 +346,7 @@ hrt_call_reschedule()
|
||||
static void
|
||||
hrt_call_internal(struct hrt_call *entry, hrt_abstime deadline, hrt_abstime interval, hrt_callout callout, void *arg)
|
||||
{
|
||||
//PX4_INFO("hrt_call_internal deadline=%lu interval = %lu", deadline, interval);
|
||||
PX4_DEBUG("hrt_call_internal deadline=%lu interval = %lu", deadline, interval);
|
||||
hrt_lock();
|
||||
|
||||
//PX4_INFO("hrt_call_internal after lock");
|
||||
@@ -351,7 +362,7 @@ hrt_call_internal(struct hrt_call *entry, hrt_abstime deadline, hrt_abstime inte
|
||||
sq_rem(&entry->link, &callout_queue);
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
|
||||
// Use this to debug busy CPU that keeps rescheduling with 0 period time
|
||||
if (interval < HRT_INTERVAL_MIN) {
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "systemlib/param/param.h"
|
||||
#include "hrt_work.h"
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include "px4_time.h"
|
||||
|
||||
extern pthread_t _shell_task_id;
|
||||
|
||||
@@ -55,8 +56,6 @@ __BEGIN_DECLS
|
||||
|
||||
long PX4_TICKS_PER_SEC = sysconf(_SC_CLK_TCK);
|
||||
|
||||
extern void hrt_init(void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
namespace px4
|
||||
@@ -67,7 +66,7 @@ void init_once(void);
|
||||
void init_once(void)
|
||||
{
|
||||
_shell_task_id = pthread_self();
|
||||
PX4_INFO("Shell id is %lu", _shell_task_id);
|
||||
printf("[init] shell id: %lu\n", (unsigned long)_shell_task_id);
|
||||
work_queues_init();
|
||||
hrt_work_queue_init();
|
||||
hrt_init();
|
||||
@@ -75,7 +74,18 @@ void init_once(void)
|
||||
|
||||
void init(int argc, char *argv[], const char *app_name)
|
||||
{
|
||||
printf("App name: %s\n", app_name);
|
||||
printf("[init] task name: %s\n", app_name);
|
||||
printf("\n");
|
||||
printf("______ __ __ ___ \n");
|
||||
printf("| ___ \\ \\ \\ / / / |\n");
|
||||
printf("| |_/ / \\ V / / /| |\n");
|
||||
printf("| __/ / \\ / /_| |\n");
|
||||
printf("| | / /^\\ \\ \\___ |\n");
|
||||
printf("\\_| \\/ \\/ |_/\n");
|
||||
printf("\n");
|
||||
printf("Ready to fly.\n");
|
||||
printf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
uint64_t get_time_micros()
|
||||
|
||||
@@ -135,7 +135,7 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int
|
||||
taskdata->argc = argc;
|
||||
|
||||
for (i=0; i<argc; i++) {
|
||||
printf("arg %d %s\n", i, argv[i]);
|
||||
PX4_DEBUG("arg %d %s\n", i, argv[i]);
|
||||
taskdata->argv[i] = (char *)offset;
|
||||
strcpy((char *)offset, argv[i]);
|
||||
offset+=strlen(argv[i])+1;
|
||||
@@ -271,7 +271,7 @@ void px4_show_tasks()
|
||||
for (idx=0; idx < PX4_MAX_TASKS; idx++)
|
||||
{
|
||||
if (taskmap[idx].isused) {
|
||||
PX4_INFO(" %-10s %lu", taskmap[idx].name.c_str(), taskmap[idx].pid);
|
||||
PX4_INFO(" %-10s %lu", taskmap[idx].name.c_str(), (unsigned long)taskmap[idx].pid);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015 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_sem.cpp
|
||||
*
|
||||
* PX4 Middleware Wrapper Linux Implementation
|
||||
*/
|
||||
|
||||
#include <px4_defines.h>
|
||||
#include <px4_middleware.h>
|
||||
#include <px4_workqueue.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef __PX4_DARWIN
|
||||
|
||||
#include <px4_posix.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
int px4_sem_init(px4_sem_t *s, int pshared, unsigned value)
|
||||
{
|
||||
// We do not used the process shared arg
|
||||
(void)pshared;
|
||||
s->value = value;
|
||||
pthread_cond_init(&(s->wait), NULL);
|
||||
pthread_mutex_init(&(s->lock), NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_sem_wait(px4_sem_t *s)
|
||||
{
|
||||
pthread_mutex_lock(&(s->lock));
|
||||
s->value--;
|
||||
if(s->value < 0) {
|
||||
pthread_cond_wait(&(s->wait), &(s->lock));
|
||||
}
|
||||
pthread_mutex_unlock(&(s->lock));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_sem_post(px4_sem_t *s)
|
||||
{
|
||||
pthread_mutex_lock(&(s->lock));
|
||||
s->value++;
|
||||
if(s->value <= 0) {
|
||||
pthread_cond_signal(&(s->wait));
|
||||
}
|
||||
pthread_mutex_unlock(&(s->lock));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_sem_getvalue(px4_sem_t *s, int *sval)
|
||||
{
|
||||
pthread_mutex_lock(&(s->lock));
|
||||
*sval = s->value;
|
||||
pthread_mutex_unlock(&(s->lock));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_sem_destroy(px4_sem_t *s)
|
||||
{
|
||||
pthread_mutex_lock(&(s->lock));
|
||||
pthread_cond_destroy(&(s->wait));
|
||||
pthread_mutex_unlock(&(s->lock));
|
||||
pthread_mutex_destroy(&(s->lock));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__tests__hello
|
||||
MAIN hello
|
||||
SRCS
|
||||
hello_main.cpp
|
||||
hello_start_posix.cpp
|
||||
hello_example.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__tests__hrt_test
|
||||
MAIN hrttest
|
||||
SRCS
|
||||
hrt_test_main.cpp
|
||||
hrt_test_start_posix.cpp
|
||||
hrt_test.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__tests__muorb
|
||||
MAIN muorb_test
|
||||
SRCS
|
||||
muorb_test_main.cpp
|
||||
muorb_test_start_posix.cpp
|
||||
muorb_test_example.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__tests__vcdev_test
|
||||
MAIN vcdevtest
|
||||
SRCS
|
||||
vcdevtest_main.cpp
|
||||
vcdevtest_start_posix.cpp
|
||||
vcdevtest_example.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__tests__wqueue
|
||||
MAIN wqueue_test
|
||||
SRCS
|
||||
wqueue_main.cpp
|
||||
wqueue_start_posix.cpp
|
||||
wqueue_test.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,55 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__posix__work_queue
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
hrt_thread.c
|
||||
hrt_queue.c
|
||||
hrt_work_cancel.c
|
||||
work_thread.c
|
||||
work_lock.c
|
||||
work_queue.c
|
||||
work_cancel.c
|
||||
queue.c
|
||||
dq_addlast.c
|
||||
dq_remfirst.c
|
||||
sq_addlast.c
|
||||
sq_remfirst.c
|
||||
sq_addafter.c
|
||||
dq_rem.c
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
#include <px4_posix.h>
|
||||
#include <stdint.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
@@ -67,7 +68,7 @@ struct wqueue_s g_hrt_work;
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
sem_t _hrt_work_lock;
|
||||
px4_sem_t _hrt_work_lock;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -262,7 +263,7 @@ static int work_hrtthread(int argc, char *argv[])
|
||||
|
||||
void hrt_work_queue_init(void)
|
||||
{
|
||||
sem_init(&_hrt_work_lock, 0, 1);
|
||||
px4_sem_init(&_hrt_work_lock, 0, 1);
|
||||
|
||||
// Create high priority worker thread
|
||||
g_hrt_work.pid = px4_task_spawn_cmd("wkr_hrt",
|
||||
|
||||
@@ -31,21 +31,19 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
#include <px4_log.h>
|
||||
#include <semaphore.h>
|
||||
#include <px4_posix.h>
|
||||
#include <stdio.h>
|
||||
#include "work_lock.h"
|
||||
|
||||
|
||||
extern sem_t _work_lock[];
|
||||
extern px4_sem_t _work_lock[];
|
||||
|
||||
void work_lock(int id)
|
||||
{
|
||||
//PX4_INFO("work_lock %d", id);
|
||||
sem_wait(&_work_lock[id]);
|
||||
px4_sem_wait(&_work_lock[id]);
|
||||
}
|
||||
|
||||
void work_unlock(int id)
|
||||
{
|
||||
//PX4_INFO("work_unlock %d", id);
|
||||
sem_post(&_work_lock[id]);
|
||||
px4_sem_post(&_work_lock[id]);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
#include <px4_posix.h>
|
||||
#include <px4_time.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -68,7 +69,7 @@ struct wqueue_s g_work[NWORKERS];
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
sem_t _work_lock[NWORKERS];
|
||||
px4_sem_t _work_lock[NWORKERS];
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -187,10 +188,10 @@ static void work_process(struct wqueue_s *wqueue, int lock_id)
|
||||
****************************************************************************/
|
||||
void work_queues_init(void)
|
||||
{
|
||||
sem_init(&_work_lock[HPWORK], 0, 1);
|
||||
sem_init(&_work_lock[LPWORK], 0, 1);
|
||||
px4_sem_init(&_work_lock[HPWORK], 0, 1);
|
||||
px4_sem_init(&_work_lock[LPWORK], 0, 1);
|
||||
#ifdef CONFIG_SCHED_USRWORK
|
||||
sem_init(&_work_lock[USRWORK], 0, 1);
|
||||
px4_sem_init(&_work_lock[USRWORK], 0, 1);
|
||||
#endif
|
||||
|
||||
// Create high priority worker thread
|
||||
|
||||
@@ -144,9 +144,13 @@ typedef param_t px4_param_t;
|
||||
/* FIXME - Used to satisfy build */
|
||||
#define getreg32(a) (*(volatile uint32_t *)(a))
|
||||
|
||||
#ifdef __PX4_QURT
|
||||
#define PX4_TICKS_PER_SEC 1000L
|
||||
#else
|
||||
__BEGIN_DECLS
|
||||
extern long PX4_TICKS_PER_SEC;
|
||||
__END_DECLS
|
||||
#endif
|
||||
|
||||
#define USEC_PER_TICK (1000000UL/PX4_TICKS_PER_SEC)
|
||||
#define USEC2TICK(x) (((x)+(USEC_PER_TICK/2))/USEC_PER_TICK)
|
||||
|
||||
+43
-43
@@ -63,40 +63,40 @@ static inline void do_nothing(int level, ...)
|
||||
#define PX4_ERR(...) ROS_WARN(__VA_ARGS__)
|
||||
#define PX4_WARN(...) ROS_WARN(__VA_ARGS__)
|
||||
#define PX4_INFO(...) ROS_WARN(__VA_ARGS__)
|
||||
#define PX4_DEBUG(...)
|
||||
#define PX4_DEBUG(...)
|
||||
|
||||
#elif defined(__PX4_QURT)
|
||||
#include "qurt_log.h"
|
||||
/****************************************************************************
|
||||
* Messages that should never be filtered or compiled out
|
||||
****************************************************************************/
|
||||
#define PX4_LOG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_INFO(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_LOG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_INFO(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
|
||||
#if defined(TRACE_BUILD)
|
||||
/****************************************************************************
|
||||
* Extremely Verbose settings for a Trace build
|
||||
****************************************************************************/
|
||||
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
|
||||
#elif defined(DEBUG_BUILD)
|
||||
/****************************************************************************
|
||||
* Verbose settings for a Debug build
|
||||
****************************************************************************/
|
||||
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
|
||||
#elif defined(RELEASE_BUILD)
|
||||
/****************************************************************************
|
||||
* Non-verbose settings for a Release build to minimize strings in build
|
||||
****************************************************************************/
|
||||
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_WARN(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_WARN, FMT, ##__VA_ARGS__)
|
||||
#define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
|
||||
|
||||
@@ -104,14 +104,14 @@ static inline void do_nothing(int level, ...)
|
||||
/****************************************************************************
|
||||
* Medium verbose settings for a default build
|
||||
****************************************************************************/
|
||||
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
||||
#define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
#define PX4_LOG_NAMED(name, FMT, ...) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, "%s " FMT, name, ##__VA_ARGS__)
|
||||
#define PX4_LOG_NAMED_COND(name, cond, FMT, ...) if( cond ) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, "%s " FMT, name, ##__VA_ARGS__)
|
||||
#define PX4_LOG_NAMED(name, FMT, ...) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILE__, __LINE__, "%s " FMT, name, ##__VA_ARGS__)
|
||||
#define PX4_LOG_NAMED_COND(name, cond, FMT, ...) if( cond ) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILE__, __LINE__, "%s " FMT, name, ##__VA_ARGS__)
|
||||
|
||||
#else
|
||||
|
||||
@@ -137,13 +137,13 @@ __END_DECLS
|
||||
*
|
||||
* To write to a specific stream for each message type, open the streams and
|
||||
* set __px4__log_startline to something like:
|
||||
* if (level <= __px4_log_level_current) printf(_px4_fd[level],
|
||||
* if (level <= __px4_log_level_current) printf(_px4_fd[level],
|
||||
*
|
||||
* Additional behavior can be added using "{\" for __px4__log_startline and
|
||||
* "}" for __px4__log_endline and any other required setup or teardown steps
|
||||
****************************************************************************/
|
||||
#define __px4__log_startcond(cond) if (cond) printf(
|
||||
#define __px4__log_startline(level) if (level <= __px4_log_level_current) printf(
|
||||
#define __px4__log_printcond(cond, ...) if (cond) printf(__VA_ARGS__)
|
||||
#define __px4__log_printline(level, ...) if (level <= __px4_log_level_current) printf(__VA_ARGS__)
|
||||
|
||||
#define __px4__log_timestamp_fmt "%-10" PRIu64 " "
|
||||
#define __px4__log_timestamp_arg ,hrt_absolute_time()
|
||||
@@ -172,12 +172,12 @@ __END_DECLS
|
||||
* if the first arg/condition is true.
|
||||
****************************************************************************/
|
||||
#define __px4_log_named_cond(name, cond, FMT, ...) \
|
||||
__px4__log_startcond(cond)\
|
||||
__px4__log_printcond(cond,\
|
||||
"%s " \
|
||||
FMT\
|
||||
__px4__log_end_fmt \
|
||||
,name, ##__VA_ARGS__\
|
||||
__px4__log_endline
|
||||
)
|
||||
|
||||
/****************************************************************************
|
||||
* __px4_log:
|
||||
@@ -187,12 +187,12 @@ __END_DECLS
|
||||
* printf("%-5s val is %d\n", __px4_log_level_str[3], val);
|
||||
****************************************************************************/
|
||||
#define __px4_log(level, FMT, ...) \
|
||||
__px4__log_startline(level)\
|
||||
__px4__log_printline(level,\
|
||||
__px4__log_level_fmt \
|
||||
FMT\
|
||||
__px4__log_end_fmt \
|
||||
__px4__log_level_arg(level), ##__VA_ARGS__\
|
||||
__px4__log_endline
|
||||
)
|
||||
|
||||
/****************************************************************************
|
||||
* __px4_log_timestamp:
|
||||
@@ -203,7 +203,7 @@ __END_DECLS
|
||||
* hrt_absolute_time(), val);
|
||||
****************************************************************************/
|
||||
#define __px4_log_timestamp(level, FMT, ...) \
|
||||
__px4__log_startline(level)\
|
||||
__px4__log_printline(level,\
|
||||
__px4__log_level_fmt\
|
||||
__px4__log_timestamp_fmt\
|
||||
FMT\
|
||||
@@ -211,7 +211,7 @@ __END_DECLS
|
||||
__px4__log_level_arg(level)\
|
||||
__px4__log_timestamp_arg\
|
||||
, ##__VA_ARGS__\
|
||||
__px4__log_endline
|
||||
)
|
||||
|
||||
/****************************************************************************
|
||||
* __px4_log_timestamp_thread:
|
||||
@@ -222,7 +222,7 @@ __END_DECLS
|
||||
* hrt_absolute_time(), pthread_self(), val);
|
||||
****************************************************************************/
|
||||
#define __px4_log_timestamp_thread(level, FMT, ...) \
|
||||
__px4__log_startline(level)\
|
||||
__px4__log_printline(level,\
|
||||
__px4__log_level_fmt\
|
||||
__px4__log_timestamp_fmt\
|
||||
__px4__log_thread_fmt\
|
||||
@@ -232,18 +232,18 @@ __END_DECLS
|
||||
__px4__log_timestamp_arg\
|
||||
__px4__log_thread_arg\
|
||||
, ##__VA_ARGS__\
|
||||
__px4__log_endline
|
||||
)
|
||||
|
||||
/****************************************************************************
|
||||
* __px4_log_file_and_line:
|
||||
* Convert a message in the form:
|
||||
* PX4_WARN("val is %d", val);
|
||||
* to
|
||||
* printf("%-5s val is %d (file %s line %u)\n",
|
||||
* printf("%-5s val is %d (file %s line %u)\n",
|
||||
* __px4_log_level_str[3], val, __FILE__, __LINE__);
|
||||
****************************************************************************/
|
||||
#define __px4_log_file_and_line(level, FMT, ...) \
|
||||
__px4__log_startline(level)\
|
||||
__px4__log_printline(level,\
|
||||
__px4__log_level_fmt\
|
||||
__px4__log_timestamp_fmt\
|
||||
FMT\
|
||||
@@ -253,19 +253,19 @@ __END_DECLS
|
||||
__px4__log_timestamp_arg\
|
||||
, ##__VA_ARGS__\
|
||||
__px4__log_file_and_line_arg\
|
||||
__px4__log_endline
|
||||
)
|
||||
|
||||
/****************************************************************************
|
||||
* __px4_log_timestamp_file_and_line:
|
||||
* Convert a message in the form:
|
||||
* PX4_WARN("val is %d", val);
|
||||
* to
|
||||
* printf("%-5s %-10lu val is %d (file %s line %u)\n",
|
||||
* printf("%-5s %-10lu val is %d (file %s line %u)\n",
|
||||
* __px4_log_level_str[3], hrt_absolute_time(),
|
||||
* val, __FILE__, __LINE__);
|
||||
****************************************************************************/
|
||||
#define __px4_log_timestamp_file_and_line(level, FMT, ...) \
|
||||
__px4__log_startline(level)\
|
||||
__px4__log_printline(level,\
|
||||
__px4__log_level_fmt\
|
||||
__px4__log_timestamp_fmt\
|
||||
FMT\
|
||||
@@ -275,19 +275,19 @@ __END_DECLS
|
||||
__px4__log_timestamp_arg\
|
||||
, ##__VA_ARGS__\
|
||||
__px4__log_file_and_line_arg\
|
||||
__px4__log_endline
|
||||
)
|
||||
|
||||
/****************************************************************************
|
||||
* __px4_log_thread_file_and_line:
|
||||
* Convert a message in the form:
|
||||
* PX4_WARN("val is %d", val);
|
||||
* to
|
||||
* printf("%-5s %#X val is %d (file %s line %u)\n",
|
||||
* __px4_log_level_str[3], pthread_self(),
|
||||
* printf("%-5s %#X val is %d (file %s line %u)\n",
|
||||
* __px4_log_level_str[3], pthread_self(),
|
||||
* val, __FILE__, __LINE__);
|
||||
****************************************************************************/
|
||||
#define __px4_log_thread_file_and_line(level, FMT, ...) \
|
||||
__px4__log_startline(level)\
|
||||
__px4__log_printline(level,\
|
||||
__px4__log_level_fmt\
|
||||
__px4__log_thread_fmt\
|
||||
FMT\
|
||||
@@ -297,19 +297,19 @@ __END_DECLS
|
||||
__px4__log_thread_arg\
|
||||
, ##__VA_ARGS__\
|
||||
__px4__log_file_and_line_arg\
|
||||
__px4__log_endline
|
||||
)
|
||||
|
||||
/****************************************************************************
|
||||
* __px4_log_timestamp_thread_file_and_line:
|
||||
* Convert a message in the form:
|
||||
* PX4_WARN("val is %d", val);
|
||||
* to
|
||||
* printf("%-5s %-10lu %#X val is %d (file %s line %u)\n",
|
||||
* __px4_log_level_str[3], hrt_absolute_time(),
|
||||
* printf("%-5s %-10lu %#X val is %d (file %s line %u)\n",
|
||||
* __px4_log_level_str[3], hrt_absolute_time(),
|
||||
* pthread_self(), val, __FILE__, __LINE__);
|
||||
****************************************************************************/
|
||||
#define __px4_log_timestamp_thread_file_and_line(level, FMT, ...) \
|
||||
__px4__log_startline(level)\
|
||||
__px4__log_printline(level,\
|
||||
__px4__log_level_fmt\
|
||||
__px4__log_timestamp_fmt\
|
||||
__px4__log_thread_fmt\
|
||||
@@ -321,7 +321,7 @@ __END_DECLS
|
||||
__px4__log_thread_arg\
|
||||
, ##__VA_ARGS__\
|
||||
__px4__log_file_and_line_arg\
|
||||
__px4__log_endline
|
||||
)
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
/* includes when building for ros */
|
||||
#include "ros/ros.h"
|
||||
#include <list>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <type_traits>
|
||||
#else
|
||||
|
||||
@@ -48,6 +48,45 @@
|
||||
#include <semaphore.h>
|
||||
|
||||
|
||||
/* Semaphore handling */
|
||||
|
||||
#ifdef __PX4_DARWIN
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t wait;
|
||||
int value;
|
||||
} px4_sem_t;
|
||||
|
||||
__EXPORT int px4_sem_init(px4_sem_t *s, int pshared, unsigned value);
|
||||
__EXPORT int px4_sem_wait(px4_sem_t *s);
|
||||
__EXPORT int px4_sem_post(px4_sem_t *s);
|
||||
__EXPORT int px4_sem_getvalue(px4_sem_t *s, int *sval);
|
||||
__EXPORT int px4_sem_destroy(px4_sem_t *s);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#else
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef sem_t px4_sem_t;
|
||||
|
||||
#define px4_sem_init sem_init
|
||||
#define px4_sem_wait sem_wait
|
||||
#define px4_sem_post sem_post
|
||||
#define px4_sem_getvalue sem_getvalue
|
||||
#define px4_sem_destroy sem_destroy
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
//###################################
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
|
||||
#define PX4_F_RDONLY 1
|
||||
@@ -85,7 +124,7 @@ typedef struct {
|
||||
pollevent_t revents; /* The output event flags */
|
||||
|
||||
/* Required for PX4 compatability */
|
||||
sem_t *sem; /* Pointer to semaphore used to post output event */
|
||||
px4_sem_t *sem; /* Pointer to semaphore used to post output event */
|
||||
void *priv; /* For use by drivers */
|
||||
} px4_pollfd_struct_t;
|
||||
|
||||
|
||||
@@ -38,8 +38,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef CONFIG_ARCH_BOARD_SIM
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
#if defined(__PX4_ROS)
|
||||
/* includes when building for ros */
|
||||
@@ -219,10 +221,12 @@ public:
|
||||
protected:
|
||||
uORB::SubscriptionBase * _uorb_sub; /**< Handle to the subscription */
|
||||
|
||||
#ifndef CONFIG_ARCH_BOARD_SIM
|
||||
typename std::remove_reference<decltype(((T*)nullptr)->data())>::type getUORBData()
|
||||
{
|
||||
return (typename std::remove_reference<decltype(((T*)nullptr)->data())>::type)*_uorb_sub;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get void pointer to last message value
|
||||
@@ -242,8 +246,13 @@ public:
|
||||
* @param cbf Callback, executed on receiving a new message
|
||||
* @param interval Minimal interval between calls to callback
|
||||
*/
|
||||
SubscriberUORBCallback(unsigned interval,
|
||||
std::function<void(const T &)> cbf) :
|
||||
SubscriberUORBCallback(unsigned interval
|
||||
#ifndef CONFIG_ARCH_BOARD_SIM
|
||||
,std::function<void(const T &)> cbf)
|
||||
#else
|
||||
)
|
||||
#endif
|
||||
:
|
||||
SubscriberUORB<T>(interval),
|
||||
_cbf(cbf)
|
||||
{}
|
||||
@@ -277,7 +286,9 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
#ifndef CONFIG_ARCH_BOARD_SIM
|
||||
std::function<void(const T &)> _cbf; /**< Callback that the user provided on the subscription */
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -80,6 +80,12 @@ typedef int px4_task_t;
|
||||
#error "No target OS defined"
|
||||
#endif
|
||||
|
||||
#if defined (__PX4_LINUX) || defined(__PX4_NUTTX)
|
||||
#include <sys/prctl.h>
|
||||
#else
|
||||
#define prctl(_action, _string, _pid)
|
||||
#endif
|
||||
|
||||
typedef int px4_task_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -8,6 +8,20 @@
|
||||
#define px4_clock_gettime clock_gettime
|
||||
#define px4_clock_settime clock_settime
|
||||
|
||||
#elif defined(__PX4_DARWIN)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define clockid_t unsigned
|
||||
#define CLOCK_REALTIME 0
|
||||
|
||||
int px4_clock_gettime(clockid_t clk_id, struct timespec *tp);
|
||||
int px4_clock_settime(clockid_t clk_id, struct timespec *tp);
|
||||
|
||||
__EXPORT unsigned int sleep(unsigned int sec);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#elif defined(__PX4_QURT)
|
||||
|
||||
#include <sys/timespec.h>
|
||||
|
||||
@@ -33,20 +33,16 @@
|
||||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#define STACK_SIZE 0x8000
|
||||
static char __attribute__ ((aligned (16))) stack1[STACK_SIZE];
|
||||
//#define STACK_SIZE 0x8000
|
||||
//static char __attribute__ ((aligned (16))) stack1[STACK_SIZE];
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
static void do_dlopen()
|
||||
{
|
||||
int ret = 0;
|
||||
char *builtin[]={"libgcc.so", "libc.so", "libstdc++.so"};
|
||||
#if 0
|
||||
void *handle;
|
||||
char *error;
|
||||
void (*entry_function)() = NULL;
|
||||
|
||||
printf("In DSPAL main\n");
|
||||
dlinit(3, builtin);
|
||||
#if 0
|
||||
handle = dlopen ("libdspal_client.so", RTLD_LAZY);
|
||||
if (!handle) {
|
||||
printf("Error opening libdspal_client.so\n");
|
||||
@@ -59,6 +55,18 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
dlclose(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
char *builtin[]={"libgcc.so", "libc.so", "libstdc++.so"};
|
||||
|
||||
printf("In DSPAL main\n");
|
||||
dlinit(3, builtin);
|
||||
|
||||
do_dlopen();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
set(QURT_LAYER_SRCS
|
||||
px4_qurt_impl.cpp
|
||||
px4_qurt_tasks.cpp
|
||||
lib_crc32.c
|
||||
drv_hrt.c
|
||||
qurt_stubs.c
|
||||
main.cpp
|
||||
params.c
|
||||
)
|
||||
if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
|
||||
list(APPEND QURT_LAYER_SRCS
|
||||
../stubs/stubs_posix.c
|
||||
../stubs/stubs_qurt.c
|
||||
)
|
||||
endif()
|
||||
|
||||
# For Eagle, the commands are specific to the build config label
|
||||
# e.g. config_qurt_eagle_hil uses commands_hil.c
|
||||
if ("${BOARD}" STREQUAL "eagle")
|
||||
|
||||
# The CI test target can use the hil commands
|
||||
if ("${LABEL}" STREQUAL "travis")
|
||||
set(CONFIG_SRC commands_hil.c)
|
||||
else()
|
||||
set(CONFIG_SRC commands_${LABEL}.c)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
px4_add_module(
|
||||
MODULE platforms__qurt__px4_layer
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS
|
||||
${QURT_LAYER_SRCS}
|
||||
${CONFIG_SRC}
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -37,6 +37,7 @@
|
||||
* @author Mark Charlebois <charlebm@gmail.com>
|
||||
*/
|
||||
|
||||
const char *get_commands(void);
|
||||
const char *get_commands()
|
||||
{
|
||||
|
||||
|
||||
@@ -37,10 +37,12 @@
|
||||
* High-resolution timer with callouts and timekeeping.
|
||||
*/
|
||||
|
||||
#include <px4_defines.h>
|
||||
#include <px4_workqueue.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <semaphore.h>
|
||||
#include <time.h>
|
||||
#include <dspal_time.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2015 Mark Charlebois. All rights reserved.
|
||||
* Copyright (C) 2015 Mark Charlebois. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -42,10 +41,12 @@
|
||||
#include <px4_time.h>
|
||||
#include <px4_posix.h>
|
||||
#include <px4_defines.h>
|
||||
#include <dspal_platform.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
#include <apps.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -99,19 +100,9 @@ static void process_commands(map<string,px4_main_t> &apps, const char *cmds)
|
||||
bool found_first_char = false;
|
||||
char arg[256];
|
||||
|
||||
// This is added because it is a parameter used by commander, yet created by mavlink. Since mavlink is not
|
||||
// running on QURT, we need to manually define it so it is available to commander. "2" is for quadrotor.
|
||||
|
||||
// Following is hack to prevent duplicate parameter definition error in param parser
|
||||
/**
|
||||
* @board QuRT_App
|
||||
*/
|
||||
PARAM_DEFINE_INT32(MAV_TYPE,2);
|
||||
|
||||
// Eat leading whitespace
|
||||
eat_whitespace(b, i);
|
||||
|
||||
|
||||
for(;;) {
|
||||
// End of command line
|
||||
if (b[i] == '\n' || b[i] == '\0') {
|
||||
@@ -152,7 +143,7 @@ extern void init_once(void);
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern int dspal_main(int argc, char *argv[]);
|
||||
int dspal_main(int argc, char *argv[]);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
@@ -164,13 +155,13 @@ int dspal_entry( int argc, char* argv[] )
|
||||
px4::init_once();
|
||||
px4::init(argc, (char **)argv, "mainapp");
|
||||
process_commands(apps, get_commands());
|
||||
usleep( 1000000 ); // give time for all commands to execute before starting external function
|
||||
sleep(1); // give time for all commands to execute before starting external function
|
||||
if(qurt_external_hook)
|
||||
{
|
||||
qurt_external_hook();
|
||||
}
|
||||
for( ;; ){
|
||||
usleep( 1000000 );
|
||||
for(;;){
|
||||
sleep(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2015 Mark Charlebois. 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <systemlib/param/param.h>
|
||||
|
||||
// This is added because it is a parameter used by commander, yet created by mavlink. Since mavlink is not
|
||||
// running on QURT, we need to manually define it so it is available to commander. "2" is for quadrotor.
|
||||
|
||||
// Following is hack to prevent duplicate parameter definition error in param parser
|
||||
/**
|
||||
* @board QuRT_App
|
||||
*/
|
||||
PARAM_DEFINE_INT32(MAV_TYPE,2);
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
__BEGIN_DECLS
|
||||
extern uint64_t get_ticks_per_us();
|
||||
|
||||
long PX4_TICKS_PER_SEC = 1000;
|
||||
//long PX4_TICKS_PER_SEC = 1000L;
|
||||
|
||||
unsigned int sleep(unsigned int sec)
|
||||
{
|
||||
|
||||
@@ -31,93 +31,90 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "px4_log.h"
|
||||
//extern "C" {
|
||||
#include <semaphore.h>
|
||||
|
||||
void block_indefinite(void);
|
||||
void _Read_uleb(void);
|
||||
void _Parse_fde_instr(void);
|
||||
void _Parse_csd(void);
|
||||
void _Valbytes(void);
|
||||
void _Get_eh_data(void);
|
||||
void _Parse_lsda(void);
|
||||
void __cxa_guard_release(void);
|
||||
void _Read_enc_ptr(void);
|
||||
void _Read_sleb(void);
|
||||
void __cxa_guard_acquire(void);
|
||||
void __cxa_pure_virtual(void);
|
||||
|
||||
void block_indefinite( void )
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
volatile int x = 0;
|
||||
++x;
|
||||
}
|
||||
sem_t forever;
|
||||
sem_init(&forever, 0, 0);
|
||||
sem_wait(&forever);
|
||||
}
|
||||
|
||||
void _Read_uleb( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Parse_fde_instr( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Parse_csd( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Locksyslock( int x )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Unlocksyslock( int x )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Valbytes( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Get_eh_data( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Parse_lsda( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void __cxa_guard_release( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Read_enc_ptr( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void _Read_sleb( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void __cxa_guard_acquire( void )
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
void __cxa_pure_virtual()
|
||||
{
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
PX4_WARN( "Error: Calling unresolved symbol stub[%s]", __FUNCTION__ );
|
||||
block_indefinite();
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#include <semaphore.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
int sem_init(sem_t *sem, int pshared, unsigned int value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sem_wait(sem_t *sem)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sem_destroy(sem_t *sem)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sem_post(sem_t *sem)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sem_getvalue(sem_t *sem, int *sval)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int usleep(useconds_t usec)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pthread_t pthread_self(void)
|
||||
{
|
||||
pthread_t x = 0;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
int pthread_kill(pthread_t thread, int sig)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void pthread_exit(void *retval)
|
||||
{
|
||||
}
|
||||
|
||||
int pthread_join(pthread_t thread, void **retval)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_cancel(pthread_t thread)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int pthread_attr_init(pthread_attr_t *attr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_attr_destroy(pthread_attr_t *attr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <dlfcn.h>
|
||||
#include <qurt_log.h>
|
||||
#include <dspal_platform.h>
|
||||
|
||||
void HAP_debug(const char *msg, int level, const char *filename, int line)
|
||||
{
|
||||
}
|
||||
|
||||
void HAP_power_request(int a, int b, int c)
|
||||
{
|
||||
}
|
||||
|
||||
int dlinit(int a, char **b)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__qurt__tests__hello
|
||||
MAIN hello
|
||||
SRCS
|
||||
hello_main.cpp
|
||||
hello_start_qurt.cpp
|
||||
hello_example.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -0,0 +1,42 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 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.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE platforms__qurt__tests__muorb
|
||||
MAIN muorb_test
|
||||
SRCS
|
||||
muorb_test_start_qurt.cpp
|
||||
muorb_test_example.cpp
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -45,7 +45,7 @@
|
||||
#include <string.h>
|
||||
#include "uORB/topics/sensor_combined.h"
|
||||
#include "uORB/topics/pwm_input.h"
|
||||
#include "uORB.h"
|
||||
#include "modules/uORB/uORB.h"
|
||||
#include "px4_middleware.h"
|
||||
#include "px4_defines.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
Reference in New Issue
Block a user