equal
deleted
inserted
replaced
1 /****************************************************************************** |
1 /****************************************************************************** |
2 * |
2 * |
3 * $Id$ |
3 * $Id$ |
4 * |
4 * |
5 * Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH |
5 * Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH |
6 * |
6 * |
7 * This file is part of the IgH EtherCAT master userspace library. |
7 * This file is part of the IgH EtherCAT master userspace library. |
8 * |
8 * |
9 * The IgH EtherCAT master userspace library is free software; you can |
9 * The IgH EtherCAT master userspace library is free software; you can |
10 * redistribute it and/or modify it under the terms of the GNU Lesser General |
10 * redistribute it and/or modify it under the terms of the GNU Lesser General |
11 * Public License as published by the Free Software Foundation; version 2.1 |
11 * Public License as published by the Free Software Foundation; version 2.1 |
12 * of the License. |
12 * of the License. |
13 * |
13 * |
17 * GNU Lesser General Public License for more details. |
17 * GNU Lesser General Public License for more details. |
18 * |
18 * |
19 * You should have received a copy of the GNU Lesser General Public License |
19 * You should have received a copy of the GNU Lesser General Public License |
20 * along with the IgH EtherCAT master userspace library. If not, see |
20 * along with the IgH EtherCAT master userspace library. If not, see |
21 * <http://www.gnu.org/licenses/>. |
21 * <http://www.gnu.org/licenses/>. |
22 * |
22 * |
23 * --- |
23 * --- |
24 * |
24 * |
25 * The license mentioned above concerns the source code only. Using the |
25 * The license mentioned above concerns the source code only. Using the |
26 * EtherCAT technology and brand is only permitted in compliance with the |
26 * EtherCAT technology and brand is only permitted in compliance with the |
27 * industrial property and similar rights of Beckhoff Automation GmbH. |
27 * industrial property and similar rights of Beckhoff Automation GmbH. |
28 * |
28 * |
29 *****************************************************************************/ |
29 *****************************************************************************/ |
84 if (ioctl(sc->master->fd, EC_IOCTL_SC_SYNC, &data) == -1) { |
84 if (ioctl(sc->master->fd, EC_IOCTL_SC_SYNC, &data) == -1) { |
85 fprintf(stderr, "Failed to config sync manager: %s\n", |
85 fprintf(stderr, "Failed to config sync manager: %s\n", |
86 strerror(errno)); |
86 strerror(errno)); |
87 return -1; // FIXME |
87 return -1; // FIXME |
88 } |
88 } |
89 |
89 |
90 return 0; |
90 return 0; |
91 } |
91 } |
92 |
92 |
93 /*****************************************************************************/ |
93 /*****************************************************************************/ |
94 |
94 |
122 if (ioctl(sc->master->fd, EC_IOCTL_SC_ADD_PDO, &data) == -1) { |
122 if (ioctl(sc->master->fd, EC_IOCTL_SC_ADD_PDO, &data) == -1) { |
123 fprintf(stderr, "Failed to add PDO: %s\n", |
123 fprintf(stderr, "Failed to add PDO: %s\n", |
124 strerror(errno)); |
124 strerror(errno)); |
125 return -1; // FIXME |
125 return -1; // FIXME |
126 } |
126 } |
127 |
127 |
128 return 0; |
128 return 0; |
129 } |
129 } |
130 |
130 |
131 /*****************************************************************************/ |
131 /*****************************************************************************/ |
132 |
132 |
161 if (ioctl(sc->master->fd, EC_IOCTL_SC_ADD_ENTRY, &data) == -1) { |
161 if (ioctl(sc->master->fd, EC_IOCTL_SC_ADD_ENTRY, &data) == -1) { |
162 fprintf(stderr, "Failed to add PDO entry: %s\n", |
162 fprintf(stderr, "Failed to add PDO entry: %s\n", |
163 strerror(errno)); |
163 strerror(errno)); |
164 return -1; // FIXME |
164 return -1; // FIXME |
165 } |
165 } |
166 |
166 |
167 return 0; |
167 return 0; |
168 } |
168 } |
169 |
169 |
170 /*****************************************************************************/ |
170 /*****************************************************************************/ |
171 |
171 |
426 |
426 |
427 data.config_index = sc->index; |
427 data.config_index = sc->index; |
428 data.sdo_index = index; |
428 data.sdo_index = index; |
429 data.sdo_subindex = subindex; |
429 data.sdo_subindex = subindex; |
430 data.size = size; |
430 data.size = size; |
431 |
431 |
432 if (ioctl(sc->master->fd, EC_IOCTL_SC_SDO_REQUEST, &data) == -1) { |
432 if (ioctl(sc->master->fd, EC_IOCTL_SC_SDO_REQUEST, &data) == -1) { |
433 fprintf(stderr, "Failed to create SDO request: %s\n", |
433 fprintf(stderr, "Failed to create SDO request: %s\n", |
434 strerror(errno)); |
434 strerror(errno)); |
435 ec_sdo_request_clear(req); |
435 ec_sdo_request_clear(req); |
436 free(req); |
436 free(req); |
437 return NULL; |
437 return NULL; |
438 } |
438 } |
439 |
439 |
440 req->next = NULL; |
440 req->next = NULL; |
441 req->config = sc; |
441 req->config = sc; |
442 req->index = data.request_index; |
442 req->index = data.request_index; |
493 voe->data = NULL; |
493 voe->data = NULL; |
494 } |
494 } |
495 |
495 |
496 data.config_index = sc->index; |
496 data.config_index = sc->index; |
497 data.size = size; |
497 data.size = size; |
498 |
498 |
499 if (ioctl(sc->master->fd, EC_IOCTL_SC_VOE, &data) == -1) { |
499 if (ioctl(sc->master->fd, EC_IOCTL_SC_VOE, &data) == -1) { |
500 fprintf(stderr, "Failed to create VoE handler: %s\n", |
500 fprintf(stderr, "Failed to create VoE handler: %s\n", |
501 strerror(errno)); |
501 strerror(errno)); |
502 ec_voe_handler_clear(voe); |
502 ec_voe_handler_clear(voe); |
503 free(voe); |
503 free(voe); |
504 return NULL; |
504 return NULL; |
505 } |
505 } |
506 |
506 |
507 voe->next = NULL; |
507 voe->next = NULL; |
508 voe->config = sc; |
508 voe->config = sc; |
509 voe->index = data.voe_index; |
509 voe->index = data.voe_index; |
522 { |
522 { |
523 ec_ioctl_sc_state_t data; |
523 ec_ioctl_sc_state_t data; |
524 |
524 |
525 data.config_index = sc->index; |
525 data.config_index = sc->index; |
526 data.state = state; |
526 data.state = state; |
527 |
527 |
528 if (ioctl(sc->master->fd, EC_IOCTL_SC_STATE, &data) == -1) { |
528 if (ioctl(sc->master->fd, EC_IOCTL_SC_STATE, &data) == -1) { |
529 fprintf(stderr, "Failed to get slave configuration state: %s\n", |
529 fprintf(stderr, "Failed to get slave configuration state: %s\n", |
530 strerror(errno)); |
530 strerror(errno)); |
531 } |
531 } |
532 } |
532 } |