mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 21:55:34 +08:00
worker and HRT threads for Qurt platform (#20739)
* Getting work manager and hrt threads ready for Qurt platform
This commit is contained in:
@@ -104,6 +104,13 @@ typedef struct {
|
||||
// Qurt has no fsync implementation so need to declare one here
|
||||
// and then define a fake one in the Qurt platform code.
|
||||
void fsync(int fd);
|
||||
// Qurt doesn't have a way to set the scheduler policy. It is always, essentially,
|
||||
// SCHED_FIFO. So have to add a fake function for the code that tries to set it.
|
||||
#include <pthread.h>
|
||||
__EXPORT int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
|
||||
// Qurt POSIX implementation doesn't define the SIGCONT signal so we just map it
|
||||
// to a reasonable alternative
|
||||
#define SIGCONT SIGALRM
|
||||
#endif
|
||||
|
||||
__EXPORT int px4_open(const char *path, int flags, ...);
|
||||
|
||||
@@ -267,9 +267,7 @@ WorkQueueManagerRun(int, char **)
|
||||
// create new work queue
|
||||
|
||||
// stack size
|
||||
#if defined(__PX4_QURT)
|
||||
const size_t stacksize = math::max(8 * 1024, PX4_STACK_ADJUSTED(wq->stacksize));
|
||||
#elif defined(__PX4_NUTTX)
|
||||
#if defined(__PX4_NUTTX) || defined(__PX4_QURT)
|
||||
const size_t stacksize = math::max(PTHREAD_STACK_MIN, PX4_STACK_ADJUSTED(wq->stacksize));
|
||||
#elif defined(__PX4_POSIX)
|
||||
// On posix system , the desired stacksize round to the nearest multiplier of the system pagesize
|
||||
@@ -304,8 +302,6 @@ WorkQueueManagerRun(int, char **)
|
||||
PX4_ERR("getting sched param for %s failed (%i)", wq->name, ret_getschedparam);
|
||||
}
|
||||
|
||||
#ifndef __PX4_QURT
|
||||
|
||||
// schedule policy FIFO
|
||||
int ret_setschedpolicy = pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
|
||||
|
||||
@@ -313,8 +309,6 @@ WorkQueueManagerRun(int, char **)
|
||||
PX4_ERR("failed to set sched policy SCHED_FIFO (%i)", ret_setschedpolicy);
|
||||
}
|
||||
|
||||
#endif // ! QuRT
|
||||
|
||||
// priority
|
||||
param.sched_priority = sched_priority;
|
||||
int ret_setschedparam = pthread_attr_setschedparam(&attr, ¶m);
|
||||
|
||||
@@ -293,4 +293,3 @@ void hrt_work_queue_init(void)
|
||||
signal(SIGCONT, _sighandler);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user