-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.h
69 lines (52 loc) · 1.18 KB
/
task.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
task.h
Copyright (c) 2013-2021 Akihisa ONODA
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
*/
#ifndef __TASK_H__
#define __TASK_H__
#include <defines.h>
#include <itron.h>
#include <kernel.h>
#include <service_call.h>
#define TA_TSK_STAT_RUNNING (1)
#define TA_TSK_STAT_READY (2)
#define TA_TSK_STAT_DORMANT (3)
typedef struct t_tctx {
UW sp;
} T_TCTX;
typedef struct t_service_call {
enum service_call_id id;
U_SPRMP prmp;
} T_SERVICE_CALL;
typedef struct t_tcb {
struct t_tcb *next;
PRI bpri;
PRI npri;
VP stk;
SIZE stksz;
STAT state;
FP task;
VP_INT exinf;
T_SERVICE_CALL service_call;
T_TCTX ctx;
} T_TCB;
typedef struct t_cre_tsk_prm {
ID tskid;
T_CTSK t_ctsk;
} T_CRE_TSK_PRM;
extern T_TCB *task_current;
extern T_SERVICE_CALL init_service_call;
extern T_TCB task_control_blocks[];
extern const T_CRE_TSK_PRM cre_tsk_prms[];
void task_init(void);
void task_execute(T_TCB *tcbp);
void task_terminate(void);
void task_get_current(void);
ER task_push_queue(T_TCB *tcbp);
ER task_remove_queue(T_TCB *tcbp);
void task_schedule(void);
void task_reschedule(void);
void task_dispatch(void);
#endif /* __TASK_H__ */