Skip to content
Snippets Groups Projects
Commit e4a8f32f authored by Mark Charlebois's avatar Mark Charlebois
Browse files

QuRT: Added HRT workqueues as per POSIX


A high rate workqueue is required that acts like an interrupt handler
for a HW timer.

Signed-off-by: default avatarMark Charlebois <charlebm@gmail.com>
parent 83bcb959
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,6 @@
#
MODULES += drivers/device
MODULES += drivers/blinkm
MODULES += drivers/buzzer
MODULES += drivers/hil
MODULES += drivers/rgbled
MODULES += drivers/led
......
......@@ -57,7 +57,7 @@
#define MAX_CMD_LEN 100
#define PX4_MAX_TASKS 100
#define PX4_MAX_TASKS 50
#define SHELL_TASK_ID (PX4_MAX_TASKS+1)
pthread_t _shell_task_id = 0;
......
......@@ -40,6 +40,9 @@ SRCDIR=$(dir $(MODULE_MK))
SRCS = \
px4_qurt_impl.cpp \
px4_qurt_tasks.cpp \
hrt_thread.c \
hrt_queue.c \
hrt_work_cancel.c \
work_thread.c \
work_queue.c \
work_lock.c \
......
......@@ -49,8 +49,11 @@
#include <unistd.h>
#include <semaphore.h>
#include "systemlib/param/param.h"
#include "hrt_work.h"
extern pthread_t _shell_task_id;
__BEGIN_DECLS
// FIXME - sysconf(_SC_CLK_TCK) not supported
......@@ -92,7 +95,10 @@ void init_once(void)
// Required for QuRT
//_posix_init();
_shell_task_id = pthread_self();
PX4_INFO("Shell id is %lu", _shell_task_id);
work_queues_init();
hrt_work_queue_init();
hrt_init();
}
......
......@@ -57,7 +57,11 @@
#define MAX_CMD_LEN 100
#define PX4_MAX_TASKS 100
#define PX4_MAX_TASKS 50
#define SHELL_TASK_ID (PX4_MAX_TASKS+1)
pthread_t _shell_task_id = 0;
struct task_entry
{
pthread_t pid;
......@@ -269,13 +273,16 @@ int px4_getpid()
{
pthread_t pid = pthread_self();
if (pid == _shell_task_id)
return SHELL_TASK_ID;
// Get pthread ID from the opaque ID
for (int i=0; i<PX4_MAX_TASKS; ++i) {
if (taskmap[i].pid == pid) {
if (taskmap[i].isused && taskmap[i].pid == pid) {
return i;
}
}
PX4_ERR("px4_getpid() called from non-thread context!");
PX4_ERR("px4_getpid() called from unknown thread context!");
return -EINVAL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment