Xenomai  3.0.8
taskLib.h
1 /*
2  * Copyright (C) 2008 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  *
18  * This file satisfies the references within the emulator code
19  * mimicking a VxWorks-like API built upon the copperplate library.
20  *
21  * VxWorks is a registered trademark of Wind River Systems, Inc.
22  */
23 
24 #ifndef _XENOMAI_VXWORKS_TASKLIB_H
25 #define _XENOMAI_VXWORKS_TASKLIB_H
26 
27 #include <pthread.h>
28 #include <vxworks/types.h>
29 
30 /* Task options: none applicable - only there for code compatibility. */
31 #define VX_UNBREAKABLE 0x0002
32 #define VX_FP_TASK 0x0008
33 #define VX_PRIVATE_ENV 0x0080
34 #define VX_NO_STACK_FILL 0x0100
35 
36 #define WIND_READY 0x0
37 #define WIND_SUSPEND 0x1
38 #define WIND_PEND 0x2
39 #define WIND_DELAY 0x4
40 #define WIND_DEAD 0x8
41 #define WIND_STOP 0x10 /* Never reported. */
42 
43 typedef uintptr_t TASK_ID;
44 
45 typedef void (*FUNCPTR)(long arg, ...);
46 
47 typedef struct WIND_TCB {
48  void *opaque;
49  int status;
50  int safeCnt;
51  int flags;
52  FUNCPTR entry;
53 } WIND_TCB;
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 TASK_ID taskSpawn(const char *name,
60  int prio,
61  int flags,
62  int stacksize,
63  FUNCPTR entry,
64  long arg0, long arg1, long arg2, long arg3, long arg4,
65  long arg5, long arg6, long arg7, long arg8, long arg9);
66 
67 STATUS taskInit(WIND_TCB *pTcb,
68  const char *name,
69  int prio,
70  int flags,
71  char * stack __attribute__ ((unused)),
72  int stacksize,
73  FUNCPTR entry,
74  long arg0, long arg1, long arg2, long arg3, long arg4,
75  long arg5, long arg6, long arg7, long arg8, long arg9);
76 
77 STATUS taskActivate(TASK_ID tid);
78 
79 STATUS taskDelete(TASK_ID tid);
80 
81 STATUS taskDeleteForce(TASK_ID tid);
82 
83 STATUS taskSuspend(TASK_ID tid);
84 
85 STATUS taskResume(TASK_ID tid);
86 
87 STATUS taskPrioritySet(TASK_ID tid,
88  int prio);
89 
90 STATUS taskPriorityGet(TASK_ID tid,
91  int *pprio);
92 
93 void taskExit(int code);
94 
95 STATUS taskLock(void);
96 
97 STATUS taskUnlock(void);
98 
99 TASK_ID taskIdSelf(void);
100 
101 STATUS taskSafe(void);
102 
103 STATUS taskUnsafe(void);
104 
105 STATUS taskDelay(int ticks);
106 
107 STATUS taskIdVerify(TASK_ID tid);
108 
109 struct WIND_TCB *taskTcb(TASK_ID tid);
110 
111 int wind_task_normalize_priority(int wind_prio);
112 
113 int wind_task_denormalize_priority(int core_prio);
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif /* !_XENOMAI_VXWORKS_TASKLIB_H */