mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 03:33:34 +08:00
Removed extra abstracton layer in systemlib
The calls to task_spawn_cmd, kill_all, and systemreset were wrappers
around the px4_{task_spawn_cmd|kill_all|systemreset} implementations.
Removed the wrappers and changed all calls to the px4_ equivalents.
NuttX specific code was moved into px4_tasks.h
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -113,7 +113,7 @@ usage(const char *reason)
|
||||
* Makefile does only apply to this management task.
|
||||
*
|
||||
* The actual stack size should be set in the call
|
||||
* to task_spawn_cmd().
|
||||
* to px4_task_spawn_cmd().
|
||||
*/
|
||||
int attitude_estimator_ekf_main(int argc, char *argv[])
|
||||
{
|
||||
@@ -131,7 +131,7 @@ int attitude_estimator_ekf_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
thread_should_exit = false;
|
||||
attitude_estimator_ekf_task = task_spawn_cmd("attitude_estimator_ekf",
|
||||
attitude_estimator_ekf_task = px4_task_spawn_cmd("attitude_estimator_ekf",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
7700,
|
||||
|
||||
@@ -132,7 +132,7 @@ usage(const char *reason)
|
||||
* Makefile does only apply to this management task.
|
||||
*
|
||||
* The actual stack size should be set in the call
|
||||
* to task_spawn_cmd().
|
||||
* to px4_px4_task_spawn_cmd().
|
||||
*/
|
||||
int attitude_estimator_so3_main(int argc, char *argv[])
|
||||
{
|
||||
@@ -149,7 +149,7 @@ int attitude_estimator_so3_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
thread_should_exit = false;
|
||||
attitude_estimator_so3_task = task_spawn_cmd("attitude_estimator_so3",
|
||||
attitude_estimator_so3_task = px4_px4_task_spawn_cmd("attitude_estimator_so3",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
14000,
|
||||
|
||||
@@ -225,7 +225,7 @@ BottleDrop::start()
|
||||
ASSERT(_main_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_main_task = task_spawn_cmd("bottle_drop",
|
||||
_main_task = px4_task_spawn_cmd("bottle_drop",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_DEFAULT + 15,
|
||||
1500,
|
||||
|
||||
@@ -269,7 +269,7 @@ int commander_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
thread_should_exit = false;
|
||||
daemon_task = task_spawn_cmd("commander",
|
||||
daemon_task = px4_task_spawn_cmd("commander",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 40,
|
||||
3400,
|
||||
@@ -2652,13 +2652,13 @@ void *commander_low_prio_loop(void *arg)
|
||||
answer_command(cmd, VEHICLE_CMD_RESULT_ACCEPTED);
|
||||
usleep(100000);
|
||||
/* reboot */
|
||||
systemreset(false);
|
||||
px4_systemreset(false);
|
||||
|
||||
} else if (((int)(cmd.param1)) == 3) {
|
||||
answer_command(cmd, VEHICLE_CMD_RESULT_ACCEPTED);
|
||||
usleep(100000);
|
||||
/* reboot to bootloader */
|
||||
systemreset(true);
|
||||
px4_systemreset(true);
|
||||
|
||||
} else {
|
||||
answer_command(cmd, VEHICLE_CMD_RESULT_DENIED);
|
||||
|
||||
@@ -1038,7 +1038,7 @@ int AttitudePositionEstimatorEKF::start()
|
||||
ASSERT(_estimator_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_estimator_task = task_spawn_cmd("ekf_att_pos_estimator",
|
||||
_estimator_task = px4_task_spawn_cmd("ekf_att_pos_estimator",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 40,
|
||||
7500,
|
||||
|
||||
@@ -111,7 +111,7 @@ int fixedwing_backside_main(int argc, char *argv[])
|
||||
|
||||
thread_should_exit = false;
|
||||
|
||||
deamon_task = task_spawn_cmd("fixedwing_backside",
|
||||
deamon_task = px4_task_spawn_cmd("fixedwing_backside",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 10,
|
||||
5120,
|
||||
|
||||
@@ -1117,7 +1117,7 @@ FixedwingAttitudeControl::start()
|
||||
ASSERT(_control_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_control_task = task_spawn_cmd("fw_att_control",
|
||||
_control_task = px4_task_spawn_cmd("fw_att_control",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
1600,
|
||||
|
||||
@@ -1621,7 +1621,7 @@ FixedwingPositionControl::start()
|
||||
ASSERT(_control_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_control_task = task_spawn_cmd("fw_pos_control_l1",
|
||||
_control_task = px4_task_spawn_cmd("fw_pos_control_l1",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
1600,
|
||||
|
||||
@@ -136,7 +136,7 @@ static int land_detector_start(const char *mode)
|
||||
}
|
||||
|
||||
//Start new thread task
|
||||
_landDetectorTaskID = task_spawn_cmd("land_detector",
|
||||
_landDetectorTaskID = px4_task_spawn_cmd("land_detector",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_DEFAULT,
|
||||
1000,
|
||||
|
||||
@@ -906,7 +906,7 @@ MulticopterAttitudeControl::start()
|
||||
ASSERT(_control_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_control_task = task_spawn_cmd("mc_att_control",
|
||||
_control_task = px4_task_spawn_cmd("mc_att_control",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
1500,
|
||||
|
||||
@@ -68,7 +68,7 @@ int mc_att_control_m_main(int argc, char *argv[])
|
||||
|
||||
task_should_exit = false;
|
||||
|
||||
daemon_task = task_spawn_cmd("mc_att_control_m",
|
||||
daemon_task = px4_task_spawn_cmd("mc_att_control_m",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
1900,
|
||||
|
||||
@@ -1423,7 +1423,7 @@ MulticopterPositionControl::start()
|
||||
ASSERT(_control_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_control_task = task_spawn_cmd("mc_pos_control",
|
||||
_control_task = px4_task_spawn_cmd("mc_pos_control",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
1500,
|
||||
|
||||
@@ -68,7 +68,7 @@ int mc_pos_control_m_main(int argc, char *argv[])
|
||||
|
||||
task_should_exit = false;
|
||||
|
||||
daemon_task = task_spawn_cmd("mc_pos_control_m",
|
||||
daemon_task = px4_task_spawn_cmd("mc_pos_control_m",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
2500,
|
||||
|
||||
@@ -515,7 +515,7 @@ Navigator::start()
|
||||
ASSERT(_navigator_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_navigator_task = task_spawn_cmd("navigator",
|
||||
_navigator_task = px4_task_spawn_cmd("navigator",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_DEFAULT + 20,
|
||||
1700,
|
||||
|
||||
@@ -153,7 +153,7 @@ int position_estimator_inav_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
thread_should_exit = false;
|
||||
position_estimator_inav_task = task_spawn_cmd("position_estimator_inav",
|
||||
position_estimator_inav_task = px4_task_spawn_cmd("position_estimator_inav",
|
||||
SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 5000,
|
||||
position_estimator_inav_thread_main,
|
||||
(argv) ? (char * const *) &argv[2] : (char * const *) NULL);
|
||||
|
||||
@@ -106,7 +106,7 @@ int segway_main(int argc, char *argv[])
|
||||
|
||||
thread_should_exit = false;
|
||||
|
||||
deamon_task = task_spawn_cmd("segway",
|
||||
deamon_task = px4_task_spawn_cmd("segway",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 10,
|
||||
5120,
|
||||
|
||||
@@ -2252,7 +2252,7 @@ Sensors::start()
|
||||
ASSERT(_sensors_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_sensors_task = task_spawn_cmd("sensors_task",
|
||||
_sensors_task = px4_task_spawn_cmd("sensors_task",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
2000,
|
||||
|
||||
@@ -42,7 +42,6 @@ SRCS = err.c \
|
||||
cpuload.c \
|
||||
getopt_long.c \
|
||||
pid/pid.c \
|
||||
systemlib.c \
|
||||
airspeed.c \
|
||||
system_params.c \
|
||||
mavlink_log.c \
|
||||
|
||||
@@ -42,31 +42,12 @@
|
||||
#include <float.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
|
||||
// OS specific settings defined in px4_tasks.h
|
||||
#include <px4_tasks.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/** Reboots the board */
|
||||
__EXPORT void systemreset(bool to_bootloader) noreturn_function;
|
||||
|
||||
/** Sends SIGUSR1 to all processes */
|
||||
__EXPORT void killall(void);
|
||||
|
||||
/** Default scheduler type */
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
# define SCHED_DEFAULT SCHED_RR
|
||||
#else
|
||||
# define SCHED_DEFAULT SCHED_FIFO
|
||||
#endif
|
||||
|
||||
/** Starts a task and performs any specific accounting, scheduler setup, etc. */
|
||||
__EXPORT int task_spawn_cmd(const char *name,
|
||||
int priority,
|
||||
int scheduler,
|
||||
int stack_size,
|
||||
px4_main_t entry,
|
||||
char * const argv[]);
|
||||
|
||||
enum MULT_PORTS {
|
||||
MULT_0_US2_RXTX = 0,
|
||||
MULT_1_US2_FLOW,
|
||||
|
||||
@@ -194,7 +194,7 @@ int UavcanNode::start(uavcan::NodeID node_id, uint32_t bitrate)
|
||||
* Start the task. Normally it should never exit.
|
||||
*/
|
||||
static auto run_trampoline = [](int, char *[]) {return UavcanNode::_instance->run();};
|
||||
_instance->_task = task_spawn_cmd("uavcan", SCHED_DEFAULT, SCHED_PRIORITY_ACTUATOR_OUTPUTS, StackSize,
|
||||
_instance->_task = px4_task_spawn_cmd("uavcan", SCHED_DEFAULT, SCHED_PRIORITY_ACTUATOR_OUTPUTS, StackSize,
|
||||
static_cast<main_t>(run_trampoline), nullptr);
|
||||
|
||||
if (_instance->_task < 0) {
|
||||
|
||||
@@ -861,7 +861,7 @@ VtolAttitudeControl::start()
|
||||
ASSERT(_control_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_control_task = task_spawn_cmd("vtol_att_control",
|
||||
_control_task = px4_task_spawn_cmd("vtol_att_control",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 10,
|
||||
2048,
|
||||
|
||||
Reference in New Issue
Block a user