-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.h
More file actions
42 lines (31 loc) · 843 Bytes
/
Copy pathtask.h
File metadata and controls
42 lines (31 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef __TASK_H__
#define __TASK_H__
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
struct task_list;
/* timer source */
typedef uint32_t(*task_timer)(void);
/* task object */
typedef void(*task_ob)(struct task_list *handle, void *user_data);
struct task_list
{
/* set user needed data */
const char *name;
void *user_data;
/* task last time */
uint32_t deadline;
uint32_t start;
/* task node and object */
struct task_list *next;
task_ob ob;
};
/* task process */
void task_add(struct task_list *item);
void task_remove(struct task_list *item);
void task_member(void);
/* initialize task polling and operate polling */
void task_init(struct task_list *item, const char *_name, uint32_t _deadline, task_ob ob, task_timer _timer);
void task_start(void);
void task_stop(void);
#endif