mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 12:23:34 +08:00
Rebase changes on upstream master
This brings in many of the changes from the PX4 fork on ATLFLight. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
committed by
Julian Oes
parent
2938d23c6c
commit
014f15d8b0
@@ -60,6 +60,11 @@ long PX4_TICKS_PER_SEC = sysconf(_SC_CLK_TCK);
|
||||
|
||||
#ifdef ENABLE_SHMEM
|
||||
extern void init_params(void);
|
||||
|
||||
#ifdef ENABLE_SHMEM
|
||||
extern void init_own_params(void);
|
||||
extern unsigned int init_other_params(void);
|
||||
extern unsigned int param_sync_done;
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
@@ -78,8 +83,9 @@ void init_once(void)
|
||||
hrt_init();
|
||||
|
||||
#ifdef ENABLE_SHMEM
|
||||
PX4_INFO("Syncing params to shared memory\n");
|
||||
init_params();
|
||||
PX4_INFO("Starting shared memory param sync\n");
|
||||
init_own_params();
|
||||
param_sync_done=init_other_params();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015 Vijay Venkatraman. All rights reserved.
|
||||
* Copyright (c) 2015 Ramakrishna Kintada. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -31,6 +32,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <px4_defines.h>
|
||||
#include <px4_posix.h>
|
||||
#include <string.h>
|
||||
@@ -56,8 +58,8 @@
|
||||
|
||||
int mem_fd;
|
||||
unsigned char *map_base, *virt_addr;
|
||||
struct shmem_info *shmem_info_p;
|
||||
static void *map_memory(off_t target);
|
||||
struct shmem_info* shmem_info_p;
|
||||
static void* map_memory(off_t target);
|
||||
|
||||
int get_shmem_lock(void);
|
||||
void release_shmem_lock(void);
|
||||
@@ -236,6 +238,7 @@ static void update_index_from_shmem(void)
|
||||
release_shmem_lock();
|
||||
}
|
||||
|
||||
|
||||
static void update_value_from_shmem(param_t param, union param_value_u *value)
|
||||
{
|
||||
unsigned int byte_changed, bit_changed;
|
||||
|
||||
@@ -61,10 +61,12 @@ static int writer_main(int argc, char *argv[])
|
||||
|
||||
int fd = px4_open(TESTDEV, PX4_F_WRONLY);
|
||||
|
||||
int fd = px4_open(TESTDEV, PX4_F_WRONLY);
|
||||
if (fd < 0) {
|
||||
PX4_INFO("Writer: Open failed %d %d", fd, px4_errno);
|
||||
return -px4_errno;
|
||||
}
|
||||
src/platforms/posix/tests/vcdev_test/vcdevtest_example.cpp
|
||||
|
||||
int ret;
|
||||
int i = 0;
|
||||
@@ -92,6 +94,12 @@ static int writer_main(int argc, char *argv[])
|
||||
|
||||
class PrivData
|
||||
{
|
||||
PrivData() : _read_offset(0) {}
|
||||
~PrivData() {}
|
||||
|
||||
size_t _read_offset;
|
||||
};
|
||||
|
||||
public:
|
||||
PrivData() : _read_offset(0) {}
|
||||
~PrivData() {}
|
||||
@@ -321,12 +329,16 @@ int VCDevExample::main()
|
||||
(char *const *)NULL);
|
||||
|
||||
ret = 0;
|
||||
|
||||
PX4_INFO("TEST: BLOCKING POLL ---------------");
|
||||
|
||||
if (do_poll(fd, -1, 3, 0)) {
|
||||
ret = 1;
|
||||
goto fail2;
|
||||
PX4_INFO("TEST: ZERO TIMEOUT POLL -----------");
|
||||
if(do_poll(fd, 0, 3, 0)) {
|
||||
ret = 1;
|
||||
goto fail2;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
PX4_INFO("TEST: ZERO TIMEOUT POLL -----------");
|
||||
|
||||
@@ -77,10 +77,20 @@ typedef sem_t px4_sem_t;
|
||||
|
||||
#define px4_sem_init sem_init
|
||||
#define px4_sem_wait sem_wait
|
||||
|
||||
#define px4_sem_post sem_post
|
||||
#define px4_sem_getvalue sem_getvalue
|
||||
#define px4_sem_destroy sem_destroy
|
||||
|
||||
#if 0
|
||||
// TODO: Implement this function or remove it from the implementation.
|
||||
// #define px4_sem_timedwait sem_timedwait
|
||||
inline int px4_sem_timedwait(px4_sem_t *sem, const struct timespec *abstime)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __PX4_QURT
|
||||
__EXPORT int px4_sem_timedwait(px4_sem_t *sem, const struct timespec *abstime);
|
||||
#else
|
||||
|
||||
@@ -73,30 +73,30 @@ static void run_cmd(map<string, px4_main_t> &apps, const vector<string> &appargs
|
||||
string command = appargs[0];
|
||||
|
||||
//replaces app.find with iterator code to avoid null pointer exception
|
||||
for (map<string, px4_main_t>::iterator it = apps.begin(); it != apps.end(); ++it)
|
||||
if (it->first == command) {
|
||||
const char *arg[2 + 1];
|
||||
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
|
||||
if (it->first == command) {
|
||||
const char *arg[2 + 1];
|
||||
|
||||
unsigned int i = 0;
|
||||
|
||||
while (i < appargs.size() && appargs[i].c_str()[0] != '\0') {
|
||||
arg[i] = (char *)appargs[i].c_str();
|
||||
PX4_WARN(" arg%d = '%s'\n", i, arg[i]);
|
||||
++i;
|
||||
}
|
||||
|
||||
arg[i] = (char *)0;
|
||||
|
||||
//PX4_DEBUG_PRINTF(i);
|
||||
if (apps[command] == NULL) {
|
||||
PX4_ERR("Null function !!\n");
|
||||
|
||||
} else {
|
||||
apps[command](i, (char **)arg);
|
||||
break;
|
||||
}
|
||||
unsigned int i = 0;
|
||||
|
||||
while (i < appargs.size() && appargs[i].c_str()[0] != '\0') {
|
||||
arg[i] = (char *)appargs[i].c_str();
|
||||
PX4_WARN(" arg%d = '%s'\n", i, arg[i]);
|
||||
++i;
|
||||
}
|
||||
|
||||
arg[i] = (char *)0;
|
||||
|
||||
//PX4_DEBUG_PRINTF(i);
|
||||
if (apps[command] == NULL) {
|
||||
PX4_ERR("Null function !!\n");
|
||||
|
||||
} else {
|
||||
apps[command](i, (char **)arg);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void eat_whitespace(const char *&b, int &i)
|
||||
@@ -115,6 +115,7 @@ static void process_commands(map<string, px4_main_t> &apps, const char *cmds)
|
||||
const char *b = cmds;
|
||||
char arg[256];
|
||||
|
||||
|
||||
// Eat leading whitespace
|
||||
eat_whitespace(b, i);
|
||||
|
||||
|
||||
@@ -71,7 +71,9 @@ unsigned int sleep(unsigned int sec)
|
||||
}
|
||||
|
||||
extern void hrt_init(void);
|
||||
extern void init_params();
|
||||
extern void init_own_params();
|
||||
extern unsigned int init_other_params();
|
||||
extern unsigned int param_sync_done;
|
||||
|
||||
#if 0
|
||||
void qurt_log(const char *fmt, ...)
|
||||
@@ -110,8 +112,9 @@ void init_once(void)
|
||||
hrt_init();
|
||||
PX4_WARN("after calling hrt_init");
|
||||
|
||||
/* Shared memory param sync*/
|
||||
init_params();
|
||||
/*Shared memory param sync*/
|
||||
init_own_params();
|
||||
param_sync_done=init_other_params();
|
||||
}
|
||||
|
||||
void init(int argc, char *argv[], const char *app_name)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015 Ramakrishna Kintada. All rights reserved.
|
||||
|
||||
Reference in New Issue
Block a user