mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 17:43:33 +08:00
Linux to posix conversion
Changed "linux" target to "posix". Most of the changes are shared with QuRT and with OSX. The Linux specific parts are in for i2c which uses <linux/i2c.h> and <linux/i2c-dev.h>. There is also a check for __PX4_LINUX in mavlink for a tty ioctl that is not supported. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -36,8 +36,8 @@
|
||||
#
|
||||
|
||||
SRCS = \
|
||||
px4_linux_impl.cpp \
|
||||
px4_linux_tasks.cpp \
|
||||
px4_posix_impl.cpp \
|
||||
px4_posix_tasks.cpp \
|
||||
work_thread.c \
|
||||
work_queue.c \
|
||||
work_cancel.c \
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file px4_linux_impl.cpp
|
||||
* @file px4_posix_impl.cpp
|
||||
*
|
||||
* PX4 Middleware Wrapper Linux Implementation
|
||||
*/
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file px4_linux_tasks.c
|
||||
* @file px4_posix_tasks.c
|
||||
* Implementation of existing task API for Linux
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
************************************************************************/
|
||||
|
||||
// FIXME - need px4_queue
|
||||
#include <platforms/linux/include/queue.h>
|
||||
#include <platforms/posix/include/queue.h>
|
||||
#include <stddef.h>
|
||||
|
||||
__EXPORT void sq_rem(sq_entry_t *node, sq_queue_t *queue);
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file hello_start_linux.cpp
|
||||
* @file hello_start_posix.cpp
|
||||
*
|
||||
* @author Thomas Gubler <thomasgubler@gmail.com>
|
||||
* @author Mark Charlebois <mcharleb@gmail.com>
|
||||
+1
-1
@@ -38,6 +38,6 @@
|
||||
MODULE_COMMAND = hello
|
||||
|
||||
SRCS = hello_main.cpp \
|
||||
hello_start_linux.cpp \
|
||||
hello_start_posix.cpp \
|
||||
hello_example.cpp
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file hrt_test_start_linux.cpp
|
||||
* @file hrt_test_start_posix.cpp
|
||||
*
|
||||
* @author Mark Charlebois <mcharleb@gmail.com>
|
||||
*/
|
||||
+1
-1
@@ -38,6 +38,6 @@
|
||||
MODULE_COMMAND = hrttest
|
||||
|
||||
SRCS = hrt_test_main.cpp \
|
||||
hrt_test_start_linux.cpp \
|
||||
hrt_test_start_posix.cpp \
|
||||
hrt_test.cpp
|
||||
|
||||
+1
-1
@@ -38,6 +38,6 @@
|
||||
MODULE_COMMAND = vcdevtest
|
||||
|
||||
SRCS = vcdevtest_main.cpp \
|
||||
vcdevtest_start_linux.cpp \
|
||||
vcdevtest_start_posix.cpp \
|
||||
vcdevtest_example.cpp
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file vcdevtest_start_linux.cpp
|
||||
* @file vcdevtest_start_posix.cpp
|
||||
*
|
||||
* @author Thomas Gubler <thomasgubler@gmail.com>
|
||||
* @author Mark Charlebois <mcharleb@gmail.com>
|
||||
+1
-1
@@ -38,6 +38,6 @@
|
||||
MODULE_COMMAND = wqueue_test
|
||||
|
||||
SRCS = wqueue_main.cpp \
|
||||
wqueue_start_linux.cpp \
|
||||
wqueue_start_posix.cpp \
|
||||
wqueue_test.cpp
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file wqueue_start_linux.cpp
|
||||
* @file wqueue_start_posix.cpp
|
||||
*
|
||||
* @author Thomas Gubler <thomasgubler@gmail.com>
|
||||
* @author Mark Charlebois <mcharleb@gmail.com>
|
||||
@@ -48,7 +48,7 @@
|
||||
* Building for NuttX
|
||||
*/
|
||||
#include <nuttx/analog/adc.h>
|
||||
#elif defined(__PX4_LINUX)
|
||||
#elif defined(__PX4_POSIX)
|
||||
|
||||
// FIXME - this needs to be a px4_adc_msg_s type
|
||||
// Curently copied from NuttX
|
||||
|
||||
@@ -42,12 +42,12 @@
|
||||
|
||||
#if defined(__PX4_NUTTX)
|
||||
#include <px4_config.h>
|
||||
#elif defined (__PX4_LINUX) || defined (__PX4_QURT)
|
||||
#elif defined (__PX4_POSIX) || defined (__PX4_QURT)
|
||||
#define CONFIG_NFILE_STREAMS 1
|
||||
#define CONFIG_SCHED_WORKQUEUE 1
|
||||
#define CONFIG_SCHED_HPWORK 1
|
||||
#define CONFIG_SCHED_LPWORK 1
|
||||
#define CONFIG_ARCH_BOARD_LINUXTEST 1
|
||||
#define CONFIG_ARCH_BOARD_POSIXTEST 1
|
||||
|
||||
/** time in ms between checks for work in work queues **/
|
||||
#define CONFIG_SCHED_WORKPERIOD 10
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
/* 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_LINUX) || defined(__PX4_QURT)
|
||||
#elif defined(__PX4_NUTTX) || defined(__PX4_POSIX) || defined(__PX4_QURT)
|
||||
/*
|
||||
* Building for NuttX or Linux
|
||||
*/
|
||||
@@ -107,7 +107,7 @@ typedef param_t px4_param_t;
|
||||
#define PX4_ISFINITE(x) isfinite(x)
|
||||
|
||||
/* Linux Specific defines */
|
||||
#elif defined(__PX4_LINUX)
|
||||
#elif defined(__PX4_POSIX)
|
||||
|
||||
// Flag is meaningless on Linux
|
||||
#define O_BINARY 0
|
||||
@@ -134,7 +134,7 @@ __END_DECLS
|
||||
|
||||
|
||||
/* Defines for ROS and Linux */
|
||||
#if defined(__PX4_ROS) || defined(__PX4_LINUX) || defined(__PX4_QURT)
|
||||
#if defined(__PX4_ROS) || defined(__PX4_POSIX) || defined(__PX4_QURT)
|
||||
#define OK 0
|
||||
#define ERROR -1
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ typedef struct i2c_dev_s px4_i2c_dev_t;
|
||||
|
||||
#define px4_interrupt_context() up_interrupt_context()
|
||||
|
||||
#elif defined(__PX4_LINUX)
|
||||
#elif defined(__PX4_POSIX)
|
||||
#include <stdint.h>
|
||||
|
||||
#define I2C_M_READ 0x0001 /* read data, from slave to master */
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
#include <systemlib/param/param.h>
|
||||
#include <systemlib/systemlib.h>
|
||||
|
||||
#elif defined(__PX4_LINUX)
|
||||
#elif defined(__PX4_POSIX)
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <uORB/uORB.h>
|
||||
@@ -110,24 +110,24 @@
|
||||
#define ASSERT(x) assert(x)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <platforms/linux/px4_messages/px4_rc_channels.h>
|
||||
#include <platforms/linux/px4_messages/px4_vehicle_attitude_setpoint.h>
|
||||
#include <platforms/linux/px4_messages/px4_manual_control_setpoint.h>
|
||||
#include <platforms/linux/px4_messages/px4_actuator_controls.h>
|
||||
#include <platforms/linux/px4_messages/px4_actuator_controls_0.h>
|
||||
#include <platforms/linux/px4_messages/px4_actuator_controls_1.h>
|
||||
#include <platforms/linux/px4_messages/px4_actuator_controls_2.h>
|
||||
#include <platforms/linux/px4_messages/px4_actuator_controls_3.h>
|
||||
#include <platforms/linux/px4_messages/px4_vehicle_rates_setpoint.h>
|
||||
#include <platforms/linux/px4_messages/px4_vehicle_attitude.h>
|
||||
#include <platforms/linux/px4_messages/px4_vehicle_control_mode.h>
|
||||
#include <platforms/linux/px4_messages/px4_actuator_armed.h>
|
||||
#include <platforms/linux/px4_messages/px4_parameter_update.h>
|
||||
#include <platforms/linux/px4_messages/px4_vehicle_status.h>
|
||||
#include <platforms/linux/px4_messages/px4_vehicle_local_position_setpoint.h>
|
||||
#include <platforms/linux/px4_messages/px4_vehicle_global_velocity_setpoint.h>
|
||||
#include <platforms/linux/px4_messages/px4_vehicle_local_position.h>
|
||||
#include <platforms/linux/px4_messages/px4_position_setpoint_triplet.h>
|
||||
#include <platforms/posix/px4_messages/px4_rc_channels.h>
|
||||
#include <platforms/posix/px4_messages/px4_vehicle_attitude_setpoint.h>
|
||||
#include <platforms/posix/px4_messages/px4_manual_control_setpoint.h>
|
||||
#include <platforms/posix/px4_messages/px4_actuator_controls.h>
|
||||
#include <platforms/posix/px4_messages/px4_actuator_controls_0.h>
|
||||
#include <platforms/posix/px4_messages/px4_actuator_controls_1.h>
|
||||
#include <platforms/posix/px4_messages/px4_actuator_controls_2.h>
|
||||
#include <platforms/posix/px4_messages/px4_actuator_controls_3.h>
|
||||
#include <platforms/posix/px4_messages/px4_vehicle_rates_setpoint.h>
|
||||
#include <platforms/posix/px4_messages/px4_vehicle_attitude.h>
|
||||
#include <platforms/posix/px4_messages/px4_vehicle_control_mode.h>
|
||||
#include <platforms/posix/px4_messages/px4_actuator_armed.h>
|
||||
#include <platforms/posix/px4_messages/px4_parameter_update.h>
|
||||
#include <platforms/posix/px4_messages/px4_vehicle_status.h>
|
||||
#include <platforms/posix/px4_messages/px4_vehicle_local_position_setpoint.h>
|
||||
#include <platforms/posix/px4_messages/px4_vehicle_global_velocity_setpoint.h>
|
||||
#include <platforms/posix/px4_messages/px4_vehicle_local_position.h>
|
||||
#include <platforms/posix/px4_messages/px4_position_setpoint_triplet.h>
|
||||
#endif
|
||||
#include <systemlib/err.h>
|
||||
#include <systemlib/param/param.h>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#include <nuttx/spi.h>
|
||||
#elif defined(__PX4_LINUX)
|
||||
#elif defined(__PX4_POSIX)
|
||||
enum spi_dev_e
|
||||
{
|
||||
SPIDEV_NONE = 0, /* Not a valid value */
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef int px4_task_t;
|
||||
|
||||
#define px4_task_exit(x) _exit(x)
|
||||
|
||||
#elif defined(__PX4_LINUX) || defined(__PX4_QURT)
|
||||
#elif defined(__PX4_POSIX) || defined(__PX4_QURT)
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/clock.h>
|
||||
#elif defined(__PX4_LINUX) || defined(__PX4_QURT)
|
||||
#elif defined(__PX4_POSIX) || defined(__PX4_QURT)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <queue.h>
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
MODULE_COMMAND = hello
|
||||
|
||||
SRCS = hello_main.cpp \
|
||||
hello_start_linux.cpp \
|
||||
hello_start_qurt.cpp \
|
||||
hello_example.cpp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user