dpl_tasks.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
22 #include "os/os_task.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 struct dpl_task {
32  struct os_task t;
33 };
34 
38 typedef os_task_func_t dpl_task_func_t;
39 
59 static inline int dpl_task_init(struct dpl_task *t, const char *name, dpl_task_func_t func,
60  void *arg, uint8_t prio, dpl_time_t sanity_itvl,
61  dpl_stack_t *stack_bottom, uint16_t stack_size)
62 {
63  return os_task_init(&t->t, name, func, arg, prio, sanity_itvl, stack_bottom, stack_size);
64 }
70 static inline int dpl_task_remove(struct dpl_task *t)
71 {
72  return os_task_remove(&t->t);
73 }
74 
80 static inline uint8_t dpl_task_count(void)
81 {
82  return os_task_count();
83 }
84 
88 static inline void dpl_task_yield(void)
89 {
90  return os_task_yield();
91 }
92 
93 #ifdef __cplusplus
94 }
95 #endif
static void dpl_task_yield(void)
Lets current thread yield.
Definition: dpl_tasks.h:88
static int dpl_task_init(struct dpl_task *t, const char *name, dpl_task_func_t func, void *arg, uint8_t prio, dpl_time_t sanity_itvl, dpl_stack_t *stack_bottom, uint16_t stack_size)
Initialize a task.
Definition: dpl_tasks.h:59
static int dpl_task_remove(struct dpl_task *t)
removes specified task
Definition: dpl_tasks.h:70
os_task_func_t dpl_task_func_t
dpl task function
Definition: dpl_tasks.h:38
static uint8_t dpl_task_count(void)
Return the number of tasks initialized.
Definition: dpl_tasks.h:80
os_time_t dpl_time_t
dpl time type
Definition: dpl_types.h:56
os_stack_t dpl_stack_t
dpl stack buffer type
Definition: dpl_types.h:61
dpl task wrapper
Definition: dpl_tasks.h:31
struct os_task t
os task
Definition: dpl_tasks.h:32