author | Florian Pose <fp@igh-essen.com> |
Thu, 29 May 2008 09:53:10 +0000 | |
changeset 921 | c8c2caf0d667 |
parent 916 | db73994fbdac |
child 923 | a6b51990e7e6 |
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) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
buf += sprintf(buf, " 0x%04X:%X \"%s\", %u bit\n", |
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 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
buf += sprintf(buf, " 0x%04X:%-3i -> %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) { |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
293 |
buf += sprintf(buf, " 0x%04X:%u\n", req->index, req->subindex); |
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 |
unsigned int alias_found = 0, relative_position = 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
if (sc->slave) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
return 0; // already attached |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
list_for_each_entry(slave, &sc->master->slaves, list) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
if (!alias_found) { |
834
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
343 |
if (sc->alias && slave->sii.alias != sc->alias) |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
continue; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
alias_found = 1; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
relative_position = 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
if (relative_position == sc->position) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
goto found; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
relative_position++; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
|
797 | 353 |
EC_WARN("Failed to find slave for configuration %u:%u.\n", |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
sc->alias, sc->position); |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
return -1; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
found: |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
if (slave->config) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
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
|
360 |
" 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
|
361 |
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
|
362 |
return -2; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
} |
834
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
364 |
if (slave->sii.vendor_id != sc->vendor_id |
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
365 |
|| 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
|
366 |
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
|
367 |
" 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
|
368 |
slave->ring_position, slave->sii.vendor_id, |
0791aac03180
Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
369 |
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
|
370 |
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
|
371 |
return -3; |
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 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
// attach slave |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
slave->config = sc; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
sc->slave = slave; |
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 |
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
|
379 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
return 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
} |
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 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
/** 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
|
386 |
*/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
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
|
388 |
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
|
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 |
if (sc->slave) { |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
sc->slave->config = NULL; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
sc->slave = NULL; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
} |
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 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
399 |
/** 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
|
400 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
401 |
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
|
402 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
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
|
404 |
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
|
405 |
ec_sync_t *sync; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
if (!sc->slave) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
return; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
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
|
411 |
pdos = &sc->pdos[dir]; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
412 |
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
|
413 |
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
|
414 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
415 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
416 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
417 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
418 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
419 |
/** 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
|
420 |
*/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
421 |
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
|
422 |
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
|
423 |
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
|
424 |
) |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
425 |
{ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
426 |
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
|
427 |
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
|
428 |
|
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
429 |
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
|
430 |
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
|
431 |
" 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
|
432 |
|
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
433 |
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
|
434 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
435 |
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
|
436 |
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
|
437 |
" 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
|
438 |
return; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
439 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
440 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
441 |
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
|
442 |
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
|
443 |
" 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
|
444 |
return; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
445 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
446 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
447 |
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
|
448 |
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
|
449 |
continue; |
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 |
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
|
452 |
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
|
453 |
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
|
454 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
455 |
// 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
|
456 |
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
|
457 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
458 |
// 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
|
459 |
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
|
460 |
return; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
461 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
462 |
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
|
463 |
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
|
464 |
list_for_each_entry(entry, &pdo->entries, list) { |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
465 |
EC_DBG(" Entry 0x%04X:%u.\n", |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
466 |
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
|
467 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
468 |
} |
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
/****************************************************************************** |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
* Realtime interface |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
476 |
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
|
477 |
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
|
478 |
{ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
479 |
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
|
480 |
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
|
481 |
|
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
482 |
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
|
483 |
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
|
484 |
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
|
485 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
486 |
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
|
487 |
return -1; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
488 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
489 |
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
|
490 |
return 0; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
491 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
492 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
493 |
/*****************************************************************************/ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
494 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
495 |
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
|
496 |
ec_direction_t dir) |
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 |
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
|
499 |
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
|
500 |
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
|
501 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
502 |
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
|
503 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
504 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
505 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
506 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
507 |
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
|
508 |
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
|
509 |
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
|
510 |
{ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
511 |
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
|
512 |
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
|
513 |
|
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
514 |
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
|
515 |
EC_DBG("Adding Pdo entry 0x%04X:%u (%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
|
516 |
" 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
|
517 |
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
|
518 |
|
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
519 |
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
|
520 |
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
|
521 |
break; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
522 |
|
843
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
523 |
if (!pdo) { |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
524 |
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
|
525 |
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
|
526 |
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
|
527 |
} |
b6bddb663755
Added some debugging and fixed a bug, when Pdo was not found.
Florian Pose <fp@igh-essen.com>
parents:
842
diff
changeset
|
528 |
|
842
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
529 |
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
|
530 |
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
|
531 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
532 |
|
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
533 |
/*****************************************************************************/ |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
534 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
535 |
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
|
536 |
uint16_t pdo_index) |
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 |
ec_direction_t dir; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
539 |
ec_pdo_t *pdo; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
540 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
541 |
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
|
542 |
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
|
543 |
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
|
544 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
545 |
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
|
546 |
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
|
547 |
break; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
548 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
549 |
if (!pdo) { |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
550 |
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
|
551 |
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
|
552 |
return; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
553 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
554 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
555 |
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
|
556 |
} |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
557 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
558 |
/*****************************************************************************/ |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
559 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
560 |
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
|
561 |
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
|
562 |
{ |
844
8839ba8bfeb4
Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents:
843
diff
changeset
|
563 |
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
|
564 |
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
|
565 |
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
|
566 |
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
|
567 |
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
|
568 |
|
844
8839ba8bfeb4
Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents:
843
diff
changeset
|
569 |
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
|
570 |
pi = &pdo_infos[i]; |
878 | 571 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
572 |
if (pi->dir == EC_END) |
878 | 573 |
break; |
574 |
||
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
575 |
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
|
576 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
577 |
if (!cleared[pi->dir]) { |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
578 |
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
|
579 |
cleared[pi->dir] = 1; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
580 |
} |
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 |
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
|
583 |
return -1; |
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
584 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
585 |
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
|
586 |
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
|
587 |
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
|
588 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
589 |
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
|
590 |
|
844
8839ba8bfeb4
Fixed 2 bugs in new Pdo mapping function.
Florian Pose <fp@igh-essen.com>
parents:
843
diff
changeset
|
591 |
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
|
592 |
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
|
593 |
|
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
594 |
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
|
595 |
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
|
596 |
return -1; |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
597 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
598 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
599 |
} |
40e27e5a8dce
Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents:
834
diff
changeset
|
600 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
return 0; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
|
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
606 |
int ecrt_slave_config_reg_pdo_entry( |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
607 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
608 |
uint16_t index, /**< Index of Pdo entry to register. */ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
609 |
uint8_t subindex, /**< Subindex of Pdo entry to register. */ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
610 |
ec_domain_t *domain /**< Domain. */ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
611 |
) |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
612 |
{ |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
613 |
int ret = ecrt_slave_config_reg_pdo_entry_bitwise( |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
614 |
sc, index, subindex, domain); |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
615 |
|
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
616 |
if (ret < 0) |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
617 |
return ret; |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
618 |
|
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
619 |
if (ret % 8) { |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
620 |
EC_ERR("Bytewise Pdo entry registration requested, but the result is " |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
621 |
"not byte-aligned.\n"); |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
622 |
return -3; |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
623 |
} |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
624 |
|
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
625 |
return ret / 8; |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
626 |
} |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
627 |
|
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
628 |
/*****************************************************************************/ |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
629 |
|
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
630 |
int ecrt_slave_config_reg_pdo_entry_bitwise( |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
631 |
ec_slave_config_t *sc, /**< Slave configuration. */ |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
632 |
uint16_t index, /**< Index of Pdo entry to register. */ |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
633 |
uint8_t subindex, /**< Subindex of Pdo entry to register. */ |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
634 |
ec_domain_t *domain /**< Domain. */ |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
635 |
) |
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
636 |
{ |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
637 |
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
|
638 |
ec_pdo_list_t *pdos; |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
639 |
unsigned int bit_offset; |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
640 |
ec_pdo_t *pdo; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
641 |
ec_pdo_entry_t *entry; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
642 |
int ret; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
643 |
|
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
644 |
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
|
645 |
pdos = &sc->pdos[dir]; |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
646 |
bit_offset = 0; |
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
647 |
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
|
648 |
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
|
649 |
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
|
650 |
bit_offset += entry->bit_length; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
651 |
} else { |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
652 |
goto found; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
653 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
654 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
655 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
656 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
657 |
|
814 | 658 |
EC_ERR("Pdo entry 0x%04X:%u 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
|
659 |
index, subindex, sc->alias, sc->position); |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
660 |
return -1; |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
661 |
|
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
662 |
found: |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
663 |
if ((ret = ec_slave_config_prepare_fmmu(sc, domain, dir)) < 0) |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
664 |
return -2; |
916
db73994fbdac
Added bitwise Pdo registration.
Florian Pose <fp@igh-essen.com>
parents:
893
diff
changeset
|
665 |
return ret * 8 + bit_offset; |
807
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
666 |
} |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
667 |
|
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
668 |
/*****************************************************************************/ |
f8bca95ab75d
Moved ecrt_domain_reg_pdo_entry() to
Florian Pose <fp@igh-essen.com>
parents:
797
diff
changeset
|
669 |
|
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
670 |
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
|
671 |
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
|
672 |
{ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
673 |
ec_slave_t *slave = sc->slave; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
674 |
ec_sdo_request_t *req; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
675 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
676 |
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
|
677 |
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
|
678 |
return -1; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
679 |
} |
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 |
if (!(req = (ec_sdo_request_t *) |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
682 |
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
|
683 |
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
|
684 |
return -1; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
685 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
686 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
687 |
ec_sdo_request_init(req); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
688 |
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
|
689 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
690 |
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
|
691 |
ec_sdo_request_clear(req); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
692 |
kfree(req); |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
693 |
return -1; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
694 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
695 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
696 |
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
|
697 |
return 0; |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
698 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
699 |
|
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 |
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
|
703 |
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
|
704 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
uint8_t data[1]; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
EC_WRITE_U8(data, value); |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
707 |
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
|
708 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
709 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
710 |
/*****************************************************************************/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
711 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
712 |
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
|
713 |
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
|
714 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
uint8_t data[2]; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
EC_WRITE_U16(data, value); |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
717 |
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
|
718 |
} |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
719 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
720 |
/*****************************************************************************/ |
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
721 |
|
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
722 |
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
|
723 |
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
|
724 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
uint8_t data[4]; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
EC_WRITE_U32(data, value); |
893
d921fff3d6e2
Exported ecrt_slave_config_sdo(); added documentation.
Florian Pose <fp@igh-essen.com>
parents:
879
diff
changeset
|
727 |
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
|
728 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
|
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
732 |
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
|
733 |
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
|
734 |
{ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
735 |
ec_sdo_request_t *req; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
736 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
737 |
if (!(req = (ec_sdo_request_t *) |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
738 |
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
|
739 |
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
|
740 |
return NULL; |
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 |
ec_sdo_request_init(req); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
744 |
ec_sdo_request_address(req, index, subindex); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
745 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
746 |
if (ec_sdo_request_alloc(req, size)) { |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
747 |
ec_sdo_request_clear(req); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
748 |
kfree(req); |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
749 |
return NULL; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
750 |
} |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
751 |
|
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
752 |
// 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
|
753 |
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
|
754 |
req->data_size = size; |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
755 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
756 |
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
|
757 |
return req; |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
758 |
} |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
759 |
|
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
760 |
/*****************************************************************************/ |
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
761 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
/** \cond */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
|
879
9b395c5646ab
Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents:
878
diff
changeset
|
764 |
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
|
765 |
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
|
766 |
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
|
767 |
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
|
768 |
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
|
769 |
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
|
770 |
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
|
771 |
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
|
772 |
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
|
773 |
EXPORT_SYMBOL(ecrt_slave_config_sdo32); |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
774 |
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
|
775 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
/** \endcond */ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
/*****************************************************************************/ |