qurt: replacing qurt threads with pthread

This commit is contained in:
Zachary Lowell 2022-10-03 17:01:04 -05:00 committed by GitHub
parent 4b687beb3b
commit 4520186878
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

View File

@ -35,7 +35,7 @@ set(HEXAGON_SDK_INCLUDES
${HEXAGON_SDK_ROOT}/incs
${HEXAGON_SDK_ROOT}/incs/stddef
${HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include/qurt
# ${HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include/posix
${HEXAGON_SDK_ROOT}/rtos/qurt/computev66/include/posix
${HEXAGON_SDK_ROOT}/tools/HEXAGON_Tools/8.4.05/Tools/target/hexagon/include
)
@ -100,7 +100,6 @@ set(ARCHCPUFLAGS
add_definitions(
-D __QURT
-D _PROVIDE_POSIX_TIME_DECLS
-D _TIMER_T
-D _HAS_C9X
-D restrict=__restrict__
-D noreturn_function=

View File

@ -36,6 +36,7 @@
#include <qurt.h>
#include <qurt_thread.h>
#include <pthread.h>
// TODO: Move this out of here once we have px4-log functionality
extern "C" void HAP_debug(const char *msg, int level, const char *filename, int line);
@ -45,7 +46,7 @@ static MUORBTestType test_to_run;
fc_func_ptrs muorb_func_ptrs;
static void test_runner(void *test)
static void *test_runner(void *test)
{
HAP_debug("test_runner called", 1, muorb_test_topic_name, 0);
@ -74,7 +75,7 @@ static void test_runner(void *test)
break;
}
qurt_thread_exit(0);
return nullptr;
}
int px4muorb_orb_initialize(fc_func_ptrs *func_ptrs, int32_t clock_offset_us)
@ -93,14 +94,13 @@ char stack[TEST_STACK_SIZE];
void run_test(MUORBTestType test)
{
qurt_thread_t tid;
qurt_thread_attr_t attr;
qurt_thread_attr_init(&attr);
qurt_thread_attr_set_stack_addr(&attr, stack);
qurt_thread_attr_set_stack_size(&attr, TEST_STACK_SIZE);
pthread_t tid;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, TEST_STACK_SIZE);
test_to_run = test;
(void) qurt_thread_create(&tid, &attr, &test_runner, (void *) &test_to_run);
pthread_create(&tid, &attr, &test_runner, (void *) &test_to_run);
pthread_attr_destroy(&attr);
}
int px4muorb_topic_advertised(const char *topic_name)