Platform header file cleanup and consolidation

Removed obsolete porting cruft from px4_XXX.h files and merged the
POSIX changes in PreflightCheck_posix.cpp back to PreflightCheck.cpp

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-04-24 11:45:14 -07:00
parent 16d6068bfd
commit 20d35e33da
9 changed files with 47 additions and 399 deletions
-1
View File
@@ -4,5 +4,4 @@
#include <types.h>
size_t strnlen(const char *s, size_t maxlen);
//inline bool isfinite(int x) { return true; }
#endif
+5 -5
View File
@@ -34,15 +34,17 @@
/**
* @file px4_config.h
* Preserve abiility to load config information that is used in subsequent
* includes or code
Configuration flags used in code.
*/
#pragma once
#if defined(__PX4_NUTTX)
#include <nuttx/config.h>
#elif defined (__PX4_POSIX) || defined (__PX4_QURT)
#elif defined (__PX4_POSIX)
#define CONFIG_NFILE_STREAMS 1
#define CONFIG_SCHED_WORKQUEUE 1
#define CONFIG_SCHED_HPWORK 1
@@ -55,6 +57,4 @@
#define CONFIG_SCHED_INSTRUMENTATION 1
#define CONFIG_MAX_TASKS 32
#define px4_errx(x, ...) errx(x, __VA_ARGS__)
#endif
+16 -7
View File
@@ -67,9 +67,9 @@
/* Get value of parameter by name, which is equal to the handle for ros */
#define PX4_PARAM_GET_BYNAME(_name, _destpt) ros::param::get(_name, *_destpt)
#elif defined(__PX4_NUTTX) || defined(__PX4_POSIX) || defined(__PX4_QURT)
#elif defined(__PX4_NUTTX) || defined(__PX4_POSIX)
/*
* Building for NuttX or Linux
* Building for NuttX or POSIX
*/
#include <platforms/px4_includes.h>
/* Main entry point */
@@ -90,7 +90,9 @@ typedef param_t px4_param_t;
#error "No target OS defined"
#endif
/* NuttX Specific defines */
/*
* NuttX Specific defines
*/
#if defined(__PX4_NUTTX)
/* XXX this is a hack to resolve conflicts with NuttX headers */
@@ -106,7 +108,9 @@ typedef param_t px4_param_t;
#define PX4_ISFINITE(x) isfinite(x)
/* POSIX Specific defines */
/*
* POSIX Specific defines
*/
#elif defined(__PX4_POSIX)
// Flag is meaningless on Linux
@@ -119,6 +123,7 @@ typedef param_t px4_param_t;
//STM DocID018909 Rev 8 Sect 39.1 (Unique device ID Register)
#define UNIQUE_ID 0x1FFF7A10
/* FIXME - Used to satisfy build */
#define getreg32(a) (*(volatile uint32_t *)(a))
__BEGIN_DECLS
@@ -133,8 +138,10 @@ __END_DECLS
#endif
/* Defines for ROS and Linux */
#if defined(__PX4_ROS) || defined(__PX4_POSIX) || defined(__PX4_QURT)
/*
* Defines for ROS and Linux
*/
#if defined(__PX4_ROS) || defined(__PX4_POSIX)
#define OK 0
#define ERROR -1
@@ -203,7 +210,9 @@ __END_DECLS
#endif
/* Defines for all platforms */
/*
*Defines for all platforms
*/
/* wrapper for 2d matrices */
#define PX4_ARRAY2D(_array, _ncols, _x, _y) (_array[_x * _ncols + _y])
+3 -20
View File
@@ -42,7 +42,9 @@
#define PX4_I2C_M_READ 0x0001 /* read data, from slave to master */
#if defined(__PX4_ROS)
#error "Devices not supported in ROS"
#elif defined (__PX4_NUTTX)
/*
* Building for NuttX
@@ -64,12 +66,6 @@
typedef struct i2c_dev_s px4_i2c_dev_t;
#define px4_i2cuninitialize(x) up_i2cuninitialize(x)
#define px4_i2cinitialize(x) up_i2cinitialize(x)
#define px4_i2creset(x) up_i2creset(x)
#define px4_interrupt_context() up_interrupt_context()
#elif defined(__PX4_POSIX)
#include <stdint.h>
@@ -85,25 +81,11 @@ typedef struct {
int length;
} px4_i2c_msg_t;
struct px4_i2c_ops_t;
// NOTE - This is a copy of the NuttX i2c_ops_s structure
typedef struct {
const struct px4_i2c_ops_t *ops; /* I2C vtable */
} px4_i2c_dev_t;
// FIXME - Stub implementations
inline void px4_i2cuninitialize(px4_i2c_dev_t *dev);
inline void px4_i2cuninitialize(px4_i2c_dev_t *dev) {}
inline px4_i2c_dev_t *px4_i2cinitialize(int bus);
inline px4_i2c_dev_t *px4_i2cinitialize(int bus) { return (px4_i2c_dev_t *)0; }
inline void px4_i2creset(px4_i2c_dev_t *dev);
inline void px4_i2creset(px4_i2c_dev_t *dev) { }
inline bool px4_interrupt_context(void);
inline bool px4_interrupt_context(void) { return false; }
// FIXME - Empty defines for I2C ops
// Original version commented out
//#define I2C_SETFREQUENCY(d,f) ((d)->ops->setfrequency(d,f))
@@ -134,6 +116,7 @@ struct i2c_rdwr_ioctl_data {
uint32_t nmsgs; /* number of i2c_msgs */
};
// FIXME - The functions are not implemented on QuRT/DSPAL
int ioctl(int fd, int flags, unsigned long data);
int write(int fd, const char *buffer, int buflen);
#endif