mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 23:53:33 +08:00
QuRT: Changes to enable qurt target to build
QuRT doesn't support unlink and does not provide getpid(). The DSPAL layer provides access to usleep so an implementation is no longer needed. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -48,7 +48,6 @@
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <qurt.h>
|
||||
#include "systemlib/param/param.h"
|
||||
|
||||
|
||||
@@ -57,14 +56,10 @@ __BEGIN_DECLS
|
||||
// FIXME - sysconf(_SC_CLK_TCK) not supported
|
||||
long PX4_TICKS_PER_SEC = 1000;
|
||||
|
||||
void usleep(useconds_t usec) {
|
||||
qurt_timer_sleep(usec);
|
||||
}
|
||||
|
||||
unsigned int sleep(unsigned int sec)
|
||||
{
|
||||
for (unsigned int i=0; i< sec; i++)
|
||||
qurt_timer_sleep(1000000);
|
||||
usleep(1000000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +245,20 @@ int px4_task_kill(px4_task_t id, int sig)
|
||||
return rv;
|
||||
}
|
||||
|
||||
pid_t px4_getpid()
|
||||
{
|
||||
pthread_t pid = pthread_self();
|
||||
|
||||
// Get pthread ID from the opaque ID
|
||||
for (int i=0; i<PX4_MAX_TASKS; ++i) {
|
||||
if (taskmap[i].pid == pid) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
PX4_ERR("px4_getpid() called from non-thread context!");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
void px4_show_tasks()
|
||||
{
|
||||
int idx;
|
||||
|
||||
Reference in New Issue
Block a user