MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
mbrtai_utils.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/mbrtai_utils.h,v 1.25 2017/01/12 14:46:09 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 /* socket driver */
33 
34 #ifndef MBRTAI_UTILS_H
35 #define MBRTAI_UTILS_H
36 
37 // NOTE: all calls to RTAI are wrapped by MBDyn calls prefixed by "rtmbdyn_"
38 
39 #ifdef USE_RTAI
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif /* __cplusplus */
44 
45 extern int rtmbdyn_rt_task_init(const char *name, int priority, int stack_size,
46  int max_msg_size, int cpu, void **task);
47 extern int rtmbdyn_rt_task_delete(void **task);
48 
49 extern void rtmbdyn_rt_make_hard_real_time(void);
50 extern void rtmbdyn_rt_make_soft_real_time(void);
51 
52 extern void rtmbdyn_rt_allow_nonroot_hrt(void);
53 
54 extern void rtmbdyn_rt_set_oneshot_mode(void);
55 extern void rtmbdyn_rt_set_periodic_mode(void);
56 
57 extern int rtmbdyn_rt_is_hard_timer_running(void);
58 extern long long rtmbdyn_start_rt_timer(long long period);
59 extern void rtmbdyn_stop_rt_timer(void);
60 extern long long rtmbdyn_rt_get_time(void);
61 extern int rtmbdyn_rt_task_make_periodic(void *task, long long start_time,
62  long long period);
63 extern void rtmbdyn_rt_task_wait_period(void);
64 extern long long rtmbdyn_count2nano(long long count);
65 extern long long rtmbdyn_nano2count(long long nanos);
66 
67 extern int rtmbdyn_rt_request_port(unsigned long node);
68 
69 extern int rtmbdyn_rt_mbx_init(const char *name, int size, void **mbx);
70 extern int rtmbdyn_rt_mbx_delete(void **mbx);
71 extern int rtmbdyn_RT_mbx_send(unsigned long node, int port, void *mbx,
72  void *msg, int msg_size);
73 extern int rtmbdyn_RT_mbx_send_if(unsigned long node, int port, void *mbx,
74  void *msg, int msg_size);
75 extern int rtmbdyn_RT_mbx_receive(unsigned long node, int port, void *mbx,
76  void *msg, int msg_size);
77 extern int rtmbdyn_RT_mbx_receive_if(unsigned long node, int port, void *mbx,
78  void *msg, int msg_size);
79 
80 extern int rtmbdyn_RT_get_adr(unsigned long node, int port, const char *name,
81  void **task);
82 
83 extern int rtmbdyn_rt_task_suspend(void *task);
84 extern int rtmbdyn_rt_task_resume(void *task);
85 extern void rtmbdyn_rt_sleep(long long count);
86 
87 extern int rtmbdyn_rt_sem_init(char *name, int value, void **sem);
88 extern int rtmbdyn_rt_sem_delete(void **sem);
89 extern int rtmbdyn_rt_sem_signal(void *sem);
90 extern int rtmbdyn_rt_sem_wait(void *sem);
91 
92 extern void *rtmbdyn_rt_receive(void *task,int *msg);
93 extern void *rtmbdyn_rt_receive_if(void *task,int *msg);
94 extern long long rtmbdyn_rt_get_cpu_time_ns(void);
95 
96 #ifdef __cplusplus
97 }
98 #endif /* __cplusplus */
99 
100 #endif /* USE_RTAI */
101 
102 #endif /* MBRTAI_UTILS_H */
103 
static int count
Definition: modules.cc:41
struct mbrtai_msg_t msg
unsigned short int port
Definition: autopilot.c:143