author | Florian Pose <fp@igh-essen.com> |
Fri, 16 Mar 2012 16:04:26 +0100 | |
branch | redundancy |
changeset 2367 | 8527429b6137 |
parent 1959 | 656f114153c2 |
child 2421 | bc2d4bf9cbe5 |
child 2589 | 2b9c78543663 |
permissions | -rw-r--r-- |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
6 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT master userspace library. |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
8 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
9 |
* The IgH EtherCAT master userspace library is free software; you can |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
10 |
* redistribute it and/or modify it under the terms of the GNU Lesser General |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
11 |
* Public License as published by the Free Software Foundation; version 2.1 |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
12 |
* of the License. |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
14 |
* The IgH EtherCAT master userspace library is distributed in the hope that |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
15 |
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
16 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
17 |
* GNU Lesser General Public License for more details. |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
19 |
* You should have received a copy of the GNU Lesser General Public License |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
20 |
* along with the IgH EtherCAT master userspace library. If not, see |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
21 |
* <http://www.gnu.org/licenses/>. |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
22 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
23 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
24 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
25 |
* The license mentioned above concerns the source code only. Using the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
26 |
* EtherCAT technology and brand is only permitted in compliance with the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1352
diff
changeset
|
27 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
/** \file |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
* Canopen over EtherCAT SDO request functions. |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
*/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include <stdio.h> |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
#include <errno.h> |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
#include <string.h> |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include "sdo_request.h" |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
#include "master/ioctl.h" |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
#include "slave_config.h" |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
#include "master.h" |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
|
1959
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
46 |
/*****************************************************************************/ |
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
47 |
|
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
48 |
void ec_sdo_request_clear(ec_sdo_request_t *req) |
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
49 |
{ |
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
50 |
if (req->data) { |
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
51 |
free(req->data); |
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
52 |
} |
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
53 |
} |
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
54 |
|
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
/***************************************************************************** |
1959
656f114153c2
Free all userspace library objects on releasing master.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
56 |
* Application interface. |
1352
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
void ecrt_sdo_request_timeout(ec_sdo_request_t *req, uint32_t timeout) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
ec_ioctl_sdo_request_t data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
data.config_index = req->config->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
data.request_index = req->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
data.timeout = timeout; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
if (ioctl(req->config->master->fd, EC_IOCTL_SDO_REQUEST_TIMEOUT, |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
&data) == -1) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
fprintf(stderr, "Failed to set SDO request timeout: %s\n", |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
strerror(errno)); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
uint8_t *ecrt_sdo_request_data(ec_sdo_request_t *req) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
return req->data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
size_t ecrt_sdo_request_data_size(const ec_sdo_request_t *req) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
return req->data_size; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
ec_request_state_t ecrt_sdo_request_state(ec_sdo_request_t *req) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
ec_ioctl_sdo_request_t data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
data.config_index = req->config->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
data.request_index = req->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
if (ioctl(req->config->master->fd, EC_IOCTL_SDO_REQUEST_STATE, |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
&data) == -1) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
fprintf(stderr, "Failed to get SDO request state: %s\n", |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
strerror(errno)); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
if (data.size) { // new data waiting to be copied |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
if (req->mem_size < data.size) { |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
if (req->data) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
free(req->data); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
req->data = malloc(data.size); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
if (!req->data) { |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
req->mem_size = 0; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
fprintf(stderr, "Failed to allocate %u bytes of SDO data" |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
" memory!\n", data.size); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
return EC_REQUEST_ERROR; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
req->mem_size = data.size; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
data.data = req->data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
if (ioctl(req->config->master->fd, EC_IOCTL_SDO_REQUEST_DATA, |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
&data) == -1) { |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
fprintf(stderr, "Failed to get SDO data: %s\n", strerror(errno)); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
return EC_REQUEST_ERROR; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
req->data_size = data.size; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
return data.state; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
void ecrt_sdo_request_read(ec_sdo_request_t *req) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
ec_ioctl_sdo_request_t data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
data.config_index = req->config->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
data.request_index = req->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
if (ioctl(req->config->master->fd, EC_IOCTL_SDO_REQUEST_READ, |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
&data) == -1) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
fprintf(stderr, "Failed to command an SDO read operation : %s\n", |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
strerror(errno)); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
void ecrt_sdo_request_write(ec_sdo_request_t *req) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
ec_ioctl_sdo_request_t data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
data.config_index = req->config->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
data.request_index = req->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
data.data = req->data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
data.size = req->data_size; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
if (ioctl(req->config->master->fd, EC_IOCTL_SDO_REQUEST_WRITE, |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
&data) == -1) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
fprintf(stderr, "Failed to command an SDO write operation : %s\n", |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
strerror(errno)); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
/*****************************************************************************/ |