Xenomai API  2.6.5
internal.h
1 /*
2  * Copyright (C) 2005-2007 Jan Kiszka <[email protected]>.
3  * Copyright (C) 2005 Joerg Langenberg <[email protected]>.
4  *
5  * Xenomai is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * Xenomai is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with Xenomai; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _RTDM_INTERNAL_H
21 #define _RTDM_INTERNAL_H
22 
23 #include <nucleus/pod.h>
24 #include <nucleus/ppd.h>
25 #include <rtdm/rtdm_driver.h>
26 
27 #include <linux/list.h>
28 #include <linux/sem.h>
29 
30 #ifndef CONFIG_XENO_OPT_DEBUG_RTDM_APPL
31 #define CONFIG_XENO_OPT_DEBUG_RTDM_APPL 0
32 #endif
33 
34 #define RTDM_FD_MAX CONFIG_XENO_OPT_RTDM_FILDES
35 
36 #define DEF_DEVNAME_HASHTAB_SIZE 256 /* entries in name hash table */
37 #define DEF_PROTO_HASHTAB_SIZE 256 /* entries in protocol hash table */
38 
39 struct rtdm_fildes {
40  struct rtdm_dev_context *context;
41 };
42 
43 struct rtdm_process {
44 #ifdef CONFIG_XENO_OPT_VFILE
45  char name[32];
46  pid_t pid;
47 #endif /* CONFIG_XENO_OPT_VFILE */
48 
49  xnshadow_ppd_t ppd;
50 };
51 
52 DECLARE_EXTERN_XNLOCK(rt_fildes_lock);
53 DECLARE_EXTERN_XNLOCK(rt_dev_lock);
54 
55 extern int __rtdm_muxid;
56 extern struct rtdm_fildes fildes_table[];
57 extern int open_fildes;
58 extern struct semaphore nrt_dev_lock;
59 extern unsigned int devname_hashtab_size;
60 extern unsigned int protocol_hashtab_size;
61 extern struct list_head *rtdm_named_devices;
62 extern struct list_head *rtdm_protocol_devices;
63 
64 #ifdef MODULE
65 #define rtdm_initialised 1
66 #else /* !MODULE */
67 extern int rtdm_initialised;
68 #endif /* MODULE */
69 
70 void cleanup_owned_contexts(void *user_info);
71 int rtdm_no_support(void);
72 struct rtdm_device *get_named_device(const char *name);
73 struct rtdm_device *get_protocol_device(int protocol_family, int socket_type);
74 
75 static inline void rtdm_dereference_device(struct rtdm_device *device)
76 {
77  atomic_dec(&device->reserved.refcount);
78 }
79 
80 int __init rtdm_dev_init(void);
81 void rtdm_dev_cleanup(void);
82 
83 #ifdef CONFIG_XENO_OPT_VFILE
84 int rtdm_proc_init(void);
85 void rtdm_proc_cleanup(void);
86 int rtdm_proc_register_device(struct rtdm_device *device);
87 void rtdm_proc_unregister_device(struct rtdm_device *device);
88 #else
89 static inline int rtdm_proc_init(void)
90 {
91  return 0;
92 }
93 void rtdm_proc_cleanup(void)
94 {
95 }
96 static int rtdm_proc_register_device(struct rtdm_device *device)
97 {
98  return 0;
99 }
100 static void rtdm_proc_unregister_device(struct rtdm_device *device)
101 {
102 }
103 #endif
104 
105 void rtdm_apc_handler(void *cookie);
106 
107 #endif /* _RTDM_INTERNAL_H */
int socket_type
Protocol device identification: socket type (SOCK_xxx)
Definition: rtdm_driver.h:478
Real-time pod interface header.
struct rtdm_dev_reserved reserved
Data stored by RTDM inside a registered device (internal use only)
Definition: rtdm_driver.h:533
Device context.
Definition: rtdm_driver.h:397
Real-Time Driver Model for Xenomai, driver API header.
RTDM device.
Definition: rtdm_driver.h:462
int protocol_family
Protocol device identification: protocol family (PF_xxx)
Definition: rtdm_driver.h:476