Xenomai  3.0-rc3
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, long, long, long, long,
46  long, long, long, long, long);
47 
48 typedef struct WIND_TCB {
49  void *opaque;
50  int status;
51  int safeCnt;
52  int flags;
53  FUNCPTR entry;
54 } WIND_TCB;
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 TASK_ID taskSpawn(const char *name,
61  int prio,
62  int flags,
63  int stacksize,
64  FUNCPTR entry,
65  long arg0, long arg1, long arg2, long arg3, long arg4,
66  long arg5, long arg6, long arg7, long arg8, long arg9);
67 
68 STATUS taskInit(WIND_TCB *pTcb,
69  const char *name,
70  int prio,
71  int flags,
72  char * stack __attribute__ ((unused)),
73  int stacksize,
74  FUNCPTR entry,
75  long arg0, long arg1, long arg2, long arg3, long arg4,
76  long arg5, long arg6, long arg7, long arg8, long arg9);
77 
78 STATUS taskActivate(TASK_ID tid);
79 
80 STATUS taskDelete(TASK_ID tid);
81 
82 STATUS taskDeleteForce(TASK_ID tid);
83 
84 STATUS taskSuspend(TASK_ID tid);
85 
86 STATUS taskResume(TASK_ID tid);
87 
88 STATUS taskPrioritySet(TASK_ID tid,
89  int prio);
90 
91 STATUS taskPriorityGet(TASK_ID tid,
92  int *pprio);
93 
94 void taskExit(int code);
95 
96 STATUS taskLock(void);
97 
98 STATUS taskUnlock(void);
99 
100 TASK_ID taskIdSelf(void);
101 
102 STATUS taskSafe(void);
103 
104 STATUS taskUnsafe(void);
105 
106 STATUS taskDelay(int ticks);
107 
108 STATUS taskIdVerify(TASK_ID tid);
109 
110 struct WIND_TCB *taskTcb(TASK_ID tid);
111 
112 int wind_task_normalize_priority(int wind_prio);
113 
114 int wind_task_denormalize_priority(int core_prio);
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif /* !_XENOMAI_VXWORKS_TASKLIB_H */