303 return ret; |
303 return ret; |
304 } |
304 } |
305 |
305 |
306 /*****************************************************************************/ |
306 /*****************************************************************************/ |
307 |
307 |
|
308 int ecrt_slave_config_reg_pdo_entry_pos( |
|
309 ec_slave_config_t *sc, |
|
310 uint8_t sync_index, |
|
311 unsigned int pdo_pos, |
|
312 unsigned int entry_pos, |
|
313 ec_domain_t *domain, |
|
314 unsigned int *bit_position |
|
315 ) |
|
316 { |
|
317 ec_ioctl_reg_pdo_pos_t io; |
|
318 int ret; |
|
319 |
|
320 io.config_index = sc->index; |
|
321 io.sync_index = sync_index; |
|
322 io.pdo_pos = pdo_pos; |
|
323 io.entry_pos = entry_pos; |
|
324 io.domain_index = domain->index; |
|
325 |
|
326 ret = ioctl(sc->master->fd, EC_IOCTL_SC_REG_PDO_POS, &io); |
|
327 if (EC_IOCTL_IS_ERROR(ret)) { |
|
328 fprintf(stderr, "Failed to register PDO entry: %s\n", |
|
329 strerror(EC_IOCTL_ERRNO(ret))); |
|
330 return -EC_IOCTL_ERRNO(ret); |
|
331 } |
|
332 |
|
333 if (bit_position) { |
|
334 *bit_position = io.bit_position; |
|
335 } else { |
|
336 if (io.bit_position) { |
|
337 fprintf(stderr, "PDO entry %u/%u/%u does not byte-align " |
|
338 "in config %u:%u.\n", sync_index, pdo_pos, entry_pos, |
|
339 sc->alias, sc->position); |
|
340 return -EFAULT; |
|
341 } |
|
342 } |
|
343 |
|
344 return ret; |
|
345 } |
|
346 |
|
347 /*****************************************************************************/ |
|
348 |
308 void ecrt_slave_config_dc(ec_slave_config_t *sc, uint16_t assign_activate, |
349 void ecrt_slave_config_dc(ec_slave_config_t *sc, uint16_t assign_activate, |
309 uint32_t sync0_cycle_time, int32_t sync0_shift_time, |
350 uint32_t sync0_cycle_time, int32_t sync0_shift_time, |
310 uint32_t sync1_cycle_time, int32_t sync1_shift_time) |
351 uint32_t sync1_cycle_time, int32_t sync1_shift_time) |
311 { |
352 { |
312 ec_ioctl_config_t data; |
353 ec_ioctl_config_t data; |