Browse Source

px4_task_spawn_cmd: launch kernel thread in protected/kernel build on kernel side

Also task name is accessible only in kernel side for protected/kernel build

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
master
Jukka Laitinen 4 years ago committed by Daniel Agar
parent
commit
3aab4d2daf
  1. 7
      platforms/nuttx/src/px4/common/tasks.cpp

7
platforms/nuttx/src/px4/common/tasks.cpp

@ -42,6 +42,7 @@ @@ -42,6 +42,7 @@
#include <px4_platform_common/tasks.h>
#include <nuttx/board.h>
#include <nuttx/kthread.h>
#include <sys/wait.h>
#include <stdbool.h>
@ -67,8 +68,12 @@ int px4_task_spawn_cmd(const char *name, int scheduler, int priority, int stack_ @@ -67,8 +68,12 @@ int px4_task_spawn_cmd(const char *name, int scheduler, int priority, int stack_
clearenv();
#endif
#if !defined(__KERNEL__)
/* create the task */
int pid = task_create(name, priority, stack_size, entry, argv);
#else
int pid = kthread_create(name, priority, stack_size, entry, argv);
#endif
if (pid > 0) {
/* configure the scheduler */
@ -88,7 +93,7 @@ int px4_task_delete(int pid) @@ -88,7 +93,7 @@ int px4_task_delete(int pid)
const char *px4_get_taskname(void)
{
#if CONFIG_TASK_NAME_SIZE > 0
#if CONFIG_TASK_NAME_SIZE > 0 && (defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT))
FAR struct tcb_s *thisproc = nxsched_self();
return thisproc->name;

Loading…
Cancel
Save