32 #define T_CPU(cpu) (1 << (24 + (cpu & 7)))
33 #define T_CPUMASK 0xff000000
42 #define T_BLOCKED XNPEND
43 #define T_DELAYED XNDELAY
44 #define T_READY XNREADY
45 #define T_DORMANT XNDORMANT
46 #define T_STARTED XNSTARTED
47 #define T_BOOST XNBOOST
49 #define T_NOSIG XNASDI
50 #define T_WARNSW XNTRAPSW
51 #define T_RPIOFF XNRPIOFF
54 #define T_CONFORMING 0x00000200
55 #define T_JOINABLE 0x00000400
59 #define T_HOOK_START XNHOOK_THREAD_START
60 #define T_HOOK_SWITCH XNHOOK_THREAD_SWITCH
61 #define T_HOOK_DELETE XNHOOK_THREAD_DELETE
62 #define T_DESC(cookie) thread2rtask(cookie)
65 #define T_LOPRIO XNSCHED_LOW_PRIO
66 #define T_HIPRIO XNSCHED_HIGH_PRIO
68 typedef struct rt_task_placeholder {
70 unsigned long opaque2;
71 } RT_TASK_PLACEHOLDER;
90 char name[XNOBJECT_NAME_LEN];
102 #define RT_MCB_FSTORE_LIMIT 64
119 #if (defined(__KERNEL__) || defined(__XENO_SIM__)) && !defined(DOXYGEN_CPP)
121 #include <nucleus/synch.h>
123 #define XENO_TASK_MAGIC 0x55550101
125 typedef struct rt_task {
131 #define link2rtask(ln) container_of(ln, RT_TASK, link)
133 xnthread_t thread_base;
135 char rname[XNOBJECT_NAME_LEN];
147 xnarch_cpumask_t affinity;
156 #ifdef CONFIG_XENO_OPT_NATIVE_MPS
165 #ifdef CONFIG_XENO_OPT_NATIVE_MPS
174 static inline RT_TASK *thread2rtask (xnthread_t *t)
176 return t ? container_of(t, RT_TASK, thread_base) : NULL;
179 #define xeno_current_task() thread2rtask(xnpod_current_thread())
185 void __native_task_safe(RT_TASK *task);
187 void __native_task_unsafe(RT_TASK *task);
189 int __native_task_safewait(RT_TASK *task);
191 int __native_task_pkg_init(
void);
193 void __native_task_pkg_cleanup(
void);
198 void (*routine)(
void *cookie));
201 void (*routine)(
void *cookie));
205 static inline int rt_task_same(RT_TASK *task1, RT_TASK *task2)
207 return task1 == task2;
216 typedef RT_TASK_PLACEHOLDER RT_TASK;
234 task->opaque = XN_NO_HANDLE;
256 int mode) __deprecated_in_kernel__;
259 void (*fun)(
void *cookie),
316 void (*entry)(
void *cookie),
int rt_task_wait_period(unsigned long *overruns_r)
Wait for the next periodic release point.
Definition: task.c:295
int rt_task_slice(RT_TASK *task, RTIME quantum)
Set a task's round-robin quantum.
Definition: task.c:386
int rt_task_notify(RT_TASK *task, rt_sigset_t sigs)
Send signals to a task.
Definition: task.c:353
ssize_t rt_task_send(RT_TASK *task, RT_TASK_MCB *mcb_s, RT_TASK_MCB *mcb_r, RTIME timeout)
Send a message to a task.
Definition: task.c:400
int rt_task_catch(void(*handler)(rt_sigset_t))
Install a signal handler.
Definition: task.c:1335
unsigned status
Task's status.
Definition: task.h:86
struct rt_task_info RT_TASK_INFO
Structure containing task-information useful to users.
Scheduler interface header.
int rt_task_add_hook(int type, void(*routine)(void *cookie))
Install a task hook.
Definition: task.c:1260
int rt_task_reply(int flowid, RT_TASK_MCB *mcb_s)
Reply to a task.
Definition: task.c:423
char name[XNOBJECT_NAME_LEN]
Symbolic name assigned at creation.
Definition: task.h:90
int rt_task_set_mode(int clrmask, int setmask, int *mode_r)
Change task mode bits.
Definition: task.c:359
int rt_task_yield(void)
Manual round-robin.
Definition: task.c:283
int rt_task_inquire(RT_TASK *task, RT_TASK_INFO *info)
Inquire about a real-time task.
Definition: task.c:347
int rt_task_start(RT_TASK *task, void(*fun)(void *cookie), void *cookie)
Start a real-time task.
Definition: task.c:178
int pagefaults
Number of triggered page faults.
Definition: task.h:98
int ctxswitches
Number of context switches.
Definition: task.h:96
int rt_task_suspend(RT_TASK *task)
Suspend a real-time task.
Definition: task.c:248
caddr_t data
Message address.
Definition: task.h:113
int rt_task_resume(RT_TASK *task)
Resume a real-time task.
Definition: task.c:253
int rt_task_delete(RT_TASK *task)
Delete a real-time task.
Definition: task.c:258
int rt_task_bind(RT_TASK *task, const char *name, RTIME timeout)
Bind to a real-time task.
Definition: task.c:242
int rt_task_join(RT_TASK *task)
Wait on the termination of a real-time task.
Definition: task.c:392
RTIME relpoint
Time of next release.
Definition: task.h:88
static int rt_task_unbind(RT_TASK *task)
Unbind from a real-time task.
Definition: task.h:231
int cprio
Current priority.
Definition: task.h:84
Structure containing task-information useful to users.
Definition: task.h:80
RT_TASK * rt_task_self(void)
Retrieve the current task.
Definition: task.c:370
Structure used in passing messages between tasks.
Definition: task.h:107
int rt_task_remove_hook(int type, void(*routine)(void *cookie))
Remove a task hook.
Definition: task.c:1298
int rt_task_set_priority(RT_TASK *task, int prio)
Change the base priority of a real-time task.
Definition: task.c:309
int rt_task_create(RT_TASK *task, const char *name, int stksize, int prio, int mode) __deprecated_in_kernel__
Create a new real-time task.
Definition: task.c:123
int rt_task_unblock(RT_TASK *task)
Unblock a real-time task.
Definition: task.c:342
int rt_task_shadow(RT_TASK *task, const char *name, int prio, int mode)
Turns the current Linux task into a native Xenomai task.
Definition: task.c:184
size_t size
Message size (bytes).
Definition: task.h:115
int rt_task_sleep_until(RTIME date)
Delay the calling task (absolute).
Definition: task.c:328
int rt_task_set_periodic(RT_TASK *task, RTIME idate, RTIME period)
Make a real-time task periodic.
Definition: task.c:288
struct rt_task_mcb RT_TASK_MCB
Structure used in passing messages between tasks.
int rt_task_same(RT_TASK *task1, RT_TASK *task2)
Compare two task descriptors.
Definition: task.c:429
int opcode
Operation code.
Definition: task.h:111
int modeswitches
Number of primary->secondary mode switches.
Definition: task.h:94
int flowid
Flow identifier.
Definition: task.h:109
int rt_task_sleep(RTIME delay)
Delay the calling task (relative).
Definition: task.c:315
RTIME exectime
Execution time in primary mode in nanoseconds.
Definition: task.h:92
This file is part of the Xenomai project.
int rt_task_receive(RT_TASK_MCB *mcb_r, RTIME timeout)
Receive a message from a task.
Definition: task.c:417
int bprio
Base priority.
Definition: task.h:82
static int rt_task_spawn(RT_TASK *task, const char *name, int stksize, int prio, int mode, void(*entry)(void *cookie), void *cookie)
Spawn a new real-time task.
Definition: task.h:311