Add new 'task_spawn' interface for starting new tasks in the PX4 world

This commit is contained in:
px4dev
2012-10-01 00:02:38 -07:00
parent 6005077d54
commit 93c200d281
14 changed files with 130 additions and 24 deletions
+28 -3
View File
@@ -68,10 +68,10 @@ const struct __multiport_info multiport_info = {
****************************************************************************/
/****************************************************************************
* Public Functions
* Private Functions
****************************************************************************/
void kill_task(FAR _TCB *tcb, FAR void *arg);
static void kill_task(FAR _TCB *tcb, FAR void *arg);
/****************************************************************************
* user_start
@@ -116,11 +116,36 @@ void killall()
sched_foreach(kill_task, NULL);
}
void kill_task(FAR _TCB *tcb, FAR void *arg)
static void kill_task(FAR _TCB *tcb, FAR void *arg)
{
kill(tcb->pid, SIGUSR1);
}
int task_spawn(const char *name, int scheduler, int priority, int stack_size, main_t entry, const char *argv[])
{
int pid;
sched_lock();
/* create the task */
pid = task_create(name, priority, stack_size, entry, argv);
if (pid > 0) {
/* configure the scheduler */
struct sched_param param;
param.sched_priority = priority;
sched_setscheduler(pid, scheduler, &param);
/* XXX do any other private task accounting here */
}
sched_unlock();
return pid;
}
#define PX4_BOARD_ID_FMU (5)
int fmu_get_board_info(struct fmu_board_info_s *info)