Browse Source

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: Mark Charlebois <charlebm@gmail.com>
sbg
Mark Charlebois 10 years ago
parent
commit
e4a8f32f1b
  1. 1
      makefiles/posix/config_posix_default.mk
  2. 2
      src/platforms/posix/px4_layer/px4_posix_tasks.cpp
  3. 3
      src/platforms/qurt/px4_layer/module.mk
  4. 6
      src/platforms/qurt/px4_layer/px4_qurt_impl.cpp
  5. 13
      src/platforms/qurt/px4_layer/px4_qurt_tasks.cpp

1
makefiles/posix/config_posix_default.mk

@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
#
MODULES += drivers/device
MODULES += drivers/blinkm
MODULES += drivers/buzzer
MODULES += drivers/hil
MODULES += drivers/rgbled
MODULES += drivers/led

2
src/platforms/posix/px4_layer/px4_posix_tasks.cpp

@ -57,7 +57,7 @@ @@ -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;

3
src/platforms/qurt/px4_layer/module.mk

@ -40,6 +40,9 @@ SRCDIR=$(dir $(MODULE_MK)) @@ -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 \

6
src/platforms/qurt/px4_layer/px4_qurt_impl.cpp

@ -49,8 +49,11 @@ @@ -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) @@ -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();
}

13
src/platforms/qurt/px4_layer/px4_qurt_tasks.cpp

@ -57,7 +57,11 @@ @@ -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() @@ -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;
}

Loading…
Cancel
Save