equal
deleted
inserted
replaced
163 /*****************************************************************************/ |
163 /*****************************************************************************/ |
164 |
164 |
165 int ecrt_master_get_sync_manager(ec_master_t *master, uint16_t slave_position, |
165 int ecrt_master_get_sync_manager(ec_master_t *master, uint16_t slave_position, |
166 uint8_t sync_index, ec_sync_info_t *sync) |
166 uint8_t sync_index, ec_sync_info_t *sync) |
167 { |
167 { |
168 ec_ioctl_slave_sync_t data; |
168 ec_ioctl_slave_sync_t data; |
169 |
169 |
170 if (sync_index >= EC_MAX_SYNC_MANAGERS) |
170 if (sync_index >= EC_MAX_SYNC_MANAGERS) |
171 return -ENOENT; |
171 return -ENOENT; |
172 |
172 |
173 memset(&data, 0x00, sizeof(ec_ioctl_slave_sync_t)); |
173 memset(&data, 0x00, sizeof(ec_ioctl_slave_sync_t)); |
179 strerror(errno)); |
179 strerror(errno)); |
180 return -1; // FIXME |
180 return -1; // FIXME |
181 } |
181 } |
182 |
182 |
183 sync->index = sync_index; |
183 sync->index = sync_index; |
184 sync->dir = EC_READ_BIT(&data.control_register, 2) ? |
184 sync->dir = EC_READ_BIT(&data.control_register, 2) ? |
185 EC_DIR_OUTPUT : EC_DIR_INPUT; |
185 EC_DIR_OUTPUT : EC_DIR_INPUT; |
186 sync->n_pdos = data.pdo_count; |
186 sync->n_pdos = data.pdo_count; |
187 sync->pdos = NULL; |
187 sync->pdos = NULL; |
188 sync->watchdog_mode = EC_READ_BIT(&data.control_register, 6) ? |
188 sync->watchdog_mode = EC_READ_BIT(&data.control_register, 6) ? |
189 EC_WD_ENABLE : EC_WD_DISABLE; |
189 EC_WD_ENABLE : EC_WD_DISABLE; |
194 /*****************************************************************************/ |
194 /*****************************************************************************/ |
195 |
195 |
196 int ecrt_master_get_pdo(ec_master_t *master, uint16_t slave_position, |
196 int ecrt_master_get_pdo(ec_master_t *master, uint16_t slave_position, |
197 uint8_t sync_index, uint16_t pos, ec_pdo_info_t *pdo) |
197 uint8_t sync_index, uint16_t pos, ec_pdo_info_t *pdo) |
198 { |
198 { |
199 ec_ioctl_slave_sync_pdo_t data; |
199 ec_ioctl_slave_sync_pdo_t data; |
200 |
200 |
201 if (sync_index >= EC_MAX_SYNC_MANAGERS) |
201 if (sync_index >= EC_MAX_SYNC_MANAGERS) |
202 return -ENOENT; |
202 return -ENOENT; |
203 |
203 |
204 memset(&data, 0x00, sizeof(ec_ioctl_slave_sync_pdo_t)); |
204 memset(&data, 0x00, sizeof(ec_ioctl_slave_sync_pdo_t)); |
223 |
223 |
224 int ecrt_master_get_pdo_entry(ec_master_t *master, uint16_t slave_position, |
224 int ecrt_master_get_pdo_entry(ec_master_t *master, uint16_t slave_position, |
225 uint8_t sync_index, uint16_t pdo_pos, uint16_t entry_pos, |
225 uint8_t sync_index, uint16_t pdo_pos, uint16_t entry_pos, |
226 ec_pdo_entry_info_t *entry) |
226 ec_pdo_entry_info_t *entry) |
227 { |
227 { |
228 ec_ioctl_slave_sync_pdo_entry_t data; |
228 ec_ioctl_slave_sync_pdo_entry_t data; |
229 |
229 |
230 if (sync_index >= EC_MAX_SYNC_MANAGERS) |
230 if (sync_index >= EC_MAX_SYNC_MANAGERS) |
231 return -ENOENT; |
231 return -ENOENT; |
232 |
232 |
233 memset(&data, 0x00, sizeof(ec_ioctl_slave_sync_pdo_entry_t)); |
233 memset(&data, 0x00, sizeof(ec_ioctl_slave_sync_pdo_entry_t)); |
347 |
347 |
348 /*****************************************************************************/ |
348 /*****************************************************************************/ |
349 |
349 |
350 int ecrt_master_set_send_interval(ec_master_t *master,size_t send_interval_us) |
350 int ecrt_master_set_send_interval(ec_master_t *master,size_t send_interval_us) |
351 { |
351 { |
352 if (ioctl(master->fd, EC_IOCTL_SET_SEND_INTERVAL, |
352 if (ioctl(master->fd, EC_IOCTL_SET_SEND_INTERVAL, |
353 &send_interval_us) == -1) { |
353 &send_interval_us) == -1) { |
354 fprintf(stderr, "Failed to set send interval: %s\n", |
354 fprintf(stderr, "Failed to set send interval: %s\n", |
355 strerror(errno)); |
355 strerror(errno)); |
356 return -1; // FIXME |
356 return -1; // FIXME |
357 } |
357 } |
358 return 0; |
358 return 0; |
359 } |
359 } |