forked from Archive/PX4-Autopilot
purge broken qurt support and atlflight boards
This commit is contained in:
parent
4a0fa08953
commit
65745a3676
|
@ -13,7 +13,6 @@ pipeline {
|
|||
arm64: "px4io/px4-dev-aarch64:2021-05-04",
|
||||
base: "px4io/px4-dev-base-bionic:2021-05-04",
|
||||
nuttx: "px4io/px4-dev-nuttx-focal:2021-05-04",
|
||||
snapdragon: "lorenzmeier/px4-dev-snapdragon:2020-04-01"
|
||||
]
|
||||
|
||||
def armhf_builds = [
|
||||
|
@ -106,14 +105,8 @@ pipeline {
|
|||
archive: true
|
||||
]
|
||||
|
||||
def snapdragon_builds = [
|
||||
target: ["atlflight_eagle_qurt", "atlflight_eagle_default"],
|
||||
image: docker_images.snapdragon,
|
||||
archive: false
|
||||
]
|
||||
|
||||
def docker_builds = [
|
||||
armhf_builds, base_builds, nuttx_builds_archive//, snapdragon_builds
|
||||
armhf_builds, base_builds, nuttx_builds_archive
|
||||
]
|
||||
|
||||
for (def build_type = 0; build_type < docker_builds.size(); build_type++) {
|
||||
|
@ -165,12 +158,6 @@ pipeline {
|
|||
def createBuildNode(Boolean archive, String docker_image, String target) {
|
||||
return {
|
||||
|
||||
// TODO: fix the snapdragon image
|
||||
bypass_entrypoint = ''
|
||||
if (docker_image == 'lorenzmeier/px4-dev-snapdragon:2020-04-01') {
|
||||
bypass_entrypoint = ' --entrypoint=""'
|
||||
}
|
||||
|
||||
node {
|
||||
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_dagar') {
|
||||
docker.image(docker_image).inside('-e CCACHE_BASEDIR=${WORKSPACE} -v ${CCACHE_DIR}:${CCACHE_DIR}:rw' + bypass_entrypoint) {
|
||||
|
|
|
@ -18,10 +18,6 @@
|
|||
path = src/lib/matrix
|
||||
url = https://github.com/PX4/PX4-Matrix.git
|
||||
branch = master
|
||||
[submodule "boards/atlflight/cmake_hexagon"]
|
||||
path = boards/atlflight/cmake_hexagon
|
||||
url = https://github.com/PX4/cmake_hexagon.git
|
||||
branch = px4
|
||||
[submodule "src/drivers/gps/devices"]
|
||||
path = src/drivers/gps/devices
|
||||
url = https://github.com/PX4/PX4-GPSDrivers.git
|
||||
|
@ -38,9 +34,6 @@
|
|||
path = platforms/nuttx/NuttX/apps
|
||||
url = https://github.com/PX4/NuttX-apps.git
|
||||
branch = px4_firmware_nuttx-10.0.0+
|
||||
[submodule "platforms/qurt/dspal"]
|
||||
path = platforms/qurt/dspal
|
||||
url = https://github.com/ATLFlight/dspal.git
|
||||
[submodule "Tools/flightgear_bridge"]
|
||||
path = Tools/flightgear_bridge
|
||||
url = https://github.com/PX4/PX4-FlightGear-Bridge.git
|
||||
|
|
14
Makefile
14
Makefile
|
@ -214,7 +214,7 @@ define colorecho
|
|||
endef
|
||||
|
||||
# Get a list of all config targets boards/*/*.cmake
|
||||
ALL_CONFIG_TARGETS := $(shell find boards -maxdepth 3 -mindepth 3 ! -name '*common*' ! -name '*sdflight*' -name '*.cmake' -print | sed -e 's|boards\/||' | sed -e 's|\.cmake||' | sed -e 's|\/|_|g' | sort)
|
||||
ALL_CONFIG_TARGETS := $(shell find boards -maxdepth 3 -mindepth 3 -name '*.cmake' -print | sed -e 's|boards\/||' | sed -e 's|\.cmake||' | sed -e 's|\/|_|g' | sort)
|
||||
|
||||
# ADD CONFIGS HERE
|
||||
# --------------------------------------------------------------------
|
||||
|
@ -240,16 +240,6 @@ endef
|
|||
# All targets with just dependencies but no recipe must either be marked as phony (or have the special @: as recipe).
|
||||
.PHONY: all px4_sitl_default all_config_targets all_default_targets
|
||||
|
||||
# Multi- config targets.
|
||||
eagle_default: atlflight_eagle_default atlflight_eagle_qurt
|
||||
eagle_rtps: atlflight_eagle_rtps atlflight_eagle_qurt-rtps
|
||||
|
||||
excelsior_default: atlflight_excelsior_default atlflight_excelsior_qurt
|
||||
excelsior_rtps: atlflight_excelsior_rtps atlflight_excelsior_qurt-rtps
|
||||
|
||||
.PHONY: eagle_default eagle_rtps
|
||||
.PHONY: excelsior_default excelsior_rtps
|
||||
|
||||
# Other targets
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
@ -512,7 +502,7 @@ help:
|
|||
@echo "Where <target> is one of:"
|
||||
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | \
|
||||
awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | \
|
||||
egrep -v -e '^[^[:alnum:]]' -e '^($(subst $(space),|,$(ALL_CONFIG_TARGETS)))$$' -e '_default$$' -e '^(posix|eagle|Makefile)'
|
||||
egrep -v -e '^[^[:alnum:]]' -e '^($(subst $(space),|,$(ALL_CONFIG_TARGETS)))$$' -e '_default$$' -e '^(Makefile)'
|
||||
@echo
|
||||
@echo "Or, $(MAKE) <config_target> [<make_target(s)>]"
|
||||
@echo "Use '$(MAKE) list_config_targets' for a list of configuration targets."
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
This repository holds the [PX4](http://px4.io) flight control solution for drones, with the main applications located in the [src/modules](https://github.com/PX4/PX4-Autopilot/tree/master/src/modules) directory. It also contains the PX4 Drone Middleware Platform, which provides drivers and middleware to run drones.
|
||||
|
||||
PX4 is highly portable, OS-independent and supports Linux, NuttX and QuRT out of the box.
|
||||
PX4 is highly portable, OS-independent and supports Linux, NuttX and MacOS out of the box.
|
||||
|
||||
* Official Website: http://px4.io (License: BSD 3-clause, [LICENSE](https://github.com/PX4/PX4-Autopilot/blob/master/LICENSE))
|
||||
* [Supported airframes](https://docs.px4.io/master/en/airframes/airframe_reference.html) ([portfolio](http://px4.io/#airframes)):
|
||||
|
|
|
@ -11,9 +11,6 @@ if [ -z ${PX4_DOCKER_REPO+x} ]; then
|
|||
elif [[ $@ =~ .*pilotpi.arm64 ]]; then
|
||||
# scumaker_pilotpi_arm64
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-aarch64:latest"
|
||||
elif [[ $@ =~ .*eagle.* ]] || [[ $@ =~ .*excelsior.* ]]; then
|
||||
# eagle, excelsior
|
||||
PX4_DOCKER_REPO="lorenzmeier/px4-dev-snapdragon:2020-04-01"
|
||||
elif [[ $@ =~ .*navio2.* ]] || [[ $@ =~ .*raspberry.* ]] || [[ $@ =~ .*bebop.* ]]; then
|
||||
# posix_rpi_cross, posix_bebop_default
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-armhf:2021-02-04"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 08fd0a73045346448adf6969660196228b23e1fa
|
|
@ -1,32 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2018 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.
|
||||
#
|
||||
############################################################################
|
|
@ -1,64 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2020 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
if("${PX4_PLATFORM}" MATCHES "qurt")
|
||||
|
||||
add_custom_target(upload
|
||||
COMMAND ${PX4_BOARD_DIR}/scripts/adb_upload.sh
|
||||
${PX4_BINARY_DIR}/platforms/qurt/libpx4.so ${PX4_BINARY_DIR}/platforms/qurt/libpx4muorb_skel.so ${PX4_SOURCE_DIR}/posix-configs/eagle/flight/px4.config # source
|
||||
/usr/share/data/adsp # destination
|
||||
DEPENDS px4 px4muorb_skel ${PX4_BOARD_DIR}/scripts/adb_upload.sh
|
||||
COMMENT "uploading px4"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
else()
|
||||
|
||||
add_custom_target(upload
|
||||
COMMAND ${PX4_BOARD_DIR}/scripts/adb_upload.sh
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config ${PX4_BINARY_DIR}/etc # source
|
||||
/home/linaro # destination
|
||||
DEPENDS px4 ${PX4_BOARD_DIR}/scripts/adb_upload.sh
|
||||
COMMENT "uploading px4"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
add_custom_target(sanity
|
||||
COMMAND ./px4_snapflight_sanitytest.sh -i -t
|
||||
DEPENDS px4
|
||||
WORKING_DIRECTORY ${PX4_BOARD_DIR}/scripts
|
||||
COMMENT "uploading px4"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
endif()
|
|
@ -1,128 +0,0 @@
|
|||
|
||||
# The Eagle board is the first generation Snapdragon Flight board by Qualcomm.
|
||||
|
||||
include(px4_git)
|
||||
px4_add_git_submodule(TARGET git_cmake_hexagon PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon")
|
||||
list(APPEND CMAKE_MODULE_PATH
|
||||
"${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon"
|
||||
"${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon/toolchain"
|
||||
)
|
||||
|
||||
# Get $QC_SOC_TARGET from environment if existing.
|
||||
if (DEFINED ENV{QC_SOC_TARGET})
|
||||
set(QC_SOC_TARGET $ENV{QC_SOC_TARGET})
|
||||
else()
|
||||
set(QC_SOC_TARGET "APQ8074")
|
||||
endif()
|
||||
|
||||
# Disable the creation of the parameters.xml file by scanning individual
|
||||
# source files, and scan all source files. This will create a parameters.xml
|
||||
# file that contains all possible parameters, even if the associated module
|
||||
# is not used. This is necessary for parameter synchronization between the
|
||||
# ARM and DSP processors.
|
||||
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
|
||||
|
||||
set(CONFIG_SHMEM "1")
|
||||
add_definitions(-DORB_COMMUNICATOR)
|
||||
|
||||
# atlflight toolchain doesn't properly set the compiler, so these aren't set automatically
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C>:-std=gnu99>)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=gnu++11>)
|
||||
|
||||
add_definitions(
|
||||
-D__PX4_POSIX_EAGLE
|
||||
-D__PX4_LINUX
|
||||
)
|
||||
|
||||
px4_add_board(
|
||||
PLATFORM posix
|
||||
VENDOR atlflight
|
||||
MODEL eagle
|
||||
LABEL default
|
||||
TOOLCHAIN arm-linux-gnueabihf
|
||||
ROMFSROOT px4fmu_common
|
||||
DRIVERS
|
||||
#barometer # all available barometer drivers
|
||||
batt_smbus
|
||||
camera_trigger
|
||||
differential_pressure # all available differential pressure drivers
|
||||
distance_sensor # all available distance sensor drivers
|
||||
gps
|
||||
#imu # all available imu drivers
|
||||
#lights/rgbled
|
||||
#magnetometer # all available magnetometer drivers
|
||||
pwm_out_sim
|
||||
qshell/posix
|
||||
rc_input
|
||||
smart_battery/batmon
|
||||
#telemetry # all available telemetry drivers
|
||||
MODULES
|
||||
airspeed_selector
|
||||
attitude_estimator_q
|
||||
camera_feedback
|
||||
commander
|
||||
dataman
|
||||
ekf2
|
||||
events
|
||||
flight_mode_manager
|
||||
fw_att_control
|
||||
fw_pos_control_l1
|
||||
gyro_calibration
|
||||
gyro_fft
|
||||
land_detector
|
||||
landing_target_estimator
|
||||
#load_mon
|
||||
local_position_estimator
|
||||
logger
|
||||
mavlink
|
||||
mc_att_control
|
||||
mc_hover_thrust_estimator
|
||||
mc_pos_control
|
||||
mc_rate_control
|
||||
#micrortps_bridge
|
||||
muorb/krait
|
||||
muorb/test
|
||||
navigator
|
||||
rc_update
|
||||
rover_pos_control
|
||||
sensors
|
||||
#sih
|
||||
temperature_compensation
|
||||
simulator
|
||||
vmount
|
||||
vtol_att_control
|
||||
SYSTEMCMDS
|
||||
#bl_update
|
||||
#dumpfile
|
||||
esc_calib
|
||||
#hardfault_log
|
||||
led_control
|
||||
mixer
|
||||
motor_ramp
|
||||
motor_test
|
||||
#mtd
|
||||
#nshterm
|
||||
param
|
||||
perf
|
||||
pwm
|
||||
sd_bench
|
||||
shutdown
|
||||
system_time
|
||||
#top
|
||||
topic_listener
|
||||
tune_control
|
||||
uorb
|
||||
ver
|
||||
work_queue
|
||||
EXAMPLES
|
||||
#fake_gps
|
||||
#fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control
|
||||
#hello
|
||||
#hwtest # Hardware test
|
||||
#matlab_csv_serial
|
||||
#px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html
|
||||
#px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html
|
||||
#rover_steering_control # Rover example app
|
||||
#uuv_example_app
|
||||
#work_item
|
||||
)
|
|
@ -1,88 +0,0 @@
|
|||
|
||||
# The Eagle board is the first generation Snapdragon Flight board by Qualcomm.
|
||||
#
|
||||
# This cmake config builds for QURT which is the operating system running on
|
||||
# the DSP side.
|
||||
|
||||
# Get $QC_SOC_TARGET from environment if existing.
|
||||
if (DEFINED ENV{QC_SOC_TARGET})
|
||||
set(QC_SOC_TARGET $ENV{QC_SOC_TARGET})
|
||||
else()
|
||||
set(QC_SOC_TARGET "APQ8074")
|
||||
endif()
|
||||
|
||||
include(px4_git)
|
||||
px4_add_git_submodule(TARGET git_cmake_hexagon PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon")
|
||||
list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon")
|
||||
|
||||
if ("$ENV{HEXAGON_SDK_ROOT}" STREQUAL "")
|
||||
message(FATAL_ERROR "Enviroment variable HEXAGON_SDK_ROOT must be set")
|
||||
else()
|
||||
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
|
||||
endif()
|
||||
|
||||
include(toolchain/Toolchain-qurt)
|
||||
include(qurt_flags)
|
||||
include_directories(${HEXAGON_SDK_INCLUDES})
|
||||
|
||||
set(CONFIG_SHMEM "1")
|
||||
add_definitions(-DORB_COMMUNICATOR)
|
||||
|
||||
# Disable the creation of the parameters.xml file by scanning individual
|
||||
# source files, and scan all source files. This will create a parameters.xml
|
||||
# file that contains all possible parameters, even if the associated module
|
||||
# is not used. This is necessary for parameter synchronization between the
|
||||
# ARM and DSP processors.
|
||||
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
|
||||
|
||||
# This definition allows to differentiate the specific board.
|
||||
add_definitions(-D__PX4_QURT_EAGLE)
|
||||
|
||||
px4_add_board(
|
||||
PLATFORM qurt
|
||||
VENDOR atlflight
|
||||
MODEL eagle
|
||||
LABEL qurt
|
||||
DRIVERS
|
||||
barometer/bmp280
|
||||
gps
|
||||
imu/invensense/mpu9250
|
||||
#magnetometer/hmc5883
|
||||
qshell/qurt
|
||||
snapdragon_spektrum_rc
|
||||
MODULES
|
||||
airspeed_selector
|
||||
attitude_estimator_q
|
||||
commander
|
||||
ekf2
|
||||
flight_mode_manager
|
||||
fw_att_control
|
||||
fw_pos_control_l1
|
||||
gyro_calibration
|
||||
gyro_fft
|
||||
land_detector
|
||||
landing_target_estimator
|
||||
local_position_estimator
|
||||
mc_att_control
|
||||
mc_hover_thrust_estimator
|
||||
mc_pos_control
|
||||
mc_rate_control
|
||||
muorb/adsp
|
||||
rc_update
|
||||
rover_pos_control
|
||||
sensors
|
||||
temperature_compensation
|
||||
vmount
|
||||
vtol_att_control
|
||||
SYSTEMCMDS
|
||||
led_control
|
||||
mixer
|
||||
#motor_ramp
|
||||
motor_test
|
||||
param
|
||||
perf
|
||||
#pwm
|
||||
#topic_listener
|
||||
ver
|
||||
work_queue
|
||||
)
|
|
@ -1,2 +0,0 @@
|
|||
minidm.log
|
||||
px4.log
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ "$#" < 2 ]]; then
|
||||
echo "usage: adb_upload.sh SRC1 [SRC2 ...] DEST"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Get last argument
|
||||
for last; do true; done
|
||||
|
||||
echo "Wait for device..."
|
||||
adb wait-for-device
|
||||
|
||||
echo "Creating folder structure..."
|
||||
adb shell mkdir -p $last
|
||||
|
||||
echo "Uploading..."
|
||||
# Go through source files and push them one by one.
|
||||
i=0
|
||||
for arg
|
||||
do
|
||||
if [[ $((i+1)) == "$#" ]]; then
|
||||
break
|
||||
fi
|
||||
# echo "Pushing $arg to $last"
|
||||
adb push $arg $last
|
||||
((i+=1))
|
||||
done
|
||||
|
||||
# Make sure they are synced to the file system
|
||||
echo "Syncing FS..."
|
||||
adb shell sync
|
|
@ -1,288 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#################################################################################################
|
||||
#
|
||||
# This script loads PX4 binaries to the Snapdragon Flight target and does a quick on-target sanity test.
|
||||
#
|
||||
# Pre-requisites:
|
||||
# - Snapdragon Flight board connected to the host computer via USB cable
|
||||
# - Snapdragon Flight board must have the latest platform BSP and flight controller addon installed"
|
||||
# - mini-dm installed on host computer (see https://github.com/ATLFlight/ATLFlightDocs/blob/master/UserGuide.md#adsp)
|
||||
# - PX4 software was built and binaries are in their usual locations in the Firmware tree.
|
||||
#
|
||||
# This script supports two modes:
|
||||
# - Default mode (supported by PX4 community)
|
||||
# - Legacy mode (uses proprietary drivers for ESC and RC Receiver, supported by Qualcomm)
|
||||
#
|
||||
# For help and cmd line options, run the script with the -h option
|
||||
#
|
||||
#################################################################################################
|
||||
|
||||
# Halt on error
|
||||
set -e
|
||||
|
||||
# Verbose mode
|
||||
## set -x
|
||||
|
||||
# Mode of operation
|
||||
readonly MODE_DEFAULT=0
|
||||
readonly MODE_LEGACY=1
|
||||
readonly MODE_8x96=2
|
||||
readonly MODE_MAX=$MODE_8x96
|
||||
|
||||
readonly RESULT_PASS=0
|
||||
readonly RESULT_FAIL=3
|
||||
readonly EXIT_ERROR=3
|
||||
|
||||
|
||||
# List of expected strings from the apps proc
|
||||
declare -a appsproc_strings_present=(
|
||||
"on udp port 14556 remote port 14550"
|
||||
)
|
||||
|
||||
# List of unexpected strings from the apps proc
|
||||
declare -a appsproc_strings_absent=(
|
||||
"ERROR"
|
||||
"Getting Bulk data from fastRPC link"
|
||||
"Segmentation fault"
|
||||
)
|
||||
|
||||
# List of expected strings from the DSP
|
||||
declare -a dsp_strings_present=(
|
||||
"EKF aligned"
|
||||
)
|
||||
|
||||
# List of unexpected strings from the DSP
|
||||
declare -a dsp_strings_absent=(
|
||||
"Segmentation fault"
|
||||
)
|
||||
|
||||
|
||||
install=0
|
||||
test=0
|
||||
mode=0
|
||||
result=$RESULT_PASS
|
||||
|
||||
# Default mini-dm path (needs to be installed in this location or overriden through cmd line
|
||||
minidmPath=~/Qualcomm/Hexagon_SDK/3.0/tools/debug/mini-dm/Linux_Debug
|
||||
|
||||
# Default workspace path (parent directory of the script location)
|
||||
workspace=`pwd`/../../../..
|
||||
|
||||
|
||||
verifypx4test() {
|
||||
|
||||
#TODO: This needs to be fixed. For now, skip string checks for 8x96 platform.
|
||||
if [ $mode == 2 ]; then
|
||||
echo -e "[WARNING] Skipping string checks for 8x96 platform"
|
||||
return
|
||||
fi
|
||||
|
||||
echo -e "Verifying test results..."
|
||||
|
||||
# verify the presence of expected stings in the apps proc console log
|
||||
for lineString in "${appsproc_strings_present[@]}"
|
||||
do
|
||||
if ! grep -Fq "$lineString" px4.log
|
||||
then
|
||||
# code if not found
|
||||
echo -e "[ERROR] Missing expected string in apps proc log: $lineString"
|
||||
result=$RESULT_FAIL
|
||||
fi
|
||||
done
|
||||
|
||||
# verify the absence of unexpected stings in the apps proc console log
|
||||
for lineString in "${appsproc_strings_absent[@]}"
|
||||
do
|
||||
if grep -Fq "$lineString" px4.log
|
||||
then
|
||||
# code if not found
|
||||
echo -e "[ERROR] Found unexpected string in apps proc log: $lineString"
|
||||
result=$RESULT_FAIL
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "Displaying the content of the minidm.log"
|
||||
cat minidm.log
|
||||
echo -e "Analyzing the log for success and failure indications."
|
||||
|
||||
# verify the presence of expected stings in the DSP console log
|
||||
for lineString in "${dsp_strings_present[@]}"
|
||||
do
|
||||
if ! grep -Fq "$lineString" minidm.log
|
||||
then
|
||||
# code if not found
|
||||
echo -e "[ERROR] Missing expected string in DSP log: $lineString"
|
||||
result=$RESULT_FAIL
|
||||
fi
|
||||
done
|
||||
|
||||
# verify the absence of unexpected stings in the DSP console log
|
||||
for lineString in "${dsp_strings_absent[@]}"
|
||||
do
|
||||
if grep -Fq "$lineString" minidm.log
|
||||
then
|
||||
# code if not found
|
||||
echo -e "[ERROR] Found unexpected string in DSP log: $lineString"
|
||||
result=$RESULT_FAIL
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "Verification complete."
|
||||
|
||||
if [ $result -eq $RESULT_FAIL ]; then
|
||||
echo -e "PX4 test result: FAIL"
|
||||
else
|
||||
echo -e "PX4 test result: PASS"
|
||||
fi
|
||||
}
|
||||
|
||||
installpx4() {
|
||||
|
||||
if [ $install -eq 0 ]; then
|
||||
echo -e "SKIPPING install"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
# Reboot the target before beginning the installation
|
||||
echo -e "Rebooting the target..."
|
||||
adb reboot
|
||||
adb wait-for-usb-device
|
||||
# Wait a bit longer after bootup, before copying binaries to the target.
|
||||
sleep 30
|
||||
adb devices
|
||||
|
||||
echo -e "Now installing PX4 binaries..."
|
||||
# Copy binaries to the target
|
||||
if [ $mode == 0 ]; then
|
||||
# copy default binaries
|
||||
echo -e "Copying the PX4 binaries from the eagle_default build tree..."
|
||||
adb push $workspace/build/atlflight_eagle_qurt/platforms/qurt/libpx4.so /usr/share/data/adsp
|
||||
adb push $workspace/build/atlflight_eagle_qurt/platforms/qurt/libpx4muorb_skel.so /usr/share/data/adsp
|
||||
adb push $workspace/build/atlflight_eagle_default/bin/px4 /home/linaro
|
||||
adb push $workspace/posix-configs/eagle/flight/px4.config /usr/share/data/adsp
|
||||
adb push $workspace/posix-configs/eagle/flight/mainapp.config /home/linaro
|
||||
fi
|
||||
|
||||
echo -e "Installation complete."
|
||||
}
|
||||
|
||||
|
||||
testpx4() {
|
||||
|
||||
if [ $test -eq 0 ]; then
|
||||
echo -e "SKIPPING test"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
echo -e "Starting PX4 test..."
|
||||
|
||||
# Remove previous instances of the file
|
||||
rm px4.log | true
|
||||
rm minidm.log | true
|
||||
|
||||
# Start mini-dm
|
||||
echo -e "Starting mini-dm..."
|
||||
${minidmPath}/mini-dm > minidm.log &
|
||||
sleep 5
|
||||
# Verify that mini-dm is running
|
||||
checkProc=$(ps -aef | grep mini-dm | grep -v grep)
|
||||
|
||||
if [ -z "${checkProc}" ]; then
|
||||
echo "[ERROR] Unable to start mini-dm from path: ${minidmPath}"
|
||||
exit $EXIT_ERROR
|
||||
fi
|
||||
|
||||
|
||||
# Start PX4
|
||||
echo -e "Starting PX4..."
|
||||
if [ $mode == 2 ]; then
|
||||
# 8x96 platform
|
||||
adb shell "/home/root/px4 /home/root/mainapp.config" > px4.log 2>&1 &
|
||||
else
|
||||
# 8x74 platform
|
||||
adb shell "/home/linaro/px4 /home/linaro/mainapp.config" > px4.log 2>&1 &
|
||||
fi
|
||||
sleep 20
|
||||
# Verify that PX4 is still running
|
||||
checkProc=$(adb shell "ps -aef | grep px4 | grep -v grep")
|
||||
if [ -z "${checkProc}" ]; then
|
||||
echo "[ERROR] PX4 is not running on target!"
|
||||
exit $EXIT_ERROR
|
||||
fi
|
||||
|
||||
# Stop the PX4 process on target
|
||||
adb shell "ps -eaf | grep px4 | grep -v grep | awk '{print $2}' | tr -s ' ' | cut -d' ' -f2 | xargs kill"
|
||||
sleep 5
|
||||
|
||||
# Stop the mini-dm
|
||||
killall mini-dm
|
||||
|
||||
echo -e "PX4 test complete."
|
||||
|
||||
# Verify the results
|
||||
verifypx4test
|
||||
|
||||
echo -e "For more information, see px4.log and minidm.log."
|
||||
}
|
||||
|
||||
|
||||
usage() {
|
||||
echo -e "\nThis script can copy PX4 binaries to the Snapdragon Flight target and do a quick on-target sanity test.\n"
|
||||
echo -e "Pre-requisites:"
|
||||
echo -e "- Snapdragon Flight board must be connected to host computer via USB"
|
||||
echo -e "- Snapdragon Flight board must have the latest platform BSP and flight controller addon installed"
|
||||
echo -e "- mini-dm must be installed on host computer (see https://github.com/ATLFlight/ATLFlightDocs/blob/master/UserGuide.md#adsp)"
|
||||
echo -e "- PX4 software was built and binaries are in their usual locations in the tree\n"
|
||||
echo -e "USAGE:\n ${0} [-m mode] [-i] [-t] [-l <minidm-path>]"
|
||||
echo -e " -m --> Build mode (0 = default mode, 1 = legacy mode)"
|
||||
echo -e " -i --> Install the PX4 binaries"
|
||||
echo -e " -t --> Test PX4 on target"
|
||||
echo -e " -l --> location of the mini-dm executable (Default: ${minidmPath})"
|
||||
echo -e " -h --> Display this help information"
|
||||
}
|
||||
|
||||
# Parse the command line options
|
||||
while getopts "m:l:ith" opt;
|
||||
do
|
||||
case $opt in
|
||||
m)
|
||||
if [ $OPTARG -gt $MODE_MAX ]; then
|
||||
echo "Invalid mode: $OPTARG (max allowed is $MODE_MAX)"
|
||||
exit $EXIT_ERROR
|
||||
fi
|
||||
mode=$OPTARG
|
||||
echo "Will run the script in mode $mode."
|
||||
;;
|
||||
i)
|
||||
install=1
|
||||
;;
|
||||
t)
|
||||
test=1
|
||||
;;
|
||||
l)
|
||||
minidmPath=$OPTARG
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument" >&2
|
||||
exit 1;;
|
||||
?)
|
||||
echo "Unknown arg $opt"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Install the PX4 binaries
|
||||
installpx4
|
||||
|
||||
# Run the sanity test
|
||||
testpx4
|
||||
|
||||
exit $result
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add_library(drivers_board
|
||||
board_config.h
|
||||
i2c.cpp
|
||||
init.c
|
||||
spi.cpp
|
||||
)
|
|
@ -1,53 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2017 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 board_config.h
|
||||
*
|
||||
* EAGLE internal definitions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define BOARD_OVERRIDE_UUID "EAGLEID000000000" // must be of length 16
|
||||
#define PX4_SOC_ARCH_ID PX4_SOC_ARCH_ID_EAGLE
|
||||
|
||||
/*
|
||||
* I2C busses
|
||||
*/
|
||||
#define PX4_NUMBER_I2C_BUSES 3
|
||||
|
||||
// Battery ADC channels
|
||||
|
||||
#include <system_config.h>
|
||||
#include <px4_platform_common/board_common.h>
|
|
@ -1,40 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_arch/i2c_hw_description.h>
|
||||
|
||||
constexpr px4_i2c_bus_t px4_i2c_buses[I2C_BUS_MAX_BUS_ITEMS] = {
|
||||
initI2CBusExternal(2),
|
||||
initI2CBusExternal(3),
|
||||
initI2CBusExternal(9),
|
||||
};
|
|
@ -1,41 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_arch/spi_hw_description.h>
|
||||
#include <drivers/drv_sensor.h>
|
||||
|
||||
constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
|
||||
initSPIBus(1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU9250),
|
||||
}),
|
||||
};
|
|
@ -1,126 +0,0 @@
|
|||
|
||||
# Excelsior is the code name of a board currently in development.
|
||||
|
||||
include(px4_git)
|
||||
px4_add_git_submodule(TARGET git_cmake_hexagon PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon")
|
||||
list(APPEND CMAKE_MODULE_PATH
|
||||
"${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon"
|
||||
"${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon/toolchain"
|
||||
)
|
||||
|
||||
# Get $QC_SOC_TARGET from environment if existing.
|
||||
if (DEFINED ENV{QC_SOC_TARGET})
|
||||
set(QC_SOC_TARGET $ENV{QC_SOC_TARGET})
|
||||
else()
|
||||
set(QC_SOC_TARGET "APQ8074")
|
||||
endif()
|
||||
|
||||
# Disable the creation of the parameters.xml file by scanning individual
|
||||
# source files, and scan all source files. This will create a parameters.xml
|
||||
# file that contains all possible parameters, even if the associated module
|
||||
# is not used. This is necessary for parameter synchronization between the
|
||||
# ARM and DSP processors.
|
||||
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
|
||||
|
||||
set(CONFIG_SHMEM "1")
|
||||
add_definitions(-DORB_COMMUNICATOR)
|
||||
|
||||
# atlflight toolchain doesn't properly set the compiler, so these aren't set automatically
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C>:-std=gnu99>)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=gnu++11>)
|
||||
|
||||
add_definitions(
|
||||
-D__PX4_POSIX_EXCELSIOR
|
||||
-D__PX4_LINUX
|
||||
)
|
||||
|
||||
px4_add_board(
|
||||
PLATFORM posix
|
||||
VENDOR atlflight
|
||||
MODEL excelsior
|
||||
LABEL default
|
||||
TOOLCHAIN arm-oemllib32-linux-gnueabi
|
||||
DRIVERS
|
||||
#barometer # all available barometer drivers
|
||||
batt_smbus
|
||||
camera_trigger
|
||||
differential_pressure # all available differential pressure drivers
|
||||
distance_sensor # all available distance sensor drivers
|
||||
gps
|
||||
#imu # all available imu drivers
|
||||
#lights/rgbled
|
||||
#magnetometer # all available magnetometer drivers
|
||||
pwm_out_sim
|
||||
qshell/posix
|
||||
rc_input
|
||||
smart_battery/batmon
|
||||
#telemetry # all available telemetry drivers
|
||||
MODULES
|
||||
airspeed_selector
|
||||
attitude_estimator_q
|
||||
camera_feedback
|
||||
commander
|
||||
dataman
|
||||
ekf2
|
||||
events
|
||||
flight_mode_manager
|
||||
fw_att_control
|
||||
fw_pos_control_l1
|
||||
gyro_calibration
|
||||
gyro_fft
|
||||
land_detector
|
||||
landing_target_estimator
|
||||
#load_mon
|
||||
local_position_estimator
|
||||
logger
|
||||
mavlink
|
||||
mc_att_control
|
||||
mc_hover_thrust_estimator
|
||||
mc_pos_control
|
||||
mc_rate_control
|
||||
#micrortps_bridge
|
||||
muorb/krait
|
||||
muorb/test
|
||||
navigator
|
||||
rc_update
|
||||
rover_pos_control
|
||||
sensors
|
||||
#sih
|
||||
simulator
|
||||
vmount
|
||||
vtol_att_control
|
||||
SYSTEMCMDS
|
||||
#bl_update
|
||||
#dumpfile
|
||||
esc_calib
|
||||
#hardfault_log
|
||||
led_control
|
||||
mixer
|
||||
motor_ramp
|
||||
motor_test
|
||||
#mtd
|
||||
#nshterm
|
||||
param
|
||||
perf
|
||||
pwm
|
||||
sd_bench
|
||||
shutdown
|
||||
system_time
|
||||
#top
|
||||
topic_listener
|
||||
tune_control
|
||||
uorb
|
||||
ver
|
||||
work_queue
|
||||
EXAMPLES
|
||||
#fake_gps
|
||||
#fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control
|
||||
#hello
|
||||
#hwtest # Hardware test
|
||||
#matlab_csv_serial
|
||||
#px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html
|
||||
#px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html
|
||||
#rover_steering_control # Rover example app
|
||||
#uuv_example_app
|
||||
#work_item
|
||||
)
|
|
@ -1,88 +0,0 @@
|
|||
|
||||
# Excelsior is the code name of a board currently in development.
|
||||
#
|
||||
# This cmake config builds for QURT which is the operating system running on
|
||||
# the DSP side.
|
||||
|
||||
# Get $QC_SOC_TARGET from environment if existing.
|
||||
if (DEFINED ENV{QC_SOC_TARGET})
|
||||
set(QC_SOC_TARGET $ENV{QC_SOC_TARGET})
|
||||
else()
|
||||
set(QC_SOC_TARGET "APQ8074")
|
||||
endif()
|
||||
|
||||
include(px4_git)
|
||||
px4_add_git_submodule(TARGET git_cmake_hexagon PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon")
|
||||
list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon")
|
||||
|
||||
if ("$ENV{HEXAGON_SDK_ROOT}" STREQUAL "")
|
||||
message(FATAL_ERROR "Enviroment variable HEXAGON_SDK_ROOT must be set")
|
||||
else()
|
||||
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
|
||||
endif()
|
||||
|
||||
include(toolchain/Toolchain-qurt)
|
||||
include(qurt_flags)
|
||||
include_directories(${HEXAGON_SDK_INCLUDES})
|
||||
|
||||
set(CONFIG_SHMEM "1")
|
||||
add_definitions(-DORB_COMMUNICATOR)
|
||||
|
||||
# Disable the creation of the parameters.xml file by scanning individual
|
||||
# source files, and scan all source files. This will create a parameters.xml
|
||||
# file that contains all possible parameters, even if the associated module
|
||||
# is not used. This is necessary for parameter synchronization between the
|
||||
# ARM and DSP processors.
|
||||
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
|
||||
|
||||
# This definition allows to differentiate the specific board.
|
||||
add_definitions(-D__PX4_QURT_EXCELSIOR)
|
||||
|
||||
px4_add_board(
|
||||
PLATFORM qurt
|
||||
VENDOR atlflight
|
||||
MODEL excelsior
|
||||
LABEL qurt
|
||||
DRIVERS
|
||||
barometer/bmp280
|
||||
gps
|
||||
imu/invensense/mpu9250
|
||||
magnetometer/hmc5883
|
||||
qshell/qurt
|
||||
snapdragon_spektrum_rc
|
||||
MODULES
|
||||
airspeed_selector
|
||||
attitude_estimator_q
|
||||
commander
|
||||
ekf2
|
||||
flight_mode_manager
|
||||
fw_att_control
|
||||
fw_pos_control_l1
|
||||
gyro_calibration
|
||||
gyro_fft
|
||||
land_detector
|
||||
landing_target_estimator
|
||||
local_position_estimator
|
||||
mc_att_control
|
||||
mc_hover_thrust_estimator
|
||||
mc_pos_control
|
||||
mc_rate_control
|
||||
muorb/adsp
|
||||
rc_update
|
||||
rover_pos_control
|
||||
sensors
|
||||
temperature_compensation
|
||||
vmount
|
||||
vtol_att_control
|
||||
SYSTEMCMDS
|
||||
led_control
|
||||
mixer
|
||||
#motor_ramp
|
||||
motor_test
|
||||
param
|
||||
perf
|
||||
#pwm
|
||||
#topic_listener
|
||||
ver
|
||||
work_queue
|
||||
)
|
|
@ -1,39 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add_library(drivers_board
|
||||
board_config.h
|
||||
init.c
|
||||
spi.cpp
|
||||
i2c.cpp
|
||||
)
|
|
@ -1,51 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2017 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 board_config.h
|
||||
*
|
||||
* EXCELSIOR internal definitions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define BOARD_OVERRIDE_UUID "EAGLEID000000000" // must be of length 16
|
||||
#define PX4_SOC_ARCH_ID PX4_SOC_ARCH_ID_EAGLE
|
||||
|
||||
/*
|
||||
* I2C busses
|
||||
*/
|
||||
#define PX4_NUMBER_I2C_BUSES 3
|
||||
|
||||
#include <system_config.h>
|
||||
#include <px4_platform_common/board_common.h>
|
|
@ -1,40 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_arch/i2c_hw_description.h>
|
||||
|
||||
constexpr px4_i2c_bus_t px4_i2c_buses[I2C_BUS_MAX_BUS_ITEMS] = {
|
||||
initI2CBusExternal(2),
|
||||
initI2CBusExternal(3),
|
||||
initI2CBusExternal(9),
|
||||
};
|
|
@ -1,41 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_arch/spi_hw_description.h>
|
||||
#include <drivers/drv_sensor.h>
|
||||
|
||||
constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
|
||||
initSPIBus(1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU9250),
|
||||
}),
|
||||
};
|
|
@ -244,22 +244,6 @@ RingBuffer::force(double val)
|
|||
return force(&val, sizeof(val));
|
||||
}
|
||||
|
||||
// FIXME - clang crashes on this get() call
|
||||
#ifdef __PX4_QURT
|
||||
#define __PX4_SBCAP my_sync_bool_compare_and_swap
|
||||
static inline bool my_sync_bool_compare_and_swap(volatile unsigned *a, unsigned b, unsigned c)
|
||||
{
|
||||
if (*a == b) {
|
||||
*a = c;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#else
|
||||
#define __PX4_SBCAP __sync_bool_compare_and_swap
|
||||
#endif
|
||||
bool
|
||||
RingBuffer::get(void *val, size_t val_size)
|
||||
{
|
||||
|
@ -284,7 +268,7 @@ RingBuffer::get(void *val, size_t val_size)
|
|||
}
|
||||
|
||||
/* if the tail pointer didn't change, we got our item */
|
||||
} while (!__PX4_SBCAP(&_tail, candidate, next));
|
||||
} while (!__sync_bool_compare_and_swap(&_tail, candidate, next));
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
@ -179,9 +179,7 @@ function(px4_add_module)
|
|||
endif()
|
||||
set_target_properties(${MODULE} PROPERTIES STACK_MAX ${STACK_MAX})
|
||||
|
||||
if(${PX4_PLATFORM} STREQUAL "qurt")
|
||||
set_property(TARGET ${MODULE} PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
||||
elseif(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
if(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
target_compile_options(${MODULE} PRIVATE -Wframe-larger-than=${STACK_MAX})
|
||||
endif()
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
set(SRCS)
|
||||
|
||||
if (NOT "${PX4_PLATFORM}" MATCHES "qurt" AND NOT "${PX4_BOARD}" MATCHES "io-v2" AND NOT "${PX4_BOARD_LABEL}" MATCHES "bootloader")
|
||||
if(NOT "${PX4_BOARD}" MATCHES "io-v2" AND NOT "${PX4_BOARD_LABEL}" MATCHES "bootloader")
|
||||
list(APPEND SRCS
|
||||
px4_log.cpp
|
||||
)
|
||||
|
|
|
@ -84,10 +84,6 @@ public:
|
|||
*/
|
||||
inline T load() const
|
||||
{
|
||||
#ifdef __PX4_QURT
|
||||
return _value;
|
||||
#else
|
||||
|
||||
#if defined(__PX4_NUTTX)
|
||||
|
||||
if (!__atomic_always_lock_free(sizeof(T), 0)) {
|
||||
|
@ -101,8 +97,6 @@ public:
|
|||
{
|
||||
return __atomic_load_n(&_value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,10 +104,6 @@ public:
|
|||
*/
|
||||
inline void store(T value)
|
||||
{
|
||||
#ifdef __PX4_QURT
|
||||
_value = value;
|
||||
#else
|
||||
|
||||
#if defined(__PX4_NUTTX)
|
||||
|
||||
if (!__atomic_always_lock_free(sizeof(T), 0)) {
|
||||
|
@ -126,8 +116,6 @@ public:
|
|||
{
|
||||
__atomic_store(&_value, &value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,11 +124,6 @@ public:
|
|||
*/
|
||||
inline T fetch_add(T num)
|
||||
{
|
||||
#ifdef __PX4_QURT
|
||||
// TODO: fix
|
||||
return _value++;
|
||||
#else
|
||||
|
||||
#if defined(__PX4_NUTTX)
|
||||
|
||||
if (!__atomic_always_lock_free(sizeof(T), 0)) {
|
||||
|
@ -154,8 +137,6 @@ public:
|
|||
{
|
||||
return __atomic_fetch_add(&_value, num, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -301,13 +282,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
#ifdef __PX4_QURT
|
||||
// It seems that __atomic_store and __atomic_load are not supported on Qurt,
|
||||
// so the best that we can do is to use volatile.
|
||||
volatile T _value{};
|
||||
#else
|
||||
T _value {};
|
||||
#endif
|
||||
};
|
||||
|
||||
using atomic_int = atomic<int>;
|
||||
|
|
|
@ -89,33 +89,14 @@ constexpr bool PX4_ISFINITE(double x) { return __builtin_isfinite(x); }
|
|||
#define USEC_PER_TICK (1000000/PX4_TICKS_PER_SEC)
|
||||
#define USEC2TICK(x) (((x)+(USEC_PER_TICK/2))/USEC_PER_TICK)
|
||||
|
||||
#ifdef __PX4_QURT
|
||||
|
||||
// QURT specific
|
||||
# include "dspal_math.h"
|
||||
# define PX4_ROOTFSDIR "."
|
||||
# define PX4_TICKS_PER_SEC 1000L
|
||||
|
||||
#else // __PX4_QURT
|
||||
|
||||
// All POSIX except QURT.
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern long PX4_TICKS_PER_SEC;
|
||||
__END_DECLS
|
||||
|
||||
# if defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_EXCELSIOR)
|
||||
# define PX4_ROOTFSDIR "/home/linaro"
|
||||
# else
|
||||
# define PX4_ROOTFSDIR "."
|
||||
# endif
|
||||
|
||||
#endif // __PX4_QURT
|
||||
#define PX4_ROOTFSDIR "."
|
||||
|
||||
#define PX4_STORAGEDIR PX4_ROOTFSDIR
|
||||
#endif // __PX4_POSIX
|
||||
|
||||
#if defined(__PX4_POSIX)
|
||||
/****************************************************************************
|
||||
* Defines for POSIX and ROS
|
||||
****************************************************************************/
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015 Ramakrishna Kintada. 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <parameters/param.h>
|
||||
|
||||
#define MAX_SHMEM_PARAMS 2000 //MAP_SIZE - (LOCK_SIZE - sizeof(struct shmem_info))
|
||||
|
||||
#define PARAM_BUFFER_SIZE (MAX_SHMEM_PARAMS / 8 + 1)
|
||||
|
||||
struct shmem_info {
|
||||
union param_value_u params_val[MAX_SHMEM_PARAMS];
|
||||
unsigned char krait_changed_index[MAX_SHMEM_PARAMS / 8 + 1]; /*bit map of all params changed by krait*/
|
||||
unsigned char adsp_changed_index[MAX_SHMEM_PARAMS / 8 + 1]; /*bit map of all params changed by adsp*/
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
#if (defined(__PX4_POSIX_EXCELSIOR) || defined(__PX4_QURT_EXCELSIOR))
|
||||
#define MAP_ADDRESS 0x861FC000
|
||||
#else
|
||||
#define MAP_ADDRESS 0xfbfc000
|
||||
#endif
|
||||
#define MAP_SIZE 16384
|
||||
#define MAP_MASK (MAP_SIZE - 1)
|
||||
|
||||
#define LOCK_OFFSET 0
|
||||
#define LOCK_SIZE 4
|
||||
#define LOCK_MEM 1
|
||||
#define UNLOCK_MEM 2
|
||||
|
||||
#define TYPE_MASK 0x1
|
||||
|
||||
extern bool handle_in_range(param_t);
|
||||
|
||||
#ifdef __PX4_QURT
|
||||
extern struct shmem_info *shmem_info_p;
|
||||
|
||||
int get_shmem_lock(const char *caller_file_name, int caller_line_number);
|
||||
void release_shmem_lock(const char *caller_file_name, int caller_line_number);
|
||||
void init_shared_memory(void);
|
||||
|
||||
void copy_params_to_shmem(const param_info_s *param_info_base);
|
||||
#endif
|
||||
|
||||
void update_to_shmem(param_t param, union param_value_u value);
|
||||
int update_from_shmem(param_t param, union param_value_u *value);
|
||||
void update_index_from_shmem(void);
|
|
@ -45,10 +45,6 @@
|
|||
#include <queue.h>
|
||||
#include <px4_platform_types.h>
|
||||
|
||||
#ifdef __PX4_QURT
|
||||
#include <dspal_types.h>
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define HPWORK 0
|
||||
|
|
|
@ -49,7 +49,7 @@ WorkQueue::WorkQueue(const wq_config_t &config) :
|
|||
// set the threads name
|
||||
#ifdef __PX4_DARWIN
|
||||
pthread_setname_np(_config.name);
|
||||
#elif !defined(__PX4_QURT)
|
||||
#else
|
||||
pthread_setname_np(pthread_self(), _config.name);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,73 +25,46 @@ px4_posix_generate_alias(
|
|||
PREFIX ${PX4_SHELL_COMMAND_PREFIX}
|
||||
)
|
||||
|
||||
if (("${PX4_BOARD}" MATCHES "atlflight_eagle") OR ("${PX4_BOARD}" MATCHES "atlflight_excelsior"))
|
||||
include(fastrpc)
|
||||
include(linux_app)
|
||||
|
||||
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
|
||||
|
||||
LINUX_APP(
|
||||
APP_NAME px4
|
||||
IDL_NAME px4muorb
|
||||
APPS_DEST "/home/linaro"
|
||||
SOURCES
|
||||
px4muorb_stub.c
|
||||
src/px4/common/main.cpp
|
||||
apps.cpp
|
||||
LINK_LIBS
|
||||
-Wl,--start-group
|
||||
px4_layer
|
||||
parameters
|
||||
${module_libraries}
|
||||
${FASTRPC_ARM_LIBS}
|
||||
pthread m rt
|
||||
-Wl,--end-group
|
||||
)
|
||||
|
||||
else()
|
||||
add_executable(px4
|
||||
src/px4/common/main.cpp
|
||||
apps.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(px4
|
||||
PRIVATE
|
||||
${module_libraries}
|
||||
pthread m
|
||||
|
||||
# horrible circular dependencies that need to be teased apart
|
||||
px4_layer px4_platform
|
||||
work_queue
|
||||
parameters
|
||||
add_executable(px4
|
||||
src/px4/common/main.cpp
|
||||
apps.cpp
|
||||
)
|
||||
|
||||
if(NOT APPLE)
|
||||
target_link_libraries(px4 PRIVATE rt)
|
||||
endif()
|
||||
target_link_libraries(px4
|
||||
PRIVATE
|
||||
${module_libraries}
|
||||
pthread m
|
||||
|
||||
target_link_libraries(px4 PRIVATE uORB)
|
||||
|
||||
#=============================================================================
|
||||
# install
|
||||
#
|
||||
|
||||
# TODO: extend to snapdragon
|
||||
|
||||
# px4 dirs
|
||||
install(
|
||||
DIRECTORY
|
||||
${PROJECT_SOURCE_DIR}/posix-configs
|
||||
${PROJECT_SOURCE_DIR}/test
|
||||
${CMAKE_BINARY_DIR}/etc
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
DESTINATION
|
||||
${PROJECT_NAME}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
)
|
||||
# horrible circular dependencies that need to be teased apart
|
||||
px4_layer px4_platform
|
||||
work_queue
|
||||
parameters
|
||||
)
|
||||
|
||||
if(NOT APPLE)
|
||||
target_link_libraries(px4 PRIVATE rt)
|
||||
endif()
|
||||
|
||||
target_link_libraries(px4 PRIVATE uORB)
|
||||
|
||||
#=============================================================================
|
||||
# install
|
||||
#
|
||||
|
||||
# TODO: extend to snapdragon
|
||||
|
||||
# px4 dirs
|
||||
install(
|
||||
DIRECTORY
|
||||
${PROJECT_SOURCE_DIR}/posix-configs
|
||||
${PROJECT_SOURCE_DIR}/test
|
||||
${CMAKE_BINARY_DIR}/etc
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
DESTINATION
|
||||
${PROJECT_NAME}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
)
|
||||
|
||||
# Module Symlinks
|
||||
px4_posix_generate_symlinks(
|
||||
MODULE_LIST ${module_libraries}
|
||||
|
|
|
@ -36,17 +36,6 @@ add_subdirectory(px4_daemon)
|
|||
add_subdirectory(lockstep_scheduler)
|
||||
|
||||
set(EXTRA_DEPENDS)
|
||||
if("${CONFIG_SHMEM}" STREQUAL "1")
|
||||
list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon")
|
||||
include(hexagon_sdk)
|
||||
include_directories(${HEXAGON_SDK_INCLUDES})
|
||||
include_directories(${PX4_BINARY_DIR}/platforms/posix)
|
||||
list(APPEND SHMEM_SRCS
|
||||
shmem_posix.cpp
|
||||
)
|
||||
add_definitions(-DCONFIG_SHMEM=1)
|
||||
set(EXTRA_DEPENDS generate_px4muorb_stubs)
|
||||
endif()
|
||||
|
||||
add_library(px4_layer
|
||||
px4_posix_impl.cpp
|
||||
|
@ -57,7 +46,6 @@ add_library(px4_layer
|
|||
drv_hrt.cpp
|
||||
cpuload.cpp
|
||||
print_load.cpp
|
||||
${SHMEM_SRCS}
|
||||
)
|
||||
target_compile_definitions(px4_layer PRIVATE MODULE_NAME="px4")
|
||||
target_compile_options(px4_layer PRIVATE -Wno-cast-align) # TODO: fix and enable
|
||||
|
|
|
@ -317,15 +317,6 @@ int main(int argc, char **argv)
|
|||
pxh.run_pxh();
|
||||
}
|
||||
|
||||
// When we exit, we need to stop muorb on Snapdragon.
|
||||
|
||||
#ifdef __PX4_POSIX_EAGLE
|
||||
// Sending muorb stop is needed if it is running to exit cleanly.
|
||||
// TODO: we should check with px4_task_is_running("muorb") before stopping it.
|
||||
std::string muorb_stop_cmd("muorb stop");
|
||||
px4_daemon::Pxh::process_line(muorb_stop_cmd, true);
|
||||
#endif
|
||||
|
||||
std::string cmd("shutdown");
|
||||
px4_daemon::Pxh::process_line(cmd, true);
|
||||
|
||||
|
@ -451,10 +442,7 @@ void sig_int_handler(int sig_num)
|
|||
|
||||
void set_cpu_scaling()
|
||||
{
|
||||
#ifdef __PX4_POSIX_EAGLE
|
||||
// On Snapdragon we miss updates in sdlog2 unless all 4 CPUs are run
|
||||
// at the maximum frequency all the time.
|
||||
// Interestingely, cpu0 and cpu3 set the scaling for all 4 CPUs on Snapdragon.
|
||||
#if 0
|
||||
system("echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
|
||||
system("echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor");
|
||||
|
||||
|
|
|
@ -73,19 +73,6 @@ FILE *get_stdout(bool *isatty_)
|
|||
return stdout;
|
||||
}
|
||||
|
||||
#ifdef __PX4_POSIX_EAGLE
|
||||
|
||||
// XXX FIXME: thread_data_ptr is set to 0x1 in the main thread on Snapdragon
|
||||
// even though the pthread_key has been created.
|
||||
// We can catch this using the check below but we have no clue why this happens.
|
||||
if (thread_data_ptr == (void *)0x1) {
|
||||
if (isatty_) { *isatty_ = isatty(1); }
|
||||
|
||||
return stdout;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (thread_data_ptr->thread_stdout == nullptr) {
|
||||
if (isatty_) { *isatty_ = isatty(1); }
|
||||
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015 Vijay Venkatraman. 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 <px4_platform_common/defines.h>
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <systemlib/err.h>
|
||||
#include <errno.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <parameters/param.h>
|
||||
|
||||
#include <px4_platform_common/shmem.h>
|
||||
#include "px4muorb.h"
|
||||
|
||||
//#define SHMEM_DEBUG
|
||||
|
||||
static uint64_t update_from_shmem_prev_time = 0, update_from_shmem_current_time = 0;
|
||||
extern unsigned char *adsp_changed_index;
|
||||
|
||||
struct param_wbuf_s {
|
||||
union param_value_u val;
|
||||
param_t param;
|
||||
bool unsaved;
|
||||
};
|
||||
|
||||
/*update value and param's change bit in shared memory*/
|
||||
void update_to_shmem(param_t param, union param_value_u value)
|
||||
{
|
||||
if (px4muorb_param_update_to_shmem(param, (unsigned char *) &value, sizeof(value))) {
|
||||
PX4_ERR("krait update param %u failed", param);
|
||||
}
|
||||
}
|
||||
|
||||
void update_index_from_shmem(void)
|
||||
{
|
||||
if (!adsp_changed_index) {
|
||||
PX4_ERR("%s no param buffer", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
px4muorb_param_update_index_from_shmem(adsp_changed_index, PARAM_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
static void update_value_from_shmem(param_t param, union param_value_u *value)
|
||||
{
|
||||
if (px4muorb_param_update_value_from_shmem(param, (unsigned char *) value, sizeof(union param_value_u))) {
|
||||
PX4_ERR("%s get param failed", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
int update_from_shmem(param_t param, union param_value_u *value)
|
||||
{
|
||||
unsigned int byte_changed, bit_changed;
|
||||
unsigned int retval = 0;
|
||||
|
||||
if (!adsp_changed_index) {
|
||||
PX4_ERR("%s no param buffer", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
update_from_shmem_current_time = hrt_absolute_time();
|
||||
|
||||
if ((update_from_shmem_current_time - update_from_shmem_prev_time)
|
||||
> 1000000) { //update every 1 second
|
||||
update_from_shmem_prev_time = update_from_shmem_current_time;
|
||||
update_index_from_shmem();
|
||||
}
|
||||
|
||||
byte_changed = param / 8;
|
||||
bit_changed = 1 << param % 8;
|
||||
|
||||
if (adsp_changed_index[byte_changed] & bit_changed) {
|
||||
update_value_from_shmem(param, value);
|
||||
adsp_changed_index[byte_changed] &= ~bit_changed; //clear the bit
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
//else {PX4_INFO("no change to param %s", param_name(param));}
|
||||
|
||||
PX4_DEBUG("%s %d bit on adsp index[%d]",
|
||||
(retval) ? "cleared" : "unchanged", bit_changed, byte_changed);
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
|
||||
px4_add_git_submodule(TARGET git_dspal PATH "${PX4_SOURCE_DIR}/platforms/qurt/dspal")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/platforms/qurt/dspal/cmake_hexagon")
|
||||
include(toolchain/Toolchain-qurt)
|
||||
include(fastrpc)
|
||||
include(qurt_lib)
|
||||
include(qurt_flags)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES)
|
||||
|
||||
px4_qurt_generate_builtin_commands(
|
||||
OUT ${PX4_BINARY_DIR}/apps
|
||||
MODULE_LIST ${module_libraries}
|
||||
)
|
||||
|
||||
FASTRPC_STUB_GEN(px4muorb.idl)
|
||||
|
||||
add_definitions(-D__QAIC_SKEL_EXPORT=__EXPORT)
|
||||
|
||||
# Enable build without HexagonSDK to check link dependencies
|
||||
if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
|
||||
|
||||
add_definitions(-D QURT_EXE_BUILD=1)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${FASTRPC_DSP_INCLUDES}
|
||||
)
|
||||
|
||||
add_executable(px4
|
||||
${PX4_BINARY_DIR}/apps.cpp
|
||||
${PX4_BINARY_DIR}/platforms/qurt/px4muorb_skel.c
|
||||
)
|
||||
|
||||
target_link_libraries(px4 PRIVATE ${module_libraries})
|
||||
|
||||
else()
|
||||
# Generate the DSP lib and stubs but not the apps side executable
|
||||
# The Apps side executable is generated via the posix_eagle_xxxx target
|
||||
QURT_LIB(LIB_NAME px4
|
||||
IDL_NAME px4muorb
|
||||
SOURCES
|
||||
${PX4_BINARY_DIR}/apps.cpp
|
||||
LINK_LIBS
|
||||
modules__muorb__adsp
|
||||
${module_libraries}
|
||||
m
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# board defined upload helper
|
||||
if(EXISTS "${PX4_BOARD_DIR}/cmake/upload.cmake")
|
||||
include(${PX4_BOARD_DIR}/cmake/upload.cmake)
|
||||
endif()
|
|
@ -1,188 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# Defined functions in this file
|
||||
#
|
||||
# OS Specific Functions
|
||||
#
|
||||
# * px4_qurt_add_firmware
|
||||
# * px4_qurt_generate_builtin_commands
|
||||
# * px4_qurt_add_export
|
||||
# * px4_qurt_generate_romfs
|
||||
#
|
||||
# Required OS Inteface Functions
|
||||
#
|
||||
# * px4_os_add_flags
|
||||
# * px4_os_determine_build_chip
|
||||
# * px4_os_prebuild_targets
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_qurt_generate_builtin_commands
|
||||
#
|
||||
# This function generates the builtin_commands.c src for qurt
|
||||
#
|
||||
# Usage:
|
||||
# px4_qurt_generate_builtin_commands(
|
||||
# MODULE_LIST <in-list>
|
||||
# OUT <file>)
|
||||
#
|
||||
# Input:
|
||||
# MODULE_LIST : list of modules
|
||||
#
|
||||
# Output:
|
||||
# OUT : stem of generated apps.cpp/apps.h ("apps").
|
||||
#
|
||||
# Example:
|
||||
# px4_qurt_generate_builtin_commands(
|
||||
# OUT <generated-src> MODULE_LIST px4_simple_app)
|
||||
#
|
||||
function(px4_qurt_generate_builtin_commands)
|
||||
px4_parse_function_args(
|
||||
NAME px4_qurt_generate_builtin_commands
|
||||
ONE_VALUE OUT
|
||||
MULTI_VALUE MODULE_LIST
|
||||
REQUIRED MODULE_LIST OUT
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(builtin_apps_string)
|
||||
set(builtin_apps_decl_string)
|
||||
set(command_count 0)
|
||||
foreach(module ${MODULE_LIST})
|
||||
foreach(property MAIN STACK_MAIN PRIORITY)
|
||||
get_target_property(${property} ${module} ${property})
|
||||
endforeach()
|
||||
if (MAIN)
|
||||
set(builtin_apps_string
|
||||
"${builtin_apps_string}\tapps[\"${MAIN}\"] = ${MAIN}_main;\n")
|
||||
set(builtin_apps_decl_string
|
||||
"${builtin_apps_decl_string}int ${MAIN}_main(int argc, char *argv[]);\n")
|
||||
math(EXPR command_count "${command_count}+1")
|
||||
endif()
|
||||
endforeach()
|
||||
configure_file(${PX4_SOURCE_DIR}/platforms/common/apps.cpp.in ${OUT}.cpp)
|
||||
configure_file(${PX4_SOURCE_DIR}/platforms/common/apps.h.in ${OUT}.h)
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_os_add_flags
|
||||
#
|
||||
# Set the qurt build flags.
|
||||
#
|
||||
# Usage:
|
||||
# px4_os_add_flags()
|
||||
#
|
||||
function(px4_os_add_flags)
|
||||
|
||||
set(DSPAL_ROOT platforms/qurt/dspal)
|
||||
include_directories(
|
||||
${DSPAL_ROOT}/include
|
||||
${DSPAL_ROOT}/sys
|
||||
${DSPAL_ROOT}/sys/sys
|
||||
|
||||
platforms/posix/include
|
||||
platforms/qurt/include
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-D__PX4_POSIX
|
||||
-D__PX4_QURT
|
||||
)
|
||||
|
||||
add_compile_options(
|
||||
-fPIC
|
||||
-fmath-errno
|
||||
|
||||
-Wno-unknown-warning-option
|
||||
-Wno-cast-align
|
||||
)
|
||||
|
||||
# Clear -rdynamic flag which fails for hexagon
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
|
||||
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_os_determine_build_chip
|
||||
#
|
||||
# Sets PX4_CHIP and PX4_CHIP_MANUFACTURER.
|
||||
#
|
||||
# Usage:
|
||||
# px4_os_determine_build_chip()
|
||||
#
|
||||
function(px4_os_determine_build_chip)
|
||||
|
||||
# always use generic chip and chip manufacturer
|
||||
set(PX4_CHIP "generic" CACHE STRING "PX4 Chip" FORCE)
|
||||
set(PX4_CHIP_MANUFACTURER "generic" CACHE STRING "PX4 Chip Manufacturer" FORCE)
|
||||
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_os_prebuild_targets
|
||||
#
|
||||
# This function generates os dependent targets
|
||||
#
|
||||
# Usage:
|
||||
# px4_os_prebuild_targets(
|
||||
# OUT <out-list_of_targets>
|
||||
# BOARD <in-string>
|
||||
# )
|
||||
#
|
||||
# Input:
|
||||
# BOARD : board
|
||||
#
|
||||
# Output:
|
||||
# OUT : the target list
|
||||
#
|
||||
# Example:
|
||||
# px4_os_prebuild_targets(OUT target_list BOARD px4_fmu-v2)
|
||||
#
|
||||
function(px4_os_prebuild_targets)
|
||||
px4_parse_function_args(
|
||||
NAME px4_os_prebuild_targets
|
||||
ONE_VALUE OUT BOARD
|
||||
REQUIRED OUT
|
||||
ARGN ${ARGN})
|
||||
|
||||
add_library(prebuild_targets INTERFACE)
|
||||
add_dependencies(prebuild_targets DEPENDS uorb_headers)
|
||||
|
||||
endfunction()
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 0322a4e345e48ea28cb1cee14a33033cdaf0b16a
|
|
@ -1,83 +0,0 @@
|
|||
/****************************************************************************
|
||||
* include/crc.h
|
||||
*
|
||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 NuttX 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_CRC32_H
|
||||
#define __INCLUDE_CRC32_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: crc32part
|
||||
*
|
||||
* Description:
|
||||
* Continue CRC calculation on a part of the buffer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN uint32_t crc32part(const uint8_t *src, size_t len,
|
||||
uint32_t crc32val);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: crc32
|
||||
*
|
||||
* Description:
|
||||
* Return a 32-bit CRC of the contents of the 'src' buffer, length 'len'
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN uint32_t crc32(const uint8_t *src, size_t len);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_CRC32_H */
|
|
@ -1,65 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* 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 <px4_platform_common/log.h>
|
||||
#include <semaphore.h>
|
||||
#include <px4_platform_common/workqueue.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern sem_t _hrt_work_lock;
|
||||
extern struct wqueue_s g_hrt_work;
|
||||
|
||||
void hrt_work_queue_init(void);
|
||||
int hrt_work_queue(struct work_s *work, worker_t worker, void *arg, uint32_t usdelay);
|
||||
void hrt_work_cancel(struct work_s *work);
|
||||
|
||||
static inline void hrt_work_lock(void);
|
||||
static inline void hrt_work_unlock(void);
|
||||
|
||||
static inline void hrt_work_lock()
|
||||
{
|
||||
//PX4_INFO("hrt_work_lock");
|
||||
sem_wait(&_hrt_work_lock);
|
||||
}
|
||||
|
||||
static inline void hrt_work_unlock()
|
||||
{
|
||||
//PX4_INFO("hrt_work_unlock");
|
||||
sem_post(&_hrt_work_lock);
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
|
|
@ -1,134 +0,0 @@
|
|||
/************************************************************************
|
||||
* include/queue.h
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 NuttX 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_QUEUE_H
|
||||
#define __INCLUDE_QUEUE_H
|
||||
|
||||
/************************************************************************
|
||||
* Included Files
|
||||
************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef> // NULL
|
||||
#else
|
||||
#include <stddef.h> // NULL
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************/
|
||||
|
||||
#define sq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0)
|
||||
#define dq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0)
|
||||
|
||||
#define sq_next(p) ((p)->flink)
|
||||
#define dq_next(p) ((p)->flink)
|
||||
#define dq_prev(p) ((p)->blink)
|
||||
|
||||
#define sq_empty(q) ((q)->head == NULL)
|
||||
#define dq_empty(q) ((q)->head == NULL)
|
||||
|
||||
#define sq_peek(q) ((q)->head)
|
||||
#define dq_peek(q) ((q)->head)
|
||||
|
||||
// Required for Linux
|
||||
#define FAR
|
||||
|
||||
/************************************************************************
|
||||
* Global Type Declarations
|
||||
************************************************************************/
|
||||
|
||||
struct sq_entry_s {
|
||||
FAR struct sq_entry_s *flink;
|
||||
};
|
||||
typedef struct sq_entry_s sq_entry_t;
|
||||
|
||||
struct dq_entry_s {
|
||||
FAR struct dq_entry_s *flink;
|
||||
FAR struct dq_entry_s *blink;
|
||||
};
|
||||
typedef struct dq_entry_s dq_entry_t;
|
||||
|
||||
struct sq_queue_s {
|
||||
FAR sq_entry_t *head;
|
||||
FAR sq_entry_t *tail;
|
||||
};
|
||||
typedef struct sq_queue_s sq_queue_t;
|
||||
|
||||
struct dq_queue_s {
|
||||
FAR dq_entry_t *head;
|
||||
FAR dq_entry_t *tail;
|
||||
};
|
||||
typedef struct dq_queue_s dq_queue_t;
|
||||
|
||||
/************************************************************************
|
||||
* Global Function Prototypes
|
||||
************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN void sq_addfirst(FAR sq_entry_t *node, sq_queue_t *queue);
|
||||
EXTERN void dq_addfirst(FAR dq_entry_t *node, dq_queue_t *queue);
|
||||
EXTERN void sq_addlast(FAR sq_entry_t *node, sq_queue_t *queue);
|
||||
EXTERN void dq_addlast(FAR dq_entry_t *node, dq_queue_t *queue);
|
||||
EXTERN void sq_addafter(FAR sq_entry_t *prev, FAR sq_entry_t *node,
|
||||
sq_queue_t *queue);
|
||||
EXTERN void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node,
|
||||
dq_queue_t *queue);
|
||||
EXTERN void dq_addbefore(FAR dq_entry_t *next, FAR dq_entry_t *node,
|
||||
dq_queue_t *queue);
|
||||
|
||||
EXTERN FAR sq_entry_t *sq_remafter(FAR sq_entry_t *node, sq_queue_t *queue);
|
||||
EXTERN void sq_rem(FAR sq_entry_t *node, sq_queue_t *queue);
|
||||
EXTERN void dq_rem(FAR dq_entry_t *node, dq_queue_t *queue);
|
||||
EXTERN FAR sq_entry_t *sq_remlast(sq_queue_t *queue);
|
||||
EXTERN FAR dq_entry_t *dq_remlast(dq_queue_t *queue);
|
||||
EXTERN FAR sq_entry_t *sq_remfirst(sq_queue_t *queue);
|
||||
EXTERN FAR dq_entry_t *dq_remfirst(dq_queue_t *queue);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_QUEUE_H_ */
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
__EXPORT extern uint64_t hrt_absolute_time(void);
|
||||
|
||||
//void qurt_log(int level, const char *file, int line, const char *format, ...);
|
||||
|
||||
// declaration to make the compiler happy. This symbol is part of the adsp static image.
|
||||
void HAP_debug(const char *msg, int level, const char *filename, int line);
|
||||
|
||||
#ifndef qurt_log_defined
|
||||
#define qurt_log_defined
|
||||
static __inline void qurt_log(int level, const char *file, int line,
|
||||
const char *format, ...)
|
||||
{
|
||||
char buf[256];
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
va_end(args);
|
||||
HAP_debug(buf, level, file, line);
|
||||
}
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
|
@ -1,184 +0,0 @@
|
|||
//=======================================================================
|
||||
// Copyright (c) 2016, 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:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * 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.
|
||||
// * Neither the name of The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
// 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 "AEEStdDef.idl"
|
||||
|
||||
interface px4muorb{
|
||||
|
||||
/**
|
||||
* interface method to start the uorb service and initialize the muorb
|
||||
*/
|
||||
AEEResult orb_initialize();
|
||||
|
||||
/**
|
||||
* Interface to set an offset to hrt_absolute_time on the DSP.
|
||||
*
|
||||
* @param time_diff_us: time difference of the DSP clock to Linux clock.
|
||||
* A positive number means the Linux clock is ahead of the DSP one.
|
||||
*/
|
||||
AEEResult set_absolute_time_offset( in long time_diff_us );
|
||||
|
||||
/**
|
||||
* Interface to request hrt_absolute_time on the DSP.
|
||||
* @param time_us: pointer to time in us
|
||||
*/
|
||||
AEEResult get_absolute_time(rout unsigned long long time_us);
|
||||
|
||||
/**
|
||||
* Interface to update param for krait.
|
||||
*
|
||||
* @param param: param index.
|
||||
* @param value: param value.
|
||||
*/
|
||||
AEEResult param_update_to_shmem( in unsigned long param, in sequence<octet> value);
|
||||
|
||||
/**
|
||||
* Interface to update index for krait.
|
||||
* @param data: param index array.
|
||||
*/
|
||||
AEEResult param_update_index_from_shmem( rout sequence<octet> data);
|
||||
|
||||
/**
|
||||
* Interface to get param value for krait.
|
||||
*
|
||||
* @param param: param index.
|
||||
* @param value: param value.
|
||||
*/
|
||||
AEEResult param_update_value_from_shmem( in unsigned long param, rout sequence<octet> value);
|
||||
|
||||
/**
|
||||
* Interface called from krait to inform of a published topic.
|
||||
* @param topic_name: name of the topic being advertised
|
||||
*/
|
||||
AEEResult topic_advertised(in string topic_name);
|
||||
|
||||
/**
|
||||
* Interface called from krait to inform of a published topic.
|
||||
* @param topic_name: name of the topic being advertised
|
||||
*/
|
||||
AEEResult topic_unadvertised(in string topic_name);
|
||||
|
||||
/**
|
||||
* Interface to add a subscriber to the identified topic
|
||||
* @param topic_name
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult add_subscriber( in string topic_name );
|
||||
|
||||
/**
|
||||
* Interface to remove a subscriber for the identified topic.
|
||||
* @param topic_name
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult remove_subscriber( in string topic_name );
|
||||
|
||||
/**
|
||||
* Interface called from krait for topic data.
|
||||
* @param topic_name
|
||||
* @param data
|
||||
* a sequence of bytes for the passed data stream.
|
||||
* as per the HExagon Documention, the max size of this stream is 255 bytes.
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult send_topic_data( in string topic_name, in sequence<octet> data );
|
||||
|
||||
/**
|
||||
* Inteface to check if there are subscribers on the remote adsp client
|
||||
* This inteface is required as the krait app can be restarted without adsp
|
||||
* being re-started. In this scenario the krait app does not know if there
|
||||
* is subscriber on the remote end(ie adsp).
|
||||
* @param topic_name
|
||||
* The name of the topic for which the subscription needs to be checked.
|
||||
* @param rout int status
|
||||
* The status of the subscription, 0=no-subscribers, 1 = more than one subscriber.
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult is_subscriber_present( in string topic_name, rout long status );
|
||||
|
||||
/**
|
||||
* Interface to receive data from adsp. Since there is only one interface, the different message
|
||||
* types are identified by the msg_type field.
|
||||
* @param msg_type
|
||||
* The possible values are:
|
||||
* 1 ==> add_subscriber
|
||||
* 2 ==> remove_subscriber
|
||||
* 3 ==> recieve_topic_data
|
||||
* 4 ==> advertised_topic
|
||||
* @note: for message types, 1 & 2, the data pointer returned is null with length of 0.
|
||||
* @param topic_name
|
||||
* The topic being returned.
|
||||
* @param data
|
||||
* the data stream
|
||||
* @param bytes_returned
|
||||
* The number of bytes returned in the byte buffer.
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult receive_msg( rout long msg_type, rout string topic_name, rout sequence<octet> data, rout long bytes_returned );
|
||||
|
||||
/**
|
||||
* Since the receive_msg is a blocking call, the client will not be able to peform a clean shutdown. Calling this
|
||||
* function will unblock the receive msg an return an error code.
|
||||
* Ideally this should be implemented as a timeout for the #receive_msg call.
|
||||
* @param none
|
||||
* @return status
|
||||
* 0 = success
|
||||
* all others is a failure.
|
||||
**/
|
||||
AEEResult unblock_recieve_msg();
|
||||
|
||||
/**
|
||||
* This interface will perform a bulk read from the adsp and return the data buffer.
|
||||
* The structure of the messages is as follows
|
||||
* +----------------+-----------+---------------+----------+----------------+
|
||||
* | Topic Name Len | datal_len |TopicName(nullterminated) | data bytes |
|
||||
* +----------------+-----------+---------------+----------+----------------+
|
||||
* |<-- 2 bytes -->|<-2bytes-> |<-- topicnamelen bytes -->|<-datalenbytes->|
|
||||
* +----------------+---------------------------+----------+----------------+
|
||||
* @param data
|
||||
* The output buffer where the data needs to be copied
|
||||
* @param bytes_returned
|
||||
* The number of bytes the buffer is filled up by.
|
||||
* @param topic_count
|
||||
* The numbe of topics filled in the buffer.
|
||||
* @return status
|
||||
* 0 = success
|
||||
* all others is a failure.
|
||||
**/
|
||||
AEEResult receive_bulk_data( rout sequence<octet> data, rout long bytes_returned, rout long topic_count );
|
||||
};
|
|
@ -1,37 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2019 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add_subdirectory(common)
|
||||
|
||||
add_subdirectory(${PX4_CHIP_MANUFACTURER})
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon")
|
||||
include(hexagon_sdk)
|
||||
|
||||
include_directories(${HEXAGON_8074_INCLUDES})
|
||||
|
||||
set(QURT_LAYER_SRCS
|
||||
px4_qurt_impl.cpp
|
||||
tasks.cpp
|
||||
lib_crc32.c
|
||||
drv_hrt.cpp
|
||||
qurt_stubs.c
|
||||
main.cpp
|
||||
shmem_qurt.cpp
|
||||
px4_init.cpp
|
||||
)
|
||||
|
||||
if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
|
||||
list(APPEND QURT_LAYER_SRCS
|
||||
stubs/posix.c
|
||||
stubs/qurt.c
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(px4_layer
|
||||
${QURT_LAYER_SRCS}
|
||||
${CONFIG_SRC}
|
||||
)
|
||||
target_link_libraries(px4_layer PRIVATE work_queue)
|
||||
add_dependencies(px4_layer uorb_msgs) # dataman requires mission
|
|
@ -1,107 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/**
|
||||
* @file commands_muorb_test.c
|
||||
* Commands to run for the "qurt_muorb_test" config
|
||||
*
|
||||
* @author Mark Charlebois <charlebm@gmail.com>
|
||||
*/
|
||||
|
||||
const char *get_commands(void);
|
||||
const char *get_commands()
|
||||
{
|
||||
|
||||
static const char *commands =
|
||||
"param set CAL_GYRO0_ID 2293760\n"
|
||||
"param set CAL_ACC0_ID 1310720\n"
|
||||
"param set CAL_ACC1_ID 1376256\n"
|
||||
"param set CAL_MAG0_ID 196608\n"
|
||||
// "rgbled start\n"
|
||||
// "tone_alarm start\n"
|
||||
"rc_update start\n"
|
||||
"commander start --hil\n"
|
||||
"sensors start\n"
|
||||
"ekf2 start\n"
|
||||
"mc_hover_thrust_estimator start\n"
|
||||
"flight_mode_manager start\n"
|
||||
"mc_pos_control start\n"
|
||||
"mc_att_control start\n"
|
||||
"mc_rate_control start\n"
|
||||
"sleep 1\n"
|
||||
"pwm_out_sim start\n"
|
||||
"param set RC1_MAX 2015\n"
|
||||
"param set RC1_MIN 996\n"
|
||||
"param set RC1_TRIM 1502\n"
|
||||
"param set RC1_REV -1\n"
|
||||
"param set RC2_MAX 2016 \n"
|
||||
"param set RC2_MIN 995\n"
|
||||
"param set RC2_TRIM 1500\n"
|
||||
"param set RC3_MAX 2003\n"
|
||||
"param set RC3_MIN 992\n"
|
||||
"param set RC3_TRIM 992\n"
|
||||
"param set RC4_MAX 2011\n"
|
||||
"param set RC4_MIN 997\n"
|
||||
"param set RC4_TRIM 1504\n"
|
||||
"param set RC4_REV -1\n"
|
||||
"param set RC6_MAX 2016\n"
|
||||
"param set RC6_MIN 992\n"
|
||||
"param set RC6_TRIM 1504\n"
|
||||
"param set RC_CHAN_CNT 8\n"
|
||||
"param set RC_MAP_MODE_SW 5\n"
|
||||
"param set RC_MAP_POSCTL_SW 7\n"
|
||||
"param set RC_MAP_RETURN_SW 8\n"
|
||||
"param set MC_YAW_P 1.5\n"
|
||||
"param set MC_PITCH_P 3.0\n"
|
||||
"param set MC_ROLL_P 3.0\n"
|
||||
"param set MC_YAWRATE_P 0.2\n"
|
||||
"param set MC_PITCHRATE_P 0.03\n"
|
||||
"param set MC_ROLLRATE_P 0.03\n"
|
||||
"param set ATT_W_ACC 0.0002\n"
|
||||
"param set ATT_W_MAG 0.002\n"
|
||||
"param set ATT_W_GYRO_BIAS 0.05\n"
|
||||
"sleep 1\n"
|
||||
|
||||
|
||||
"param set MAV_TYPE 2\n"
|
||||
"mixer load /dev/pwm_output0 /startup/quad_x.main.mix\n"
|
||||
"list_files\n"
|
||||
"list_tasks\n"
|
||||
"sleep 10\n"
|
||||
"list_tasks\n"
|
||||
"sleep 10\n"
|
||||
|
||||
;
|
||||
|
||||
return commands;
|
||||
|
||||
}
|
|
@ -1,477 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2012 - 2018 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 drv_hrt.cpp
|
||||
*
|
||||
* High-resolution timer with callouts and timekeeping.
|
||||
*/
|
||||
|
||||
#include <px4_platform_common/time.h>
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
#include <px4_platform_common/workqueue.h>
|
||||
#include <px4_platform_common/tasks.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
#include <semaphore.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "hrt_work.h"
|
||||
|
||||
// Intervals in usec
|
||||
static constexpr unsigned HRT_INTERVAL_MIN = 50;
|
||||
static constexpr unsigned HRT_INTERVAL_MAX = 50000000;
|
||||
|
||||
/*
|
||||
* Queue of callout entries.
|
||||
*/
|
||||
static struct sq_queue_s callout_queue;
|
||||
|
||||
/* latency baseline (last compare value applied) */
|
||||
static uint64_t latency_baseline;
|
||||
|
||||
/* timer count at interrupt (for latency purposes) */
|
||||
static uint64_t latency_actual;
|
||||
|
||||
/* latency histogram */
|
||||
const uint16_t latency_bucket_count = LATENCY_BUCKET_COUNT;
|
||||
const uint16_t latency_buckets[LATENCY_BUCKET_COUNT] = { 1, 2, 5, 10, 20, 50, 100, 1000 };
|
||||
__EXPORT uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
||||
|
||||
static px4_sem_t _hrt_lock;
|
||||
static struct work_s _hrt_work;
|
||||
|
||||
static int32_t dsp_offset = 0;
|
||||
|
||||
static void hrt_latency_update();
|
||||
|
||||
static void hrt_call_reschedule();
|
||||
static void hrt_call_invoke();
|
||||
|
||||
hrt_abstime hrt_absolute_time_offset()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hrt_lock()
|
||||
{
|
||||
px4_sem_wait(&_hrt_lock);
|
||||
}
|
||||
|
||||
static void hrt_unlock()
|
||||
{
|
||||
px4_sem_post(&_hrt_lock);
|
||||
}
|
||||
|
||||
#include "dspal_time.h"
|
||||
|
||||
int px4_clock_settime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
/* do nothing right now */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
return clock_gettime(clk_id, tp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get absolute time.
|
||||
*/
|
||||
hrt_abstime hrt_absolute_time()
|
||||
{
|
||||
struct timespec ts;
|
||||
px4_clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return ts_to_abstime(&ts) + dsp_offset;
|
||||
}
|
||||
|
||||
int hrt_set_absolute_time_offset(int32_t time_diff_us)
|
||||
{
|
||||
dsp_offset = time_diff_us;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a timespec to absolute time.
|
||||
*/
|
||||
hrt_abstime ts_to_abstime(const struct timespec *ts)
|
||||
{
|
||||
hrt_abstime result;
|
||||
|
||||
result = (hrt_abstime)(ts->tv_sec) * 1000000;
|
||||
result += ts->tv_nsec / 1000;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the delta between a timestamp taken in the past
|
||||
* and now.
|
||||
*
|
||||
* This function is safe to use even if the timestamp is updated
|
||||
* by an interrupt during execution.
|
||||
*/
|
||||
hrt_abstime hrt_elapsed_time_atomic(const volatile hrt_abstime *then)
|
||||
{
|
||||
// This is not atomic as the value on the application layer of POSIX is limited.
|
||||
hrt_abstime delta = hrt_absolute_time() - *then;
|
||||
return delta;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store the absolute time in an interrupt-safe fashion.
|
||||
*
|
||||
* This function ensures that the timestamp cannot be seen half-written by an interrupt handler.
|
||||
*/
|
||||
void hrt_store_absolute_time(volatile hrt_abstime *t)
|
||||
{
|
||||
*t = hrt_absolute_time();
|
||||
}
|
||||
|
||||
/*
|
||||
* If this returns true, the entry has been invoked and removed from the callout list,
|
||||
* or it has never been entered.
|
||||
*
|
||||
* Always returns false for repeating callouts.
|
||||
*/
|
||||
bool hrt_called(struct hrt_call *entry)
|
||||
{
|
||||
return (entry->deadline == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the entry from the callout list.
|
||||
*/
|
||||
void hrt_cancel(struct hrt_call *entry)
|
||||
{
|
||||
hrt_lock();
|
||||
sq_rem(&entry->link, &callout_queue);
|
||||
entry->deadline = 0;
|
||||
|
||||
/* if this is a periodic call being removed by the callout, prevent it from
|
||||
* being re-entered when the callout returns.
|
||||
*/
|
||||
entry->period = 0;
|
||||
hrt_unlock();
|
||||
// endif
|
||||
}
|
||||
|
||||
static void hrt_latency_update()
|
||||
{
|
||||
uint16_t latency = latency_actual - latency_baseline;
|
||||
unsigned index;
|
||||
|
||||
/* bounded buckets */
|
||||
for (index = 0; index < LATENCY_BUCKET_COUNT; index++) {
|
||||
if (latency <= latency_buckets[index]) {
|
||||
latency_counters[index]++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* catch-all at the end */
|
||||
latency_counters[index]++;
|
||||
}
|
||||
|
||||
/*
|
||||
* initialise a hrt_call structure
|
||||
*/
|
||||
void hrt_call_init(struct hrt_call *entry)
|
||||
{
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
}
|
||||
|
||||
/*
|
||||
* delay a hrt_call_every() periodic call by the given number of
|
||||
* microseconds. This should be called from within the callout to
|
||||
* cause the callout to be re-scheduled for a later time. The periodic
|
||||
* callouts will then continue from that new base time at the
|
||||
* previously specified period.
|
||||
*/
|
||||
void hrt_call_delay(struct hrt_call *entry, hrt_abstime delay)
|
||||
{
|
||||
entry->deadline = hrt_absolute_time() + delay;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise the HRT.
|
||||
*/
|
||||
void hrt_init()
|
||||
{
|
||||
sq_init(&callout_queue);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
static void
|
||||
hrt_call_enter(struct hrt_call *entry)
|
||||
{
|
||||
struct hrt_call *call, *next;
|
||||
|
||||
call = (struct hrt_call *)sq_peek(&callout_queue);
|
||||
|
||||
if ((call == nullptr) || (entry->deadline < call->deadline)) {
|
||||
sq_addfirst(&entry->link, &callout_queue);
|
||||
//if (call != nullptr) PX4_INFO("call enter at head, reschedule (%lu %lu)", entry->deadline, call->deadline);
|
||||
/* we changed the next deadline, reschedule the timer event */
|
||||
hrt_call_reschedule();
|
||||
|
||||
} else {
|
||||
do {
|
||||
next = (struct hrt_call *)sq_next(&call->link);
|
||||
|
||||
if ((next == nullptr) || (entry->deadline < next->deadline)) {
|
||||
//lldbg("call enter after head\n");
|
||||
sq_addafter(&call->link, &entry->link, &callout_queue);
|
||||
break;
|
||||
}
|
||||
} while ((call = next) != nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Timer interrupt handler
|
||||
*
|
||||
* This routine simulates a timer interrupt handler
|
||||
*/
|
||||
static void
|
||||
hrt_tim_isr(void *p)
|
||||
{
|
||||
/* grab the timer for latency tracking purposes */
|
||||
latency_actual = hrt_absolute_time();
|
||||
|
||||
/* do latency calculations */
|
||||
hrt_latency_update();
|
||||
|
||||
/* run any callouts that have met their deadline */
|
||||
hrt_call_invoke();
|
||||
|
||||
hrt_lock();
|
||||
|
||||
/* and schedule the next interrupt */
|
||||
hrt_call_reschedule();
|
||||
|
||||
hrt_unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reschedule the next timer interrupt.
|
||||
*
|
||||
* This routine must be called with interrupts disabled.
|
||||
*/
|
||||
static void
|
||||
hrt_call_reschedule()
|
||||
{
|
||||
hrt_abstime now = hrt_absolute_time();
|
||||
hrt_abstime delay = HRT_INTERVAL_MAX;
|
||||
struct hrt_call *next = (struct hrt_call *)sq_peek(&callout_queue);
|
||||
hrt_abstime deadline = now + HRT_INTERVAL_MAX;
|
||||
|
||||
/*
|
||||
* Determine what the next deadline will be.
|
||||
*
|
||||
* Note that we ensure that this will be within the counter
|
||||
* period, so that when we truncate all but the low 16 bits
|
||||
* the next time the compare matches it will be the deadline
|
||||
* we want.
|
||||
*
|
||||
* It is important for accurate timekeeping that the compare
|
||||
* interrupt fires sufficiently often that the base_time update in
|
||||
* hrt_absolute_time runs at least once per timer period.
|
||||
*/
|
||||
if (next != nullptr) {
|
||||
//lldbg("entry in queue\n");
|
||||
if (next->deadline <= (now + HRT_INTERVAL_MIN)) {
|
||||
//lldbg("pre-expired\n");
|
||||
/* set a minimal deadline so that we call ASAP */
|
||||
delay = HRT_INTERVAL_MIN;
|
||||
|
||||
} else if (next->deadline < deadline) {
|
||||
//lldbg("due soon\n");
|
||||
delay = next->deadline - now;
|
||||
}
|
||||
}
|
||||
|
||||
/* set the new compare value and remember it for latency tracking */
|
||||
latency_baseline = now + delay;
|
||||
|
||||
// There is no timer ISR, so simulate one by putting an event on the
|
||||
// high priority work queue
|
||||
|
||||
// Remove the existing expiry and update with the new expiry
|
||||
hrt_work_cancel(&_hrt_work);
|
||||
|
||||
hrt_work_queue(&_hrt_work, (worker_t)&hrt_tim_isr, nullptr, delay);
|
||||
}
|
||||
|
||||
static void
|
||||
hrt_call_internal(struct hrt_call *entry, hrt_abstime deadline, hrt_abstime interval, hrt_callout callout, void *arg)
|
||||
{
|
||||
PX4_DEBUG("hrt_call_internal deadline=%lu interval = %lu", deadline, interval);
|
||||
hrt_lock();
|
||||
|
||||
//PX4_INFO("hrt_call_internal after lock");
|
||||
/* if the entry is currently queued, remove it */
|
||||
/* note that we are using a potentially uninitialised
|
||||
entry->link here, but it is safe as sq_rem() doesn't
|
||||
dereference the passed node unless it is found in the
|
||||
list. So we potentially waste a bit of time searching the
|
||||
queue for the uninitialised entry->link but we don't do
|
||||
anything actually unsafe.
|
||||
*/
|
||||
if (entry->deadline != 0) {
|
||||
sq_rem(&entry->link, &callout_queue);
|
||||
}
|
||||
|
||||
entry->deadline = deadline;
|
||||
entry->period = interval;
|
||||
entry->callout = callout;
|
||||
entry->arg = arg;
|
||||
|
||||
hrt_call_enter(entry);
|
||||
hrt_unlock();
|
||||
}
|
||||
|
||||
/*
|
||||
* Call callout(arg) after delay has elapsed.
|
||||
*
|
||||
* If callout is nullptr, this can be used to implement a timeout by testing the call
|
||||
* with hrt_called().
|
||||
*/
|
||||
void hrt_call_after(struct hrt_call *entry, hrt_abstime delay, hrt_callout callout, void *arg)
|
||||
{
|
||||
//printf("hrt_call_after\n");
|
||||
hrt_call_internal(entry,
|
||||
hrt_absolute_time() + delay,
|
||||
0,
|
||||
callout,
|
||||
arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Call callout(arg) after delay, and then after every interval.
|
||||
*
|
||||
* Note thet the interval is timed between scheduled, not actual, call times, so the call rate may
|
||||
* jitter but should not drift.
|
||||
*/
|
||||
void hrt_call_every(struct hrt_call *entry, hrt_abstime delay, hrt_abstime interval, hrt_callout callout, void *arg)
|
||||
{
|
||||
hrt_call_internal(entry,
|
||||
hrt_absolute_time() + delay,
|
||||
interval,
|
||||
callout,
|
||||
arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Call callout(arg) at absolute time calltime.
|
||||
*/
|
||||
void hrt_call_at(struct hrt_call *entry, hrt_abstime calltime, hrt_callout callout, void *arg)
|
||||
{
|
||||
hrt_call_internal(entry, calltime, 0, callout, arg);
|
||||
}
|
||||
|
||||
static void
|
||||
hrt_call_invoke()
|
||||
{
|
||||
struct hrt_call *call;
|
||||
hrt_abstime deadline;
|
||||
|
||||
hrt_lock();
|
||||
|
||||
while (true) {
|
||||
/* get the current time */
|
||||
hrt_abstime now = hrt_absolute_time();
|
||||
|
||||
call = (struct hrt_call *)sq_peek(&callout_queue);
|
||||
|
||||
if (call == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (call->deadline > now) {
|
||||
break;
|
||||
}
|
||||
|
||||
sq_rem(&call->link, &callout_queue);
|
||||
//PX4_INFO("call pop");
|
||||
|
||||
/* save the intended deadline for periodic calls */
|
||||
deadline = call->deadline;
|
||||
|
||||
/* zero the deadline, as the call has occurred */
|
||||
call->deadline = 0;
|
||||
|
||||
/* invoke the callout (if there is one) */
|
||||
if (call->callout) {
|
||||
// Unlock so we don't deadlock in callback
|
||||
hrt_unlock();
|
||||
|
||||
//PX4_INFO("call %p: %p(%p)", call, call->callout, call->arg);
|
||||
call->callout(call->arg);
|
||||
|
||||
hrt_lock();
|
||||
}
|
||||
|
||||
/* if the callout has a non-zero period, it has to be re-entered */
|
||||
if (call->period != 0) {
|
||||
// re-check call->deadline to allow for
|
||||
// callouts to re-schedule themselves
|
||||
// using hrt_call_delay()
|
||||
if (call->deadline <= now) {
|
||||
call->deadline = deadline + call->period;
|
||||
//PX4_INFO("call deadline set to %lu now=%lu", call->deadline, now);
|
||||
}
|
||||
|
||||
hrt_call_enter(call);
|
||||
}
|
||||
}
|
||||
|
||||
hrt_unlock();
|
||||
}
|
||||
|
||||
void abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
|
||||
{
|
||||
ts->tv_sec = abstime / 1000000;
|
||||
abstime -= ts->tv_sec * 1000000;
|
||||
ts->tv_nsec = abstime * 1000;
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/****************************************************************************
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/**
|
||||
* @file get_commands.cpp
|
||||
* functions to call to run the set of startup commands
|
||||
*
|
||||
* @author Mark Charlebois <charlebm@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
__BEGIN_DECLS
|
||||
// The commands to run are specified in a target file: commands_<target>.c
|
||||
extern const char *get_commands(void);
|
||||
|
||||
// Enable external library hook
|
||||
void qurt_external_hook(void) __attribute__((weak));
|
||||
__END_DECLS
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2019 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <px4_platform/micro_hal.h>
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
/************************************************************************************************
|
||||
* libc/misc/lib_crc32.c
|
||||
*
|
||||
* This file is a part of NuttX:
|
||||
*
|
||||
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
||||
*
|
||||
* The logic in this file was developed by Gary S. Brown:
|
||||
*
|
||||
* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or code or tables
|
||||
* extracted from it, as desired without restriction.
|
||||
*
|
||||
* First, the polynomial itself and its table of feedback terms. The polynomial is:
|
||||
*
|
||||
* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
|
||||
*
|
||||
* Note that we take it "backwards" and put the highest-order term in the lowest-order bit.
|
||||
* The X^32 term is "implied"; the LSB is the X^31 term, etc. The X^0 term (usually shown
|
||||
* as "+1") results in the MSB being 1
|
||||
*
|
||||
* Note that the usual hardware shift register implementation, which is what we're using
|
||||
* (we're merely optimizing it by doing eight-bit chunks at a time) shifts bits into the
|
||||
* lowest-order term. In our implementation, that means shifting towards the right. Why
|
||||
* do we do it this way? Because the calculated CRC must be transmitted in order from
|
||||
* highest-order term to lowest-order term. UARTs transmit characters in order from LSB
|
||||
* to MSB. By storing the CRC this way we hand it to the UART in the order low-byte to
|
||||
* high-byte; the UART sends each low-bit to hight-bit; and the result is transmission bit
|
||||
* by bit from highest- to lowest-order term without requiring any bit shuffling on our
|
||||
* part. Reception works similarly
|
||||
*
|
||||
* The feedback terms table consists of 256, 32-bit entries. Notes
|
||||
*
|
||||
* - The table can be generated at runtime if desired; code to do so is shown later. It
|
||||
* might not be obvious, but the feedback terms simply represent the results of eight
|
||||
* shift/xor operations for all combinations of data and CRC register values
|
||||
*
|
||||
* - The values must be right-shifted by eight bits by the updcrc logic; the shift must
|
||||
* be u_(bring in zeroes). On some hardware you could probably optimize the shift in
|
||||
* assembler by using byte-swap instructions polynomial $edb88320
|
||||
************************************************************************************************/
|
||||
|
||||
/************************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <crc32.h>
|
||||
|
||||
// Needed for Linux
|
||||
#define FAR
|
||||
|
||||
/************************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************************/
|
||||
|
||||
static const uint32_t crc32_tab[] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
|
||||
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
||||
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
||||
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
|
||||
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
||||
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
|
||||
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
|
||||
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
||||
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
|
||||
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
||||
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
|
||||
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
|
||||
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
|
||||
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
|
||||
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
||||
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
|
||||
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
||||
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
|
||||
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
|
||||
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
||||
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
|
||||
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
||||
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
|
||||
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
|
||||
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
|
||||
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
||||
};
|
||||
|
||||
/************************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************************/
|
||||
/************************************************************************************************
|
||||
* Name: crc32part
|
||||
*
|
||||
* Description:
|
||||
* Continue CRC calculation on a part of the buffer.
|
||||
*
|
||||
************************************************************************************************/
|
||||
|
||||
uint32_t crc32part(FAR const uint8_t *src, size_t len, uint32_t crc32val)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
crc32val = crc32_tab[(crc32val ^ src[i]) & 0xff] ^ (crc32val >> 8);
|
||||
}
|
||||
|
||||
return crc32val;
|
||||
}
|
||||
|
||||
/************************************************************************************************
|
||||
* Name: crc32
|
||||
*
|
||||
* Description:
|
||||
* Return a 32-bit CRC of the contents of the 'src' buffer, length 'len'
|
||||
*
|
||||
************************************************************************************************/
|
||||
|
||||
uint32_t crc32(FAR const uint8_t *src, size_t len)
|
||||
{
|
||||
return crc32part(src, len, 0);
|
||||
}
|
|
@ -1,250 +0,0 @@
|
|||
/****************************************************************************
|
||||
* Copyright (C) 2015-2016 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 main.cpp
|
||||
*
|
||||
* Basic shell to execute builtin "apps" on QURT.
|
||||
*
|
||||
* @author Mark Charlebois <charlebm@gmail.com>
|
||||
* @author Julian Oes <julian@oes.ch>
|
||||
*/
|
||||
|
||||
#include <px4_platform_common/tasks.h>
|
||||
#include <px4_platform_common/time.h>
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <px4_platform_common/init.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
#include <dspal_platform.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "get_commands.h"
|
||||
#include "apps.h"
|
||||
|
||||
#define MAX_ARGS 8 // max number of whitespace separated args after app name
|
||||
|
||||
|
||||
static px4_task_t g_dspal_task = -1;
|
||||
|
||||
__BEGIN_DECLS
|
||||
// The commands to run are specified in a target file: commands_<target>.c
|
||||
extern const char *get_commands(void);
|
||||
|
||||
// Enable external library hook
|
||||
void qurt_external_hook(void) __attribute__((weak));
|
||||
__END_DECLS
|
||||
|
||||
void qurt_external_hook(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void run_cmd(apps_map_type &apps, const std::vector<std::string> &appargs)
|
||||
{
|
||||
// command is appargs[0]
|
||||
std::string command = appargs[0];
|
||||
|
||||
//replaces app.find with iterator code to avoid null pointer exception
|
||||
for (apps_map_type::iterator it = apps.begin(); it != apps.end(); ++it)
|
||||
if (it->first == command) {
|
||||
// one for command name, one for null terminator
|
||||
const char *arg[MAX_ARGS + 2];
|
||||
|
||||
unsigned int i = 0;
|
||||
|
||||
if (appargs.size() > MAX_ARGS + 1) {
|
||||
PX4_ERR("%d too many arguments in run_cmd", appargs.size() - (MAX_ARGS + 1));
|
||||
return;
|
||||
}
|
||||
|
||||
while (i < appargs.size() && appargs[i].c_str()[0] != '\0') {
|
||||
arg[i] = (char *)appargs[i].c_str();
|
||||
PX4_DEBUG(" arg%d = '%s'\n", i, arg[i]);
|
||||
++i;
|
||||
}
|
||||
|
||||
arg[i] = (char *)0;
|
||||
|
||||
//PX4_DEBUG_PRINTF(i);
|
||||
if (apps[command] == NULL) {
|
||||
PX4_ERR("Null function !!\n");
|
||||
|
||||
} else {
|
||||
apps[command](i, (char **)arg);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void eat_whitespace(const char *&b, int &i)
|
||||
{
|
||||
// Eat whitespace
|
||||
while (b[i] == ' ' || b[i] == '\t') { ++i; }
|
||||
|
||||
b = &b[i];
|
||||
i = 0;
|
||||
}
|
||||
|
||||
static void process_commands(apps_map_type &apps, const char *cmds)
|
||||
{
|
||||
std::vector<std::string> appargs;
|
||||
int i = 0;
|
||||
const char *b = cmds;
|
||||
char arg[256];
|
||||
|
||||
// Eat leading whitespace
|
||||
eat_whitespace(b, i);
|
||||
|
||||
for (;;) {
|
||||
// End of command line
|
||||
if (b[i] == '\n' || b[i] == '\0') {
|
||||
strncpy(arg, b, i);
|
||||
arg[i] = '\0';
|
||||
appargs.push_back(arg);
|
||||
|
||||
// If we have a command to run
|
||||
if (appargs.size() > 0) {
|
||||
PX4_DEBUG("Processing command: %s", appargs[0].c_str());
|
||||
|
||||
for (int ai = 1; ai < (int)appargs.size(); ai++) {
|
||||
PX4_DEBUG(" > arg: %s", appargs[ai].c_str());
|
||||
}
|
||||
|
||||
run_cmd(apps, appargs);
|
||||
}
|
||||
|
||||
appargs.clear();
|
||||
|
||||
if (b[i] == '\n') {
|
||||
eat_whitespace(b, ++i);
|
||||
continue;
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// End of arg
|
||||
else if (b[i] == ' ') {
|
||||
strncpy(arg, b, i);
|
||||
arg[i] = '\0';
|
||||
appargs.push_back(arg);
|
||||
eat_whitespace(b, ++i);
|
||||
continue;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
namespace px4
|
||||
{
|
||||
extern void init_once(void);
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
int dspal_main(int argc, char *argv[]);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
const char *get_commands()
|
||||
{
|
||||
// All that needs to be started automatically on the DSP side
|
||||
// are uorb and qshell. After that, everything else can get
|
||||
// started from the main startup script on the Linux side.
|
||||
static const char *commands = "qshell start\n";
|
||||
|
||||
return commands;
|
||||
}
|
||||
|
||||
|
||||
int dspal_entry(int argc, char *argv[])
|
||||
{
|
||||
PX4_INFO("In dspal_entry");
|
||||
apps_map_type apps;
|
||||
init_app_map(apps);
|
||||
px4::init_once();
|
||||
px4::init(argc, (char **)argv, "px4");
|
||||
process_commands(apps, get_commands());
|
||||
sleep(1); // give time for all commands to execute before starting external function
|
||||
|
||||
if (qurt_external_hook) {
|
||||
qurt_external_hook();
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void usage()
|
||||
{
|
||||
PX4_INFO("Usage: dspal {start |stop}");
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
int dspal_main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (argc == 2 && strcmp(argv[1], "start") == 0) {
|
||||
g_dspal_task = px4_task_spawn_cmd("dspal",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
1500,
|
||||
dspal_entry,
|
||||
argv);
|
||||
|
||||
} else if (argc == 2 && strcmp(argv[1], "stop") == 0) {
|
||||
if (g_dspal_task < 0) {
|
||||
PX4_WARN("start up thread not running");
|
||||
|
||||
} else {
|
||||
px4_task_delete(g_dspal_task);
|
||||
g_dspal_task = -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
usage();
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2019 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_platform_common/init.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <lib/parameters/param.h>
|
||||
#include <px4_platform_common/px4_work_queue/WorkQueueManager.hpp>
|
||||
|
||||
int px4_platform_init()
|
||||
{
|
||||
hrt_init();
|
||||
|
||||
param_init();
|
||||
|
||||
px4::WorkQueueManagerStart();
|
||||
|
||||
uorb_start();
|
||||
|
||||
//px4_log_initialize();
|
||||
|
||||
return PX4_OK;
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file px4_linux_impl.cpp
|
||||
*
|
||||
* PX4 Middleware Wrapper Linux Implementation
|
||||
*/
|
||||
|
||||
#include <px4_platform_common/defines.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/init.h>
|
||||
#include <px4_platform_common/tasks.h>
|
||||
#include <px4_platform_common/workqueue.h>
|
||||
#include <dataman/dataman.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <parameters/param.h>
|
||||
#include "hrt_work.h"
|
||||
|
||||
//extern pthread_t _shell_task_id;
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern uint64_t get_ticks_per_us();
|
||||
|
||||
//long PX4_TICKS_PER_SEC = 1000L;
|
||||
|
||||
unsigned int sleep(unsigned int sec)
|
||||
{
|
||||
for (unsigned int i = 0; i < sec; i++) {
|
||||
usleep(1000000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern void hrt_init(void);
|
||||
|
||||
#if 0
|
||||
void qurt_log(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
printf(fmt, args);
|
||||
printf("n");
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
|
||||
//extern int _posix_init(void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
extern struct wqueue_s gwork[NWORKERS];
|
||||
|
||||
|
||||
namespace px4
|
||||
{
|
||||
|
||||
void init_once(void);
|
||||
|
||||
void init_once(void)
|
||||
{
|
||||
// Required for QuRT
|
||||
//_posix_init();
|
||||
|
||||
// _shell_task_id = pthread_self();
|
||||
// PX4_INFO("Shell id is %lu", _shell_task_id);
|
||||
|
||||
work_queues_init();
|
||||
hrt_work_queue_init();
|
||||
|
||||
px4_platform_init();
|
||||
}
|
||||
|
||||
void init(int argc, char *argv[], const char *app_name)
|
||||
{
|
||||
PX4_DEBUG("App name: %s\n", app_name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Retrieve from the data manager store */
|
||||
ssize_t
|
||||
dm_read(
|
||||
dm_item_t item, /* The item type to retrieve */
|
||||
unsigned index, /* The index of the item */
|
||||
void *buffer, /* Pointer to caller data buffer */
|
||||
size_t buflen /* Length in bytes of data to retrieve */
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** write to the data manager store */
|
||||
ssize_t
|
||||
dm_write(
|
||||
dm_item_t item, /* The item type to store */
|
||||
unsigned index, /* The index of the item */
|
||||
dm_persitence_t persistence, /* The persistence level of this item */
|
||||
const void *buffer, /* Pointer to caller data buffer */
|
||||
size_t buflen /* Length in bytes of data to retrieve */
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t strnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
while (s[i] != '\0' && i < maxlen) {
|
||||
++i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int fprintf(FILE *stream, const char *format, ...)
|
||||
{
|
||||
PX4_ERR("Error: Calling unresolved symbol stub:[%s(%s,...)]", __FUNCTION__, format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fputc(int c, FILE *stream)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
int putchar(int character)
|
||||
{
|
||||
return character;
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* 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 <px4_platform_common/log.h>
|
||||
#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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
void _Parse_fde_instr(void)
|
||||
{
|
||||
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 _Valbytes(void)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
void _Parse_lsda(void)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
void _Read_enc_ptr(void)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
void __cxa_guard_acquire(void)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
float _Stof(const char *p0, char **p1, long p2)
|
||||
{
|
||||
PX4_WARN("Error: Calling unresolved symbol stub[%s]", __FUNCTION__);
|
||||
block_indefinite();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *bsearch(const void *key, const void *ptr, size_t count, size_t size, int (*comp)(const void *, const void *))
|
||||
{
|
||||
const char *first = (const char *)ptr;
|
||||
|
||||
while (count > 1) {
|
||||
size_t m = count / 2;
|
||||
const char *middle_element = first + m * size;
|
||||
int cmp_res = comp(middle_element, key);
|
||||
|
||||
if (cmp_res > 0) {
|
||||
count = m;
|
||||
|
||||
} else if (cmp_res == 0) {
|
||||
return (void *)middle_element;
|
||||
|
||||
} else {
|
||||
first = middle_element + size;
|
||||
count = count - m - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (count && comp(first, key) == 0) {
|
||||
return (void *)first;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -1,344 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015 Vijay Venkatraman. 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 <px4_platform_common/defines.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <atomic_ops.h>
|
||||
|
||||
#include <parameters/param.h>
|
||||
|
||||
#include <px4_platform_common/shmem.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
//#define SHMEM_DEBUG
|
||||
//#define PARAM_LOCK_DEBUG
|
||||
|
||||
static atomic_word_t mem_lock;
|
||||
|
||||
static unsigned char *map_base, *virt_addr;
|
||||
static uint64_t update_from_shmem_prev_time = 0, update_from_shmem_current_time = 0;
|
||||
static unsigned char krait_changed_index[MAX_SHMEM_PARAMS / 8 + 1];
|
||||
|
||||
struct shmem_info *shmem_info_p;
|
||||
|
||||
// Small helper to get log2 for ints
|
||||
static unsigned log2_for_int(unsigned v)
|
||||
{
|
||||
unsigned r = 0;
|
||||
|
||||
while (v >>= 1) {
|
||||
++r;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
struct param_wbuf_s {
|
||||
union param_value_u val;
|
||||
param_t param;
|
||||
bool unsaved;
|
||||
};
|
||||
extern struct param_wbuf_s *param_find_changed(param_t param);
|
||||
|
||||
int get_shmem_lock(const char *caller_file_name, int caller_line_number)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
#ifdef PARAM_LOCK_DEBUG
|
||||
PX4_INFO("lock value %d before get from %s, line: %d\n", mem_lock.value, strrchr(caller_file_name, '/'),
|
||||
caller_line_number);
|
||||
#endif
|
||||
|
||||
while (!atomic_compare_and_set(&mem_lock, 1, 0)) {
|
||||
i++;
|
||||
usleep(1000);
|
||||
|
||||
if (i > 100) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > 100) {
|
||||
PX4_INFO("Could not get lock, file name: %s, line number: %d.\n",
|
||||
strrchr(caller_file_name, '/'), caller_line_number);
|
||||
return -1;
|
||||
|
||||
} else {
|
||||
PX4_DEBUG("Lock acquired, file name: %s, line number: %d\n",
|
||||
caller_file_name, caller_line_number);
|
||||
}
|
||||
|
||||
return 0; //got the lock
|
||||
|
||||
}
|
||||
|
||||
void release_shmem_lock(const char *caller_file_name, int caller_line_number)
|
||||
{
|
||||
atomic_set(&mem_lock, 1);
|
||||
|
||||
#ifdef PARAM_LOCK_DEBUG
|
||||
PX4_INFO("release lock, file name: %s, line number: %d.\n",
|
||||
strrchr(caller_file_name, '/'), caller_line_number);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void init_shared_memory(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (shmem_info_p) {
|
||||
return;
|
||||
}
|
||||
|
||||
//virt_addr = map_memory(MAP_ADDRESS);
|
||||
map_base = (unsigned char *)calloc(MAP_SIZE, 1); //16KB
|
||||
|
||||
if (map_base == NULL) {
|
||||
PX4_INFO("adsp memory malloc failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
virt_addr = map_base;
|
||||
shmem_info_p = (struct shmem_info *) virt_addr;
|
||||
|
||||
atomic_init(&mem_lock, 1);
|
||||
|
||||
for (i = 0; i < MAX_SHMEM_PARAMS / 8 + 1; i++) {
|
||||
shmem_info_p->krait_changed_index[i] = 0;
|
||||
}
|
||||
|
||||
PX4_INFO("adsp memory mapped\n");
|
||||
}
|
||||
|
||||
void copy_params_to_shmem(const param_info_s *param_info_base)
|
||||
{
|
||||
param_t param;
|
||||
unsigned int i;
|
||||
|
||||
if (get_shmem_lock(__FILE__, __LINE__) != 0) {
|
||||
PX4_INFO("Could not get shmem lock\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//else PX4_INFO("Got lock\n");
|
||||
|
||||
for (param = 0; param < param_count(); param++) {
|
||||
//{PX4_INFO("writing to offset %d\n", (unsigned char*)(shmem_info_p->adsp_params[param].name)-(unsigned char*)shmem_info_p);}
|
||||
struct param_wbuf_s *s = param_find_changed(param);
|
||||
|
||||
if (s == NULL) {
|
||||
shmem_info_p->params_val[param] = param_info_base[param].val;
|
||||
}
|
||||
|
||||
else {
|
||||
shmem_info_p->params_val[param] = s->val;
|
||||
}
|
||||
|
||||
#ifdef SHMEM_DEBUG
|
||||
|
||||
if (param_type(param) == PARAM_TYPE_INT32) {
|
||||
PX4_INFO("%d: written %d for param %s to shared mem", param, shmem_info_p->params_val[param].i, param_name(param));
|
||||
|
||||
} else if (param_type(param) == PARAM_TYPE_FLOAT) {
|
||||
PX4_INFO("%d: written %f for param %s to shared mem", param, shmem_info_p->params_val[param].f, param_name(param));
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_SHMEM_PARAMS / 8 + 1; i++) {
|
||||
shmem_info_p->adsp_changed_index[i] = 0;
|
||||
krait_changed_index[i] = 0;
|
||||
}
|
||||
|
||||
release_shmem_lock(__FILE__, __LINE__);
|
||||
//PX4_INFO("Released lock\n");
|
||||
|
||||
}
|
||||
|
||||
/*update value and param's change bit in shared memory*/
|
||||
void update_to_shmem(param_t param, union param_value_u value)
|
||||
{
|
||||
unsigned int byte_changed, bit_changed;
|
||||
|
||||
if (!handle_in_range(param)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_shmem_lock(__FILE__, __LINE__) != 0) {
|
||||
PX4_ERR("Could not get shmem lock\n");
|
||||
return;
|
||||
}
|
||||
|
||||
shmem_info_p->params_val[param] = value;
|
||||
|
||||
byte_changed = param / 8;
|
||||
bit_changed = 1 << param % 8;
|
||||
shmem_info_p->adsp_changed_index[byte_changed] |= bit_changed;
|
||||
|
||||
//PX4_INFO("set %d bit on adsp index[%d] to %d\n", bit_changed, byte_changed, shmem_info_p->adsp_changed_index[byte_changed]);
|
||||
|
||||
#ifdef SHMEM_DEBUG
|
||||
|
||||
if (param_type(param) == PARAM_TYPE_INT32) {
|
||||
PX4_INFO("Set value %d for param %s to shmem, set adsp index %d:%d\n", value.i, param_name(param), byte_changed,
|
||||
bit_changed);
|
||||
}
|
||||
|
||||
else if (param_type(param) == PARAM_TYPE_FLOAT) {
|
||||
PX4_INFO("Set value %f for param %s to shmem, set adsp index %d:%d\n", value.f, param_name(param), byte_changed,
|
||||
bit_changed);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
release_shmem_lock(__FILE__, __LINE__);
|
||||
|
||||
}
|
||||
|
||||
void update_index_from_shmem(void)
|
||||
{
|
||||
unsigned int i;
|
||||
param_t params[MAX_SHMEM_PARAMS / 8 + 1];
|
||||
|
||||
if (get_shmem_lock(__FILE__, __LINE__) != 0) {
|
||||
PX4_ERR("Could not get shmem lock\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_SHMEM_PARAMS / 8 + 1; i++) {
|
||||
// Check if any param has been changed.
|
||||
if (krait_changed_index[i] != shmem_info_p->krait_changed_index[i]) {
|
||||
|
||||
// If a param has changed, we need to find out which one.
|
||||
// From the byte and bit that is different, we can resolve the param number.
|
||||
unsigned bit = log2_for_int(
|
||||
krait_changed_index[i]
|
||||
^ shmem_info_p->krait_changed_index[i]);
|
||||
param_t param_to_get = i * 8 + bit;
|
||||
|
||||
// Update our krait_changed_index as well.
|
||||
krait_changed_index[i] = shmem_info_p->krait_changed_index[i];
|
||||
params[i] = param_to_get;
|
||||
|
||||
} else {
|
||||
params[i] = 0xFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
release_shmem_lock(__FILE__, __LINE__);
|
||||
|
||||
// FIXME: this is a hack but it gets the param so that it gets added
|
||||
// to the local list param_values in param_shmem.c.
|
||||
for (i = 0; i < MAX_SHMEM_PARAMS / 8 + 1; i++) {
|
||||
if (params[i] != 0xFFFF) {
|
||||
int32_t dummy;
|
||||
param_get(params[i], &dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void update_value_from_shmem(param_t param, union param_value_u *value)
|
||||
{
|
||||
unsigned int byte_changed, bit_changed;
|
||||
|
||||
if (get_shmem_lock(__FILE__, __LINE__) != 0) {
|
||||
PX4_ERR("Could not get shmem lock\n");
|
||||
return;
|
||||
}
|
||||
|
||||
*value = shmem_info_p->params_val[param];
|
||||
|
||||
/*also clear the index since we are holding the lock*/
|
||||
byte_changed = param / 8;
|
||||
bit_changed = 1 << param % 8;
|
||||
shmem_info_p->krait_changed_index[byte_changed] &= ~bit_changed;
|
||||
|
||||
release_shmem_lock(__FILE__, __LINE__);
|
||||
|
||||
#ifdef SHMEM_DEBUG
|
||||
|
||||
if (param_type(param) == PARAM_TYPE_INT32) {
|
||||
PX4_INFO("Got value %d for param %s from shmem, cleared krait index %d:%d\n", value->i, param_name(param), byte_changed,
|
||||
bit_changed);
|
||||
}
|
||||
|
||||
else if (param_type(param) == PARAM_TYPE_FLOAT) {
|
||||
PX4_INFO("Got value %f for param %s from shmem, cleared krait index %d:%d\n", value->f, param_name(param), byte_changed,
|
||||
bit_changed);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int update_from_shmem(param_t param, union param_value_u *value)
|
||||
{
|
||||
unsigned int byte_changed, bit_changed;
|
||||
unsigned int retval = 0;
|
||||
|
||||
if (!handle_in_range(param) || value == NULL) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
update_from_shmem_current_time = hrt_absolute_time();
|
||||
|
||||
if ((update_from_shmem_current_time - update_from_shmem_prev_time)
|
||||
> 1000000) { //update every 1 second
|
||||
update_from_shmem_prev_time = update_from_shmem_current_time;
|
||||
update_index_from_shmem();
|
||||
}
|
||||
|
||||
byte_changed = param / 8;
|
||||
bit_changed = 1 << param % 8;
|
||||
|
||||
if (krait_changed_index[byte_changed] & bit_changed) {
|
||||
update_value_from_shmem(param, value);
|
||||
krait_changed_index[byte_changed] &= ~bit_changed;
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
//else {PX4_INFO("no change to param %s\n", param_name(param));}
|
||||
|
||||
PX4_DEBUG("%s %d bit on krait changed index[%d]\n",
|
||||
(retval) ? "cleared" : "unchanged", bit_changed, byte_changed);
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
#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;
|
||||
}
|
||||
|
||||
int pthread_mutex_lock(pthread_mutex_t *mutex)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_mutex_unlock(pthread_mutex_t *mutex)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_cond_signal(pthread_cond_t *cond)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int pthread_mutex_destroy(pthread_mutex_t *mutex)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int pthread_mutexattr_init(pthread_mutexattr_t *attr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pthread_condattr_init(pthread_condattr_t *attr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fsync(int fd)
|
||||
{
|
||||
return -1;
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* 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 <dlfcn.h>
|
||||
#include <qurt_log.h>
|
||||
#include <dspal_platform.h>
|
||||
|
||||
// This code is never run. It is used solely to test linking in the
|
||||
// TravisCI build test to make sure all symbols are resolved.
|
||||
__EXPORT int _start_main(void);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int _start_main()
|
||||
{
|
||||
return -1;
|
||||
}
|
|
@ -1,402 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2015-2016 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file px4_qurt_tasks.c
|
||||
* Implementation of existing task API for QURT.
|
||||
*
|
||||
* @author Mark Charlebois <charlebm@gmail.com>
|
||||
*/
|
||||
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <px4_platform_common/workqueue.h>
|
||||
#include <px4_platform_common/time.h>
|
||||
#include <hrt_work.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if !defined(__PX4_QURT)
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
|
||||
#include <px4_platform_common/tasks.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#define MAX_CMD_LEN 100
|
||||
|
||||
#define PX4_MAX_TASKS 50
|
||||
#define SHELL_TASK_ID (PX4_MAX_TASKS+1)
|
||||
|
||||
pthread_t _shell_task_id = 0;
|
||||
|
||||
struct task_entry {
|
||||
pthread_t pid;
|
||||
std::string name;
|
||||
bool isused;
|
||||
task_entry() : isused(false) {}
|
||||
};
|
||||
|
||||
static task_entry taskmap[PX4_MAX_TASKS];
|
||||
|
||||
typedef struct {
|
||||
px4_main_t entry;
|
||||
int argc;
|
||||
char *argv[];
|
||||
// strings are allocated after the
|
||||
} pthdata_t;
|
||||
|
||||
static void *entry_adapter(void *ptr)
|
||||
{
|
||||
pthdata_t *data;
|
||||
data = (pthdata_t *) ptr;
|
||||
|
||||
data->entry(data->argc, data->argv);
|
||||
//PX4_WARN("Before waiting infinte busy loop");
|
||||
//for( ;; )
|
||||
//{
|
||||
// volatile int x = 0;
|
||||
// ++x;
|
||||
// }
|
||||
free(ptr);
|
||||
px4_task_exit(0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int stack_size, px4_main_t entry,
|
||||
char *const argv[])
|
||||
{
|
||||
struct sched_param param;
|
||||
pthread_attr_t attr;
|
||||
pthread_t task;
|
||||
int rv;
|
||||
int argc = 0;
|
||||
int i;
|
||||
unsigned int len = 0;
|
||||
unsigned long offset;
|
||||
unsigned long structsize;
|
||||
char *p = (char *)argv;
|
||||
|
||||
PX4_DEBUG("Creating %s\n", name);
|
||||
PX4_DEBUG("attr address: 0x%X, param address: 0x%X", &attr, ¶m);
|
||||
|
||||
// Calculate argc
|
||||
while (p != (char *)0) {
|
||||
p = argv[argc];
|
||||
|
||||
if (p == (char *)0) {
|
||||
break;
|
||||
}
|
||||
|
||||
++argc;
|
||||
len += strlen(p) + 1;
|
||||
}
|
||||
|
||||
structsize = sizeof(pthdata_t) + (argc + 1) * sizeof(char *);
|
||||
pthdata_t *taskdata = nullptr;
|
||||
|
||||
// not safe to pass stack data to the thread creation
|
||||
taskdata = (pthdata_t *)malloc(structsize + len);
|
||||
|
||||
if (taskdata == nullptr) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
offset = ((unsigned long)taskdata) + structsize;
|
||||
|
||||
taskdata->entry = entry;
|
||||
taskdata->argc = argc;
|
||||
|
||||
for (i = 0; i < argc; 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;
|
||||
}
|
||||
|
||||
// Must add NULL at end of argv
|
||||
taskdata->argv[argc] = (char *)0;
|
||||
|
||||
rv = pthread_attr_init(&attr);
|
||||
|
||||
if (rv != 0) {
|
||||
PX4_WARN("px4_task_spawn_cmd: failed to init thread attrs");
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
PX4_DEBUG("stack address after pthread_attr_init: 0x%X", attr.stackaddr);
|
||||
PX4_DEBUG("attr address: 0x%X, param address: 0x%X", &attr, ¶m);
|
||||
rv = pthread_attr_getschedparam(&attr, ¶m);
|
||||
PX4_DEBUG("stack address after pthread_attr_getschedparam: 0x%X", attr.stackaddr);
|
||||
|
||||
if (rv != 0) {
|
||||
PX4_WARN("px4_task_spawn_cmd: failed to get thread sched param");
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
#if 0
|
||||
rv = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||
|
||||
if (rv != 0) {
|
||||
PX4_WARN("px4_task_spawn_cmd: failed to set inherit sched");
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
rv = pthread_attr_setschedpolicy(&attr, scheduler);
|
||||
|
||||
if (rv != 0) {
|
||||
PX4_WARN("px4_task_spawn_cmd: failed to set sched policy");
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
#endif
|
||||
size_t fixed_stacksize = -1;
|
||||
pthread_attr_getstacksize(&attr, &fixed_stacksize);
|
||||
PX4_DEBUG("stack size: %d passed stacksize(%d)", fixed_stacksize, stack_size);
|
||||
fixed_stacksize = 8 * 1024;
|
||||
fixed_stacksize = (fixed_stacksize < (size_t)stack_size) ? (size_t)stack_size : fixed_stacksize;
|
||||
|
||||
PX4_DEBUG("setting the thread[%s] stack size to[%d]", name, fixed_stacksize);
|
||||
pthread_attr_setstacksize(&attr, PX4_STACK_ADJUSTED(fixed_stacksize));
|
||||
|
||||
PX4_DEBUG("stack address after pthread_attr_setstacksize: 0x%X", attr.stackaddr);
|
||||
param.sched_priority = priority;
|
||||
|
||||
rv = pthread_attr_setschedparam(&attr, ¶m);
|
||||
|
||||
if (rv != 0) {
|
||||
PX4_ERR("px4_task_spawn_cmd: failed to set sched param");
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
rv = pthread_create(&task, &attr, &entry_adapter, (void *) taskdata);
|
||||
|
||||
if (rv != 0) {
|
||||
PX4_ERR("px4_task_spawn_cmd: pthread_create failed, error: %d", rv);
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
for (i = 0; i < PX4_MAX_TASKS; ++i) {
|
||||
if (taskmap[i].isused == false) {
|
||||
taskmap[i].pid = task;
|
||||
taskmap[i].name = name;
|
||||
taskmap[i].isused = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= PX4_MAX_TASKS) {
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int px4_task_delete(px4_task_t id)
|
||||
{
|
||||
int rv = 0;
|
||||
pthread_t pid;
|
||||
PX4_WARN("Called px4_task_delete");
|
||||
|
||||
if (id < PX4_MAX_TASKS && taskmap[id].isused) {
|
||||
pid = taskmap[id].pid;
|
||||
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// If current thread then exit, otherwise cancel
|
||||
if (pthread_self() == pid) {
|
||||
taskmap[id].isused = false;
|
||||
pthread_exit(0);
|
||||
|
||||
} else {
|
||||
rv = pthread_cancel(pid);
|
||||
}
|
||||
|
||||
taskmap[id].isused = false;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void px4_task_exit(int ret)
|
||||
{
|
||||
int i;
|
||||
pthread_t pid = pthread_self();
|
||||
|
||||
// Get pthread ID from the opaque ID
|
||||
for (i = 0; i < PX4_MAX_TASKS; ++i) {
|
||||
if (taskmap[i].pid == pid) {
|
||||
taskmap[i].isused = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= PX4_MAX_TASKS) {
|
||||
PX4_ERR("px4_task_exit: self task not found!");
|
||||
|
||||
} else {
|
||||
PX4_DEBUG("px4_task_exit: %s", taskmap[i].name.c_str());
|
||||
}
|
||||
|
||||
//pthread_exit((void *)(unsigned long)ret);
|
||||
}
|
||||
|
||||
int px4_task_kill(px4_task_t id, int sig)
|
||||
{
|
||||
int rv = 0;
|
||||
pthread_t pid;
|
||||
PX4_DEBUG("Called px4_task_kill %d, taskname %s", sig, taskmap[id].name.c_str());
|
||||
|
||||
if (id < PX4_MAX_TASKS && taskmap[id].pid != 0) {
|
||||
pid = taskmap[id].pid;
|
||||
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// If current thread then exit, otherwise cancel
|
||||
rv = pthread_kill(pid, sig);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void px4_show_tasks()
|
||||
{
|
||||
int idx;
|
||||
int count = 0;
|
||||
|
||||
PX4_INFO("Active Tasks:");
|
||||
|
||||
for (idx = 0; idx < PX4_MAX_TASKS; idx++) {
|
||||
if (taskmap[idx].isused) {
|
||||
PX4_INFO(" %-10s %d", taskmap[idx].name.c_str(), taskmap[idx].pid);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
PX4_INFO(" No running tasks");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
px4_task_t px4_getpid()
|
||||
{
|
||||
pthread_t pid = pthread_self();
|
||||
//
|
||||
// if (pid == _shell_task_id)
|
||||
// return SHELL_TASK_ID;
|
||||
|
||||
// Get pthread ID from the opaque ID
|
||||
for (int i = 0; i < PX4_MAX_TASKS; ++i) {
|
||||
if (taskmap[i].isused && taskmap[i].pid == pid) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return ~0;
|
||||
}
|
||||
|
||||
|
||||
const char *px4_get_taskname()
|
||||
{
|
||||
pthread_t pid = pthread_self();
|
||||
|
||||
for (int i = 0; i < PX4_MAX_TASKS; i++) {
|
||||
if (taskmap[i].isused && taskmap[i].pid == pid) {
|
||||
return taskmap[i].name.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
return "Unknown App";
|
||||
}
|
||||
|
||||
static void timer_cb(void *data)
|
||||
{
|
||||
px4_sem_t *sem = reinterpret_cast<px4_sem_t *>(data);
|
||||
|
||||
sem_post(sem);
|
||||
}
|
||||
|
||||
int px4_sem_timedwait(px4_sem_t *sem, const struct timespec *ts)
|
||||
{
|
||||
work_s _hpwork = {};
|
||||
|
||||
// Get the current time.
|
||||
struct timespec ts_now;
|
||||
px4_clock_gettime(CLOCK_MONOTONIC, &ts_now);
|
||||
|
||||
// We get an absolute time but want to calculate a timeout in us.
|
||||
hrt_abstime timeout_us = ts_to_abstime((struct timespec *)ts) - ts_to_abstime(&ts_now);
|
||||
|
||||
// Create a timer to unblock.
|
||||
hrt_work_queue(&_hpwork, (worker_t)&timer_cb, (void *)sem, timeout_us);
|
||||
sem_wait(sem);
|
||||
hrt_work_cancel(&_hpwork);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_prctl(int option, const char *arg2, px4_task_t pid)
|
||||
{
|
||||
int rv;
|
||||
|
||||
switch (option) {
|
||||
case PR_SET_NAME:
|
||||
// set the threads name - Not supported
|
||||
// rv = pthread_setname_np(pthread_self(), arg2);
|
||||
rv = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = -1;
|
||||
PX4_WARN("FAILED SETTING TASK NAME");
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2019 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
|
||||
add_subdirectory(${PX4_CHIP})
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2019 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
|
||||
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
|
||||
{
|
||||
px4_i2c_bus_t ret{};
|
||||
ret.bus = bus;
|
||||
ret.is_external = false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
|
||||
{
|
||||
px4_i2c_bus_t ret{};
|
||||
ret.bus = bus;
|
||||
ret.is_external = true;
|
||||
return ret;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2019 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <px4_platform/micro_hal.h>
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <px4_platform_common/spi.h>
|
||||
|
||||
static inline constexpr px4_spi_bus_device_t initSPIDevice(uint8_t devid_driver)
|
||||
{
|
||||
px4_spi_bus_device_t ret{};
|
||||
ret.cs_gpio = 1; // set to some non-zero value to indicate this is used
|
||||
ret.devid = PX4_SPIDEV_ID(PX4_SPI_DEVICE_ID, 0);
|
||||
ret.devtype_driver = devid_driver;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline constexpr px4_spi_bus_t initSPIBus(int bus, const px4_spi_bus_devices_t &devices)
|
||||
{
|
||||
px4_spi_bus_t ret{};
|
||||
|
||||
for (int i = 0; i < SPI_BUS_MAX_DEVICES; ++i) {
|
||||
ret.devices[i] = devices.devices[i];
|
||||
}
|
||||
|
||||
ret.bus = bus;
|
||||
ret.is_external = false; // all buses are marked internal on QuRT
|
||||
ret.requires_locking = false;
|
||||
return ret;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PX4 commands need the 'px4-' prefix in bash.
|
||||
# (px4-alias.sh is expected to be in the PATH)
|
||||
. px4-alias.sh
|
||||
|
||||
muorb start
|
||||
logger start -t -b 200
|
||||
# Wait 1s before setting parameters for muorb to initialize
|
||||
sleep 1
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
dataman start
|
||||
navigator start
|
||||
mavlink start -x -u 14556 -r 1000000 -p
|
||||
sleep 1
|
||||
mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
mavlink stream -u 14556 -s ATTITUDE -r 50
|
||||
mavlink stream -u 14556 -s RC_CHANNELS -r 20
|
||||
mavlink boot_complete
|
|
@ -1,38 +0,0 @@
|
|||
qshell start
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
param set SYS_AUTOSTART 4001
|
||||
param set MAV_TYPE 2
|
||||
param set MC_YAW_P 12
|
||||
param set MC_YAWRATE_P 0.08
|
||||
param set MC_YAWRATE_I 0.0
|
||||
param set MC_YAWRATE_D 0
|
||||
param set MC_PITCH_P 7.0
|
||||
param set MC_PITCHRATE_P 0.08
|
||||
param set MC_PITCHRATE_I 0.0
|
||||
param set MC_PITCHRATE_D 0.001
|
||||
param set MC_ROLL_P 7.0
|
||||
param set MC_ROLLRATE_P 0.08
|
||||
param set MC_ROLLRATE_I 0.0
|
||||
param set MC_ROLLRATE_D 0.001
|
||||
param set SENS_BOARD_ROT 0
|
||||
|
||||
|
||||
sleep 1
|
||||
mpu9250 -s start
|
||||
bmp280 -I start
|
||||
gps start -d /dev/tty-4
|
||||
rc_update start
|
||||
sensors start
|
||||
commander start
|
||||
ekf2 start
|
||||
land_detector start multicopter
|
||||
mc_hover_thrust_estimator start
|
||||
flight_mode_manager start
|
||||
mc_pos_control start
|
||||
mc_att_control start
|
||||
mc_rate_control start
|
||||
uart_esc start -D /dev/tty-2
|
||||
spektrum_rc start -d /dev/tty-1
|
||||
sleep 1
|
||||
list_files
|
||||
list_tasks
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PX4 commands need the 'px4-' prefix in bash.
|
||||
# (px4-alias.sh is expected to be in the PATH)
|
||||
. px4-alias.sh
|
||||
|
||||
muorb start
|
||||
logger start -t -b 200
|
||||
# Wait 1s before setting parameters for muorb to initialize
|
||||
sleep 1
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
dataman start
|
||||
navigator start
|
||||
mavlink start -x -u 14556 -r 1000000 -p
|
||||
sleep 1
|
||||
mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
mavlink stream -u 14556 -s ATTITUDE -r 50
|
||||
mavlink stream -u 14556 -s RC_CHANNELS -r 20
|
||||
mavlink boot_complete
|
|
@ -1,38 +0,0 @@
|
|||
qshell start
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
param set SYS_AUTOSTART 4001
|
||||
param set MAV_TYPE 2
|
||||
param set MC_YAW_P 12
|
||||
param set MC_YAWRATE_P 0.08
|
||||
param set MC_YAWRATE_I 0.0
|
||||
param set MC_YAWRATE_D 0
|
||||
param set MC_PITCH_P 7.0
|
||||
param set MC_PITCHRATE_P 0.08
|
||||
param set MC_PITCHRATE_I 0.0
|
||||
param set MC_PITCHRATE_D 0.001
|
||||
param set MC_ROLL_P 7.0
|
||||
param set MC_ROLLRATE_P 0.08
|
||||
param set MC_ROLLRATE_I 0.0
|
||||
param set MC_ROLLRATE_D 0.001
|
||||
param set ATT_W_MAG 0.00
|
||||
param set SENS_BOARD_ROT 0
|
||||
|
||||
sleep 1
|
||||
mpu9250 -s start
|
||||
bmp280 -I start
|
||||
gps start -d /dev/tty-4
|
||||
rc_update start
|
||||
sensors start
|
||||
commander start
|
||||
ekf2 start
|
||||
land_detector start multicopter
|
||||
mc_hover_thrust_estimator start
|
||||
flight_mode_manager start
|
||||
mc_pos_control start
|
||||
mc_att_control start
|
||||
mc_rate_control start
|
||||
uart_esc start -D /dev/tty-2
|
||||
spektrum_rc start -d /dev/tty-1
|
||||
sleep 1
|
||||
list_files
|
||||
list_tasks
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PX4 commands need the 'px4-' prefix in bash.
|
||||
# (px4-alias.sh is expected to be in the PATH)
|
||||
. px4-alias.sh
|
||||
|
||||
muorb start
|
||||
logger start -t -b 200
|
||||
# Wait 1s before setting parameters for muorb to initialize
|
||||
sleep 1
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
dataman start
|
||||
navigator start
|
||||
mavlink start -x -u 14556 -r 1000000 -p
|
||||
sleep 1
|
||||
mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
mavlink stream -u 14556 -s ATTITUDE -r 50
|
||||
mavlink stream -u 14556 -s RC_CHANNELS -r 20
|
||||
mavlink boot_complete
|
|
@ -1,24 +0,0 @@
|
|||
qshell start
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
param set SYS_AUTOSTART 4001
|
||||
sleep 1
|
||||
gps start -d /dev/tty-4
|
||||
param set MAV_TYPE 2
|
||||
sleep 1
|
||||
hmc5883 start
|
||||
mpu9250 start
|
||||
bmp280 start
|
||||
sleep 1
|
||||
rc_update start
|
||||
sensors start
|
||||
commander start
|
||||
ekf2 start
|
||||
land_detector start multicopter
|
||||
mc_hover_thrust_estimator start
|
||||
flight_mode_manager start
|
||||
mc_pos_control start
|
||||
mc_att_control start
|
||||
mc_rate_control start
|
||||
# TODO
|
||||
#linux_pwm_out start
|
||||
spektrum_rc start
|
|
@ -1,11 +0,0 @@
|
|||
muorb start
|
||||
# Wait 1s before setting parameters for muorb to initialize
|
||||
sleep 1
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
mavlink start -x -u 14556 -p
|
||||
sleep 1
|
||||
mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
mavlink stream -u 14556 -s ATTITUDE -r 50
|
||||
mavlink boot_complete
|
||||
battery_simulator start
|
||||
simulator start
|
|
@ -1,32 +0,0 @@
|
|||
qshell start
|
||||
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
param set SYS_AUTOSTART 4001
|
||||
param set SYS_AUTOCONFIG 1
|
||||
param set MAV_TYPE 2
|
||||
param set MC_YAW_P 1.5
|
||||
param set MC_PITCH_P 3.0
|
||||
param set MC_ROLL_P 3.0
|
||||
param set MC_YAWRATE_P 0.2
|
||||
param set MC_PITCHRATE_P 0.03
|
||||
param set MC_ROLLRATE_P 0.03
|
||||
|
||||
sleep 1
|
||||
rc_update start
|
||||
commander start -hil
|
||||
sensors start
|
||||
ekf2 start
|
||||
mc_hover_thrust_estimator start
|
||||
flight_mode_manager start
|
||||
mc_pos_control start
|
||||
mc_att_control start
|
||||
mc_rate_control start
|
||||
land_detector start multicopter
|
||||
sleep 1
|
||||
pwm_out_sim start
|
||||
mixer load /dev/pwm_output0 /startup/quad_x.main.mix
|
||||
list_files
|
||||
list_tasks
|
||||
sleep 10
|
||||
list_tasks
|
||||
sleep 10
|
|
@ -1,103 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PX4 commands need the 'px4-' prefix in bash.
|
||||
# (px4-alias.sh is expected to be in the PATH)
|
||||
. px4-alias.sh
|
||||
|
||||
muorb start
|
||||
|
||||
# We need to wait until the DSP side is ready before
|
||||
# sending commands with qshell.
|
||||
sleep 1
|
||||
|
||||
# default, generic quad platform
|
||||
if param compare SYS_AUTOSTART 4100
|
||||
then
|
||||
param set MAV_TYPE 2
|
||||
|
||||
qshell pwm_out_rc_in start -d /dev/tty-2
|
||||
|
||||
qshell gps start -d /dev/tty-4
|
||||
qshell hmc5883 start
|
||||
|
||||
# Qualcomm 200qx microheli platform
|
||||
elif param compare SYS_AUTOSTART 4200
|
||||
then
|
||||
param set MAV_TYPE 2
|
||||
param set MC_YAW_P 7.0
|
||||
param set MC_YAWRATE_P 0.08
|
||||
param set MC_YAWRATE_I 0.0
|
||||
param set MC_YAWRATE_D 0
|
||||
param set MC_PITCH_P 7.0
|
||||
param set MC_PITCHRATE_P 0.08
|
||||
param set MC_PITCHRATE_I 0.0
|
||||
param set MC_PITCHRATE_D 0.0001
|
||||
param set MC_ROLL_P 7.0
|
||||
param set MC_ROLLRATE_P 0.08
|
||||
param set MC_ROLLRATE_I 0.0
|
||||
param set MC_ROLLRATE_D 0.0001
|
||||
param set SENS_BOARD_ROT 0
|
||||
|
||||
# Qualcomm internal 210qc platform
|
||||
elif param compare SYS_AUTOSTART 4210
|
||||
then
|
||||
param set MAV_TYPE 2
|
||||
param set MC_YAW_P 12
|
||||
param set MC_YAWRATE_P 0.08
|
||||
param set MC_YAWRATE_I 0.0
|
||||
param set MC_YAWRATE_D 0
|
||||
param set MC_PITCH_P 7.0
|
||||
param set MC_PITCHRATE_P 0.08
|
||||
param set MC_PITCHRATE_I 0.0
|
||||
param set MC_PITCHRATE_D 0.001
|
||||
param set MC_ROLL_P 7.0
|
||||
param set MC_ROLLRATE_P 0.08
|
||||
param set MC_ROLLRATE_I 0.0
|
||||
param set MC_ROLLRATE_D 0.001
|
||||
param set SENS_BOARD_ROT 0
|
||||
|
||||
else
|
||||
echo "NO AIRFRAME CHOSEN!"
|
||||
echo "Please set parameter to select airframe:"
|
||||
echo " SYS_AUTOSTART 4100: generic (flight) Quad"
|
||||
echo " SYS_AUTOSTART 4200: Microheli 200QX"
|
||||
fi
|
||||
|
||||
|
||||
qshell mpu9250 start
|
||||
qshell bmp280 start
|
||||
qshell rc_update start
|
||||
qshell sensors start
|
||||
|
||||
if param compare SYS_MC_EST_GROUP 1
|
||||
then
|
||||
qshell attitude_estimator_q start
|
||||
qshell local_position_estimator start
|
||||
|
||||
elif param compare SYS_MC_EST_GROUP 2
|
||||
then
|
||||
param set EKF2_GBIAS_INIT 0.01
|
||||
param set EKF2_ANGERR_INIT 0.01
|
||||
qshell ekf2 start
|
||||
else
|
||||
echo "No estimator chosen"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
qshell commander start
|
||||
qshell land_detector start multicopter
|
||||
qshell mc_hover_thrust_estimator start
|
||||
qshell flight_mode_manager start
|
||||
qshell mc_pos_control start
|
||||
qshell mc_att_control start
|
||||
qshell mc_rate_control start
|
||||
|
||||
logger start -b 200 -t
|
||||
|
||||
dataman start
|
||||
navigator start
|
||||
mavlink start -u 14556 -r 1000000 -p
|
||||
mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
mavlink stream -u 14556 -s ATTITUDE -r 50
|
||||
mavlink stream -u 14556 -s RC_CHANNELS -r 20
|
||||
mavlink boot_complete
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/sh
|
||||
# PX4 commands need the 'px4-' prefix in bash.
|
||||
# (px4-alias.sh is expected to be in the PATH)
|
||||
. px4-alias.sh
|
||||
|
||||
muorb start
|
||||
logger start -e -t
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
dataman start
|
||||
navigator start
|
||||
sleep 2
|
||||
mavlink start -x -u 14556 -r 1000000 -p
|
||||
sleep 1
|
||||
mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
mavlink stream -u 14556 -s ATTITUDE -r 50
|
||||
mavlink stream -u 14556 -s RC_CHANNELS -r 20
|
||||
mavlink boot_complete
|
|
@ -1,36 +0,0 @@
|
|||
qshell start
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
param set SYS_AUTOSTART 4001
|
||||
param set MAV_TYPE 2
|
||||
param set MC_YAW_P 12
|
||||
param set MC_YAWRATE_P 0.08
|
||||
param set MC_YAWRATE_I 0.0
|
||||
param set MC_YAWRATE_D 0
|
||||
param set MC_PITCH_P 7.0
|
||||
param set MC_PITCHRATE_P 0.08
|
||||
param set MC_PITCHRATE_I 0.0
|
||||
param set MC_PITCHRATE_D 0.001
|
||||
param set MC_ROLL_P 7.0
|
||||
param set MC_ROLLRATE_P 0.08
|
||||
param set MC_ROLLRATE_I 0.0
|
||||
param set MC_ROLLRATE_D 0.001
|
||||
param set SENS_BOARD_ROT 4
|
||||
|
||||
sleep 1
|
||||
mpu9250 -s start
|
||||
bmp280 -I start
|
||||
rc_update start
|
||||
sensors start
|
||||
commander start
|
||||
ekf2 start
|
||||
land_detector start multicopter
|
||||
mc_hover_thrust_estimator start
|
||||
flight_mode_manager start
|
||||
mc_pos_control start
|
||||
mc_att_control start
|
||||
mc_rate_control start
|
||||
uart_esc start -D /dev/tty-1
|
||||
spektrum_rc start -d /dev/tty-101
|
||||
sleep 1
|
||||
list_files
|
||||
list_tasks
|
|
@ -1,50 +0,0 @@
|
|||
#!/bin/sh
|
||||
# PX4 commands need the 'px4-' prefix in bash.
|
||||
# (px4-alias.sh is expected to be in the PATH)
|
||||
. px4-alias.sh
|
||||
|
||||
param select /root/rootfs/eeprom/parameters
|
||||
if [ -f /root/rootfs/eeprom/parameters ]
|
||||
then
|
||||
param load
|
||||
fi
|
||||
param set CBRK_SUPPLY_CHK 894281
|
||||
param set SYS_AUTOSTART 4001
|
||||
param set MAV_TYPE 2
|
||||
param set MAV_SYS_ID 1
|
||||
|
||||
load_mon start
|
||||
|
||||
mpu9250 -s -R 4 start
|
||||
hmc5883 -I start
|
||||
ms5611 -s start
|
||||
|
||||
rgbled start -b 1
|
||||
|
||||
board_adc start
|
||||
battery_status start
|
||||
|
||||
gps start -d /dev/ttyS3 -s
|
||||
rc_update start
|
||||
sensors start
|
||||
commander start
|
||||
navigator start
|
||||
dataman start
|
||||
ekf2 start
|
||||
land_detector start multicopter
|
||||
mc_hover_thrust_estimator start
|
||||
flight_mode_manager start
|
||||
mc_pos_control start
|
||||
mc_att_control start
|
||||
mc_rate_control start
|
||||
|
||||
mavlink start -x -d /dev/ttyPS1
|
||||
mavlink stream -d /dev/ttyPS1 -s HIGHRES_IMU -r 50
|
||||
mavlink stream -d /dev/ttyPS1 -s ATTITUDE -r 50
|
||||
|
||||
rc_input start -d /dev/ttyS2
|
||||
|
||||
linux_pwm_out start
|
||||
mixer load /dev/pwm_out etc/mixers/quad_x.main.mix
|
||||
logger start -t -b 200
|
||||
mavlink boot_complete
|
|
@ -1,42 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2016 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 drivers__qshell__posix
|
||||
MAIN qshell
|
||||
SRCS
|
||||
#qshell_main.cpp
|
||||
qshell_start_posix.cpp
|
||||
qshell.cpp
|
||||
DEPENDS
|
||||
)
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 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 qshell.cpp
|
||||
* Send shell commands to qurt
|
||||
*
|
||||
* @author Nicolas de Palezieux <ndepal@gmail.com>
|
||||
*/
|
||||
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <uORB/topics/qshell_retval.h>
|
||||
|
||||
#include "qshell.h"
|
||||
|
||||
px4::AppState QShell::appState;
|
||||
|
||||
int QShell::main(std::vector<std::string> argList)
|
||||
{
|
||||
int ret = _send_cmd(argList);
|
||||
|
||||
if (ret != 0) {
|
||||
PX4_ERR("Could not send command");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = _wait_for_retval();
|
||||
|
||||
if (ret != 0) {
|
||||
PX4_ERR("Could not get return value");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QShell::_send_cmd(std::vector<std::string> &argList)
|
||||
{
|
||||
// Let's use a sequence number to check if a return value belongs to the
|
||||
// command that we just sent and not a previous one that we assumed that
|
||||
// it had timed out.
|
||||
++_current_sequence;
|
||||
|
||||
qshell_req_s qshell_req{};
|
||||
std::string cmd;
|
||||
|
||||
for (size_t i = 0; i < argList.size(); i++) {
|
||||
cmd += argList[i];
|
||||
|
||||
if (i < argList.size() - 1) {
|
||||
cmd += " ";
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd.size() >= qshell_req.MAX_STRLEN) {
|
||||
PX4_ERR("Command too long: %d >= %d", (int) cmd.size(), (int) qshell_req.MAX_STRLEN);
|
||||
return -1;
|
||||
}
|
||||
|
||||
PX4_INFO("Send cmd: '%s'", cmd.c_str());
|
||||
|
||||
qshell_req.strlen = cmd.size();
|
||||
strcpy((char *)qshell_req.cmd, cmd.c_str());
|
||||
qshell_req.request_sequence = _current_sequence;
|
||||
|
||||
qshell_req.timestamp = hrt_absolute_time();
|
||||
_qshell_req_pub.publish(qshell_req);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QShell::_wait_for_retval()
|
||||
{
|
||||
const hrt_abstime time_started_us = hrt_absolute_time();
|
||||
|
||||
while (hrt_elapsed_time(&time_started_us) < 3000000) {
|
||||
qshell_retval_s retval;
|
||||
|
||||
if (_qshell_retval_sub.update(&retval)) {
|
||||
if (retval.return_sequence != _current_sequence) {
|
||||
PX4_WARN("Ignoring return value with wrong sequence");
|
||||
|
||||
} else {
|
||||
if (retval.return_value) {
|
||||
PX4_WARN("cmd returned with: %d", retval.return_value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
px4_usleep(1000);
|
||||
}
|
||||
|
||||
PX4_ERR("command timed out");
|
||||
return -1;
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 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 qshell.h
|
||||
* Send shell commands to qurt
|
||||
*
|
||||
* @author Nicolas de Palezieux <ndepal@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <uORB/Publication.hpp>
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/topics/qshell_req.h>
|
||||
#include <uORB/topics/qshell_retval.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class QShell
|
||||
{
|
||||
public:
|
||||
QShell() = default;
|
||||
~QShell() = default;
|
||||
|
||||
int main(std::vector<std::string> argList);
|
||||
|
||||
static px4::AppState appState; /* track requests to terminate app */
|
||||
|
||||
private:
|
||||
int _send_cmd(std::vector<std::string> &argList);
|
||||
int _wait_for_retval();
|
||||
|
||||
uORB::Publication<qshell_req_s> _qshell_req_pub{ORB_ID(qshell_req)};
|
||||
|
||||
uORB::Subscription _qshell_retval_sub{ORB_ID(qshell_retval)};
|
||||
|
||||
uint32_t _current_sequence{0};
|
||||
};
|
|
@ -1,77 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 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 qshell_start_posix.cpp
|
||||
* Send shell commands to qurt
|
||||
*
|
||||
* @author Nicolas de Palezieux <ndepal@gmail.com>
|
||||
*/
|
||||
|
||||
#include "qshell.h"
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <px4_platform_common/tasks.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
//using namespace px4;
|
||||
|
||||
extern "C" __EXPORT int qshell_main(int argc, char *argv[]);
|
||||
|
||||
static void usage()
|
||||
{
|
||||
PX4_DEBUG("usage: qshell cmd [args]");
|
||||
}
|
||||
|
||||
int qshell_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 2) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<std::string> argList;
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
argList.push_back(argv[i]);
|
||||
}
|
||||
|
||||
|
||||
QShell qshell;
|
||||
return qshell.main(argList);
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2016 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 drivers__qshell__qurt
|
||||
MAIN qshell
|
||||
SRCS
|
||||
qshell_main.cpp
|
||||
qshell_start_qurt.cpp
|
||||
qshell.cpp
|
||||
DEPENDS
|
||||
)
|
|
@ -1,184 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 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 qshell.cpp
|
||||
* Listener for shell commands from posix
|
||||
*
|
||||
* @author Nicolas de Palezieux <ndepal@gmail.com>
|
||||
*/
|
||||
|
||||
#include "qshell.h"
|
||||
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/time.h>
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
#include <dspal_platform.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <uORB/topics/qshell_retval.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
#define MAX_ARGS 8 // max number of whitespace separated args after app name
|
||||
|
||||
px4::AppState QShell::appState;
|
||||
|
||||
QShell::QShell()
|
||||
{
|
||||
init_app_map(m_apps);
|
||||
}
|
||||
|
||||
int QShell::main()
|
||||
{
|
||||
appState.setRunning(true);
|
||||
int sub_qshell_req = orb_subscribe(ORB_ID(qshell_req));
|
||||
|
||||
if (sub_qshell_req == PX4_ERROR) {
|
||||
PX4_ERR("Error subscribing to qshell_req topic");
|
||||
return -1;
|
||||
}
|
||||
|
||||
px4_pollfd_struct_t fds[1] = {};
|
||||
fds[0].fd = sub_qshell_req;
|
||||
fds[0].events = POLLIN;
|
||||
|
||||
while (!appState.exitRequested()) {
|
||||
|
||||
int pret = px4_poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 1000);
|
||||
|
||||
if (pret > 0 && fds[0].revents & POLLIN) {
|
||||
|
||||
orb_copy(ORB_ID(qshell_req), sub_qshell_req, &m_qshell_req);
|
||||
|
||||
PX4_INFO("qshell gotten: %s", m_qshell_req.cmd);
|
||||
char current_char;
|
||||
std::string arg;
|
||||
std::vector<std::string> appargs;
|
||||
|
||||
for (unsigned str_idx = 0; str_idx < m_qshell_req.strlen; str_idx++) {
|
||||
current_char = m_qshell_req.cmd[str_idx];
|
||||
|
||||
if (isspace(current_char)) { // split at spaces
|
||||
if (arg.length()) {
|
||||
appargs.push_back(arg);
|
||||
arg = "";
|
||||
}
|
||||
|
||||
} else {
|
||||
arg += current_char;
|
||||
}
|
||||
}
|
||||
|
||||
appargs.push_back(arg); // push last argument
|
||||
|
||||
qshell_retval_s retval{};
|
||||
retval.return_value = run_cmd(appargs);
|
||||
retval.return_sequence = m_qshell_req.request_sequence;
|
||||
|
||||
if (retval.return_value) {
|
||||
PX4_ERR("Failed to execute command: %s", m_qshell_req.cmd);
|
||||
|
||||
} else {
|
||||
PX4_INFO("Ok executing command: %s", m_qshell_req.cmd);
|
||||
}
|
||||
|
||||
retval.timestamp = hrt_absolute_time();
|
||||
_qshell_retval_pub.publish(retval);
|
||||
|
||||
} else if (pret == 0) {
|
||||
// Timing out is fine.
|
||||
} else {
|
||||
// Something is wrong.
|
||||
usleep(10000);
|
||||
}
|
||||
}
|
||||
|
||||
appState.setRunning(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QShell::run_cmd(const std::vector<std::string> &appargs)
|
||||
{
|
||||
// command is appargs[0]
|
||||
std::string command = appargs[0];
|
||||
|
||||
if (command.compare("help") == 0) {
|
||||
list_builtins(m_apps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//replaces app.find with iterator code to avoid null pointer exception
|
||||
for (apps_map_type::iterator it = m_apps.begin(); it != m_apps.end(); ++it) {
|
||||
if (it->first == command) {
|
||||
// one for command name, one for null terminator
|
||||
const char *arg[MAX_ARGS + 2];
|
||||
|
||||
unsigned int i = 0;
|
||||
|
||||
if (appargs.size() > MAX_ARGS + 1) {
|
||||
PX4_ERR("%d too many arguments in run_cmd", appargs.size() - (MAX_ARGS + 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (i < appargs.size() && appargs[i].c_str()[0] != '\0') {
|
||||
arg[i] = (char *)appargs[i].c_str();
|
||||
PX4_DEBUG(" arg%d = '%s'\n", i, arg[i]);
|
||||
++i;
|
||||
}
|
||||
|
||||
arg[i] = (char *)0;
|
||||
|
||||
//PX4_DEBUG_PRINTF(i);
|
||||
if (m_apps[command] == NULL) {
|
||||
PX4_ERR("Null function !!\n");
|
||||
|
||||
} else {
|
||||
return m_apps[command](i, (char **)arg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
PX4_ERR("Command %s not found", command.c_str());
|
||||
return 1;
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 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 qshell.h
|
||||
* Listener for shell commands from posix
|
||||
*
|
||||
* @author Nicolas de Palezieux <ndepal@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <uORB/Publication.hpp>
|
||||
#include <uORB/topics/qshell_retval.h>
|
||||
#include <uORB/topics/qshell_req.h>
|
||||
|
||||
#include "apps.h"
|
||||
|
||||
class QShell
|
||||
{
|
||||
public:
|
||||
QShell();
|
||||
~QShell() {}
|
||||
|
||||
int main();
|
||||
int run_cmd(const std::vector<std::string> &appargs);
|
||||
|
||||
static px4::AppState appState; /* track requests to terminate app */
|
||||
|
||||
private:
|
||||
|
||||
uORB::Publication<qshell_retval_s> _qshell_retval_pub{ORB_ID(qshell_retval)};
|
||||
|
||||
qshell_req_s m_qshell_req{};
|
||||
|
||||
apps_map_type m_apps;
|
||||
};
|
|
@ -1,58 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 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 qshell_main.cpp
|
||||
* Listener for shell commands from posix
|
||||
*
|
||||
* @author Nicolas de Palezieux <ndepal@gmail.com>
|
||||
*/
|
||||
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <px4_platform_common/init.h>
|
||||
#include "qshell.h"
|
||||
|
||||
extern "C" __EXPORT int qshell_entry(int argc, char **argv);
|
||||
|
||||
int qshell_entry(int argc, char **argv)
|
||||
{
|
||||
px4::init(argc, argv, "qshell");
|
||||
|
||||
PX4_DEBUG("qshell");
|
||||
QShell qshell;
|
||||
qshell.main();
|
||||
|
||||
PX4_DEBUG("goodbye");
|
||||
return 0;
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 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 qshell_start_qurt.cpp
|
||||
* Listener for shell commands from posix
|
||||
*
|
||||
* @author Nicolas de Palezieux <ndepal@gmail.com>
|
||||
*/
|
||||
|
||||
#include "qshell.h"
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/app.h>
|
||||
#include <px4_platform_common/tasks.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
|
||||
static int daemon_task; /* Handle of deamon task / thread */
|
||||
|
||||
//using namespace px4;
|
||||
|
||||
extern "C" __EXPORT int qshell_main(int argc, char *argv[]);
|
||||
|
||||
int qshell_entry(int argc, char **argv)
|
||||
{
|
||||
//px4::init(argc, argv, "qshell");
|
||||
|
||||
PX4_DEBUG("qshell entry.....");
|
||||
QShell qshell;
|
||||
qshell.main();
|
||||
|
||||
PX4_DEBUG("goodbye");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void usage()
|
||||
{
|
||||
PX4_INFO("usage: qshell {start|stop|status}");
|
||||
}
|
||||
|
||||
int qshell_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 2) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "start")) {
|
||||
|
||||
if (QShell::appState.isRunning()) {
|
||||
PX4_INFO("already running");
|
||||
/* this is not an error */
|
||||
return 0;
|
||||
}
|
||||
|
||||
PX4_DEBUG("before starting the qshell_entry task");
|
||||
|
||||
daemon_task = px4_task_spawn_cmd("qshell",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
8192,
|
||||
qshell_entry,
|
||||
(char *const *)argv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "stop")) {
|
||||
QShell::appState.requestExit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "status")) {
|
||||
if (QShell::appState.isRunning()) {
|
||||
PX4_INFO("is running");
|
||||
|
||||
} else {
|
||||
PX4_INFO("not started");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
usage();
|
||||
return 1;
|
||||
}
|
|
@ -40,12 +40,7 @@ if (${PX4_PLATFORM} STREQUAL "nuttx")
|
|||
if ("${CONFIG_SPI}" STREQUAL "y")
|
||||
list(APPEND SRCS_PLATFORM nuttx/SPI.cpp)
|
||||
endif()
|
||||
elseif((${PX4_PLATFORM} MATCHES "qurt"))
|
||||
list(APPEND SRCS_PLATFORM
|
||||
qurt/I2C.cpp
|
||||
qurt/SPI.cpp
|
||||
)
|
||||
elseif(UNIX AND NOT APPLE AND NOT (${PX4_PLATFORM} MATCHES "qurt")) #TODO: add linux PX4 platform type
|
||||
elseif(UNIX AND NOT APPLE) #TODO: add linux PX4 platform type
|
||||
# Linux I2Cdev and SPIdev
|
||||
list(APPEND SRCS_PLATFORM
|
||||
posix/I2C.cpp
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
|
||||
#ifdef __PX4_NUTTX
|
||||
#include "nuttx/I2C.hpp"
|
||||
#elif __PX4_QURT
|
||||
#include "qurt/I2C.hpp"
|
||||
#else
|
||||
#include "posix/I2C.hpp"
|
||||
#endif
|
||||
|
|
|
@ -1,170 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016-2020 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 I2C.cpp
|
||||
*
|
||||
* Base class for devices attached via the I2C bus.
|
||||
*
|
||||
* @todo Bus frequency changes; currently we do nothing with the value
|
||||
* that is supplied. Should we just depend on the bus knowing?
|
||||
*/
|
||||
|
||||
#include "I2C.hpp"
|
||||
|
||||
#include <dev_fs_lib_i2c.h>
|
||||
|
||||
#include <px4_platform_common/i2c_spi_buses.h>
|
||||
|
||||
namespace device
|
||||
{
|
||||
|
||||
I2C::I2C(uint8_t device_type, const char *name, const int bus, const uint16_t address, const uint32_t frequency) :
|
||||
CDev(name, nullptr),
|
||||
_frequency(frequency)
|
||||
{
|
||||
// fill in _device_id fields for a I2C device
|
||||
_device_id.devid_s.devtype = device_type;
|
||||
_device_id.devid_s.bus_type = DeviceBusType_I2C;
|
||||
_device_id.devid_s.bus = bus;
|
||||
_device_id.devid_s.address = address;
|
||||
}
|
||||
|
||||
I2C::I2C(const I2CSPIDriverConfig &config)
|
||||
: I2C(config.devid_driver_index, config.module_name, config.bus, config.i2c_address, config.bus_frequency)
|
||||
{
|
||||
}
|
||||
|
||||
I2C::~I2C()
|
||||
{
|
||||
if (_fd >= 0) {
|
||||
::close(_fd);
|
||||
_fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
I2C::init()
|
||||
{
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
// Open the actual I2C device
|
||||
char dev_path[16] {};
|
||||
snprintf(dev_path, sizeof(dev_path), DEV_FS_I2C_DEVICE_TYPE_STRING"%i", get_device_bus());
|
||||
_fd = ::open(dev_path, O_RDWR);
|
||||
|
||||
if (_fd < 0) {
|
||||
DEVICE_DEBUG("failed to init I2C");
|
||||
ret = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
// call the probe function to check whether the device is present
|
||||
ret = probe();
|
||||
|
||||
if (ret != OK) {
|
||||
DEVICE_DEBUG("probe failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
// do base class init, which will create device node, etc
|
||||
ret = CDev::init();
|
||||
|
||||
if (ret != OK) {
|
||||
DEVICE_DEBUG("cdev init failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
// tell the world where we are
|
||||
DEVICE_DEBUG("on I2C bus %d at 0x%02x", get_device_bus(), get_device_address());
|
||||
|
||||
out:
|
||||
|
||||
if ((ret != OK) && !(_fd < 0)) {
|
||||
::close(_fd);
|
||||
_fd = -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
I2C::transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len)
|
||||
{
|
||||
int ret = PX4_ERROR;
|
||||
unsigned retry_count = 0;
|
||||
|
||||
if (_fd < 0) {
|
||||
PX4_ERR("I2C device not opened");
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
do {
|
||||
DEVICE_DEBUG("transfer out %p/%u in %p/%u", send, send_len, recv, recv_len);
|
||||
|
||||
dspal_i2c_ioctl_slave_config slave_config{};
|
||||
slave_config.slave_address = get_device_address();
|
||||
slave_config.bus_frequency_in_khz = _frequency / 1000;
|
||||
slave_config.byte_transer_timeout_in_usecs = 10000; // 10 ms
|
||||
int ret_config = ::ioctl(_fd, I2C_IOCTL_SLAVE, &slave_config);
|
||||
|
||||
if (ret_config < 0) {
|
||||
DEVICE_DEBUG("Could not set slave config, result: %d", ret_config);
|
||||
}
|
||||
|
||||
|
||||
dspal_i2c_ioctl_combined_write_read ioctl_write_read{};
|
||||
|
||||
ioctl_write_read.write_buf = (uint8_t *)send;
|
||||
ioctl_write_read.write_buf_len = send_len;
|
||||
ioctl_write_read.read_buf = recv;
|
||||
ioctl_write_read.read_buf_len = recv_len;
|
||||
|
||||
int bytes_read = ::ioctl(_fd, I2C_IOCTL_RDWR, &ioctl_write_read);
|
||||
|
||||
if (bytes_read != (int)recv_len) {
|
||||
DEVICE_DEBUG("I2C transfer failed, bytes read %d", bytes_read);
|
||||
ret = PX4_ERROR;
|
||||
|
||||
} else {
|
||||
// success
|
||||
ret = PX4_OK;
|
||||
break;
|
||||
}
|
||||
|
||||
} while (retry_count++ < _retries);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace device
|
|
@ -1,115 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2016-2020 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 I2C.hpp
|
||||
*
|
||||
* Base class for devices connected via I2C.
|
||||
*/
|
||||
|
||||
#ifndef _DEVICE_I2C_H
|
||||
#define _DEVICE_I2C_H
|
||||
|
||||
#include "../CDev.hpp"
|
||||
|
||||
struct I2CSPIDriverConfig;
|
||||
|
||||
namespace device __EXPORT
|
||||
{
|
||||
|
||||
/**
|
||||
* Abstract class for character device on I2C
|
||||
*/
|
||||
class __EXPORT I2C : public CDev
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// no copy, assignment, move, move assignment
|
||||
I2C(const I2C &) = delete;
|
||||
I2C &operator=(const I2C &) = delete;
|
||||
I2C(I2C &&) = delete;
|
||||
I2C &operator=(I2C &&) = delete;
|
||||
|
||||
virtual int init() override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The number of times a read or write operation will be retried on
|
||||
* error.
|
||||
*/
|
||||
uint8_t _retries{0};
|
||||
|
||||
/**
|
||||
* @ Constructor
|
||||
*
|
||||
* @param device_type The device type (see drv_sensor.h)
|
||||
* @param name Driver name
|
||||
* @param bus I2C bus on which the device lives
|
||||
* @param address I2C bus address, or zero if set_address will be used
|
||||
* @param frequency I2C bus frequency for the device (currently not used)
|
||||
*/
|
||||
I2C(uint8_t device_type, const char *name, const int bus, const uint16_t address, const uint32_t frequency);
|
||||
I2C(const I2CSPIDriverConfig &config);
|
||||
virtual ~I2C();
|
||||
|
||||
/**
|
||||
* Check for the presence of the device on the bus.
|
||||
*/
|
||||
virtual int probe() { return PX4_OK; }
|
||||
|
||||
/**
|
||||
* Perform an I2C transaction to the device.
|
||||
*
|
||||
* At least one of send_len and recv_len must be non-zero.
|
||||
*
|
||||
* @param send Pointer to bytes to send.
|
||||
* @param send_len Number of bytes to send.
|
||||
* @param recv Pointer to buffer for bytes received.
|
||||
* @param recv_len Number of bytes to receive.
|
||||
* @return OK if the transfer was successful, -errno
|
||||
* otherwise.
|
||||
*/
|
||||
int transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len);
|
||||
|
||||
virtual bool external() const override { return px4_i2c_bus_external(_device_id.devid_s.bus); }
|
||||
|
||||
private:
|
||||
uint32_t _frequency{0};
|
||||
int _fd{-1};
|
||||
|
||||
};
|
||||
|
||||
} // namespace device
|
||||
|
||||
#endif /* _DEVICE_I2C_H */
|
|
@ -1,207 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2019 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 SPI.cpp
|
||||
*
|
||||
* Base class for devices connected via SPI.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "SPI.hpp"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "dev_fs_lib_spi.h"
|
||||
|
||||
#include <px4_platform_common/i2c_spi_buses.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
|
||||
namespace device
|
||||
{
|
||||
|
||||
SPI::SPI(uint8_t device_type, const char *name, int bus, uint32_t device, enum spi_mode_e mode, uint32_t frequency) :
|
||||
CDev(name, nullptr),
|
||||
_device(device),
|
||||
_mode(mode),
|
||||
_frequency(frequency)
|
||||
{
|
||||
_device_id.devid_s.devtype = device_type;
|
||||
// fill in _device_id fields for a SPI device
|
||||
_device_id.devid_s.bus_type = DeviceBusType_SPI;
|
||||
_device_id.devid_s.bus = bus;
|
||||
_device_id.devid_s.address = (uint8_t)device;
|
||||
}
|
||||
|
||||
SPI::SPI(const I2CSPIDriverConfig &config)
|
||||
: SPI(config.devid_driver_index, config.module_name, config.bus, config.spi_devid, config.spi_mode,
|
||||
config.bus_frequency)
|
||||
{
|
||||
}
|
||||
|
||||
SPI::~SPI()
|
||||
{
|
||||
if (_fd >= 0) {
|
||||
::close(_fd);
|
||||
_fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
SPI::init()
|
||||
{
|
||||
// Open the actual SPI device
|
||||
char dev_path[16];
|
||||
snprintf(dev_path, sizeof(dev_path), DEV_FS_SPI_DEVICE_TYPE_STRING"%lu", PX4_SPI_DEV_ID(_device));
|
||||
DEVICE_DEBUG("%s", dev_path);
|
||||
_fd = ::open(dev_path, O_RDWR);
|
||||
|
||||
if (_fd < 0) {
|
||||
PX4_ERR("could not open %s", dev_path);
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
/* call the probe function to check whether the device is present */
|
||||
int ret = probe();
|
||||
|
||||
if (ret != OK) {
|
||||
DEVICE_DEBUG("probe failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* do base class init, which will create the device node, etc. */
|
||||
ret = CDev::init();
|
||||
|
||||
if (ret != OK) {
|
||||
DEVICE_DEBUG("cdev init failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* tell the world where we are */
|
||||
DEVICE_DEBUG("on SPI bus %d at %d (%u KHz)", get_device_bus(), PX4_SPI_DEV_ID(_device), _frequency / 1000);
|
||||
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
int
|
||||
SPI::transfer(uint8_t *send, uint8_t *recv, unsigned len)
|
||||
{
|
||||
if ((send == nullptr) && (recv == nullptr)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// set bus frequency
|
||||
dspal_spi_ioctl_set_bus_frequency bus_freq{};
|
||||
|
||||
bus_freq.bus_frequency_in_hz = _frequency;
|
||||
|
||||
if (::ioctl(_fd, SPI_IOCTL_SET_BUS_FREQUENCY_IN_HZ, &bus_freq) < 0) {
|
||||
PX4_ERR("setting bus frequency failed");
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
// set bus mode
|
||||
// dspal_spi_ioctl_set_spi_mode bus_mode{};
|
||||
// bus_mode.eClockPolarity = SPI_CLOCK_IDLE_HIGH;
|
||||
// bus_mode.eShiftMode = SPI_OUTPUT_FIRST;
|
||||
|
||||
// if (::ioctl(spi_fildes, SPI_IOCTL_SET_SPI_MODE, &bus_mode) < 0) {
|
||||
// PX4_ERR("setting mode failed");
|
||||
// return PX4_ERROR;
|
||||
// }
|
||||
|
||||
// transfer data
|
||||
dspal_spi_ioctl_read_write ioctl_write_read{};
|
||||
|
||||
ioctl_write_read.read_buffer = send;
|
||||
ioctl_write_read.read_buffer_length = len;
|
||||
ioctl_write_read.write_buffer = recv;
|
||||
ioctl_write_read.write_buffer_length = len;
|
||||
|
||||
int result = ::ioctl(_fd, SPI_IOCTL_RDWR, &ioctl_write_read);
|
||||
|
||||
if (result < 0) {
|
||||
PX4_ERR("transfer error %d", result);
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
int
|
||||
SPI::transferhword(uint16_t *send, uint16_t *recv, unsigned len)
|
||||
{
|
||||
if ((send == nullptr) && (recv == nullptr)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// set bus frequency
|
||||
dspal_spi_ioctl_set_bus_frequency bus_freq{};
|
||||
bus_freq.bus_frequency_in_hz = _frequency;
|
||||
|
||||
if (::ioctl(_fd, SPI_IOCTL_SET_BUS_FREQUENCY_IN_HZ, &bus_freq) < 0) {
|
||||
PX4_ERR("setting bus frequency failed");
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
// set bus mode
|
||||
// dspal_spi_ioctl_set_spi_mode bus_mode{};
|
||||
// bus_mode.eClockPolarity = SPI_CLOCK_IDLE_HIGH;
|
||||
// bus_mode.eShiftMode = SPI_OUTPUT_FIRST;
|
||||
|
||||
// if (::ioctl(spi_fildes, SPI_IOCTL_SET_SPI_MODE, &bus_mode) < 0) {
|
||||
// PX4_ERR("setting mode failed");
|
||||
// return PX4_ERROR;
|
||||
// }
|
||||
|
||||
// transfer data
|
||||
dspal_spi_ioctl_read_write ioctl_write_read{};
|
||||
|
||||
ioctl_write_read.read_buffer = send;
|
||||
ioctl_write_read.read_buffer_length = len * 2;
|
||||
ioctl_write_read.write_buffer = recv;
|
||||
ioctl_write_read.write_buffer_length = len * 2;
|
||||
|
||||
int result = ::ioctl(_fd, SPI_IOCTL_RDWR, &ioctl_write_read);
|
||||
|
||||
if (result < 0) {
|
||||
PX4_ERR("transfer error %d", result);
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
} // namespace device
|
|
@ -1,171 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2019 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 SPI.hpp
|
||||
*
|
||||
* Base class for devices connected via SPI.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../CDev.hpp"
|
||||
|
||||
#include "dev_fs_lib_spi.h"
|
||||
|
||||
enum spi_mode_e {
|
||||
SPIDEV_MODE0 = 0, /* CPOL=0 CHPHA=0 */
|
||||
SPIDEV_MODE1 = 1, /* CPOL=0 CHPHA=1 */
|
||||
SPIDEV_MODE2 = 2, /* CPOL=1 CHPHA=0 */
|
||||
SPIDEV_MODE3 = 3 /* CPOL=1 CHPHA=1 */
|
||||
};
|
||||
|
||||
struct I2CSPIDriverConfig;
|
||||
|
||||
namespace device __EXPORT
|
||||
{
|
||||
|
||||
/**
|
||||
* Abstract class for character device on SPI
|
||||
*/
|
||||
class __EXPORT SPI : public CDev
|
||||
{
|
||||
protected:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param device_type The device type (see drv_sensor.h)
|
||||
* @param name Driver name
|
||||
* @param bus SPI bus on which the device lives
|
||||
* @param device Device handle (used by SPI_SELECT)
|
||||
* @param mode SPI clock/data mode
|
||||
* @param frequency SPI clock frequency
|
||||
*/
|
||||
SPI(uint8_t device_type, const char *name, int bus, uint32_t device, enum spi_mode_e mode, uint32_t frequency);
|
||||
SPI(const I2CSPIDriverConfig &config);
|
||||
virtual ~SPI();
|
||||
|
||||
/**
|
||||
* Locking modes supported by the driver.
|
||||
*/
|
||||
enum LockMode {
|
||||
LOCK_PREEMPTION, /**< the default; lock against all forms of preemption. */
|
||||
LOCK_THREADS, /**< lock only against other threads, using SPI_LOCK */
|
||||
LOCK_NONE /**< perform no locking, only safe if the bus is entirely private */
|
||||
};
|
||||
|
||||
virtual int init();
|
||||
|
||||
/**
|
||||
* Check for the presence of the device on the bus.
|
||||
*/
|
||||
virtual int probe() { return PX4_OK; }
|
||||
|
||||
/**
|
||||
* Perform a SPI transfer.
|
||||
*
|
||||
* If called from interrupt context, this interface does not lock
|
||||
* the bus and may interfere with non-interrupt-context callers.
|
||||
*
|
||||
* Clients in a mixed interrupt/non-interrupt configuration must
|
||||
* ensure appropriate interlocking.
|
||||
*
|
||||
* At least one of send or recv must be non-null.
|
||||
*
|
||||
* @param send Bytes to send to the device, or nullptr if
|
||||
* no data is to be sent.
|
||||
* @param recv Buffer for receiving bytes from the device,
|
||||
* or nullptr if no bytes are to be received.
|
||||
* @param len Number of bytes to transfer.
|
||||
* @return OK if the exchange was successful, -errno
|
||||
* otherwise.
|
||||
*/
|
||||
int transfer(uint8_t *send, uint8_t *recv, unsigned len);
|
||||
|
||||
/**
|
||||
* Perform a SPI 16 bit transfer.
|
||||
*
|
||||
* If called from interrupt context, this interface does not lock
|
||||
* the bus and may interfere with non-interrupt-context callers.
|
||||
*
|
||||
* Clients in a mixed interrupt/non-interrupt configuration must
|
||||
* ensure appropriate interlocking.
|
||||
*
|
||||
* At least one of send or recv must be non-null.
|
||||
*
|
||||
* @param send Words to send to the device, or nullptr if
|
||||
* no data is to be sent.
|
||||
* @param recv Words for receiving bytes from the device,
|
||||
* or nullptr if no bytes are to be received.
|
||||
* @param len Number of words to transfer.
|
||||
* @return OK if the exchange was successful, -errno
|
||||
* otherwise.
|
||||
*/
|
||||
int transferhword(uint16_t *send, uint16_t *recv, unsigned len);
|
||||
|
||||
/**
|
||||
* Set the SPI bus frequency
|
||||
* This is used to change frequency on the fly. Some sensors
|
||||
* (such as the MPU6000) need a lower frequency for setup
|
||||
* registers and can handle higher frequency for sensor
|
||||
* value registers
|
||||
*
|
||||
* @param frequency Frequency to set (Hz)
|
||||
*/
|
||||
void set_frequency(uint32_t frequency) { _frequency = frequency; }
|
||||
uint32_t get_frequency() { return _frequency; }
|
||||
|
||||
/**
|
||||
* Set the SPI bus locking mode
|
||||
*
|
||||
* This set the SPI locking mode. For devices competing with NuttX SPI
|
||||
* drivers on a bus the right lock mode is LOCK_THREADS.
|
||||
*
|
||||
* @param mode Locking mode
|
||||
*/
|
||||
void set_lockmode(enum LockMode mode) {}
|
||||
|
||||
private:
|
||||
int _fd{-1};
|
||||
|
||||
uint32_t _device;
|
||||
enum spi_mode_e _mode;
|
||||
uint32_t _frequency;
|
||||
|
||||
protected:
|
||||
|
||||
bool external() { return px4_spi_bus_external(get_device_bus()); }
|
||||
|
||||
};
|
||||
|
||||
} // namespace device
|
|
@ -34,8 +34,6 @@
|
|||
|
||||
#ifdef __PX4_NUTTX
|
||||
#include "nuttx/SPI.hpp"
|
||||
#elif __PX4_QURT
|
||||
#include "qurt/SPI.hpp"
|
||||
#else
|
||||
#include "posix/SPI.hpp"
|
||||
#endif
|
||||
|
|
|
@ -100,14 +100,9 @@ bool __EXPORT less_than_or_equal(float a, float b)
|
|||
}
|
||||
}
|
||||
|
||||
void __EXPORT float2SigExp(
|
||||
const float &num,
|
||||
float &sig,
|
||||
int &exp)
|
||||
void __EXPORT float2SigExp(const float &num, float &sig, int &exp)
|
||||
{
|
||||
// FIXME - This code makes no sense when exp is an int
|
||||
// FIXME - isnan and isinf not defined for QuRT
|
||||
#ifndef __PX4_QURT
|
||||
|
||||
if (!PX4_ISFINITE(num)) {
|
||||
sig = 0.0f;
|
||||
exp = -99;
|
||||
|
@ -129,8 +124,6 @@ void __EXPORT float2SigExp(
|
|||
exp = floor(exp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
sig = num;
|
||||
|
||||
// cheap power since it is integer
|
||||
|
|
|
@ -129,17 +129,12 @@ add_custom_command(OUTPUT px4_parameters.hpp
|
|||
)
|
||||
|
||||
set(SRCS)
|
||||
if ("${CONFIG_SHMEM}" STREQUAL "1")
|
||||
message(STATUS "parameters shared memory enabled")
|
||||
add_definitions(-DCONFIG_SHMEM=1)
|
||||
list(APPEND SRCS parameters_shmem.cpp)
|
||||
|
||||
list(APPEND SRCS parameters.cpp)
|
||||
if(BUILD_TESTING)
|
||||
list(APPEND SRCS param_translation_unit_tests.cpp)
|
||||
else()
|
||||
list(APPEND SRCS parameters.cpp)
|
||||
if(BUILD_TESTING)
|
||||
list(APPEND SRCS param_translation_unit_tests.cpp)
|
||||
else()
|
||||
list(APPEND SRCS param_translation.cpp)
|
||||
endif()
|
||||
list(APPEND SRCS param_translation.cpp)
|
||||
endif()
|
||||
|
||||
if(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
|
|
|
@ -81,14 +81,6 @@ static const char *param_default_file = PX4_ROOTFSDIR"/eeprom/parameters";
|
|||
|
||||
static char *param_user_file = nullptr;
|
||||
|
||||
#ifdef __PX4_QURT
|
||||
#define PARAM_OPEN px4_open
|
||||
#define PARAM_CLOSE px4_close
|
||||
#else
|
||||
#define PARAM_OPEN open
|
||||
#define PARAM_CLOSE close
|
||||
#endif
|
||||
|
||||
#include <px4_platform_common/workqueue.h>
|
||||
/* autosaving variables */
|
||||
static hrt_abstime last_autosave_timestamp = 0;
|
||||
|
@ -1133,11 +1125,11 @@ int param_save_default()
|
|||
|
||||
while (res != OK && attempts > 0) {
|
||||
// write parameters to file
|
||||
int fd = PARAM_OPEN(filename, O_WRONLY | O_CREAT, PX4_O_MODE_666);
|
||||
int fd = ::open(filename, O_WRONLY | O_CREAT, PX4_O_MODE_666);
|
||||
|
||||
if (fd > -1) {
|
||||
res = param_export(fd, false, nullptr);
|
||||
PARAM_CLOSE(fd);
|
||||
::close(fd);
|
||||
|
||||
if (res != PX4_OK) {
|
||||
PX4_ERR("param_export failed, retrying %d", attempts);
|
||||
|
@ -1170,7 +1162,7 @@ param_load_default()
|
|||
return flash_param_load();
|
||||
}
|
||||
|
||||
int fd_load = PARAM_OPEN(filename, O_RDONLY);
|
||||
int fd_load = ::open(filename, O_RDONLY);
|
||||
|
||||
if (fd_load < 0) {
|
||||
/* no parameter file is OK, otherwise this is an error */
|
||||
|
@ -1183,7 +1175,7 @@ param_load_default()
|
|||
}
|
||||
|
||||
int result = param_load(fd_load);
|
||||
PARAM_CLOSE(fd_load);
|
||||
::close(fd_load);
|
||||
|
||||
if (result != 0) {
|
||||
PX4_ERR("error reading parameters from '%s'", filename);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -49,11 +49,6 @@
|
|||
|
||||
#include "perf_counter.h"
|
||||
|
||||
#ifdef __PX4_QURT
|
||||
// There is presumably no dprintf on QURT. Therefore use the usual output to mini-dm.
|
||||
#define dprintf(_fd, _text, ...) ((_fd) == 1 ? PX4_INFO((_text), ##__VA_ARGS__) : (void)(_fd))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Header common to all counters.
|
||||
*/
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# 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_library(modules__muorb__adsp
|
||||
px4muorb.cpp
|
||||
uORBFastRpcChannel.cpp
|
||||
)
|
||||
target_include_directories(modules__muorb__adsp PRIVATE ${PX4_SOURCE_DIR}/platforms/common/uORB)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue