diff --git a/src/drivers/device/module.mk b/src/drivers/device/module.mk index 85826bbc40..f7883568e9 100644 --- a/src/drivers/device/module.mk +++ b/src/drivers/device/module.mk @@ -43,8 +43,7 @@ SRCS = \ pio.cpp \ spi.cpp \ ringbuffer.cpp -endif -ifeq ($(PX4_TARGET_OS),posix) +else SRCS = vdev.cpp \ device.cpp \ vdev_posix.cpp \ diff --git a/src/drivers/device/ringbuffer.cpp b/src/drivers/device/ringbuffer.cpp index 427876463f..e77402b0d1 100644 --- a/src/drivers/device/ringbuffer.cpp +++ b/src/drivers/device/ringbuffer.cpp @@ -234,6 +234,8 @@ RingBuffer::force(double val) return force(&val, sizeof(val)); } +// FIXME - clang crashes on this get() call +#ifndef __PX4_QURT bool RingBuffer::get(void *val, size_t val_size) { @@ -263,6 +265,7 @@ RingBuffer::get(void *val, size_t val_size) return false; } } +#endif bool RingBuffer::get(int8_t &val) diff --git a/src/platforms/px4_adc.h b/src/platforms/px4_adc.h index 42893ef885..8420f51971 100644 --- a/src/platforms/px4_adc.h +++ b/src/platforms/px4_adc.h @@ -60,7 +60,7 @@ struct adc_msg_s // Example settings #define ADC_BATTERY_VOLTAGE_CHANNEL 10 -#define ADC_BATTERY_CURRENT_CHANNEL -1 +#define ADC_BATTERY_CURRENT_CHANNEL ((uint8_t)(-1)) #define ADC_AIRSPEED_VOLTAGE_CHANNEL 11 #define ADCSIM0_DEVICE_PATH "/dev/adc0" #else diff --git a/src/platforms/px4_config.h b/src/platforms/px4_config.h index 5a187afd6c..635d82c216 100644 --- a/src/platforms/px4_config.h +++ b/src/platforms/px4_config.h @@ -41,7 +41,7 @@ #pragma once #if defined(__PX4_NUTTX) -#include +#include #elif defined (__PX4_POSIX) || defined (__PX4_QURT) #define CONFIG_NFILE_STREAMS 1 #define CONFIG_SCHED_WORKQUEUE 1 diff --git a/src/platforms/px4_i2c.h b/src/platforms/px4_i2c.h index 3e8d4ea888..423329c557 100644 --- a/src/platforms/px4_i2c.h +++ b/src/platforms/px4_i2c.h @@ -117,13 +117,26 @@ inline bool px4_interrupt_context(void) { return false; } inline int I2C_TRANSFER(px4_i2c_dev_t *dev, px4_i2c_msg_t *msg, int count); inline int I2C_TRANSFER(px4_i2c_dev_t *dev, px4_i2c_msg_t *msg, int count) { return 0; } -struct i2c_msg_s +#ifdef __PX4_QURT + +struct i2c_msg { - uint16_t addr; /* Slave address */ - uint16_t flags; /* See I2C_M_* definitions */ - uint8_t *buffer; - int length; + uint16_t addr; /* Slave address */ + uint16_t flags; /* See I2C_M_* definitions */ + uint8_t *buf; + int len; }; + +#define I2C_RDWR 0x0FFF + +struct i2c_rdwr_ioctl_data { + struct i2c_msg *msgs; /* pointers to i2c_msgs */ + uint32_t nmsgs; /* number of i2c_msgs */ +}; + +int ioctl(int fd, int flags, unsigned long data); +int write(int fd, const char *buffer, int buflen); +#endif #else #error "No target platform defined" #endif diff --git a/src/platforms/px4_includes.h b/src/platforms/px4_includes.h index d71eeea350..83bb60d796 100644 --- a/src/platforms/px4_includes.h +++ b/src/platforms/px4_includes.h @@ -102,7 +102,7 @@ #include #include -#elif defined(__PX4_POSIX) +#elif defined(__PX4_POSIX) && !defined(__PX4_QURT) #include #include #include diff --git a/src/platforms/px4_nodehandle.h b/src/platforms/px4_nodehandle.h index e4a483de65..259dab8005 100644 --- a/src/platforms/px4_nodehandle.h +++ b/src/platforms/px4_nodehandle.h @@ -42,6 +42,7 @@ #include "px4_subscriber.h" #include "px4_publisher.h" #include "px4_middleware.h" +#include "px4_posix.h" #include "px4_app.h" #if defined(__PX4_ROS) @@ -274,10 +275,10 @@ public: } /* Poll fd with smallest interval */ - struct pollfd pfd; + px4_pollfd_struct_t pfd; pfd.fd = _sub_min_interval->getUORBHandle(); pfd.events = POLLIN; - poll(&pfd, 1, timeout_ms); + px4_poll(&pfd, 1, timeout_ms); spinOnce(); } } diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index 30baaeb49c..1bc3df4b7b 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -305,7 +305,7 @@ do_show_print(void *arg, param_t param) switch (param_type(param)) { case PARAM_TYPE_INT32: if (!param_get(param, &i)) { - printf("%d\n", i); + printf("%ld\n", (long)i); return; } @@ -320,7 +320,7 @@ do_show_print(void *arg, param_t param) break; case PARAM_TYPE_STRUCT ... PARAM_TYPE_STRUCT_MAX: - printf("\n", 0 + param_type(param), param_size(param)); + printf("\n", 0 + param_type(param), param_size(param)); return; default: @@ -328,7 +328,7 @@ do_show_print(void *arg, param_t param) return; } - printf("\n", param); + printf("\n", (unsigned long)param); } static int @@ -365,9 +365,9 @@ do_set(const char *name, const char *val, bool fail_on_not_found) printf("unchanged\n"); } else { - printf("curr: %d", i); + printf("curr: %ld", (long)i); param_set(param, &newval); - printf(" -> new: %d\n", newval); + printf(" -> new: %ld\n", (long)newval); } } @@ -436,7 +436,7 @@ do_compare(const char *name, char *vals[], unsigned comparisons) int j = strtol(vals[k], &end, 10); if (i == j) { - printf(" %d: ", i); + printf(" %ld: ", (long)i); ret = 0; } }