mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 16:21:36 +08:00
QuRT and POSIX changes - part 2
Second staged group of changes for QuRT and related POSIX changes Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -43,8 +43,7 @@ SRCS = \
|
|||||||
pio.cpp \
|
pio.cpp \
|
||||||
spi.cpp \
|
spi.cpp \
|
||||||
ringbuffer.cpp
|
ringbuffer.cpp
|
||||||
endif
|
else
|
||||||
ifeq ($(PX4_TARGET_OS),posix)
|
|
||||||
SRCS = vdev.cpp \
|
SRCS = vdev.cpp \
|
||||||
device.cpp \
|
device.cpp \
|
||||||
vdev_posix.cpp \
|
vdev_posix.cpp \
|
||||||
|
|||||||
@@ -234,6 +234,8 @@ RingBuffer::force(double val)
|
|||||||
return force(&val, sizeof(val));
|
return force(&val, sizeof(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME - clang crashes on this get() call
|
||||||
|
#ifndef __PX4_QURT
|
||||||
bool
|
bool
|
||||||
RingBuffer::get(void *val, size_t val_size)
|
RingBuffer::get(void *val, size_t val_size)
|
||||||
{
|
{
|
||||||
@@ -263,6 +265,7 @@ RingBuffer::get(void *val, size_t val_size)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RingBuffer::get(int8_t &val)
|
RingBuffer::get(int8_t &val)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ struct adc_msg_s
|
|||||||
|
|
||||||
// Example settings
|
// Example settings
|
||||||
#define ADC_BATTERY_VOLTAGE_CHANNEL 10
|
#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 ADC_AIRSPEED_VOLTAGE_CHANNEL 11
|
||||||
#define ADCSIM0_DEVICE_PATH "/dev/adc0"
|
#define ADCSIM0_DEVICE_PATH "/dev/adc0"
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(__PX4_NUTTX)
|
#if defined(__PX4_NUTTX)
|
||||||
#include <px4_config.h>
|
#include <nuttx/config.h>
|
||||||
#elif defined (__PX4_POSIX) || defined (__PX4_QURT)
|
#elif defined (__PX4_POSIX) || defined (__PX4_QURT)
|
||||||
#define CONFIG_NFILE_STREAMS 1
|
#define CONFIG_NFILE_STREAMS 1
|
||||||
#define CONFIG_SCHED_WORKQUEUE 1
|
#define CONFIG_SCHED_WORKQUEUE 1
|
||||||
|
|||||||
+18
-5
@@ -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);
|
||||||
inline int I2C_TRANSFER(px4_i2c_dev_t *dev, px4_i2c_msg_t *msg, int count) { return 0; }
|
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 addr; /* Slave address */
|
||||||
uint16_t flags; /* See I2C_M_* definitions */
|
uint16_t flags; /* See I2C_M_* definitions */
|
||||||
uint8_t *buffer;
|
uint8_t *buf;
|
||||||
int length;
|
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
|
#else
|
||||||
#error "No target platform defined"
|
#error "No target platform defined"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
#include <systemlib/systemlib.h>
|
#include <systemlib/systemlib.h>
|
||||||
|
|
||||||
#elif defined(__PX4_POSIX)
|
#elif defined(__PX4_POSIX) && !defined(__PX4_QURT)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <uORB/uORB.h>
|
#include <uORB/uORB.h>
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "px4_subscriber.h"
|
#include "px4_subscriber.h"
|
||||||
#include "px4_publisher.h"
|
#include "px4_publisher.h"
|
||||||
#include "px4_middleware.h"
|
#include "px4_middleware.h"
|
||||||
|
#include "px4_posix.h"
|
||||||
#include "px4_app.h"
|
#include "px4_app.h"
|
||||||
|
|
||||||
#if defined(__PX4_ROS)
|
#if defined(__PX4_ROS)
|
||||||
@@ -274,10 +275,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Poll fd with smallest interval */
|
/* Poll fd with smallest interval */
|
||||||
struct pollfd pfd;
|
px4_pollfd_struct_t pfd;
|
||||||
pfd.fd = _sub_min_interval->getUORBHandle();
|
pfd.fd = _sub_min_interval->getUORBHandle();
|
||||||
pfd.events = POLLIN;
|
pfd.events = POLLIN;
|
||||||
poll(&pfd, 1, timeout_ms);
|
px4_poll(&pfd, 1, timeout_ms);
|
||||||
spinOnce();
|
spinOnce();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ do_show_print(void *arg, param_t param)
|
|||||||
switch (param_type(param)) {
|
switch (param_type(param)) {
|
||||||
case PARAM_TYPE_INT32:
|
case PARAM_TYPE_INT32:
|
||||||
if (!param_get(param, &i)) {
|
if (!param_get(param, &i)) {
|
||||||
printf("%d\n", i);
|
printf("%ld\n", (long)i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ do_show_print(void *arg, param_t param)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PARAM_TYPE_STRUCT ... PARAM_TYPE_STRUCT_MAX:
|
case PARAM_TYPE_STRUCT ... PARAM_TYPE_STRUCT_MAX:
|
||||||
printf("<struct type %d size %lu>\n", 0 + param_type(param), param_size(param));
|
printf("<struct type %d size %zu>\n", 0 + param_type(param), param_size(param));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -328,7 +328,7 @@ do_show_print(void *arg, param_t param)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("<error fetching parameter %lu>\n", param);
|
printf("<error fetching parameter %lu>\n", (unsigned long)param);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -365,9 +365,9 @@ do_set(const char *name, const char *val, bool fail_on_not_found)
|
|||||||
printf("unchanged\n");
|
printf("unchanged\n");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
printf("curr: %d", i);
|
printf("curr: %ld", (long)i);
|
||||||
param_set(param, &newval);
|
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);
|
int j = strtol(vals[k], &end, 10);
|
||||||
|
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
printf(" %d: ", i);
|
printf(" %ld: ", (long)i);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user