author | Florian Pose <fp@igh-essen.com> |
Mon, 23 Jul 2012 15:35:32 +0200 | |
changeset 2400 | 7c9c12c61104 |
parent 2071 | e797dc47018b |
permissions | -rw-r--r-- |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
5 |
* ec_rtdm.c Copyright (C) 2009-2010 Moehwald GmbH B.Benner |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
6 |
* 2011 IgH Andreas Stewering-Bone |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
7 |
* |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
9 |
* This file is part of the IgH EtherCAT master |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
10 |
* |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
11 |
* The IgH EtherCAT master is free software; you can |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
12 |
* redistribute it and/or modify it under the terms of the GNU Lesser General |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
13 |
* Public License as published by the Free Software Foundation; version 2.1 |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
14 |
* of the License. |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
15 |
* |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
16 |
* The IgH EtherCAT master userspace library is distributed in the hope that |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
17 |
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
18 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
19 |
* GNU Lesser General Public License for more details. |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
20 |
* |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
21 |
* You should have received a copy of the GNU Lesser General Public License |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
22 |
* along with the IgH EtherCAT master userspace library. If not, see |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
23 |
* <http://www.gnu.org/licenses/>. |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
24 |
* |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
25 |
* The license mentioned above concerns the source code only. Using the |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
26 |
* EtherCAT technology and brand is only permitted in compliance with the |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
27 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
28 |
* |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
29 |
*****************************************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
30 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
31 |
#include <linux/module.h> |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
32 |
#include <linux/mman.h> |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
33 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
34 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
35 |
#ifdef ENABLE_XENOMAI |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
36 |
#include <native/task.h> |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
37 |
#include <native/sem.h> |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
38 |
#include <native/mutex.h> |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
39 |
#include <native/timer.h> |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
40 |
#endif |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
41 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
42 |
#ifdef ENABLE_RTAI |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
43 |
#include <rtai_sched.h> |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
44 |
#include <rtai_sem.h> |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
45 |
#endif |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
46 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
47 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
48 |
#include <rtdm/rtdm_driver.h> |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
49 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
50 |
#include "../include/ecrt.h" |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
51 |
#include "../include/ec_rtdm.h" |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
52 |
|
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
53 |
#ifdef ENABLE_XENOMAI |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
54 |
#define my_mutex_create(X,Y) rt_mutex_create(X, Y) |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
55 |
#define my_mutex_acquire(X,Y) rt_mutex_acquire(X,Y) |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
56 |
#define my_mutex_release(X) rt_mutex_release(X) |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
57 |
#define my_mutex_delete(X) rt_mutex_delete(X) |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
58 |
#endif |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
59 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
60 |
#ifdef ENABLE_RTAI |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
61 |
#define my_mutex_create(X,Y) rt_sem_init(X, 1) |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
62 |
#define my_mutex_acquire(X,Y) rt_sem_wait(X) |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
63 |
#define my_mutex_release(X) rt_sem_signal(X) |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
64 |
#define my_mutex_delete(X) rt_sem_delete(X) |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
65 |
#define TM_INFINITE |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
66 |
#endif |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
67 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
68 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
69 |
|
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
70 |
|
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
71 |
#define EC_RTDM_MAX_MASTERS 5 /**< Maximum number of masters. */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
72 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
73 |
#define EC_RTDM_GINFO(fmt, args...) \ |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
74 |
rtdm_printk(KERN_INFO "EtherCATrtdm: " fmt, ##args) |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
75 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
76 |
#define EC_RTDM_GERR(fmt, args...) \ |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
77 |
rtdm_printk(KERN_ERR "EtherCATrtdm ERROR: " fmt, ##args) |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
78 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
79 |
#define EC_RTDM_GWARN(fmt, args...) \ |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
80 |
rtdm_printk(KERN_WARNING "EtherCATrtdm WARNING: " fmt, ##args) |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
81 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
82 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
83 |
#define EC_RTDM_INFO(devno, fmt, args...) \ |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
84 |
rtdm_printk(KERN_INFO "EtherCATrtdm %u: " fmt, devno, ##args) |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
85 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
86 |
#define EC_RTDM_ERR(devno, fmt, args...) \ |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
87 |
rtdm_printk(KERN_ERR "EtherCATrtdm %u ERROR: " fmt, devno, ##args) |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
88 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
89 |
#define EC_RTDM_WARN(devno, fmt, args...) \ |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
90 |
rtdm_printk(KERN_WARNING "EtherCATrtdm %u WARNING: " fmt, devno, ##args) |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
91 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
92 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
93 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
94 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
95 |
typedef struct _EC_RTDM_DRV_STRUCT { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
96 |
unsigned int isattached; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
97 |
ec_master_t * master; |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
98 |
ec_domain_t * domain; |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
99 |
#ifdef ENABLE_XENOMAI |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
100 |
RT_MUTEX masterlock; |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
101 |
#endif |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
102 |
#ifdef ENABLE_RTAI |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
103 |
SEM masterlock; |
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
104 |
#endif |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
105 |
unsigned int sendcnt; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
106 |
unsigned int reccnt; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
107 |
unsigned int sendcntlv; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
108 |
unsigned int reccntlv; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
109 |
char mutexname[64]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
110 |
unsigned int masterno; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
111 |
} EC_RTDM_DRV_STRUCT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
112 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
113 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
114 |
static EC_RTDM_DRV_STRUCT ec_rtdm_masterintf[EC_RTDM_MAX_MASTERS]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
115 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
116 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
117 |
/* import from ethercat */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
118 |
ec_master_t *ecrt_attach_master(unsigned int master_index /**< Index of the master to request. */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
119 |
); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
120 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
121 |
// driver context struct: used for storing various information |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
122 |
typedef struct _EC_RTDM_DRV_CONTEXT { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
123 |
int dev_id; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
124 |
EC_RTDM_DRV_STRUCT* pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
125 |
} EC_RTDM_DRV_CONTEXT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
126 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
127 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
128 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
129 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
130 |
/* Utilities */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
131 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
132 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
133 |
static int _atoi(const char* text) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
134 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
135 |
char b; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
136 |
int wd=-1; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
137 |
int nfak=1; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
138 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
139 |
wd=0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
140 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
141 |
while ((*text==' ') || (*text=='\t')) text++; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
142 |
if (*text=='-') |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
143 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
144 |
nfak=-1; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
145 |
text++; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
146 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
147 |
if (*text=='+') |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
148 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
149 |
text++; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
150 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
151 |
while (*text!=0) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
152 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
153 |
b = *text; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
154 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
155 |
if ( (b>='0') && (b<='9') ) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
156 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
157 |
b=b-'0'; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
158 |
wd=wd*10+b; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
159 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
160 |
text++; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
161 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
162 |
return (nfak*wd); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
163 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
164 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
165 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
166 |
/**********************************************************/ |
2071
e797dc47018b
Fix for new locking for rtdm module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2058
diff
changeset
|
167 |
/* DRIVER lockcallback */ |
e797dc47018b
Fix for new locking for rtdm module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2058
diff
changeset
|
168 |
/**********************************************************/ |
e797dc47018b
Fix for new locking for rtdm module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2058
diff
changeset
|
169 |
void request_lock_callback(void *cb_data) |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
170 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
171 |
EC_RTDM_DRV_STRUCT * pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
172 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
173 |
pdrvstruc = (EC_RTDM_DRV_STRUCT*)cb_data; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
174 |
if (pdrvstruc->master) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
175 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
176 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2071
e797dc47018b
Fix for new locking for rtdm module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2058
diff
changeset
|
177 |
} |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
178 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
179 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
180 |
/*****************************************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
181 |
|
2071
e797dc47018b
Fix for new locking for rtdm module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2058
diff
changeset
|
182 |
void release_lock_callback(void *cb_data) |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
183 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
184 |
EC_RTDM_DRV_STRUCT * pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
185 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
186 |
pdrvstruc = (EC_RTDM_DRV_STRUCT*)cb_data; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
187 |
if (pdrvstruc->master) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
188 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
189 |
my_mutex_release(&pdrvstruc->masterlock); |
2071
e797dc47018b
Fix for new locking for rtdm module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2058
diff
changeset
|
190 |
} |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
191 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
192 |
|
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
193 |
|
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
194 |
|
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
195 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
196 |
void detach_master(EC_RTDM_DRV_STRUCT * pdrvstruc) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
197 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
198 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
199 |
if (pdrvstruc->isattached) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
200 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
201 |
EC_RTDM_INFO(pdrvstruc->masterno,"reseting callbacks!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
202 |
ecrt_master_callbacks(pdrvstruc->master,NULL,NULL,NULL); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
203 |
EC_RTDM_INFO(pdrvstruc->masterno,"deleting mutex!\n"); |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
204 |
my_mutex_delete(&pdrvstruc->masterlock); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
205 |
pdrvstruc->master = NULL; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
206 |
pdrvstruc->isattached=0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
207 |
EC_RTDM_INFO(pdrvstruc->masterno,"master detach done!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
208 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
209 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
210 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
211 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
212 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
213 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
214 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
215 |
/* DRIVER OPEN */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
216 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
217 |
int ec_rtdm_open_rt(struct rtdm_dev_context *context, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
218 |
rtdm_user_info_t *user_info, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
219 |
int oflags) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
220 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
221 |
EC_RTDM_DRV_CONTEXT* my_context; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
222 |
EC_RTDM_DRV_STRUCT * pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
223 |
const char * p; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
224 |
int dev_no; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
225 |
unsigned int namelen; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
226 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
227 |
//int ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
228 |
int dev_id; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
229 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
230 |
// get the context for our driver - used to store driver info |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
231 |
my_context = (EC_RTDM_DRV_CONTEXT*)context->dev_private; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
232 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
233 |
dev_no = -1; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
234 |
namelen = strlen(context->device->driver_name); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
235 |
p = &context->device->driver_name[namelen-1]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
236 |
if (p!=&context->device->driver_name[0]) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
237 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
238 |
while ((*p>='0') && (*p<='9')) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
239 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
240 |
p--; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
241 |
if (p==&context->device->driver_name[0]) break; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
242 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
243 |
dev_no=_atoi(p); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
244 |
if ((dev_no!=-1) && (dev_no<EC_RTDM_MAX_MASTERS)) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
245 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
246 |
dev_id = context->device->device_id; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
247 |
pdrvstruc = (EC_RTDM_DRV_STRUCT*)&ec_rtdm_masterintf[dev_no]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
248 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
249 |
my_context->dev_id = dev_id; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
250 |
my_context->pdrvstruc = pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
251 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
252 |
// enable interrupt in RTDM |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
253 |
return 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
254 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
255 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
256 |
EC_RTDM_GERR("open - Cannot detect master device no\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
257 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
258 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
259 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
260 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
261 |
/* DRIVER CLOSE */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
262 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
263 |
int ec_rtdm_close_rt(struct rtdm_dev_context *context, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
264 |
rtdm_user_info_t *user_info) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
265 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
266 |
EC_RTDM_DRV_CONTEXT* my_context; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
267 |
EC_RTDM_DRV_STRUCT * pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
268 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
269 |
// get the context |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
270 |
my_context = (EC_RTDM_DRV_CONTEXT*)context->dev_private; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
271 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
272 |
pdrvstruc = my_context->pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
273 |
EC_RTDM_INFO(pdrvstruc->masterno,"close called!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
274 |
detach_master(pdrvstruc); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
275 |
return 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
276 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
277 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
278 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
279 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
280 |
/* DRIVER IOCTL */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
281 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
282 |
int ec_rtdm_ioctl_rt(struct rtdm_dev_context *context, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
283 |
rtdm_user_info_t *user_info, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
284 |
int request, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
285 |
void *arg) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
286 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
287 |
EC_RTDM_DRV_CONTEXT* my_context; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
288 |
EC_RTDM_DRV_STRUCT * pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
289 |
int ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
290 |
unsigned int l_ioctlvalue[]={0,0,0,0,0,0,0,0}; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
291 |
ec_domain_state_t ds; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
292 |
ec_master_state_t ms; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
293 |
uint64_t app_time; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
294 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
295 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
296 |
ret = 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
297 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
298 |
// get the context |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
299 |
my_context = (EC_RTDM_DRV_CONTEXT*)context->dev_private; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
300 |
pdrvstruc = my_context->pdrvstruc; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
301 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
302 |
switch (request) { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
303 |
case EC_RTDM_MASTERSTATE: |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
304 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
305 |
if (!pdrvstruc->isattached) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
306 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
307 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
308 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
309 |
if (pdrvstruc->master) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
310 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
311 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
312 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
313 |
ecrt_master_state(pdrvstruc->master, &ms); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
314 |
|
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
315 |
my_mutex_release(&pdrvstruc->masterlock); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
316 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
317 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
318 |
if (rtdm_rw_user_ok(user_info, arg, sizeof(ms))) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
319 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
320 |
// copy data to user |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
321 |
if (rtdm_copy_to_user(user_info, arg, &ms,sizeof(ms))) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
322 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
323 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
324 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
325 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
326 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
327 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
328 |
break; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
329 |
case EC_RTDM_DOMAINSTATE: |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
330 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
331 |
if (!pdrvstruc->isattached) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
332 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
333 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
334 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
335 |
if (pdrvstruc->domain) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
336 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
337 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
338 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
339 |
ecrt_domain_state(pdrvstruc->domain, &ds); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
340 |
|
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
341 |
my_mutex_release(&pdrvstruc->masterlock); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
342 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
343 |
if (rtdm_rw_user_ok(user_info, arg, sizeof(ds))) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
344 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
345 |
// copy data to user |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
346 |
if (rtdm_copy_to_user(user_info, arg, &ds,sizeof(ds))) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
347 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
348 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
349 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
350 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
351 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
352 |
break; |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
353 |
case EC_RTDM_MASTER_RECEIVE: |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
354 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
355 |
if (pdrvstruc->isattached) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
356 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
357 |
if (pdrvstruc->master) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
358 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
359 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
360 |
ecrt_master_receive(pdrvstruc->master); |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
361 |
pdrvstruc->reccnt++; |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
362 |
my_mutex_release(&pdrvstruc->masterlock); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
363 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
364 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
365 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
366 |
break; |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
367 |
case EC_RTDM_DOMAIN_PROCESS: |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
368 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
369 |
if (pdrvstruc->isattached) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
370 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
371 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
372 |
ecrt_domain_process(pdrvstruc->domain); |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
373 |
my_mutex_release(&pdrvstruc->masterlock); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
374 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
375 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
376 |
break; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
377 |
case EC_RTDM_MASTER_SEND: |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
378 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
379 |
|
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
380 |
if (pdrvstruc->isattached) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
381 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
382 |
if (pdrvstruc->master) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
383 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
384 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
385 |
ecrt_master_send(pdrvstruc->master); |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
386 |
pdrvstruc->sendcnt++; |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
387 |
my_mutex_release(&pdrvstruc->masterlock); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
388 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
389 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
390 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
391 |
break; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
392 |
case EC_RTDM_DOMAIN_QUEQUE: |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
393 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
394 |
if (pdrvstruc->isattached) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
395 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
396 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
397 |
ecrt_domain_queue(pdrvstruc->domain); |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
398 |
my_mutex_release(&pdrvstruc->masterlock); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
399 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
400 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
401 |
break; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
402 |
|
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
403 |
case EC_RTDM_MASTER_APP_TIME: |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
404 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
405 |
if (!pdrvstruc->isattached) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
406 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
407 |
rtdm_printk("ERROR : No Master attached\n"); |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
408 |
return -EFAULT; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
409 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
410 |
if (rtdm_safe_copy_from_user(user_info, &app_time, arg, sizeof(app_time))) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
411 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
412 |
rtdm_printk("ERROR : can't copy data to driver\n"); |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
413 |
return -EFAULT; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
414 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
415 |
|
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
416 |
if (pdrvstruc->master) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
417 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
418 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
419 |
|
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
420 |
ecrt_master_application_time(pdrvstruc->master, app_time); |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
421 |
my_mutex_release(&pdrvstruc->masterlock); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
422 |
|
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
423 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
424 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
425 |
break; |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
426 |
case EC_RTDM_SYNC_REF_CLOCK: |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
427 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
428 |
if (!pdrvstruc->isattached) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
429 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
430 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
431 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
432 |
if (pdrvstruc->master) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
433 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
434 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
435 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
436 |
ecrt_master_sync_reference_clock(pdrvstruc->master); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
437 |
|
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
438 |
my_mutex_release(&pdrvstruc->masterlock); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
439 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
440 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
441 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
442 |
break; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
443 |
case EC_RTDM_SYNC_SLAVE_CLOCK: |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
444 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
445 |
if (!pdrvstruc->isattached) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
446 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
447 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
448 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
449 |
if (pdrvstruc->master) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
450 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
451 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
452 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
453 |
ecrt_master_sync_slave_clocks(pdrvstruc->master); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
454 |
|
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
455 |
my_mutex_release(&pdrvstruc->masterlock); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
456 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
457 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
458 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
459 |
break; |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
460 |
case EC_RTDM_MASTER_SYNC_MONITOR_QUEQUE: |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
461 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
462 |
if (!pdrvstruc->isattached) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
463 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
464 |
return -EFAULT; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
465 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
466 |
if (pdrvstruc->master) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
467 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
468 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
469 |
ecrt_master_sync_monitor_queue(pdrvstruc->master); |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
470 |
my_mutex_release(&pdrvstruc->masterlock); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
471 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
472 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
473 |
break; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
474 |
case EC_RTDM_MASTER_SYNC_MONITOR_PROCESS: |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
475 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
476 |
uint32_t ret; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
477 |
if (!pdrvstruc->isattached) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
478 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
479 |
return -EFAULT; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
480 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
481 |
if (pdrvstruc->master) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
482 |
{ |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
483 |
my_mutex_acquire(&pdrvstruc->masterlock,TM_INFINITE); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
484 |
ret = ecrt_master_sync_monitor_process(pdrvstruc->master); |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
485 |
my_mutex_release(&pdrvstruc->masterlock); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
486 |
if (rtdm_safe_copy_to_user(user_info, arg, &ret, sizeof(ret))) |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
487 |
{ |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
488 |
EC_RTDM_ERR(pdrvstruc->masterno,"copy to user param failed!\n"); |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
489 |
ret=-EFAULT; |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
490 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
491 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
492 |
} |
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
493 |
break; |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
494 |
case EC_RTDM_MSTRATTACH: |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
495 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
496 |
unsigned int mstridx; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
497 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
498 |
mstridx = 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
499 |
ret = 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
500 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
501 |
EC_RTDM_INFO(pdrvstruc->masterno,"Master attach start!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
502 |
if (user_info) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
503 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
504 |
if (rtdm_read_user_ok(user_info, arg, sizeof(unsigned int))) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
505 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
506 |
if (rtdm_copy_from_user(user_info, &l_ioctlvalue[0], arg,sizeof(unsigned int))==0) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
507 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
508 |
pdrvstruc->domain = (ec_domain_t*)l_ioctlvalue[0]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
509 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
510 |
else |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
511 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
512 |
EC_RTDM_ERR(pdrvstruc->masterno,"copy user param failed!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
513 |
ret=-EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
514 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
515 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
516 |
else |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
517 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
518 |
EC_RTDM_ERR(pdrvstruc->masterno,"user parameter domain missing!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
519 |
ret=-EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
520 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
521 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
522 |
if (ret!=0) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
523 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
524 |
return ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
525 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
526 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
527 |
if ( (pdrvstruc->master) && (pdrvstruc->isattached)) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
528 |
// master is allready attached |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
529 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
530 |
// master is allready attached |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
531 |
EC_RTDM_ERR(pdrvstruc->masterno,"Master is allready attached!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
532 |
ret = -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
533 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
534 |
else |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
535 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
536 |
//mstr=ecrt_request_master(0); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
537 |
mstridx = pdrvstruc->masterno; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
538 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
539 |
pdrvstruc->master=ecrt_attach_master(mstridx); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
540 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
541 |
if (pdrvstruc->master) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
542 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
543 |
// Ok |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
544 |
EC_RTDM_INFO(pdrvstruc->masterno,"Master searching for domain!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
545 |
pdrvstruc->domain = ecrt_master_find_domain(pdrvstruc->master,l_ioctlvalue[0]); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
546 |
if (!pdrvstruc->domain) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
547 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
548 |
// |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
549 |
EC_RTDM_ERR(pdrvstruc->masterno,"Cannot find domain from index %u!\n",l_ioctlvalue[0]); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
550 |
ret = -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
551 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
552 |
else |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
553 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
554 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
555 |
// set device name |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
556 |
snprintf(&pdrvstruc->mutexname[0],sizeof(pdrvstruc->mutexname)-1,"ETHrtdmLOCK%d",pdrvstruc->masterno); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
557 |
EC_RTDM_INFO(pdrvstruc->masterno,"Creating Master mutex %s!\n",&pdrvstruc->mutexname[0]); |
2058
543c4ce9e86e
Working RTAI RTDM module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2055
diff
changeset
|
558 |
my_mutex_create(&pdrvstruc->masterlock,&pdrvstruc->mutexname[0]); |
2071
e797dc47018b
Fix for new locking for rtdm module
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2058
diff
changeset
|
559 |
ecrt_master_callbacks(pdrvstruc->master, request_lock_callback, release_lock_callback, pdrvstruc); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
560 |
EC_RTDM_INFO(pdrvstruc->masterno,"MSTR ATTACH done domain=%u!\n",(unsigned int)pdrvstruc->domain); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
561 |
pdrvstruc->isattached=1; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
562 |
ret = 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
563 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
564 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
565 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
566 |
else |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
567 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
568 |
EC_RTDM_ERR(pdrvstruc->masterno,"Master attach failed!\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
569 |
pdrvstruc->master = NULL; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
570 |
ret = -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
571 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
572 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
573 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
574 |
break; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
575 |
default: |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
576 |
ret = -ENOTTY; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
577 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
578 |
return ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
579 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
580 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
581 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
582 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
583 |
/* DRIVER READ */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
584 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
585 |
int ec_rtdm_read_rt(struct rtdm_dev_context *context, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
586 |
rtdm_user_info_t *user_info, void *buf, size_t nbyte) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
587 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
588 |
int ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
589 |
#if defined(USE_THIS) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
590 |
EC_RTDM_DRV_CONTEXT* my_context; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
591 |
char *out_pos; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
592 |
int dev_id; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
593 |
rtdm_toseq_t timeout_seq; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
594 |
int ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
595 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
596 |
out_pos = (char *)buf; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
597 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
598 |
my_context = (EC_RTDM_DRV_CONTEXT*)context->dev_private; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
599 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
600 |
// zero bytes requested ? return! |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
601 |
if (nbyte == 0) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
602 |
return 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
603 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
604 |
// check if R/W actions to user-space are allowed |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
605 |
if (user_info && !rtdm_rw_user_ok(user_info, buf, nbyte)) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
606 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
607 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
608 |
dev_id = my_context->dev_id; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
609 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
610 |
// in case we need to check if reading is allowed (locking) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
611 |
/* if (test_and_set_bit(0, &ctx->in_lock)) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
612 |
return -EBUSY; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
613 |
*/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
614 |
/* // if we need to do some stuff with preemption disabled: |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
615 |
rtdm_lock_get_irqsave(&ctx->lock, lock_ctx); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
616 |
// stuff here |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
617 |
rtdm_lock_put_irqrestore(&ctx->lock, lock_ctx); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
618 |
*/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
619 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
620 |
// wait: if ctx->timeout = 0, it will block infintely until |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
621 |
// rtdm_event_signal(&ctx->irq_event); is called from our |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
622 |
// interrupt routine |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
623 |
//ret = rtdm_event_timedwait(&ctx->irq_event, ctx->timeout, &timeout_seq); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
624 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
625 |
// now write the requested stuff to user-space |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
626 |
if (rtdm_copy_to_user(user_info, out_pos, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
627 |
dummy_buffer, BUFSIZE) != 0) { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
628 |
ret = -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
629 |
} else { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
630 |
ret = BUFSIZE; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
631 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
632 |
#else |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
633 |
ret = -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
634 |
#endif |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
635 |
return ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
636 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
637 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
638 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
639 |
/* DRIVER WRITE */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
640 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
641 |
int ec_rtdm_write_rt(struct rtdm_dev_context *context, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
642 |
rtdm_user_info_t *user_info, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
643 |
const void *buf, size_t nbyte) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
644 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
645 |
int ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
646 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
647 |
#if defined(USE_THIS) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
648 |
int dev_id; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
649 |
char *in_pos = (char *)buf; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
650 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
651 |
EC_RTDM_DRV_CONTEXT* my_context; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
652 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
653 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
654 |
my_context = (EC_RTDM_DRV_CONTEXT*)context->dev_private; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
655 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
656 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
657 |
if (nbyte == 0) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
658 |
return 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
659 |
if (user_info && !rtdm_read_user_ok(user_info, buf, nbyte)) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
660 |
return -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
661 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
662 |
dev_id = my_context->dev_id; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
663 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
664 |
if (rtdm_copy_from_user(user_info, dummy_buffer, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
665 |
in_pos, BUFSIZE) != 0) { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
666 |
ret = -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
667 |
} else { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
668 |
ret = BUFSIZE; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
669 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
670 |
#else |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
671 |
ret = -EFAULT; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
672 |
#endif |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
673 |
// used when it is atomic |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
674 |
// rtdm_mutex_unlock(&ctx->out_lock); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
675 |
return ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
676 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
677 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
678 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
679 |
/* DRIVER OPERATIONS */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
680 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
681 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
682 |
// Template |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
683 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
684 |
static struct rtdm_device ec_rtdm_device_t = { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
685 |
struct_version: RTDM_DEVICE_STRUCT_VER, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
686 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
687 |
device_flags: RTDM_NAMED_DEVICE, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
688 |
context_size: sizeof(EC_RTDM_DRV_CONTEXT), |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
689 |
device_name: EC_RTDM_DEV_FILE_NAME, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
690 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
691 |
/* open and close functions are not real-time safe due kmalloc |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
692 |
and kfree. If you do not use kmalloc and kfree, and you made |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
693 |
sure that there is no syscall in the open/close handler, you |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
694 |
can declare the open_rt and close_rt handler. |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
695 |
*/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
696 |
open_rt: NULL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
697 |
open_nrt: ec_rtdm_open_rt, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
698 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
699 |
ops: { |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
700 |
close_rt: NULL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
701 |
close_nrt: ec_rtdm_close_rt, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
702 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
703 |
ioctl_rt: ec_rtdm_ioctl_rt, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
704 |
ioctl_nrt: ec_rtdm_ioctl_rt, // rtdm_mmap_to_user is not RT safe |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
705 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
706 |
read_rt: ec_rtdm_read_rt, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
707 |
read_nrt: NULL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
708 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
709 |
write_rt: ec_rtdm_write_rt, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
710 |
write_nrt: NULL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
711 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
712 |
recvmsg_rt: NULL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
713 |
recvmsg_nrt: NULL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
714 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
715 |
sendmsg_rt: NULL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
716 |
sendmsg_nrt: NULL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
717 |
}, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
718 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
719 |
device_class: RTDM_CLASS_EXPERIMENTAL, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
720 |
device_sub_class: 222, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
721 |
driver_name: EC_RTDM_DEV_FILE_NAME, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
722 |
driver_version: RTDM_DRIVER_VER(1,0,1), |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
723 |
peripheral_name: EC_RTDM_DEV_FILE_NAME, |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
724 |
provider_name: "EtherLab Community", |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
725 |
// proc_name: ethcatrtdm_device.device_name, |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
726 |
}; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
727 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
728 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
729 |
static struct rtdm_device ec_rtdm_devices[EC_RTDM_MAX_MASTERS]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
730 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
731 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
732 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
733 |
/* INIT DRIVER */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
734 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
735 |
int init_module(void) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
736 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
737 |
unsigned int i; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
738 |
int ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
739 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
740 |
ret = 0; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
741 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
742 |
EC_RTDM_GINFO("Initlializing EtherCAT RTDM Interface to Igh EtherCAT Master\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
743 |
memset(&ec_rtdm_masterintf[0],0,sizeof(ec_rtdm_masterintf)); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
744 |
for (i=0;( (i<EC_RTDM_MAX_MASTERS) && (ret==0) ) ;i++) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
745 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
746 |
// master no to struct |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
747 |
ec_rtdm_masterintf[i].masterno = i; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
748 |
// copy from template |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
749 |
memcpy(&ec_rtdm_devices[i],&ec_rtdm_device_t,sizeof(ec_rtdm_devices[0])); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
750 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
751 |
// set device name |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
752 |
snprintf(&ec_rtdm_devices[i].device_name[0],RTDM_MAX_DEVNAME_LEN,"%s%d",EC_RTDM_DEV_FILE_NAME,i); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
753 |
// set proc_name |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
754 |
ec_rtdm_devices[i].proc_name = &ec_rtdm_devices[i].device_name[0]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
755 |
ec_rtdm_devices[i].driver_name = &ec_rtdm_devices[i].device_name[0]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
756 |
ec_rtdm_devices[i].peripheral_name = &ec_rtdm_devices[i].device_name[0]; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
757 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
758 |
EC_RTDM_GINFO("Registering device %s!\n",ec_rtdm_devices[i].driver_name); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
759 |
ret = rtdm_dev_register(&ec_rtdm_devices[i]); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
760 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
761 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
762 |
if (ret!=0) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
763 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
764 |
// register m |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
765 |
EC_RTDM_GERR("Initialization of EtherCAT RTDM Interface failed\n"); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
766 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
767 |
return ret; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
768 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
769 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
770 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
771 |
/* CLEANUP DRIVER */ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
772 |
/**********************************************************/ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
773 |
void cleanup_module(void) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
774 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
775 |
unsigned int i; |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
776 |
|
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
777 |
EC_RTDM_GINFO("Cleanup EtherCAT RTDM Interface \n"); |
2054
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
778 |
for (i=0;i<EC_RTDM_MAX_MASTERS;i++) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
779 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
780 |
if (ec_rtdm_masterintf[i].isattached) |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
781 |
{ |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
782 |
detach_master(&ec_rtdm_masterintf[i]); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
783 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
784 |
EC_RTDM_GINFO("Unregistering device %s!\n",ec_rtdm_devices[i].driver_name); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
785 |
rtdm_dev_unregister(&ec_rtdm_devices[i],1000); |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
786 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
787 |
} |
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
788 |
|
3417bbc4ad2f
First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
789 |
MODULE_LICENSE("GPL"); |
2055
d246ab6b50d2
Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
2054
diff
changeset
|
790 |
MODULE_DESCRIPTION("EtherCAT RTDM Interface"); |