author | Florian Pose <fp@igh-essen.com> |
Mon, 02 Jun 2008 08:54:51 +0000 | |
changeset 931 | 482bbaf3e76b |
parent 929 | 64de138e6a54 |
child 941 | 41a993738383 |
permissions | -rw-r--r-- |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* and/or modify it under the terms of the GNU General Public License |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* as published by the Free Software Foundation; either version 2 of the |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* License, or (at your option) any later version. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* The IgH EtherCAT Master is distributed in the hope that it will be |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* GNU General Public License for more details. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* along with the IgH EtherCAT Master; if not, write to the Free Software |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* The right to use EtherCAT Technology is granted and comes free of |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* charge under condition of compatibility of product made by |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* Licensee. People intending to distribute/sell products based on the |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* code, have to sign an agreement to guarantee that products using |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* software based on IgH EtherCAT master stay compatible with the actual |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* EtherCAT specification (which are released themselves as an open |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
* standard) as the (only) precondition to have the right to use EtherCAT |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Technology, IP and trade marks. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
/** |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
\file |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
EtherCAT slave configuration methods. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include <linux/module.h> |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
#include "globals.h" |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
#include "master.h" |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
#include "slave_config.h" |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
void ec_slave_config_clear(struct kobject *); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
ssize_t ec_show_slave_config_attribute(struct kobject *, struct attribute *, |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
char *); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
/** \cond */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
EC_SYSFS_READ_ATTR(info); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
static struct attribute *def_attrs[] = { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
&attr_info, |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
NULL, |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
}; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
static struct sysfs_ops sysfs_ops = { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
.show = ec_show_slave_config_attribute |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
}; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
static struct kobj_type ktype_ec_slave_config = { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
.release = ec_slave_config_clear, |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
.sysfs_ops = &sysfs_ops, |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
.default_attrs = def_attrs |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
}; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
/** \endcond */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
/** Slave configuration constructor. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
* See ecrt_master_slave_config() for the usage of the \a alias and \a |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
* position parameters. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
* \retval 0 Success. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
* \retval <0 Failure. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
int ec_slave_config_init(ec_slave_config_t *sc, /**< Slave configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
ec_master_t *master, /**< EtherCAT master. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
uint16_t alias, /**< Slave alias. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
uint16_t position, /**< Slave position. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
uint32_t vendor_id, /**< Expected vendor ID. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
uint32_t product_code /**< Expected product code. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
ec_direction_t dir; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
sc->master = master; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
sc->alias = alias; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
sc->position = position; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
sc->vendor_id = vendor_id; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
sc->product_code = product_code; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
sc->slave = NULL; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
105 |
ec_pdo_list_init(&sc->pdos[dir]); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
INIT_LIST_HEAD(&sc->sdo_configs); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
108 |
INIT_LIST_HEAD(&sc->sdo_requests); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
sc->used_fmmus = 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
// init kobject and add it to the hierarchy |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
memset(&sc->kobj, 0x00, sizeof(struct kobject)); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
kobject_init(&sc->kobj); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
sc->kobj.ktype = &ktype_ec_slave_config; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
sc->kobj.parent = &master->kobj; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
if (kobject_set_name(&sc->kobj, "config-%u-%u", sc->alias, sc->position)) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
EC_ERR("Failed to set kobject name for slave config %u:%u.\n", |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
sc->alias, sc->position); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
goto out_put; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
if (kobject_add(&sc->kobj)) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
EC_ERR("Failed to add kobject for slave config %u:%u.\n", |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
sc->alias, sc->position); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
goto out_put; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
return 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
out_put: |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
kobject_put(&sc->kobj); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
return -1; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
/** Slave configuration destructor. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
* Clears and frees a slave configuration object. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
void ec_slave_config_destroy( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
ec_slave_config_t *sc /**< Slave configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
ec_slave_config_detach(sc); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
// destroy self |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
kobject_del(&sc->kobj); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
kobject_put(&sc->kobj); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
/** Clear and free the slave configuration. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
* This method is called by the kobject, once there are no more references to |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
* it. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
void ec_slave_config_clear(struct kobject *kobj /**< kobject of the config. */) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
ec_slave_config_t *sc; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
ec_direction_t dir; |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
163 |
ec_sdo_request_t *req, *next_req; |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
sc = container_of(kobj, ec_slave_config_t, kobj); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
// Free Pdo mappings |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
169 |
ec_pdo_list_clear(&sc->pdos[dir]); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
|
814 | 171 |
// free all Sdo configurations |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
172 |
list_for_each_entry_safe(req, next_req, &sc->sdo_configs, list) { |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
173 |
list_del(&req->list); |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
174 |
ec_sdo_request_clear(req); |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
175 |
kfree(req); |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
176 |
} |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
178 |
// free all Sdo requests |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
179 |
list_for_each_entry_safe(req, next_req, &sc->sdo_requests, list) { |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
180 |
list_del(&req->list); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
181 |
ec_sdo_request_clear(req); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
182 |
kfree(req); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
183 |
} |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
184 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
kfree(sc); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
/** Prepares an FMMU configuration. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
* Configuration data for the FMMU is saved in the slave config structure and |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
* is written to the slave during the configuration. The FMMU configuration |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
* is done in a way, that the complete data range of the corresponding sync |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
* manager is covered. Seperate FMMUs are configured for each domain. If the |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
196 |
* FMMU configuration is already prepared, the function does nothing and |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
197 |
* returns with success. |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
198 |
* |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
199 |
* \retval >=0 Success, logical offset byte address. |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
200 |
* \retval -1 Error, FMMU limit reached. |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
int ec_slave_config_prepare_fmmu( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
ec_domain_t *domain, /**< Domain. */ |
814 | 205 |
ec_direction_t dir /**< Pdo direction. */ |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
unsigned int i; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
ec_fmmu_config_t *fmmu; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
// FMMU configuration already prepared? |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
for (i = 0; i < sc->used_fmmus; i++) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
fmmu = &sc->fmmu_configs[i]; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
if (fmmu->domain == domain && fmmu->dir == dir) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
return fmmu->logical_start_address; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
if (sc->used_fmmus == EC_MAX_FMMUS) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
EC_ERR("FMMU limit reached for slave configuration %u:%u!\n", |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
sc->alias, sc->position); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
return -1; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
fmmu = &sc->fmmu_configs[sc->used_fmmus++]; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
ec_fmmu_config_init(fmmu, sc, domain, dir); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
return fmmu->logical_start_address; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
/** Outputs all information about a certain slave configuration. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
ssize_t ec_slave_config_info( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
const ec_slave_config_t *sc, /**< Slave configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
char *buffer /**< Output buffer */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
char *buf = buffer; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
ec_direction_t dir; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
240 |
const ec_pdo_list_t *pdos; |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
const ec_pdo_t *pdo; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
const ec_pdo_entry_t *entry; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
char str[20]; |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
244 |
const ec_sdo_request_t *req; |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
buf += sprintf(buf, "Alias: 0x%04X (%u)\n", sc->alias, sc->alias); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
buf += sprintf(buf, "Position: %u\n", sc->position); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
250 |
pdos = &sc->pdos[dir]; |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
252 |
if (!list_empty(&pdos->list)) { |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
253 |
buf += sprintf(buf, "%s Pdo assignment / mapping:\n", |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
dir == EC_DIR_OUTPUT ? "Output" : "Input"); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
256 |
list_for_each_entry(pdo, &pdos->list, list) { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
buf += sprintf(buf, " %s 0x%04X \"%s\"\n", |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
pdo->dir == EC_DIR_OUTPUT ? "RxPdo" : "TxPdo", |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
pdo->index, pdo->name ? pdo->name : "???"); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
list_for_each_entry(entry, &pdo->entries, list) { |
926
6bb33c6ec770
Output subindices with %02X.
Florian Pose <fp@igh-essen.com>
parents:
925
diff
changeset
|
262 |
buf += sprintf(buf, " 0x%04X:%02X \"%s\", %u bit\n", |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
entry->index, entry->subindex, |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
entry->name ? entry->name : "???", |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
entry->bit_length); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
// type-cast to avoid warnings on some compilers |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
if (!list_empty((struct list_head *) &sc->sdo_configs)) { |
814 | 273 |
buf += sprintf(buf, "\nSdo configurations:\n"); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
|
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
275 |
list_for_each_entry(req, &sc->sdo_configs, list) { |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
276 |
switch (req->data_size) { |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
277 |
case 1: sprintf(str, "%u", EC_READ_U8(req->data)); break; |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
278 |
case 2: sprintf(str, "%u", EC_READ_U16(req->data)); break; |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
279 |
case 4: sprintf(str, "%u", EC_READ_U32(req->data)); break; |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
default: sprintf(str, "(invalid size)"); break; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
} |
926
6bb33c6ec770
Output subindices with %02X.
Florian Pose <fp@igh-essen.com>
parents:
925
diff
changeset
|
282 |
buf += sprintf(buf, " 0x%04X:%02X -> %s\n", |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
844
diff
changeset
|
283 |
req->index, req->subindex, str); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
buf += sprintf(buf, "\n"); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
288 |
// type-cast to avoid warnings on some compilers |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
289 |
if (!list_empty((struct list_head *) &sc->sdo_requests)) { |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
290 |
buf += sprintf(buf, "\nSdo requests:\n"); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
291 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
292 |
list_for_each_entry(req, &sc->sdo_requests, list) { |
926
6bb33c6ec770
Output subindices with %02X.
Florian Pose <fp@igh-essen.com>
parents:
925
diff
changeset
|
293 |
buf += sprintf(buf, " 0x%04X:%02X\n", req->index, req->subindex); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
294 |
} |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
295 |
buf += sprintf(buf, "\n"); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
296 |
} |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
297 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
return buf - buffer; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
/** Formats attribute data for SysFS read access. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
* \return number of bytes to read |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
ssize_t ec_show_slave_config_attribute( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
struct kobject *kobj, /**< Slave configuration's kobject */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
struct attribute *attr, /**< Requested attribute. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
char *buffer /**< Memory to store data. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
ec_slave_config_t *sc = container_of(kobj, ec_slave_config_t, kobj); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
if (attr == &attr_info) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
return ec_slave_config_info(sc, buffer); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
return 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
/** Attaches the configuration to the addressed slave object. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
* |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
* \retval 0 Success. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
* \retval -1 Slave not found. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
* \retval -2 Slave already configured. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
* \retval -3 Invalid slave type found at the given position. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
int ec_slave_config_attach( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
ec_slave_config_t *sc /**< Slave configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
ec_slave_t *slave; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
if (sc->slave) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
return 0; // already attached |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
|
927
ffb7d1876ce0
Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents:
926
diff
changeset
|
340 |
if (!(slave = ec_master_find_slave( |
ffb7d1876ce0
Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents:
926
diff
changeset
|
341 |
sc->master, sc->alias, sc->position))) { |
ffb7d1876ce0
Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents:
926
diff
changeset
|
342 |
EC_WARN("Failed to find slave for configuration %u:%u.\n", |
ffb7d1876ce0
Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents:
926
diff
changeset
|
343 |
sc->alias, sc->position); |
ffb7d1876ce0
Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents:
926
diff
changeset
|
344 |
return -1; |
ffb7d1876ce0
Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents:
926
diff
changeset
|
345 |
} |
ffb7d1876ce0
Introduced ec_master_find_slave().
Florian Pose <fp@igh-essen.com>
parents:
926
diff
changeset
|
346 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
if (slave->config) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
EC_ERR("Failed to attach slave configuration %u:%u. Slave %u" |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
" already has a configuration!\n", sc->alias, |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
sc->position, slave->ring_position); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
return -2; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
} |
834
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
353 |
if (slave->sii.vendor_id != sc->vendor_id |
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
354 |
|| slave->sii.product_code != sc->product_code) { |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
EC_ERR("Slave %u has an invalid type (0x%08X/0x%08X) for" |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
" configuration %u:%u (0x%08X/0x%08X).\n", |
834
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
357 |
slave->ring_position, slave->sii.vendor_id, |
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
358 |
slave->sii.product_code, sc->alias, sc->position, |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
sc->vendor_id, sc->product_code); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
return -3; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
// attach slave |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
slave->config = sc; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
sc->slave = slave; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
|
929 | 367 |
if (sc->master->debug_level) |
368 |
EC_DBG("Attached slave %u to config %u:%u.\n", |
|
369 |
slave->ring_position, sc->alias, sc->position); |
|
370 |
||
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
ec_slave_request_state(slave, EC_SLAVE_STATE_OP); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
return 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
/** Detaches the configuration from a slave object. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
void ec_slave_config_detach( |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
ec_slave_config_t *sc /**< Slave configuration. */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
if (sc->slave) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
sc->slave->config = NULL; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
sc->slave = NULL; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
392 |
/** Loads the default Pdo assignment from the slave object. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
393 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
394 |
void ec_slave_config_load_default_assignment(ec_slave_config_t *sc) |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
ec_direction_t dir; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
397 |
ec_pdo_list_t *pdos; |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
ec_sync_t *sync; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
if (!sc->slave) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
return; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
404 |
pdos = &sc->pdos[dir]; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
405 |
if ((sync = ec_slave_get_pdo_sync(sc->slave, dir))) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
406 |
ec_pdo_list_copy(pdos, &sync->pdos); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
407 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
408 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
409 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
410 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
411 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
412 |
/** Loads the default mapping for a Pdo from the slave object. |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
413 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
414 |
void ec_slave_config_load_default_mapping( |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
415 |
const ec_slave_config_t *sc, |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
416 |
ec_pdo_t *pdo |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
417 |
) |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
418 |
{ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
419 |
const ec_sync_t *sync; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
420 |
const ec_pdo_t *default_pdo; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
421 |
|
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
422 |
if (sc->master->debug_level) |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
423 |
EC_DBG("Loading default configuration for Pdo 0x%04X in" |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
424 |
" config %u:%u.\n", pdo->index, sc->alias, sc->position); |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
425 |
|
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
426 |
pdo->default_config = 1; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
427 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
428 |
if (!sc->slave) { |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
429 |
EC_WARN("Failed to load default Pdo configuration for %u:%u:" |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
430 |
" Slave not found.\n", sc->alias, sc->position); |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
431 |
return; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
432 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
433 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
434 |
if (!(sync = ec_slave_get_pdo_sync(sc->slave, pdo->dir))) { |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
435 |
EC_WARN("Slave %u does not provide a default Pdo" |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
436 |
" configuration!\n", sc->slave->ring_position); |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
437 |
return; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
438 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
439 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
440 |
list_for_each_entry(default_pdo, &sync->pdos.list, list) { |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
441 |
if (default_pdo->index != pdo->index) |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
442 |
continue; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
443 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
444 |
if (sc->master->debug_level) |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
445 |
EC_DBG(" Found Pdo name \"%s\".\n", |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
446 |
default_pdo->name); |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
447 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
448 |
// try to take Pdo name from mapped one |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
449 |
ec_pdo_set_name(pdo, default_pdo->name); |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
450 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
451 |
// copy entries (= default Pdo configuration) |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
452 |
if (ec_pdo_copy_entries(pdo, default_pdo)) |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
453 |
return; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
454 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
455 |
if (sc->master->debug_level) { |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
456 |
const ec_pdo_entry_t *entry; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
457 |
list_for_each_entry(entry, &pdo->entries, list) { |
926
6bb33c6ec770
Output subindices with %02X.
Florian Pose <fp@igh-essen.com>
parents:
925
diff
changeset
|
458 |
EC_DBG(" Entry 0x%04X:%02X.\n", |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
459 |
entry->index, entry->subindex); |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
460 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
461 |
} |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
/****************************************************************************** |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
* Realtime interface |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
469 |
int ecrt_slave_config_pdo_assign_add(ec_slave_config_t *sc, |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
470 |
ec_direction_t dir, uint16_t index) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
471 |
{ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
472 |
ec_pdo_list_t *pl = &sc->pdos[dir]; |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
473 |
ec_pdo_t *pdo; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
474 |
|
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
475 |
if (sc->master->debug_level) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
476 |
EC_DBG("Adding Pdo 0x%04X to assignment for dir %u, config %u:%u.\n", |
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
477 |
index, dir, sc->alias, sc->position); |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
478 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
479 |
if (!(pdo = ec_pdo_list_add_pdo(pl, dir, index))) |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
480 |
return -1; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
481 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
482 |
ec_slave_config_load_default_mapping(sc, pdo); |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
483 |
return 0; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
484 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
485 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
486 |
/*****************************************************************************/ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
487 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
488 |
void ecrt_slave_config_pdo_assign_clear(ec_slave_config_t *sc, |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
489 |
ec_direction_t dir) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
490 |
{ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
491 |
if (sc->master->debug_level) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
492 |
EC_DBG("Clearing Pdo assignment for dir %u, config %u:%u.\n", |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
493 |
dir, sc->alias, sc->position); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
494 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
495 |
ec_pdo_list_clear_pdos(&sc->pdos[dir]); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
496 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
497 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
498 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
499 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
500 |
int ecrt_slave_config_pdo_mapping_add(ec_slave_config_t *sc, |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
501 |
uint16_t pdo_index, uint16_t entry_index, uint8_t entry_subindex, |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
502 |
uint8_t entry_bit_length) |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
503 |
{ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
504 |
ec_direction_t dir; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
505 |
ec_pdo_t *pdo; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
506 |
|
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
507 |
if (sc->master->debug_level) |
926
6bb33c6ec770
Output subindices with %02X.
Florian Pose <fp@igh-essen.com>
parents:
925
diff
changeset
|
508 |
EC_DBG("Adding Pdo entry 0x%04X:%02X (%u bit) to mapping of Pdo" |
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
509 |
" 0x%04X, config %u:%u.\n", entry_index, entry_subindex, |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
510 |
entry_bit_length, pdo_index, sc->alias, sc->position); |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
511 |
|
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
512 |
for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
513 |
if ((pdo = ec_pdo_list_find_pdo(&sc->pdos[dir], pdo_index))) |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
514 |
break; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
515 |
|
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
516 |
if (!pdo) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
517 |
EC_ERR("Pdo 0x%04X is not assigned in config %u:%u.\n", |
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
518 |
pdo_index, sc->alias, sc->position); |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
519 |
return -1; |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
520 |
} |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
521 |
|
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
522 |
return ec_pdo_add_entry(pdo, entry_index, entry_subindex, |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
523 |
entry_bit_length) ? 0 : -1; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
524 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
525 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
526 |
/*****************************************************************************/ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
527 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
528 |
void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc, |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
529 |
uint16_t pdo_index) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
530 |
{ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
531 |
ec_direction_t dir; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
532 |
ec_pdo_t *pdo; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
533 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
534 |
if (sc->master->debug_level) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
535 |
EC_DBG("Clearing mapping of Pdo 0x%04X, config %u:%u.\n", |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
536 |
pdo_index, sc->alias, sc->position); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
537 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
538 |
for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
539 |
if ((pdo = ec_pdo_list_find_pdo(&sc->pdos[dir], pdo_index))) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
540 |
break; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
541 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
542 |
if (!pdo) { |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
543 |
EC_WARN("Pdo 0x%04X is not assigned in config %u:%u.\n", |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
544 |
pdo_index, sc->alias, sc->position); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
545 |
return; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
546 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
547 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
548 |
ec_pdo_clear_entries(pdo); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
549 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
550 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
551 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
552 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
553 |
int ecrt_slave_config_pdos(ec_slave_config_t *sc, unsigned int n_infos, |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
const ec_pdo_info_t pdo_infos[]) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
{ |
844
8839ba8bfeb4
Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents:
843
diff
changeset
|
556 |
unsigned int i, j; |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
557 |
const ec_pdo_info_t *pi; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
558 |
ec_pdo_list_t *pl; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
559 |
unsigned int cleared[] = {0, 0}; |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
560 |
const ec_pdo_entry_info_t *ei; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
561 |
|
844
8839ba8bfeb4
Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents:
843
diff
changeset
|
562 |
for (i = 0; i < n_infos; i++) { |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
563 |
pi = &pdo_infos[i]; |
878 | 564 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
565 |
if (pi->dir == EC_END) |
878 | 566 |
break; |
567 |
||
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
568 |
pl = &sc->pdos[pi->dir]; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
569 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
570 |
if (!cleared[pi->dir]) { |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
571 |
ecrt_slave_config_pdo_assign_clear(sc, pi->dir); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
572 |
cleared[pi->dir] = 1; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
573 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
574 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
575 |
if (ecrt_slave_config_pdo_assign_add(sc, pi->dir, pi->index)) |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
576 |
return -1; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
577 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
578 |
if (pi->n_entries && pi->entries) { // mapping provided |
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
579 |
if (sc->master->debug_level) |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
580 |
EC_DBG(" Pdo mapping information provided.\n"); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
581 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
582 |
ecrt_slave_config_pdo_mapping_clear(sc, pi->index); |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
583 |
|
844
8839ba8bfeb4
Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents:
843
diff
changeset
|
584 |
for (j = 0; j < pi->n_entries; j++) { |
8839ba8bfeb4
Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents:
843
diff
changeset
|
585 |
ei = &pi->entries[j]; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
586 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
587 |
if (ecrt_slave_config_pdo_mapping_add(sc, pi->index, |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
588 |
ei->index, ei->subindex, ei->bit_length)) |
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
589 |
return -1; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
590 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
591 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
592 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
593 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
return 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
|
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
599 |
int ecrt_slave_config_reg_pdo_entry( |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
600 |
ec_slave_config_t *sc, |
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
601 |
uint16_t index, |
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
602 |
uint8_t subindex, |
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
603 |
ec_domain_t *domain, |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
924
diff
changeset
|
604 |
unsigned int *bit_position |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
605 |
) |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
606 |
{ |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
607 |
ec_direction_t dir; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
608 |
ec_pdo_list_t *pdos; |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
924
diff
changeset
|
609 |
unsigned int bit_offset, bit_pos; |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
610 |
ec_pdo_t *pdo; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
611 |
ec_pdo_entry_t *entry; |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
612 |
int sync_offset; |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
613 |
|
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
614 |
for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
615 |
pdos = &sc->pdos[dir]; |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
616 |
bit_offset = 0; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
617 |
list_for_each_entry(pdo, &pdos->list, list) { |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
618 |
list_for_each_entry(entry, &pdo->entries, list) { |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
619 |
if (entry->index != index || entry->subindex != subindex) { |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
620 |
bit_offset += entry->bit_length; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
621 |
} else { |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
622 |
goto found; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
623 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
624 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
625 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
626 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
627 |
|
926
6bb33c6ec770
Output subindices with %02X.
Florian Pose <fp@igh-essen.com>
parents:
925
diff
changeset
|
628 |
EC_ERR("Pdo entry 0x%04X:%02X is not mapped in slave config %u:%u.\n", |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
629 |
index, subindex, sc->alias, sc->position); |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
630 |
return -1; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
631 |
|
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
632 |
found: |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
633 |
sync_offset = ec_slave_config_prepare_fmmu(sc, domain, dir); |
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
634 |
if (sync_offset < 0) |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
635 |
return -2; |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
636 |
|
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
924
diff
changeset
|
637 |
bit_pos = bit_offset % 8; |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
924
diff
changeset
|
638 |
if (bit_position) { |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
924
diff
changeset
|
639 |
*bit_position = bit_pos; |
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
924
diff
changeset
|
640 |
} else if (bit_pos) { |
926
6bb33c6ec770
Output subindices with %02X.
Florian Pose <fp@igh-essen.com>
parents:
925
diff
changeset
|
641 |
EC_ERR("Pdo entry 0x%04X:%02X does not byte-align in config %u:%u.\n", |
925
939f3e9bba1e
Some improvements concerning bit_position.
Florian Pose <fp@igh-essen.com>
parents:
924
diff
changeset
|
642 |
index, subindex, sc->alias, sc->position); |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
643 |
return -3; |
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
644 |
} |
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
645 |
|
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
646 |
return sync_offset + bit_offset / 8; |
924
d8d9a1056afa
Fixed missing right brace
Richard Hacker <ha@igh-essen.com>
parents:
923
diff
changeset
|
647 |
} |
923
a6b51990e7e6
Changed Pdo entry registration function - return byte and bit positions
Richard Hacker <ha@igh-essen.com>
parents:
916
diff
changeset
|
648 |
|
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
649 |
|
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
650 |
/*****************************************************************************/ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
651 |
|
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
652 |
int ecrt_slave_config_sdo(ec_slave_config_t *sc, uint16_t index, |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
653 |
uint8_t subindex, const uint8_t *data, size_t size) |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
654 |
{ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
655 |
ec_slave_t *slave = sc->slave; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
656 |
ec_sdo_request_t *req; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
657 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
658 |
if (slave && !(slave->sii.mailbox_protocols & EC_MBOX_COE)) { |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
659 |
EC_ERR("Slave %u does not support CoE!\n", slave->ring_position); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
660 |
return -1; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
661 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
662 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
663 |
if (!(req = (ec_sdo_request_t *) |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
664 |
kmalloc(sizeof(ec_sdo_request_t), GFP_KERNEL))) { |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
665 |
EC_ERR("Failed to allocate memory for Sdo configuration!\n"); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
666 |
return -1; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
667 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
668 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
669 |
ec_sdo_request_init(req); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
670 |
ec_sdo_request_address(req, index, subindex); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
671 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
672 |
if (ec_sdo_request_copy_data(req, data, size)) { |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
673 |
ec_sdo_request_clear(req); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
674 |
kfree(req); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
675 |
return -1; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
676 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
677 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
678 |
list_add_tail(&req->list, &sc->sdo_configs); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
679 |
return 0; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
680 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
681 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
682 |
/*****************************************************************************/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
683 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
684 |
int ecrt_slave_config_sdo8(ec_slave_config_t *sc, uint16_t index, |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
uint8_t subindex, uint8_t value) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
uint8_t data[1]; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
EC_WRITE_U8(data, value); |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
689 |
return ecrt_slave_config_sdo(sc, index, subindex, data, 1); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
690 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
691 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
692 |
/*****************************************************************************/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
693 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
694 |
int ecrt_slave_config_sdo16(ec_slave_config_t *sc, uint16_t index, |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
uint8_t subindex, uint16_t value) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
uint8_t data[2]; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
EC_WRITE_U16(data, value); |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
699 |
return ecrt_slave_config_sdo(sc, index, subindex, data, 2); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
700 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
701 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
702 |
/*****************************************************************************/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
703 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
704 |
int ecrt_slave_config_sdo32(ec_slave_config_t *sc, uint16_t index, |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
uint8_t subindex, uint32_t value) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
uint8_t data[4]; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
EC_WRITE_U32(data, value); |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
709 |
return ecrt_slave_config_sdo(sc, index, subindex, data, 4); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
714 |
ec_sdo_request_t *ecrt_slave_config_create_sdo_request(ec_slave_config_t *sc, |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
715 |
uint16_t index, uint8_t subindex, size_t size) |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
716 |
{ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
717 |
ec_sdo_request_t *req; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
718 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
719 |
if (!(req = (ec_sdo_request_t *) |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
720 |
kmalloc(sizeof(ec_sdo_request_t), GFP_KERNEL))) { |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
721 |
EC_ERR("Failed to allocate Sdo request memory!\n"); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
722 |
return NULL; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
723 |
} |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
724 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
725 |
ec_sdo_request_init(req); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
726 |
ec_sdo_request_address(req, index, subindex); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
727 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
728 |
if (ec_sdo_request_alloc(req, size)) { |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
729 |
ec_sdo_request_clear(req); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
730 |
kfree(req); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
731 |
return NULL; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
732 |
} |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
733 |
|
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
734 |
// prepare data for optional writing |
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
735 |
memset(req->data, 0x00, size); |
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
736 |
req->data_size = size; |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
737 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
738 |
list_add_tail(&req->list, &sc->sdo_requests); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
739 |
return req; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
740 |
} |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
741 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
742 |
/*****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
743 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
/** \cond */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
746 |
EXPORT_SYMBOL(ecrt_slave_config_pdo_assign_add); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
747 |
EXPORT_SYMBOL(ecrt_slave_config_pdo_assign_clear); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
748 |
EXPORT_SYMBOL(ecrt_slave_config_pdo_mapping_add); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
749 |
EXPORT_SYMBOL(ecrt_slave_config_pdo_mapping_clear); |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
750 |
EXPORT_SYMBOL(ecrt_slave_config_pdos); |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
751 |
EXPORT_SYMBOL(ecrt_slave_config_reg_pdo_entry); |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
752 |
EXPORT_SYMBOL(ecrt_slave_config_sdo); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
EXPORT_SYMBOL(ecrt_slave_config_sdo8); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
EXPORT_SYMBOL(ecrt_slave_config_sdo16); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
EXPORT_SYMBOL(ecrt_slave_config_sdo32); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
756 |
EXPORT_SYMBOL(ecrt_slave_config_create_sdo_request); |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
/** \endcond */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
/*****************************************************************************/ |