mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 14:03:33 +08:00
POSIX: fixed hrt call and workqueue implementation
The HRT call processing normally happens via HW timer interrupt handler. Since the POSIX port has no ISR handling, the HP work queue is used. Instead of irq_save() and irq_restore() calls to disable/enable interrupts, a mutex is used to protect each queue. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -55,32 +55,20 @@ extern void hrt_init(void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
extern struct wqueue_s gwork[NWORKERS];
|
||||
|
||||
namespace px4
|
||||
{
|
||||
|
||||
void init_once(void);
|
||||
|
||||
void init_once(void)
|
||||
{
|
||||
work_queues_init();
|
||||
hrt_init();
|
||||
}
|
||||
|
||||
void init(int argc, char *argv[], const char *app_name)
|
||||
{
|
||||
printf("App name: %s\n", app_name);
|
||||
|
||||
// Create high priority worker thread
|
||||
g_work[HPWORK].pid = px4_task_spawn_cmd("wkr_high",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX,
|
||||
2000,
|
||||
work_hpthread,
|
||||
(char* const*)NULL);
|
||||
|
||||
// Create low priority worker thread
|
||||
g_work[LPWORK].pid = px4_task_spawn_cmd("wkr_low",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MIN,
|
||||
2000,
|
||||
work_lpthread,
|
||||
(char* const*)NULL);
|
||||
|
||||
hrt_init();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user