QuRT and POSIX changes - part 4

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-04-24 01:24:31 -07:00
parent c802beb3d7
commit 187f13cd70
11 changed files with 65 additions and 35 deletions
@@ -39,6 +39,8 @@
*/
#include <px4_defines.h>
#include <px4_posix.h>
#include <px4_time.h>
#include <stdio.h>
#include <unistd.h>
#include <math.h>
@@ -246,7 +248,7 @@ enum detect_orientation_return detect_orientation(int mavlink_fd, int accel_sub)
float accel_err_thr = 5.0f;
/* still time required in us */
hrt_abstime still_time = 2000000;
struct pollfd fds[1];
px4_pollfd_struct_t fds[1];
fds[0].fd = accel_sub;
fds[0].events = POLLIN;
@@ -262,7 +264,7 @@ enum detect_orientation_return detect_orientation(int mavlink_fd, int accel_sub)
while (true) {
/* wait blocking for new data */
int poll_ret = poll(fds, 1, 1000);
int poll_ret = px4_poll(fds, 1, 1000);
if (poll_ret) {
orb_copy(ORB_ID(sensor_accel), accel_sub, &sensor);
+8 -2
View File
@@ -43,6 +43,8 @@
*/
#include <px4_config.h>
#include <px4_posix.h>
#include <px4_time.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
@@ -54,7 +56,9 @@
#include <systemlib/err.h>
#include <systemlib/circuit_breaker.h>
//#include <debug.h>
#ifndef __PX4_QURT
#include <sys/prctl.h>
#endif
#include <sys/stat.h>
#include <string.h>
#include <math.h>
@@ -2571,8 +2575,10 @@ void answer_command(struct vehicle_command_s &cmd, enum VEHICLE_CMD_RESULT resul
void *commander_low_prio_loop(void *arg)
{
#ifndef __PX4_QURT
/* Set thread name */
prctl(PR_SET_NAME, "commander_low_prio", getpid());
#endif
/* Subscribe to command topic */
int cmd_sub = orb_subscribe(ORB_ID(vehicle_command));
@@ -2583,7 +2589,7 @@ void *commander_low_prio_loop(void *arg)
hrt_abstime need_param_autosave_timeout = 0;
/* wakeup source(s) */
struct pollfd fds[1];
px4_pollfd_struct_t fds[1];
/* use the gyro to pace output - XXX BROKEN if we are using the L3GD20 */
fds[0].fd = cmd_sub;
@@ -2591,7 +2597,7 @@ void *commander_low_prio_loop(void *arg)
while (!thread_should_exit) {
/* wait for up to 1000ms for data */
int pret = poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 1000);
int pret = px4_poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 1000);
/* timed out - periodic check for thread_should_exit, etc. */
if (pret == 0) {