purge broken qurt support and atlflight boards

This commit is contained in:
Daniel Agar
2021-07-16 08:53:36 -04:00
parent 4a0fa08953
commit 65745a3676
116 changed files with 58 additions and 11410 deletions
+1 -6
View File
@@ -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
-2
View File
@@ -34,8 +34,6 @@
#ifdef __PX4_NUTTX
#include "nuttx/I2C.hpp"
#elif __PX4_QURT
#include "qurt/I2C.hpp"
#else
#include "posix/I2C.hpp"
#endif
-170
View File
@@ -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
-115
View File
@@ -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 */
-207
View File
@@ -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
-171
View File
@@ -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
-2
View File
@@ -34,8 +34,6 @@
#ifdef __PX4_NUTTX
#include "nuttx/SPI.hpp"
#elif __PX4_QURT
#include "qurt/SPI.hpp"
#else
#include "posix/SPI.hpp"
#endif
+2 -9
View File
@@ -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
+5 -10
View File
@@ -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")
+4 -12
View File
@@ -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
-5
View File
@@ -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.
*/