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:
Mark Charlebois
2015-04-24 01:01:36 -07:00
parent 3336fce1f4
commit 8737d77947
8 changed files with 34 additions and 18 deletions
+1 -2
View File
@@ -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 \
+3
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -41,7 +41,7 @@
#pragma once
#if defined(__PX4_NUTTX)
#include <px4_config.h>
#include <nuttx/config.h>
#elif defined (__PX4_POSIX) || defined (__PX4_QURT)
#define CONFIG_NFILE_STREAMS 1
#define CONFIG_SCHED_WORKQUEUE 1
+18 -5
View File
@@ -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
+1 -1
View File
@@ -102,7 +102,7 @@
#include <systemlib/param/param.h>
#include <systemlib/systemlib.h>
#elif defined(__PX4_POSIX)
#elif defined(__PX4_POSIX) && !defined(__PX4_QURT)
#include <string.h>
#include <assert.h>
#include <uORB/uORB.h>
+3 -2
View File
@@ -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();
}
}
+6 -6
View File
@@ -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("<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;
default:
@@ -328,7 +328,7 @@ do_show_print(void *arg, param_t param)
return;
}
printf("<error fetching parameter %lu>\n", param);
printf("<error fetching parameter %lu>\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;
}
}