mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-30 01:30:35 +08:00
enable px4 flight for excelsior(legacy)
This commit is contained in:
committed by
Lorenz Meier
parent
12767c8538
commit
b693e29d64
@@ -169,7 +169,7 @@ typedef struct {
|
||||
|
||||
int do_accel_calibration(orb_advert_t *mavlink_log_pub)
|
||||
{
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
int fd;
|
||||
#endif
|
||||
|
||||
@@ -189,7 +189,7 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
/* reset all sensors */
|
||||
for (unsigned s = 0; s < max_accel_sens; s++) {
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
sprintf(str, "%s%u", ACCEL_BASE_DEVICE_PATH, s);
|
||||
/* reset all offsets to zero and all scales to one */
|
||||
fd = px4_open(str, 0);
|
||||
@@ -323,7 +323,7 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub)
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
sprintf(str, "%s%u", ACCEL_BASE_DEVICE_PATH, i);
|
||||
fd = px4_open(str, 0);
|
||||
|
||||
@@ -413,7 +413,7 @@ calibrate_return do_accel_calibration_measurements(orb_advert_t *mavlink_log_pub
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(__PX4_QURT) || defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_RPI) || defined(__PX4_POSIX_BEBOP)
|
||||
#if defined(__PX4_QURT) || defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_EXCELSIOR)|| defined(__PX4_POSIX_RPI) || defined(__PX4_POSIX_BEBOP)
|
||||
// For QURT respectively the driver framework, we need to get the device ID by copying one report.
|
||||
struct accel_report accel_report;
|
||||
orb_copy(ORB_ID(sensor_accel), worker_data.subs[i], &accel_report);
|
||||
|
||||
@@ -180,7 +180,7 @@ int do_gyro_calibration(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
// Reset all offsets to 0 and scales to 1
|
||||
(void)memcpy(&worker_data.gyro_scale[s], &gyro_scale_zero, sizeof(gyro_scale_zero));
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
sprintf(str, "%s%u", GYRO_BASE_DEVICE_PATH, s);
|
||||
int fd = px4_open(str, 0);
|
||||
if (fd >= 0) {
|
||||
@@ -233,7 +233,7 @@ int do_gyro_calibration(orb_advert_t *mavlink_log_pub)
|
||||
for (unsigned s = 0; s < gyro_count; s++) {
|
||||
|
||||
worker_data.gyro_sensor_sub[s] = orb_subscribe_multi(ORB_ID(sensor_gyro), s);
|
||||
#if defined(__PX4_QURT) || defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_RPI) || defined(__PX4_POSIX_BEBOP)
|
||||
#if defined(__PX4_QURT) || defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_EXCELSIOR) || defined(__PX4_POSIX_RPI) || defined(__PX4_POSIX_BEBOP)
|
||||
// For QURT respectively the driver framework, we need to get the device ID by copying one report.
|
||||
struct gyro_report gyro_report;
|
||||
orb_copy(ORB_ID(sensor_gyro), worker_data.gyro_sensor_sub[s], &gyro_report);
|
||||
@@ -331,7 +331,7 @@ int do_gyro_calibration(orb_advert_t *mavlink_log_pub)
|
||||
(void)sprintf(str, "CAL_GYRO%u_ID", s);
|
||||
failed |= (PX4_OK != param_set_no_notification(param_find(str), &(worker_data.device_id[s])));
|
||||
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
/* apply new scaling and offsets */
|
||||
(void)sprintf(str, "%s%u", GYRO_BASE_DEVICE_PATH, s);
|
||||
int fd = px4_open(str, 0);
|
||||
|
||||
@@ -177,7 +177,7 @@ static px4_sem_t g_sys_state_mutex;
|
||||
/* The data manager store file handle and file name */
|
||||
static int g_fd = -1;
|
||||
static int g_task_fd = -1;
|
||||
#ifdef __PX4_POSIX_EAGLE
|
||||
#if defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_EXCELSIOR)
|
||||
static const char *default_device_path = PX4_ROOTFSDIR"/dataman";
|
||||
#else
|
||||
static const char *default_device_path = PX4_ROOTFSDIR"/fs/microsd/dataman";
|
||||
|
||||
@@ -222,7 +222,7 @@ private:
|
||||
static constexpr size_t MAX_TOPICS_NUM = 64; /**< Maximum number of logged topics */
|
||||
static constexpr unsigned MAX_NO_LOGFOLDER = 999; /**< Maximum number of log dirs */
|
||||
static constexpr unsigned MAX_NO_LOGFILE = 999; /**< Maximum number of log files */
|
||||
#ifdef __PX4_POSIX_EAGLE
|
||||
#if defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_EXCELSIOR)
|
||||
static constexpr const char *LOG_ROOT = PX4_ROOTFSDIR"/log";
|
||||
#else
|
||||
static constexpr const char *LOG_ROOT = PX4_ROOTFSDIR"/fs/microsd/log";
|
||||
|
||||
@@ -377,7 +377,7 @@ private:
|
||||
|
||||
unsigned _write_err_count = 0;
|
||||
static const unsigned write_err_threshold = 5;
|
||||
#ifndef __PX4_POSIX_EAGLE
|
||||
#if !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR)
|
||||
FILE *_fp = nullptr;
|
||||
#endif
|
||||
|
||||
@@ -387,7 +387,7 @@ protected:
|
||||
|
||||
~MavlinkStreamStatustext()
|
||||
{
|
||||
#ifndef __PX4_POSIX_EAGLE
|
||||
#if !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR)
|
||||
|
||||
if (_fp != nullptr) {
|
||||
fclose(_fp);
|
||||
@@ -413,7 +413,7 @@ protected:
|
||||
mavlink_msg_statustext_send_struct(_mavlink->get_channel(), &msg);
|
||||
|
||||
// TODO: the logging doesn't work on Snapdragon yet because of file paths.
|
||||
#ifndef __PX4_POSIX_EAGLE
|
||||
#if !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR)
|
||||
/* write log messages in first instance to disk
|
||||
* timestamp each message with gps time
|
||||
*/
|
||||
|
||||
@@ -170,7 +170,7 @@ MavlinkOrbSubscription::is_published()
|
||||
// We are checking now
|
||||
_last_pub_check = now;
|
||||
|
||||
#if defined(__PX4_QURT) || defined(__PX4_POSIX_EAGLE)
|
||||
#if defined(__PX4_QURT) || defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_EXCELSIOR)
|
||||
|
||||
// Snapdragon has currently no support for orb_exists, therefore
|
||||
// we're not using it.
|
||||
|
||||
@@ -84,6 +84,10 @@ int calc_timer_diff_to_dsp_us(int32_t *time_diff_us);
|
||||
|
||||
int calc_timer_diff_to_dsp_us(int32_t *time_diff_us)
|
||||
{
|
||||
#if defined(__PX4_POSIX_EXCELSIOR)
|
||||
*time_diff_us = 0;
|
||||
return 0;
|
||||
#endif
|
||||
int fd = open(DSP_TIMER_FILE, O_RDONLY);
|
||||
|
||||
if (fd < 0) {
|
||||
|
||||
@@ -156,7 +156,7 @@ static bool _extended_logging = false;
|
||||
static bool _gpstime_only = false;
|
||||
static int32_t _utc_offset = 0;
|
||||
|
||||
#ifndef __PX4_POSIX_EAGLE
|
||||
#if !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR)
|
||||
#define MOUNTPOINT PX4_ROOTFSDIR"/fs/microsd"
|
||||
#else
|
||||
#define MOUNTPOINT "/root"
|
||||
@@ -745,7 +745,7 @@ void sdlog2_start_log()
|
||||
/* initialize log buffer emptying thread */
|
||||
pthread_attr_init(&logwriter_attr);
|
||||
|
||||
#ifndef __PX4_POSIX_EAGLE
|
||||
#if !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR)
|
||||
struct sched_param param;
|
||||
(void)pthread_attr_getschedparam(&logwriter_attr, ¶m);
|
||||
/* low priority, as this is expensive disk I/O. */
|
||||
|
||||
@@ -449,6 +449,7 @@ uORB::DeviceNode::publish(const orb_metadata *meta, orb_advert_t handle, const v
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#if !defined(__PX4_QURT_EXCELSIOR) && !defined(__PX4_POSIX_EXCELSIOR)
|
||||
/*
|
||||
* if the write is successful, send the data over the Multi-ORB link
|
||||
*/
|
||||
@@ -462,6 +463,7 @@ uORB::DeviceNode::publish(const orb_metadata *meta, orb_advert_t handle, const v
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ uorb_main(int argc, char *argv[])
|
||||
return -errno;
|
||||
}
|
||||
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE)
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_EAGLE) && !defined(__PX4_POSIX_EXCELSIOR)
|
||||
/* FIXME: this fails on Snapdragon (see https://github.com/PX4/Firmware/issues/5406),
|
||||
* so we disable logging messages to the ulog for now. This needs further investigations.
|
||||
*/
|
||||
|
||||
@@ -273,7 +273,7 @@ bool px4_exit_requested(void)
|
||||
|
||||
static void set_cpu_scaling()
|
||||
{
|
||||
#ifdef __PX4_POSIX_EAGLE
|
||||
#if defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_EXCELSIOR)
|
||||
// On Snapdragon we miss updates in sdlog2 unless all 4 CPUs are run
|
||||
// at the maximum frequency all the time.
|
||||
// Interestingely, cpu0 and cpu3 set the scaling for all 4 CPUs on Snapdragon.
|
||||
|
||||
@@ -192,7 +192,7 @@ __BEGIN_DECLS
|
||||
extern long PX4_TICKS_PER_SEC;
|
||||
__END_DECLS
|
||||
|
||||
# if defined(__PX4_POSIX_EAGLE)
|
||||
# if defined(__PX4_POSIX_EAGLE) || defined(__PX4_POSIX_EXCELSIOR)
|
||||
# define PX4_ROOTFSDIR "/home/linaro"
|
||||
# elif defined(__PX4_POSIX_BEBOP)
|
||||
# define PX4_ROOTFSDIR "/data/ftp/internal_000"
|
||||
|
||||
@@ -49,10 +49,11 @@
|
||||
//#define SHMEM_DEBUG
|
||||
//#define PARAM_LOCK_DEBUG
|
||||
|
||||
static atomic_word_t mem_lock;
|
||||
|
||||
int mem_fd;
|
||||
unsigned char *map_base, *virt_addr;
|
||||
struct shmem_info *shmem_info_p;
|
||||
static void *map_memory(off_t target);
|
||||
int get_shmem_lock(const char *caller_file_name, int caller_line_number);
|
||||
void release_shmem_lock(const char *caller_file_name, int caller_line_number);
|
||||
void init_shared_memory(void);
|
||||
@@ -82,24 +83,16 @@ struct param_wbuf_s {
|
||||
};
|
||||
extern struct param_wbuf_s *param_find_changed(param_t param);
|
||||
|
||||
static void *map_memory(off_t target)
|
||||
{
|
||||
|
||||
return (void *)(target + LOCK_SIZE);
|
||||
|
||||
}
|
||||
|
||||
int get_shmem_lock(const char *caller_file_name, int caller_line_number)
|
||||
{
|
||||
unsigned char *lock = (unsigned char *)(MAP_ADDRESS + LOCK_OFFSET);
|
||||
unsigned int i = 0;
|
||||
|
||||
#ifdef PARAM_LOCK_DEBUG
|
||||
PX4_INFO("lock value %d before get from %s, line: %d\n", *(unsigned int *)0xfbfc000, strrchr(caller_file_name, '/'),
|
||||
PX4_INFO("lock value %d before get from %s, line: %d\n", mem_lock.value, strrchr(caller_file_name, '/'),
|
||||
caller_line_number);
|
||||
#endif
|
||||
|
||||
while (!atomic_compare_and_set(lock, 1, 0)) {
|
||||
while (!atomic_compare_and_set(&mem_lock, 1, 0)) {
|
||||
i++;
|
||||
usleep(1000);
|
||||
|
||||
@@ -124,9 +117,7 @@ int get_shmem_lock(const char *caller_file_name, int caller_line_number)
|
||||
|
||||
void release_shmem_lock(const char *caller_file_name, int caller_line_number)
|
||||
{
|
||||
unsigned char *lock = (unsigned char *)(MAP_ADDRESS + LOCK_OFFSET);
|
||||
|
||||
*lock = 1;
|
||||
atomic_set(&mem_lock, 1);
|
||||
|
||||
#ifdef PARAM_LOCK_DEBUG
|
||||
PX4_INFO("release lock, file name: %s, line number: %d.\n",
|
||||
@@ -138,25 +129,31 @@ void release_shmem_lock(const char *caller_file_name, int caller_line_number)
|
||||
|
||||
void init_shared_memory(void)
|
||||
{
|
||||
//PX4_INFO("Value at lock address is %d\n", *(unsigned int*)0xfbfc000);
|
||||
int i;
|
||||
|
||||
if (shmem_info_p) {
|
||||
return;
|
||||
}
|
||||
|
||||
virt_addr = map_memory(MAP_ADDRESS);
|
||||
//virt_addr = map_memory(MAP_ADDRESS);
|
||||
map_base = malloc(0x4000); //16KB
|
||||
|
||||
if (map_base == NULL) {
|
||||
PX4_INFO("adsp memory malloc failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
virt_addr = map_base;
|
||||
shmem_info_p = (struct shmem_info *) virt_addr;
|
||||
|
||||
//init lock as 1
|
||||
unsigned char *lock = (unsigned char *)(MAP_ADDRESS + LOCK_OFFSET);
|
||||
*lock = 1;
|
||||
atomic_init(&mem_lock, 1);
|
||||
|
||||
for (i = 0; i < MAX_SHMEM_PARAMS / 8 + 1; i++) {
|
||||
shmem_info_p->krait_changed_index[i] = 0;
|
||||
}
|
||||
|
||||
//PX4_INFO("adsp memory mapped\n");
|
||||
PX4_INFO("adsp memory mapped\n");
|
||||
|
||||
}
|
||||
|
||||
void copy_params_to_shmem(struct param_info_s *param_info_base)
|
||||
|
||||
Reference in New Issue
Block a user