# rtai_lxrt.h

Go to the documentation of this file.

    00001
    00066 #ifndef _RTAI_LXRT_H
    00067 #define _RTAI_LXRT_H
    00068
    00069 #include <rtai_sched.h>
    00070 #include <rtai_nam2num.h>
    00071
    00072 // scheduler
    00073 #define YIELD                            0
    00074 #define SUSPEND                          1
    00075 #define RESUME                           2
    00076 #define MAKE_PERIODIC                    3
    00077 #define WAIT_PERIOD                      4
    00078 #define SLEEP                            5
    00079 #define SLEEP_UNTIL                      6
    00080 #define START_TIMER                      7
    00081 #define STOP_TIMER                       8
    00082 #define GET_TIME                         9
    00083 #define COUNT2NANO                      10
    00084 #define NANO2COUNT                      11
    00085 #define BUSY_SLEEP                      12
    00086 #define SET_PERIODIC_MODE               13
    00087 #define SET_ONESHOT_MODE                14
    00088 #define SIGNAL_HANDLER                  15
    00089 #define TASK_USE_FPU                    16
    00090 #define LINUX_USE_FPU                   17
    00091 #define PREEMPT_ALWAYS_GEN              18
    00092 #define GET_TIME_NS                     19
    00093 #define GET_CPU_TIME_NS                 20
    00094 #define SET_RUNNABLE_ON_CPUS            21
    00095 #define SET_RUNNABLE_ON_CPUID           22
    00096 #define GET_TIMER_CPU                   23
    00097 #define START_RT_APIC_TIMERS            24
    00098 #define PREEMPT_ALWAYS_CPUID            25
    00099 #define COUNT2NANO_CPUID                26
    00100 #define NANO2COUNT_CPUID                27
    00101 #define GET_TIME_CPUID                  28
    00102 #define GET_TIME_NS_CPUID               29
    00103 #define MAKE_PERIODIC_NS                30
    00104 #define SET_SCHED_POLICY                31
    00105 #define SET_RESUME_END                  32
    00106 #define SPV_RMS                         33
    00107 #define WAKEUP_SLEEPING                 34
    00108 #define CHANGE_TASK_PRIO                35
    00109 #define SET_RESUME_TIME                 36
    00110 #define SET_PERIOD                      37
    00111 #define HARD_TIMER_RUNNING              38
    00112
    00113 // semaphores
    00114 #define TYPED_SEM_INIT                  39
    00115 #define SEM_DELETE                      40
    00116 #define NAMED_SEM_INIT                  41
    00117 #define NAMED_SEM_DELETE                42
    00118 #define SEM_SIGNAL                      43
    00119 #define SEM_WAIT                        44
    00120 #define SEM_WAIT_IF                     45
    00121 #define SEM_WAIT_UNTIL                  46
    00122 #define SEM_WAIT_TIMED                  47
    00123 #define SEM_BROADCAST                   48
    00124 #define SEM_WAIT_BARRIER                49
    00125 #define SEM_COUNT                       50
    00126 #define COND_WAIT                       51
    00127 #define COND_WAIT_UNTIL                 52
    00128 #define COND_WAIT_TIMED                 53
    00129 #define RWL_INIT                        54
    00130 #define RWL_DELETE                      55
    00131 #define NAMED_RWL_INIT                  56
    00132 #define NAMED_RWL_DELETE                57
    00133 #define RWL_RDLOCK                      58
    00134 #define RWL_RDLOCK_IF                   59
    00135 #define RWL_RDLOCK_UNTIL                60
    00136 #define RWL_RDLOCK_TIMED                61
    00137 #define RWL_WRLOCK                      62
    00138 #define RWL_WRLOCK_IF                   63
    00139 #define RWL_WRLOCK_UNTIL                64
    00140 #define RWL_WRLOCK_TIMED                65
    00141 #define RWL_UNLOCK                      66
    00142 #define SPL_INIT                        67
    00143 #define SPL_DELETE                      68
    00144 #define NAMED_SPL_INIT                  69
    00145 #define NAMED_SPL_DELETE                70
    00146 #define SPL_LOCK                        71
    00147 #define SPL_LOCK_IF                     72
    00148 #define SPL_LOCK_TIMED                  73
    00149 #define SPL_UNLOCK                      74
    00150
    00151 // mail boxes
    00152 #define TYPED_MBX_INIT                  75
    00153 #define MBX_DELETE                      76
    00154 #define NAMED_MBX_INIT                  77
    00155 #define NAMED_MBX_DELETE                78
    00156 #define MBX_SEND                        79
    00157 #define MBX_SEND_WP                     80
    00158 #define MBX_SEND_IF                     81
    00159 #define MBX_SEND_UNTIL                  82
    00160 #define MBX_SEND_TIMED                  83
    00161 #define MBX_RECEIVE                     84
    00162 #define MBX_RECEIVE_WP                  85
    00163 #define MBX_RECEIVE_IF                  86
    00164 #define MBX_RECEIVE_UNTIL               87
    00165 #define MBX_RECEIVE_TIMED               88
    00166 #define MBX_EVDRP                       89
    00167 #define MBX_OVRWR_SEND                  90
    00168
    00169 // short intertask messages
    00170 #define SENDMSG                         91
    00171 #define SEND_IF                         92
    00172 #define SEND_UNTIL                      93
    00173 #define SEND_TIMED                      94
    00174 #define RECEIVEMSG                      95
    00175 #define RECEIVE_IF                      96
    00176 #define RECEIVE_UNTIL                   97
    00177 #define RECEIVE_TIMED                   98
    00178 #define RPCMSG                          99
    00179 #define RPC_IF                         100
    00180 #define RPC_UNTIL                      101
    00181 #define RPC_TIMED                      102
    00182 #define EVDRP                          103
    00183 #define ISRPC                          104
    00184 #define RETURNMSG                      105
    00185
    00186 // extended intertask messages
    00187 #define RPCX                           106
    00188 #define RPCX_IF                        107
    00189 #define RPCX_UNTIL                     108
    00190 #define RPCX_TIMED                     109
    00191 #define SENDX                          110
    00192 #define SENDX_IF                       111
    00193 #define SENDX_UNTIL                    112
    00194 #define SENDX_TIMED                    113
    00195 #define RETURNX                        114
    00196 #define RECEIVEX                       115
    00197 #define RECEIVEX_IF                    116
    00198 #define RECEIVEX_UNTIL                 117
    00199 #define RECEIVEX_TIMED                 118
    00200 #define EVDRPX                         119
    00201
    00202 // proxies
    00203 #define PROXY_ATTACH                   120
    00204 #define PROXY_DETACH                   121
    00205 #define PROXY_TRIGGER                  122
    00206
    00207
    00208 // synchronous user space specific intertask messages and related proxies
    00209 #define RT_SEND                        123
    00210 #define RT_RECEIVE                     124
    00211 #define RT_CRECEIVE                    125
    00212 #define RT_REPLY                       126
    00213 #define RT_PROXY_ATTACH                127
    00214 #define RT_PROXY_DETACH                128
    00215 #define RT_TRIGGER                     129
    00216 #define RT_NAME_ATTACH                 130
    00217 #define RT_NAME_DETACH                 131
    00218 #define RT_NAME_LOCATE                 132
    00219
    00220 // bits
    00221 #define BITS_INIT                      133
    00222 #define BITS_DELETE                    134
    00223 #define NAMED_BITS_INIT                135
    00224 #define NAMED_BITS_DELETE              136
    00225 #define BITS_GET                       137
    00226 #define BITS_RESET                     138
    00227 #define BITS_SIGNAL                    139
    00228 #define BITS_WAIT                      140
    00229 #define BITS_WAIT_IF                   141
    00230 #define BITS_WAIT_UNTIL                142
    00231 #define BITS_WAIT_TIMED                143
    00232
    00233 // typed mail boxes
    00234 #define TBX_INIT                       144
    00235 #define TBX_DELETE                     145
    00236 #define NAMED_TBX_INIT                 146
    00237 #define NAMED_TBX_DELETE               147
    00238 #define TBX_SEND                       148
    00239 #define TBX_SEND_IF                    149
    00240 #define TBX_SEND_UNTIL                 150
    00241 #define TBX_SEND_TIMED                 151
    00242 #define TBX_RECEIVE                    152
    00243 #define TBX_RECEIVE_IF                 153
    00244 #define TBX_RECEIVE_UNTIL              154
    00245 #define TBX_RECEIVE_TIMED              155
    00246 #define TBX_BROADCAST                  156
    00247 #define TBX_BROADCAST_IF               157
    00248 #define TBX_BROADCAST_UNTIL            158
    00249 #define TBX_BROADCAST_TIMED            159
    00250 #define TBX_URGENT                     160
    00251 #define TBX_URGENT_IF                  161
    00252 #define TBX_URGENT_UNTIL               162
    00253 #define TBX_URGENT_TIMED               163
    00254
    00255 // pqueue
    00256 #define MQ_OPEN                        164
    00257 #define MQ_RECEIVE                     165
    00258 #define MQ_SEND                        166
    00259 #define MQ_CLOSE                       167
    00260 #define MQ_GETATTR                     168
    00261 #define MQ_SETATTR                     169
    00262 #define MQ_NOTIFY                      170
    00263 #define MQ_UNLINK                      171
    00264 #define MQ_TIMEDRECEIVE                172
    00265 #define MQ_TIMEDSEND                   173
    00266
    00267 // named tasks init/delete
    00268 #define NAMED_TASK_INIT                174
    00269 #define NAMED_TASK_INIT_CPUID          175
    00270 #define NAMED_TASK_DELETE              176
    00271
    00272 // registry
    00273 #define GET_ADR                        177
    00274 #define GET_NAME                       178
    00275
    00276 // netrpc
    00277 #define NETRPC                         179
    00278 #define SEND_REQ_REL_PORT              180
    00279 #define DDN2NL                         181
    00280 #define SET_THIS_NODE                  182
    00281 #define FIND_ASGN_STUB                 183
    00282 #define REL_STUB                       184
    00283 #define WAITING_RETURN                 185
    00284
    00285 // a semaphore extension
    00286 #define COND_SIGNAL                    186
    00287
    00288 // new shm
    00289 #define SHM_ALLOC                      187
    00290 #define SHM_FREE                       188
    00291 #define SHM_SIZE                       189
    00292 #define HEAP_SET                       190
    00293 #define HEAP_ALLOC                     191
    00294 #define HEAP_FREE                      192
    00295 #define HEAP_NAMED_ALLOC               193
    00296 #define HEAP_NAMED_FREE                194
    00297 #define MALLOC                         195
    00298 #define FREE                           196
    00299 #define NAMED_MALLOC                   197
    00300 #define NAMED_FREE                     198
    00301
    00302 #define SUSPEND_IF                     199
    00303 #define SUSPEND_UNTIL                  200
    00304 #define SUSPEND_TIMED                  201
    00305 #define IRQ_WAIT                       202
    00306 #define IRQ_WAIT_IF                    203
    00307 #define IRQ_WAIT_UNTIL                 204
    00308 #define IRQ_WAIT_TIMED                 205
    00309 #define IRQ_SIGNAL                     206
    00310 #define REQUEST_IRQ_TASK               207
    00311 #define RELEASE_IRQ_TASK               208
    00312 #define SCHED_LOCK                     209
    00313 #define SCHED_UNLOCK                   210
    00314 #define PEND_LINUX_IRQ                 211
    00315
    00316 #define MAX_LXRT_FUN                   213
    00317
    00318 // not recovered yet
    00319 // Qblk's
    00320 #define RT_INITTICKQUEUE                69
    00321 #define RT_RELEASETICKQUEUE             70
    00322 #define RT_QDYNALLOC                    71
    00323 #define RT_QDYNFREE                     72
    00324 #define RT_QDYNINIT                     73
    00325 #define RT_QBLKWAIT                     74
    00326 #define RT_QBLKREPEAT                   75
    00327 #define RT_QBLKSOON                     76
    00328 #define RT_QBLKDEQUEUE                  77
    00329 #define RT_QBLKCANCEL                   78
    00330 #define RT_QSYNC                        79
    00331 #define RT_QRECEIVE                     80
    00332 #define RT_QLOOP                        81
    00333 #define RT_QSTEP                        82
    00334 #define RT_QBLKBEFORE                   83
    00335 #define RT_QBLKAFTER                    84
    00336 #define RT_QBLKUNHOOK                   85
    00337 #define RT_QBLKRELEASE                  86
    00338 #define RT_QBLKCOMPLETE                 87
    00339 #define RT_QHOOKFLUSH                   88
    00340 #define RT_QBLKATHEAD                   89
    00341 #define RT_QBLKATTAIL                   90
    00342 #define RT_QHOOKINIT                    91
    00343 #define RT_QHOOKRELEASE                 92
    00344 #define RT_QBLKSCHEDULE                 93
    00345 #define RT_GETTICKQUEUEHOOK             94
    00346 // Testing
    00347 #define RT_BOOM                         95
    00348 #define RTAI_MALLOC                     96
    00349 #define RT_FREE                         97
    00350 #define RT_MMGR_STATS                   98
    00351 #define RT_STOMP                        99
    00352 // VC
    00353 #define RT_VC_ATTACH                    100
    00354 #define RT_VC_RELEASE                   101
    00355 #define RT_VC_RESERVE                   102
    00356 // Linux Signal Support
    00357 #define RT_GET_LINUX_SIGNAL             103
    00358 #define RT_GET_ERRNO                    104
    00359 #define RT_SET_LINUX_SIGNAL_HANDLER     105
    00360 // end of not recovered yet
    00361
    00362 #define LXRT_GET_ADR            1000
    00363 #define LXRT_GET_NAME           1001
    00364 #define LXRT_TASK_INIT          1002
    00365 #define LXRT_TASK_DELETE        1003
    00366 #define LXRT_SEM_INIT           1004
    00367 #define LXRT_SEM_DELETE         1005
    00368 #define LXRT_MBX_INIT           1006
    00369 #define LXRT_MBX_DELETE         1007
    00370 #define MAKE_SOFT_RT            1008
    00371 #define MAKE_HARD_RT            1009
    00372 #define PRINT_TO_SCREEN         1010
    00373 #define NONROOT_HRT             1011
    00374 #define RT_BUDDY                1012
    00375 #define HRT_USE_FPU             1013
    00376 #define USP_SIGHDL              1014
    00377 #define GET_USP_FLAGS           1015
    00378 #define SET_USP_FLAGS           1016
    00379 #define GET_USP_FLG_MSK         1017
    00380 #define SET_USP_FLG_MSK         1018
    00381 #define IS_HARD                 1019
    00382 #define LXRT_FORK               1020
    00383 #define ALLOC_REGISTER          1021
    00384 #define DELETE_DEREGISTER       1022
    00385 #define FORCE_TASK_SOFT         1023
    00386 #define PRINTK                  1024
    00387 #define GET_EXECTIME            1025
    00388 #define GET_TIMEORIG            1026
    00389 #define LXRT_RWL_INIT           1027
    00390 #define LXRT_RWL_DELETE         1028
    00391 #define LXRT_SPL_INIT           1029
    00392 #define LXRT_SPL_DELETE         1030
    00393
    00394 #define FORCE_SOFT 0x80000000
    00395
    00396 // Keep LXRT call enc/decoding together, so you are sure to act consistently.
    00397 // This is the encoding, note " | GT_NR_SYSCALLS" to ensure not a Linux syscall, ...
    00398 #define GT_NR_SYSCALLS  (1 << 15)
    00399 #define ENCODE_LXRT_REQ(dynx, srq, lsize)  (((dynx) << 28) | (((srq) & 0xFFF) << 16) | GT_NR_SYSCALLS | (lsize))
    00400 // ... and this is the decoding.
    00401 #define SRQ(x)   (((x) >> 16) & 0xFFF)
    00402 #define NARG(x)  ((x) & (GT_NR_SYSCALLS - 1))
    00403 #define INDX(x)  (((x) >> 28) & 0xF)
    00404
    00405 #ifdef __KERNEL__
    00406
    00407 #include <asm/rtai_lxrt.h>
    00408
    00409 /*
    00410      Encoding of system call argument
    00411             31                                    0
    00412 soft SRQ    .... |||| |||| |||| .... .... .... ....  0 - 4095 max
    00413 int  NARG   .... .... .... .... |||| |||| |||| ||||
    00414 arg  INDX   |||| .... .... .... .... .... .... ....
    00415 */
    00416
    00417 /*
    00418 These USP (unsigned long long) type fields allow to read and write up to 2 arguments.
    00419
    00420 RW marker .... .... .... .... .... .... .... ..|| .... .... .... .... .... .... .... ...|
    00421
    00422 HIGH unsigned long encodes writes
    00423 W ARG1 BF .... .... .... .... .... ...| |||| ||..
    00424 W ARG1 SZ .... .... .... .... |||| |||. .... ....
    00425 W ARG2 BF .... .... .||| |||| .... .... .... ....
    00426 W ARG2 SZ ..|| |||| |... .... .... .... .... ....
    00427 W 1st  LL .|.. .... .... .... .... .... .... ....
    00428 W 2nd  LL |... .... .... .... .... .... .... ....
    00429
    00430 LOW unsigned long encodes reads
    00431 R ARG1 BF .... .... .... .... .... ...| |||| ||..
    00432 R ARG1 SZ .... .... .... .... |||| |||. .... ....
    00433 R ARG2 BF .... .... .||| |||| .... .... .... ....
    00434 R ARG2 SZ ..|| |||| |... .... .... .... .... ....
    00435 R 1st  LL .|.. .... .... .... .... .... .... ....
    00436 R 2nd  LL |... .... .... .... .... .... .... ....
    00437
    00438 LOW unsigned long encodes also
    00439 RT Switch .... .... .... .... .... .... .... ...|
    00440
    00441 and
    00442 Always 0  .... .... .... .... .... .... .... ..|.
    00443
    00444 If SZ is zero sizeof(int) is copied by default, if LL bit is set sizeof(long long) is copied.
    00445 */
    00446
    00447 // These are for setting appropriate bits in any function entry structure, OR
    00448 // them in fun entry type to obtain the desired encoding
    00449
    00450 // for writes
    00451 #define UW1(bf, sz)  ((((unsigned long long)((((bf) & 0x7F) <<  2) | (((sz) & 0x7F) <<  9))) << 32) | 0x300000001LL)
    00452 #define UW2(bf, sz)  ((((unsigned long long)((((bf) & 0x7F) << 16) | (((sz) & 0x7F) << 23))) << 32) | 0x300000001LL)
    00453 #define UWSZ1LL      (0x4000000300000001LL)
    00454 #define UWSZ2LL      (0x8000000300000001LL)
    00455
    00456 // for reads
    00457 #define UR1(bf, sz)  ((((bf) & 0x7F) <<  2) | (((sz) & 0x7F) <<  9) | 0x300000001LL)
    00458 #define UR2(bf, sz)  ((((bf) & 0x7F) << 16) | (((sz) & 0x7F) << 23) | 0x300000001LL)
    00459 #define URSZ1LL      (0x340000001LL)
    00460 #define URSZ2LL      (0x380000001LL)
    00461
    00462 // and these are for deciding what to do in lxrt.c
    00463 #define NEED_TO_RW(x)   (((unsigned long *)&(x))[HIGH])
    00464
    00465 #define NEED_TO_R(x)    (((unsigned long *)&(x))[LOW]  & 0x0000FFFC)
    00466 #define NEED_TO_W(x)    (((unsigned long *)&(x))[HIGH] & 0x0000FFFC)
    00467
    00468 #define NEED_TO_R2ND(x) (((unsigned long *)&(x))[LOW]  & 0x3FFF0000)
    00469 #define NEED_TO_W2ND(x) (((unsigned long *)&(x))[HIGH] & 0x3FFF0000)
    00470
    00471 #define USP_RBF1(x)     ((((unsigned long *)&(x))[LOW] >>  2) & 0x7F)
    00472 #define USP_RSZ1(x)     ((((unsigned long *)&(x))[LOW] >>  9) & 0x7F)
    00473 #define USP_RBF2(x)     ((((unsigned long *)&(x))[LOW] >> 16) & 0x7F)
    00474 #define USP_RSZ2(x)     ((((unsigned long *)&(x))[LOW] >> 23) & 0x7F)
    00475 #define USP_RSZ1LL(x)   (((unsigned long *)&(x))[LOW] & 0x40000000)
    00476 #define USP_RSZ2LL(x)   (((unsigned long *)&(x))[LOW] & 0x80000000)
    00477
    00478 #define USP_WBF1(x)     ((((unsigned long *)&(x))[HIGH] >>  2) & 0x7F)
    00479 #define USP_WSZ1(x)     ((((unsigned long *)&(x))[HIGH] >>  9) & 0x7F)
    00480 #define USP_WBF2(x)     ((((unsigned long *)&(x))[HIGH] >> 16) & 0x7F)
    00481 #define USP_WSZ2(x)     ((((unsigned long *)&(x))[HIGH] >> 23) & 0x7F)
    00482 #define USP_WSZ1LL(x)   (((unsigned long *)&(x))[HIGH] & 0x40000000)
    00483 #define USP_WSZ2LL(x)   (((unsigned long *)&(x))[HIGH] & 0x80000000)
    00484
    00485 struct rt_fun_entry {
    00486     unsigned long long type;
    00487     void *fun;
    00488 };
    00489
    00490 struct rt_native_fun_entry {
    00491     struct rt_fun_entry fun;
    00492     int index;
    00493 };
    00494
    00495 extern struct rt_fun_entry rt_fun_lxrt[];
    00496
    00497 void reset_rt_fun_entries(struct rt_native_fun_entry *entry);
    00498
    00499 int set_rt_fun_entries(struct rt_native_fun_entry *entry);
    00500
    00501 #ifdef __cplusplus
    00502 extern "C" {
    00503 #endif /* __cplusplus */
    00504
    00505 #if CONFIG_RTAI_INTERNAL_LXRT_SUPPORT
    00506
    00507 static inline struct rt_task_struct *pid2rttask(pid_t pid)
    00508 {
    00509         return ((unsigned long)pid) > PID_MAX_LIMIT ? (struct rt_task_struct *)pid : find_task_by_pid(pid)->rtai_tskext[0];
    00510 }
    00511
    00512 static inline pid_t rttask2pid(struct rt_task_struct * task)
    00513 {
    00514     return task->lnxtsk ? task->lnxtsk->pid : (int) task;
    00515 }
    00516
    00517 #else /* !CONFIG_RTAI_INTERNAL_LXRT_SUPPORT */
    00518
    00519 static inline struct rt_task_struct *pid2rttask(pid_t pid)
    00520 {
    00521     return 0;
    00522 }
    00523
    00524 // The following might look strange but it must be so to work with
    00525 // buddies also.
    00526 static inline pid_t rttask2pid(struct rt_task_struct * task)
    00527 {
    00528     return (int) task;
    00529 }
    00530
    00531 #endif /* CONFIG_RTAI_INTERNAL_LXRT_SUPPORT */
    00532
    00533 int set_rtai_callback(void (*fun)(void));
    00534
    00535 void remove_rtai_callback(void (*fun)(void));
    00536
    00537 RT_TASK *rt_lxrt_whoami(void);
    00538
    00539 void exec_func(void (*func)(void *data, int evn),
    00540                void *data,
    00541                int evn);
    00542
    00543 int  set_rt_fun_ext_index(struct rt_fun_entry *fun,
    00544                           int idx);
    00545
    00546 void reset_rt_fun_ext_index(struct rt_fun_entry *fun,
    00547                             int idx);
    00548
    00549 #ifdef __cplusplus
    00550 }
    00551 #endif /* __cplusplus */
    00552
    00553 #else /* !__KERNEL__ */
    00554
    00555 #include <sys/types.h>
    00556 #include <sched.h>
    00557 #include <stdarg.h>
    00558 #include <stdio.h>
    00559 #include <string.h>
    00560 #include <asm/rtai_lxrt.h>
    00561
    00562 struct apic_timer_setup_data;
    00563
    00564 #define rt_grow_and_lock_stack(incr) \
    00565         do { \
    00566                 char buf[incr]; \
    00567                 memset(buf, 0, incr); \
    00568                 mlockall(MCL_CURRENT | MCL_FUTURE); \
    00569         } while (0)
    00570
    00571 #define BIDX   0 // rt_fun_ext[0]
    00572 #define SIZARG sizeof(arg)
    00573
    00574 #ifdef __cplusplus
    00575 extern "C" {
    00576 #endif /* __cplusplus */
    00577
    00585 RTAI_PROTO(void *,rt_get_adr,(unsigned long name))
    00586 {
    00587         struct { int name; } arg = { name };
    00588         return rtai_lxrt(BIDX, SIZARG, LXRT_GET_ADR, &arg).v[LOW];
    00589 }
    00590
    00599 RTAI_PROTO(unsigned long,rt_get_name,(void *adr))
    00600 {
    00601         struct { void *adr; } arg = { adr };
    00602         return rtai_lxrt(BIDX, SIZARG, LXRT_GET_NAME, &arg).i[LOW];
    00603 }
    00604
    00605 RTAI_PROTO(RT_TASK *,rt_task_init_schmod,(int name, int priority, int stack_size, int max_msg_size, int policy, int cpus_allowed))
    00606 {
    00607         struct sched_param mysched;
    00608         struct { int name, priority, stack_size, max_msg_size, cpus_allowed; } arg = { name, priority, stack_size, max_msg_size, cpus_allowed };
    00609
    00610         mysched.sched_priority = sched_get_priority_max(policy) - priority;
    00611         if (mysched.sched_priority < 1 ) {
    00612                 mysched.sched_priority = 1;
    00613         }
    00614         if (sched_setscheduler(0, policy, &mysched) < 0) {
    00615                 return 0;
    00616         }
    00617
    00618         return (RT_TASK *)rtai_lxrt(BIDX, SIZARG, LXRT_TASK_INIT, &arg).v[LOW];
    00619 }
    00620
    00621 #define RT_THREAD_STACK_MIN 64*1024
    00622
    00623 #if 1
    00624 #include <pthread.h>
    00625
    00626 RTAI_PROTO(int, rt_thread_create,(void *fun, void *args, int stack_size))
    00627 {
    00628         pthread_t thread;
    00629         pthread_attr_t attr;
    00630         pthread_attr_init(&attr);
    00631         if (pthread_attr_setstacksize(&attr, stack_size > RT_THREAD_STACK_MIN ? stack_size : RT_THREAD_STACK_MIN)) {
    00632                 return -1;
    00633         }
    00634         if (pthread_create(&thread, &attr, (void *(*)(void *))fun, args)) {
    00635                 return -1;
    00636         }
    00637         return thread;
    00638 }
    00639
    00640 RTAI_PROTO(int, rt_thread_join, (int thread))
    00641 {
    00642         return pthread_join((pthread_t)thread, NULL);
    00643 }
    00644
    00645 #else
    00646
    00647 #include <sys/wait.h>
    00648
    00649 RTAI_PROTO(int, rt_thread_create, (void *fun, void *args, int stack_size))
    00650 {
    00651         void *sp;
    00652         if (stack_size < RT_THREAD_STACK_MIN) {
    00653                 stack_size = RT_THREAD_STACK_MIN;
    00654         }
    00655         memset(sp = malloc(stack_size), 0, stack_size);
    00656         sp = (void *)(((unsigned long)sp + stack_size - 16) & ~0xF);
    00657         return clone(fun, sp, CLONE_VM | CLONE_FS | CLONE_FILES, args);
    00658 }
    00659
    00660 RTAI_PROTO(int, rt_thread_join, (int thread))
    00661 {
    00662         return waitpid(thread, NULL, 0);
    00663 }
    00664
    00665 #endif
    00666
    00667 RTAI_PROTO(RT_TASK *, rt_thread_init, (int name, int priority, int max_msg_size, int policy, int cpus_allowed))
    00668 {
    00669         return rt_task_init_schmod(name, priority, 0, max_msg_size, policy, cpus_allowed);
    00670 }
    00671
    00725 RTAI_PROTO(RT_TASK *,rt_task_init,(int name, int priority, int stack_size, int max_msg_size))
    00726 {
    00727         struct { int name, priority, stack_size, max_msg_size, cpus_allowed; } arg = { name, priority, stack_size, max_msg_size, 0xFF };
    00728         return (RT_TASK *)rtai_lxrt(BIDX, SIZARG, LXRT_TASK_INIT, &arg).v[LOW];
    00729 }
    00730
    00731 RTAI_PROTO(void,rt_set_sched_policy,(RT_TASK *task, int policy, int rr_quantum_ns))
    00732 {
    00733         struct { RT_TASK *task; int policy; int rr_quantum_ns; } arg = { task, policy, rr_quantum_ns };
    00734         rtai_lxrt(BIDX, SIZARG, SET_SCHED_POLICY, &arg);
    00735 }
    00736
    00737 RTAI_PROTO(int,rt_change_prio,(RT_TASK *task, int priority))
    00738 {
    00739         struct { RT_TASK *task; int priority; } arg = { task, priority };
    00740         return rtai_lxrt(BIDX, SIZARG, CHANGE_TASK_PRIO, &arg).i[LOW];
    00741 }
    00742
    00755 RTAI_PROTO(void,rt_make_soft_real_time,(void))
    00756 {
    00757         struct { unsigned long dummy; } arg;
    00758         rtai_lxrt(BIDX, SIZARG, MAKE_SOFT_RT, &arg);
    00759 }
    00760
    00761 RTAI_PROTO(int,rt_task_delete,(RT_TASK *task))
    00762 {
    00763         struct { RT_TASK *task; } arg = { task };
    00764         rt_make_soft_real_time();
    00765         return rtai_lxrt(BIDX, SIZARG, LXRT_TASK_DELETE, &arg).i[LOW];
    00766 }
    00767
    00768 RTAI_PROTO(int,rt_task_yield,(void))
    00769 {
    00770         struct { unsigned long dummy; } arg;
    00771         return rtai_lxrt(BIDX, SIZARG, YIELD, &arg).i[LOW];
    00772 }
    00773
    00774 RTAI_PROTO(int,rt_task_suspend,(RT_TASK *task))
    00775 {
    00776         struct { RT_TASK *task; } arg = { task };
    00777         return rtai_lxrt(BIDX, SIZARG, SUSPEND, &arg).i[LOW];
    00778 }
    00779
    00780 RTAI_PROTO(int,rt_task_suspend_if,(RT_TASK *task))
    00781 {
    00782         struct { RT_TASK *task; } arg = { task };
    00783         return rtai_lxrt(BIDX, SIZARG, SUSPEND_IF, &arg).i[LOW];
    00784 }
    00785
    00786 RTAI_PROTO(int,rt_task_suspend_until,(RT_TASK *task, RTIME time))
    00787 {
    00788         struct { RT_TASK *task; RTIME time; } arg = { task, time };
    00789         return rtai_lxrt(BIDX, SIZARG, SUSPEND_UNTIL, &arg).i[LOW];
    00790 }
    00791
    00792 RTAI_PROTO(int,rt_task_suspend_timed,(RT_TASK *task, RTIME delay))
    00793 {
    00794         struct { RT_TASK *task; RTIME delay; } arg = { task, delay };
    00795         return rtai_lxrt(BIDX, SIZARG, SUSPEND_TIMED, &arg).i[LOW];
    00796 }
    00797
    00798 RTAI_PROTO(int,rt_task_resume,(RT_TASK *task))
    00799 {
    00800         struct { RT_TASK *task; } arg = { task };
    00801         return rtai_lxrt(BIDX, SIZARG, RESUME, &arg).i[LOW];
    00802 }
    00803
    00804 RTAI_PROTO(void, rt_sched_lock, (void))
    00805 {
    00806         struct { int dummy; } arg;
    00807         rtai_lxrt(BIDX, SIZARG, SCHED_LOCK, &arg);
    00808 }
    00809
    00810 RTAI_PROTO(void, rt_sched_unlock, (void))
    00811 {
    00812         struct { int dummy; } arg;
    00813         rtai_lxrt(BIDX, SIZARG, SCHED_UNLOCK, &arg);
    00814 }
    00815
    00816 RTAI_PROTO(void, rt_pend_linux_irq, (unsigned irq))
    00817 {
    00818         struct { unsigned irq; } arg = { irq };
    00819         rtai_lxrt(BIDX, SIZARG, PEND_LINUX_IRQ, &arg);
    00820 }
    00821
    00822 RTAI_PROTO(int, rt_irq_wait, (unsigned irq))
    00823 {
    00824         struct { unsigned irq; } arg = { irq };
    00825         return rtai_lxrt(BIDX, SIZARG, IRQ_WAIT, &arg).i[LOW];
    00826 }
    00827
    00828 RTAI_PROTO(int, rt_irq_wait_if, (unsigned irq))
    00829 {
    00830         struct { unsigned irq; } arg = { irq };
    00831         return rtai_lxrt(BIDX, SIZARG, IRQ_WAIT_IF, &arg).i[LOW];
    00832 }
    00833
    00834 RTAI_PROTO(int, rt_irq_wait_until, (unsigned irq, RTIME time))
    00835 {
    00836         struct { unsigned irq; RTIME time; } arg = { irq, time };
    00837         return rtai_lxrt(BIDX, SIZARG, IRQ_WAIT_UNTIL, &arg).i[LOW];
    00838 }
    00839
    00840 RTAI_PROTO(int, rt_irq_wait_timed, (unsigned irq, RTIME delay))
    00841 {
    00842         struct { unsigned irq; RTIME delay; } arg = { irq, delay };
    00843         return rtai_lxrt(BIDX, SIZARG, IRQ_WAIT_TIMED, &arg).i[LOW];
    00844 }
    00845
    00846 RTAI_PROTO(int, rt_irq_signal, (unsigned irq))
    00847 {
    00848         struct { unsigned irq; } arg = { irq };
    00849         return rtai_lxrt(BIDX, SIZARG, IRQ_SIGNAL, &arg).i[LOW];
    00850 }
    00851
    00852 RTAI_PROTO(int, rt_request_irq_task, (unsigned irq, void *handler, int type, int affine2task))
    00853 {
    00854         struct { unsigned irq; void *handler; int type, affine2task; } arg = { irq, handler, type, affine2task };
    00855         return rtai_lxrt(BIDX, SIZARG, REQUEST_IRQ_TASK, &arg).i[LOW];
    00856 }
    00857
    00858
    00859 RTAI_PROTO(int, rt_release_irq_task, (unsigned irq))
    00860 {
    00861         struct { unsigned irq; } arg = { irq };
    00862         return rtai_lxrt(BIDX, SIZARG, RELEASE_IRQ_TASK, &arg).i[LOW];
    00863 }
    00864
    00865 RTAI_PROTO(int, rt_task_make_periodic,(RT_TASK *task, RTIME start_time, RTIME period))
    00866 {
    00867         struct { RT_TASK *task; RTIME start_time, period; } arg = { task, start_time, period };
    00868         return rtai_lxrt(BIDX, SIZARG, MAKE_PERIODIC, &arg).i[LOW];
    00869 }
    00870
    00871 RTAI_PROTO(int,rt_task_make_periodic_relative_ns,(RT_TASK *task, RTIME start_delay, RTIME period))
    00872 {
    00873         struct { RT_TASK *task; RTIME start_time, period; } arg = { task, start_delay, period };
    00874         return rtai_lxrt(BIDX, SIZARG, MAKE_PERIODIC_NS, &arg).i[LOW];
    00875 }
    00876
    00877 RTAI_PROTO(void,rt_task_wait_period,(void))
    00878 {
    00879         struct { unsigned long dummy; } arg;
    00880         rtai_lxrt(BIDX, SIZARG, WAIT_PERIOD, &arg);
    00881 }
    00882
    00883 RTAI_PROTO(void,rt_sleep,(RTIME delay))
    00884 {
    00885         struct { RTIME delay; } arg = { delay };
    00886         rtai_lxrt(BIDX, SIZARG, SLEEP, &arg);
    00887 }
    00888
    00889 RTAI_PROTO(void,rt_sleep_until,(RTIME time))
    00890 {
    00891         struct { RTIME time; } arg = { time };
    00892         rtai_lxrt(BIDX, SIZARG, SLEEP_UNTIL, &arg);
    00893 }
    00894
    00895 RTAI_PROTO(int,rt_is_hard_timer_running,(void))
    00896 {
    00897         struct { unsigned long dummy; } arg;
    00898         return rtai_lxrt(BIDX, SIZARG, HARD_TIMER_RUNNING, &arg).i[LOW];
    00899 }
    00900
    00901 RTAI_PROTO(RTIME, start_rt_timer,(int period))
    00902 {
    00903         struct { int period; } arg = { period };
    00904         return rtai_lxrt(BIDX, SIZARG, START_TIMER, &arg).rt;
    00905 }
    00906
    00907 RTAI_PROTO(void, stop_rt_timer,(void))
    00908 {
    00909         struct { unsigned long dummy; } arg;
    00910         rtai_lxrt(BIDX, SIZARG, STOP_TIMER, &arg);
    00911 }
    00912
    00913 RTAI_PROTO(RTIME,rt_get_time,(void))
    00914 {
    00915         struct { unsigned long dummy; } arg;
    00916         return rtai_lxrt(BIDX, SIZARG, GET_TIME, &arg).rt;
    00917 }
    00918
    00919 RTAI_PROTO(RTIME,count2nano,(RTIME count))
    00920 {
    00921         struct { RTIME count; } arg = { count };
    00922         return rtai_lxrt(BIDX, SIZARG, COUNT2NANO, &arg).rt;
    00923 }
    00924
    00925 RTAI_PROTO(RTIME,nano2count,(RTIME nanos))
    00926 {
    00927         struct { RTIME nanos; } arg = { nanos };
    00928         return rtai_lxrt(BIDX, SIZARG, NANO2COUNT, &arg).rt;
    00929 }
    00930
    00931 RTAI_PROTO(void,rt_busy_sleep,(int ns))
    00932 {
    00933         struct { int ns; } arg = { ns };
    00934         rtai_lxrt(BIDX, SIZARG, BUSY_SLEEP, &arg);
    00935 }
    00936
    00937 RTAI_PROTO(void,rt_set_periodic_mode,(void))
    00938 {
    00939         struct { unsigned long dummy; } arg;
    00940         rtai_lxrt(BIDX, SIZARG, SET_PERIODIC_MODE, &arg);
    00941 }
    00942
    00943 RTAI_PROTO(void,rt_set_oneshot_mode,(void))
    00944 {
    00945         struct { unsigned long dummy; } arg;
    00946         rtai_lxrt(BIDX, SIZARG, SET_ONESHOT_MODE, &arg);
    00947 }
    00948
    00949 RTAI_PROTO(int,rt_task_signal_handler,(RT_TASK *task, void (*handler)(void)))
    00950 {
    00951         struct { RT_TASK *task; void (*handler)(void); } arg = { task, handler };
    00952         return rtai_lxrt(BIDX, SIZARG, SIGNAL_HANDLER, &arg).i[LOW];
    00953 }
    00954
    00955 RTAI_PROTO(int,rt_task_use_fpu,(RT_TASK *task, int use_fpu_flag))
    00956 {
    00957         struct { RT_TASK *task; int use_fpu_flag; } arg = { task, use_fpu_flag };
    00958         if (rtai_lxrt(BIDX, SIZARG, RT_BUDDY, &arg).v[LOW] != task) {
    00959                 return rtai_lxrt(BIDX, SIZARG, TASK_USE_FPU, &arg).i[LOW];
    00960         } else {
    00961 // note that it would be enough to do whatever FP op here to have it OK. But
    00962 // that is scary if it is done when already in hard real time, and we do not
    00963 // want to force users to call this before making it hard.
    00964                 rtai_lxrt(BIDX, SIZARG, HRT_USE_FPU, &arg);
    00965                 return 0;
    00966         }
    00967 }
    00968
    00969 RTAI_PROTO(int,rt_buddy_task_use_fpu,(RT_TASK *task, int use_fpu_flag))
    00970 {
    00971         struct { RT_TASK *task; int use_fpu_flag; } arg = { task, use_fpu_flag };
    00972         return rtai_lxrt(BIDX, SIZARG, TASK_USE_FPU, &arg).i[LOW];
    00973 }
    00974
    00975 RTAI_PROTO(int,rt_linux_use_fpu,(int use_fpu_flag))
    00976 {
    00977         struct { int use_fpu_flag; } arg = { use_fpu_flag };
    00978         return rtai_lxrt(BIDX, SIZARG, LINUX_USE_FPU, &arg).i[LOW];
    00979 }
    00980
    00981 RTAI_PROTO(void,rt_preempt_always,(int yes_no))
    00982 {
    00983         struct { int yes_no; } arg = { yes_no };
    00984         rtai_lxrt(BIDX, SIZARG, PREEMPT_ALWAYS_GEN, &arg);
    00985 }
    00986
    00987 RTAI_PROTO(RTIME,rt_get_time_ns,(void))
    00988 {
    00989         struct { unsigned long dummy; } arg;
    00990         return rtai_lxrt(BIDX, SIZARG, GET_TIME_NS, &arg).rt;
    00991 }
    00992
    00993 RTAI_PROTO(RTIME,rt_get_cpu_time_ns,(void))
    00994 {
    00995         struct { unsigned long dummy; } arg;
    00996         return rtai_lxrt(BIDX, SIZARG, GET_CPU_TIME_NS, &arg).rt;
    00997 }
    00998
    00999 #define rt_named_task_init(task_name, thread, data, stack_size, prio, uses_fpu, signal) \
    01000         rt_task_init(nam2num(task_name), thread, data, stack_size, prio, uses_fpu, signal)
    01001
    01002 #define rt_named_task_init_cpuid(task_name, thread, data, stack_size, prio, uses_fpu, signal, run_on_cpu) \
    01003         rt_task_init_cpuid(nam2num(task_name), thread, data, stack_size, prio, uses_fpu, signal, run_on_cpu)
    01004
    01005 RTAI_PROTO(void,rt_set_runnable_on_cpus,(RT_TASK *task, unsigned long cpu_mask))
    01006 {
    01007         struct { RT_TASK *task; unsigned long cpu_mask; } arg = { task, cpu_mask };
    01008         rtai_lxrt(BIDX, SIZARG, SET_RUNNABLE_ON_CPUS, &arg);
    01009 }
    01010
    01011 RTAI_PROTO(void,rt_set_runnable_on_cpuid,(RT_TASK *task, unsigned int cpuid))
    01012 {
    01013         struct { RT_TASK *task; unsigned int cpuid; } arg = { task, cpuid };
    01014         rtai_lxrt(BIDX, SIZARG, SET_RUNNABLE_ON_CPUID, &arg);
    01015 }
    01016
    01017 RTAI_PROTO(int,rt_get_timer_cpu,(void))
    01018 {
    01019         struct { unsigned long dummy; } arg;
    01020         return rtai_lxrt(BIDX, SIZARG, GET_TIMER_CPU, &arg).i[LOW];
    01021 }
    01022
    01023 RTAI_PROTO(void,start_rt_apic_timers,(struct apic_timer_setup_data *setup_mode, unsigned int rcvr_jiffies_cpuid))
    01024 {
    01025         struct { struct apic_timer_setup_data *setup_mode; unsigned int rcvr_jiffies_cpuid; } arg = { setup_mode, rcvr_jiffies_cpuid };
    01026         rtai_lxrt(BIDX, SIZARG, START_RT_APIC_TIMERS, &arg);
    01027 }
    01028
    01029 RTAI_PROTO(void,rt_preempt_always_cpuid,(int yes_no, unsigned int cpuid))
    01030 {
    01031         struct { int yes_no; unsigned int cpuid; } arg = { yes_no, cpuid };
    01032         rtai_lxrt(BIDX, SIZARG, PREEMPT_ALWAYS_CPUID, &arg);
    01033 }
    01034
    01035 RTAI_PROTO(RTIME,count2nano_cpuid,(RTIME count, unsigned int cpuid))
    01036 {
    01037         struct { RTIME count; unsigned int cpuid; } arg = { count, cpuid };
    01038         return rtai_lxrt(BIDX, SIZARG, COUNT2NANO_CPUID, &arg).rt;
    01039 }
    01040
    01041 RTAI_PROTO(RTIME,nano2count_cpuid,(RTIME nanos, unsigned int cpuid))
    01042 {
    01043         struct { RTIME nanos; unsigned int cpuid; } arg = { nanos, cpuid };
    01044         return rtai_lxrt(BIDX, SIZARG, NANO2COUNT_CPUID, &arg).rt;
    01045 }
    01046
    01047 RTAI_PROTO(RTIME,rt_get_time_cpuid,(unsigned int cpuid))
    01048 {
    01049         struct { unsigned int cpuid; } arg = { cpuid };
    01050         return rtai_lxrt(BIDX, SIZARG, GET_TIME_CPUID, &arg).rt;
    01051 }
    01052
    01053 RTAI_PROTO(RTIME,rt_get_time_ns_cpuid,(unsigned int cpuid))
    01054 {
    01055         struct { unsigned int cpuid; } arg = { cpuid };
    01056         return rtai_lxrt(BIDX, SIZARG, GET_TIME_NS_CPUID, &arg).rt;
    01057 }
    01058
    01059 RTAI_PROTO(void,rt_boom,(void))
    01060 {
    01061         struct { int dummy; } arg = { 0 };
    01062         rtai_lxrt(BIDX, SIZARG, RT_BOOM, &arg);
    01063 }
    01064
    01065 RTAI_PROTO(void,rt_mmgr_stats,(void))
    01066 {
    01067         struct { int dummy; } arg = { 0 };
    01068         rtai_lxrt(BIDX, SIZARG, RT_MMGR_STATS, &arg);
    01069 }
    01070
    01071 RTAI_PROTO(void,rt_stomp,(void) )
    01072 {
    01073         struct { int dummy; } arg = { 0 };
    01074         rtai_lxrt(BIDX, SIZARG, RT_STOMP, &arg);
    01075 }
    01076
    01077 RTAI_PROTO(int,rt_get_linux_signal,(RT_TASK *task))
    01078 {
    01079     struct { RT_TASK *task; } arg = { task };
    01080     return rtai_lxrt(BIDX, SIZARG, RT_GET_LINUX_SIGNAL, &arg).i[LOW];
    01081 }
    01082
    01083 RTAI_PROTO(int,rt_get_errno,(RT_TASK *task))
    01084 {
    01085     struct { RT_TASK *task; } arg = { task };
    01086     return rtai_lxrt(BIDX, SIZARG, RT_GET_ERRNO, &arg).i[LOW];
    01087 }
    01088
    01089 RTAI_PROTO(int,rt_set_linux_signal_handler,(RT_TASK *task, void (*handler)(int sig)))
    01090 {
    01091     struct { RT_TASK *task; void (*handler)(int sig); } arg = { task, handler };
    01092     return rtai_lxrt(BIDX, SIZARG, RT_SET_LINUX_SIGNAL_HANDLER, &arg).i[LOW];
    01093 }
    01094
    01095 RTAI_PROTO(int, rt_lxrt_fork,(int is_a_clone))
    01096 {
    01097     struct { int is_a_clone; } arg = { is_a_clone };
    01098     return rtai_lxrt(BIDX, SIZARG, LXRT_FORK, &arg).i[LOW];
    01099 }
    01100
    01101 RTAI_PROTO(int,rtai_print_to_screen,(const char *format, ...))
    01102 {
    01103         char display[256];
    01104         struct { const char *display; int nch; } arg = { display, 0 };
    01105         va_list args;
    01106
    01107         va_start(args, format);
    01108         arg.nch = vsprintf(display, format, args);
    01109         va_end(args);
    01110         rtai_lxrt(BIDX, SIZARG, PRINT_TO_SCREEN, &arg);
    01111         return arg.nch;
    01112 }
    01113
    01114 RTAI_PROTO(int,rt_printk,(const char *format, ...))
    01115 {
    01116         char display[256];
    01117         struct { const char *display; int nch; } arg = { display, 0 };
    01118         va_list args;
    01119
    01120         va_start(args, format);
    01121         arg.nch = vsprintf(display, format, args);
    01122         va_end(args);
    01123         rtai_lxrt(BIDX, SIZARG, PRINTK, &arg);
    01124         return arg.nch;
    01125 }
    01126
    01127 RTAI_PROTO(int,rt_usp_signal_handler,(void (*handler)(void)))
    01128 {
    01129         struct { void (*handler)(void); } arg = { handler };
    01130         return rtai_lxrt(BIDX, SIZARG, USP_SIGHDL, &arg).i[0];
    01131 }
    01132
    01133 RTAI_PROTO(unsigned long,rt_get_usp_flags,(RT_TASK *rt_task))
    01134 {
    01135         struct { RT_TASK *task; } arg = { rt_task };
    01136         return rtai_lxrt(BIDX, SIZARG, GET_USP_FLAGS, &arg).i[LOW];
    01137 }
    01138
    01139 RTAI_PROTO(unsigned long,rt_get_usp_flags_mask,(RT_TASK *rt_task))
    01140 {
    01141         struct { RT_TASK *task; } arg = { rt_task };
    01142         return rtai_lxrt(BIDX, SIZARG, GET_USP_FLG_MSK, &arg).i[LOW];
    01143 }
    01144
    01145 RTAI_PROTO(void,rt_set_usp_flags,(RT_TASK *rt_task, unsigned long flags))
    01146 {
    01147         struct { RT_TASK *task; unsigned long flags; } arg = { rt_task, flags };
    01148         rtai_lxrt(BIDX, SIZARG, SET_USP_FLAGS, &arg);
    01149 }
    01150
    01151 RTAI_PROTO(void,rt_set_usp_flags_mask,(unsigned long flags_mask))
    01152 {
    01153         struct { unsigned long flags_mask; } arg = { flags_mask };
    01154         rtai_lxrt(BIDX, SIZARG, SET_USP_FLG_MSK, &arg);
    01155 }
    01156
    01157 RTAI_PROTO(RT_TASK *,rt_force_task_soft,(int pid))
    01158 {
    01159         struct { int pid; } arg = { pid };
    01160         return (RT_TASK *)rtai_lxrt(BIDX, SIZARG, FORCE_TASK_SOFT, &arg).v[LOW];
    01161 }
    01162
    01163 RTAI_PROTO(RT_TASK *,rt_agent,(void))
    01164 {
    01165         struct { unsigned long dummy; } arg;
    01166         return (RT_TASK *)rtai_lxrt(BIDX, SIZARG, RT_BUDDY, &arg).v[LOW];
    01167 }
    01168
    01169 #define rt_buddy() rt_agent()
    01170
    01193 RTAI_PROTO(void,rt_make_hard_real_time,(void))
    01194 {
    01195         struct { unsigned long dummy; } arg;
    01196         rtai_lxrt(BIDX, SIZARG, MAKE_HARD_RT, &arg);
    01197 }
    01198
    01207 RTAI_PROTO(void,rt_allow_nonroot_hrt,(void))
    01208 {
    01209         struct { unsigned long dummy; } arg;
    01210         rtai_lxrt(BIDX, SIZARG, NONROOT_HRT, &arg);
    01211 }
    01212
    01213 RTAI_PROTO(int,rt_is_hard_real_time,(RT_TASK *rt_task))
    01214 {
    01215         struct { RT_TASK *task; } arg = { rt_task };
    01216         return rtai_lxrt(BIDX, SIZARG, IS_HARD, &arg).i[LOW];
    01217 }
    01218
    01219 #define rt_is_soft_real_time(rt_task) (!rt_is_hard_real_time((rt_task)))
    01220
    01221 RTAI_PROTO(void,rt_task_set_resume_end_times,(RTIME resume, RTIME end))
    01222 {
    01223         struct { RTIME resume, end; } arg = { resume, end };
    01224         rtai_lxrt(BIDX, SIZARG, SET_RESUME_END, &arg);
    01225 }
    01226
    01227 RTAI_PROTO(int,rt_set_resume_time,(RT_TASK *rt_task, RTIME new_resume_time))
    01228 {
    01229         struct { RT_TASK *rt_task; RTIME new_resume_time; } arg = { rt_task, new_resume_time };
    01230         return rtai_lxrt(BIDX, SIZARG, SET_RESUME_TIME, &arg).i[LOW];
    01231 }
    01232
    01233 RTAI_PROTO(int,rt_set_period,(RT_TASK *rt_task, RTIME new_period))
    01234 {
    01235         struct { RT_TASK *rt_task; RTIME new_period; } arg = { rt_task, new_period };
    01236         return rtai_lxrt(BIDX, SIZARG, SET_PERIOD, &arg).i[LOW];
    01237 }
    01238
    01239 RTAI_PROTO(void,rt_spv_RMS,(int cpuid))
    01240 {
    01241         struct { int cpuid; } arg = { cpuid };
    01242         rtai_lxrt(BIDX, SIZARG, SPV_RMS, &arg);
    01243 }
    01244
    01245 RTAI_PROTO(int,rt_task_wakeup_sleeping,(RT_TASK *task))
    01246 {
    01247         struct { RT_TASK *task; } arg = { task };
    01248         return rtai_lxrt(BIDX, SIZARG, WAKEUP_SLEEPING, &arg).i[LOW];
    01249 }
    01250
    01251 RTAI_PROTO(void,rt_get_exectime,(RT_TASK *task, RTIME *exectime))
    01252 {
    01253         RTIME lexectime[] = { 0LL, 0LL, 0LL };
    01254         struct { RT_TASK *task; RTIME *lexectime; } arg = { task, lexectime };
    01255         rtai_lxrt(BIDX, SIZARG, GET_EXECTIME, &arg);
    01256         memcpy(exectime, lexectime, sizeof(lexectime));
    01257 }
    01258
    01259 RTAI_PROTO(void,rt_gettimeorig,(RTIME time_orig[]))
    01260 {
    01261         struct { RTIME *time_orig; } arg = { time_orig };
    01262         rtai_lxrt(BIDX, SIZARG, GET_TIMEORIG, &arg);
    01263 }
    01264
    01265 #ifdef __cplusplus
    01266 }
    01267 #endif /* __cplusplus */
    01268
    01269 #endif /* __KERNEL__ */
    01270
    01273 #endif /* !_RTAI_LXRT_H */