author | Florian Pose <fp@igh-essen.com> |
Fri, 17 Apr 2009 11:07:27 +0000 | |
changeset 1398 | 36c23e993040 |
parent 1363 | 11c0b2caa253 |
child 1959 | 656f114153c2 |
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 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
/***************************************************************************** |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
* Realtime interface. |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
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
|
51 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
ec_ioctl_sdo_request_t data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
data.config_index = req->config->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
data.request_index = req->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
data.timeout = timeout; |
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 |
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
|
59 |
&data) == -1) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
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
|
61 |
strerror(errno)); |
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 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
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
|
67 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
return req->data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
|
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 |
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
|
74 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
return req->data_size; |
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 |
|
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 |
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
|
81 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
ec_ioctl_sdo_request_t data; |
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 |
data.config_index = req->config->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
data.request_index = req->index; |
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 |
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
|
88 |
&data) == -1) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
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
|
90 |
strerror(errno)); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
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
|
93 |
if (req->mem_size < data.size) { |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
if (req->data) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
free(req->data); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
req->data = malloc(data.size); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
if (!req->data) { |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
req->mem_size = 0; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
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
|
100 |
" memory!\n", data.size); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
return EC_REQUEST_ERROR; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
req->mem_size = data.size; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
data.data = req->data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
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
|
109 |
&data) == -1) { |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
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
|
111 |
return EC_REQUEST_ERROR; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
req->data_size = data.size; |
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 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
return data.state; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
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
|
122 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
ec_ioctl_sdo_request_t data; |
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 |
data.config_index = req->config->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
data.request_index = req->index; |
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 |
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
|
129 |
&data) == -1) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
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
|
131 |
strerror(errno)); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
} |
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 |
/*****************************************************************************/ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
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
|
137 |
{ |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
ec_ioctl_sdo_request_t data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
data.config_index = req->config->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
data.request_index = req->index; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
data.data = req->data; |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
data.size = req->data_size; |
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 |
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
|
146 |
&data) == -1) |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
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
|
148 |
strerror(errno)); |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
} |
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
|
275d2fdeab48
Implemented SDO requests in userspace library.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
/*****************************************************************************/ |