author | Florian Pose <fp@igh-essen.com> |
Wed, 03 Oct 2007 08:53:00 +0000 | |
changeset 760 | ff09257b2c0f |
parent 666 | 825ead3e0559 |
permissions | -rw-r--r-- |
665
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* and/or modify it under the terms of the GNU General Public License |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* as published by the Free Software Foundation; either version 2 of the |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* License, or (at your option) any later version. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* The IgH EtherCAT Master is distributed in the hope that it will be |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* GNU General Public License for more details. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* along with the IgH EtherCAT Master; if not, write to the Free Software |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* The right to use EtherCAT Technology is granted and comes free of |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* charge under condition of compatibility of product made by |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* Licensee. People intending to distribute/sell products based on the |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* code, have to sign an agreement to guarantee that products using |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* software based on IgH EtherCAT master stay compatible with the actual |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* EtherCAT specification (which are released themselves as an open |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
* standard) as the (only) precondition to have the right to use EtherCAT |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Technology, IP and trade marks. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
* |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
/** |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
\file |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
Dummy EtherCAT master driver module. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
*/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
/*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include <linux/module.h> |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
//#include <linux/kernel.h> |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
//#include <linux/init.h> |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
#include "../master/globals.h" |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
#include "../include/ecrt.h" |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
/*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
int __init ec_init_module(void); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
void __exit ec_cleanup_module(void); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
char *ec_master_version_str = EC_MASTER_VERSION; |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
/*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
/** \cond */ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>"); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
MODULE_DESCRIPTION("DUMMY EtherCAT master driver module"); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
MODULE_LICENSE("GPL"); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
MODULE_VERSION(EC_MASTER_VERSION); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
/** \endcond */ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
/*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
|
666 | 68 |
#define DUMMY_SIZE (PAGE_SIZE * 8) |
69 |
||
70 |
uint8_t dummy_data[DUMMY_SIZE]; |
|
71 |
off_t dummy_off = 0; |
|
72 |
||
73 |
uint8_t *get_dummy_data(void) |
|
74 |
{ |
|
75 |
off_t cur = dummy_off; |
|
76 |
||
77 |
dummy_off += 64; |
|
78 |
dummy_off %= DUMMY_SIZE; |
|
79 |
||
80 |
return dummy_data + cur; |
|
81 |
} |
|
82 |
||
83 |
/*****************************************************************************/ |
|
84 |
||
665
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
/** |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
* Module initialization. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
* Initializes \a ec_master_count masters. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
* \return 0 on success, else < 0 |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
*/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
int __init ec_init_module(void) |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
{ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
EC_INFO("Master DUMMY driver %s\n", EC_MASTER_VERSION); |
666 | 94 |
|
95 |
memset(dummy_data, 0x00, DUMMY_SIZE); |
|
96 |
||
665
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
return 0; |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
} |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
/*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
/** |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
Module cleanup. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
Clears all master instances. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
*/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
void __exit ec_cleanup_module(void) |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
{ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
EC_INFO("Master DUMMY module cleaned up.\n"); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
} |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
/****************************************************************************** |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
* Realtime interface |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
unsigned int ecrt_version_magic(void) |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
{ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
return ECRT_VERSION_MAGIC; |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
} |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
/*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
ec_master_t *ecrt_request_master(unsigned int master_index |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
/**< master index */ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
) |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
{ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
EC_INFO("Requesting DUMMY master %u...\n", master_index); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
return (void *) master_index + 1; |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
} |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
/*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
/** |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
Releases a reserved EtherCAT master. |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
\ingroup RealtimeInterface |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
*/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
void ecrt_release_master(ec_master_t *master /**< EtherCAT master */) |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
{ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
EC_INFO("Released DUMMY master %u.\n", (unsigned int) master - 1); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
} |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
/*****************************************************************************/ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
/** \cond */ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
module_init(ec_init_module); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
module_exit(ec_cleanup_module); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
EXPORT_SYMBOL(ecrt_request_master); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
EXPORT_SYMBOL(ecrt_release_master); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
EXPORT_SYMBOL(ecrt_version_magic); |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
/** \endcond */ |
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
|
a9794f927d78
Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
/*****************************************************************************/ |