equal
deleted
inserted
replaced
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 ****************************************************************************/ |
30 |
30 |
|
31 #include <unistd.h> /* close() */ |
31 #include <stdlib.h> |
32 #include <stdlib.h> |
32 #include <sys/ioctl.h> |
33 #include <sys/ioctl.h> |
33 #include <stdio.h> |
34 #include <stdio.h> |
34 #include <errno.h> |
35 #include <errno.h> |
35 #include <string.h> |
36 #include <string.h> |
157 uint16_t alias, uint16_t position, uint32_t vendor_id, |
158 uint16_t alias, uint16_t position, uint32_t vendor_id, |
158 uint32_t product_code) |
159 uint32_t product_code) |
159 { |
160 { |
160 ec_ioctl_config_t data; |
161 ec_ioctl_config_t data; |
161 ec_slave_config_t *sc; |
162 ec_slave_config_t *sc; |
162 int index; |
|
163 |
163 |
164 sc = malloc(sizeof(ec_slave_config_t)); |
164 sc = malloc(sizeof(ec_slave_config_t)); |
165 if (!sc) { |
165 if (!sc) { |
166 fprintf(stderr, "Failed to allocate memory.\n"); |
166 fprintf(stderr, "Failed to allocate memory.\n"); |
167 return 0; |
167 return 0; |
214 |
214 |
215 int ecrt_master_get_slave(ec_master_t *master, uint16_t slave_position, |
215 int ecrt_master_get_slave(ec_master_t *master, uint16_t slave_position, |
216 ec_slave_info_t *slave_info) |
216 ec_slave_info_t *slave_info) |
217 { |
217 { |
218 ec_ioctl_slave_t data; |
218 ec_ioctl_slave_t data; |
219 int index, i; |
219 int i; |
220 |
220 |
221 data.position = slave_position; |
221 data.position = slave_position; |
222 |
222 |
223 if (ioctl(master->fd, EC_IOCTL_SLAVE, &data) == -1) { |
223 if (ioctl(master->fd, EC_IOCTL_SLAVE, &data) == -1) { |
224 fprintf(stderr, "Failed to get slave info: %s\n", strerror(errno)); |
224 fprintf(stderr, "Failed to get slave info: %s\n", strerror(errno)); |
567 io.state = state; |
567 io.state = state; |
568 if (ioctl(master->fd, EC_IOCTL_MASTER_LINK_STATE, &io) == -1) { |
568 if (ioctl(master->fd, EC_IOCTL_MASTER_LINK_STATE, &io) == -1) { |
569 fprintf(stderr, "Failed to get link state: %s\n", strerror(errno)); |
569 fprintf(stderr, "Failed to get link state: %s\n", strerror(errno)); |
570 return -errno; |
570 return -errno; |
571 } |
571 } |
|
572 |
|
573 return 0; |
572 } |
574 } |
573 |
575 |
574 /****************************************************************************/ |
576 /****************************************************************************/ |
575 |
577 |
576 void ecrt_master_application_time(ec_master_t *master, uint64_t app_time) |
578 void ecrt_master_application_time(ec_master_t *master, uint64_t app_time) |