2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public
4 * License v2 as published by the Free Software Foundation.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 * General Public License for more details.
11 * You should have received a copy of the GNU General Public
12 * License along with this program; if not, write to the
13 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14 * Boston, MA 021110-1307, USA.
17 #ifndef __TASK_UTILS_H__
18 #define __TASK_UTILS_H__
22 struct periodic_info {
24 unsigned long long wakeups_missed;
28 struct periodic_info periodic;
31 void *(*threadfn)(void *);
32 int (*postfn)(void *);
36 struct task_info *task_init(void *(*threadfn)(void *), int (*postfn)(void *),
37 void *thread_private);
38 int task_start(struct task_info *info);
39 void task_stop(struct task_info *info);
40 void task_deinit(struct task_info *info);
42 /* periodic life cycle */
43 int task_period_start(struct task_info *info, unsigned int period_ms);
44 void task_period_wait(struct task_info *info);
45 void task_period_stop(struct task_info *info);