Loading...
Searching...
No Matches
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
20#ifndef DPL_DPL_TASKS_H
21#define DPL_DPL_TASKS_H
22
23#include "os/os_task.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
32struct dpl_task {
33 struct os_task t;
34};
35
39typedef os_task_func_t dpl_task_func_t;
40
60static inline int dpl_task_init(struct dpl_task *t, const char *name, dpl_task_func_t func,
61 void *arg, uint8_t prio, dpl_time_t sanity_itvl,
62 dpl_stack_t *stack_bottom, uint16_t stack_size)
63{
64 return os_task_init(&t->t, name, func, arg, prio, sanity_itvl, stack_bottom, stack_size);
65}
71static inline int dpl_task_remove(struct dpl_task *t)
72{
73 return os_task_remove(&t->t);
74}
75
81static inline uint8_t dpl_task_count(void)
82{
83 return os_task_count();
84}
85
89static inline void dpl_task_yield(void)
90{
91 return os_task_yield();
92}
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* DPL_DPL_TASKS_H */
static void dpl_task_yield(void)
Lets current thread yield.
Definition dpl_tasks.h:89
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:60
static int dpl_task_remove(struct dpl_task *t)
removes specified task
Definition dpl_tasks.h:71
os_task_func_t dpl_task_func_t
dpl task function
Definition dpl_tasks.h:39
static uint8_t dpl_task_count(void)
Return the number of tasks initialized.
Definition dpl_tasks.h:81
os_time_t dpl_time_t
dpl time type
Definition dpl_types.h:57
os_stack_t dpl_stack_t
dpl stack buffer type
Definition dpl_types.h:62
dpl task wrapper
Definition dpl_tasks.h:32
struct os_task t
os task
Definition dpl_tasks.h:33