equal
deleted
inserted
replaced
270 ec_sync_config_t *sync_config; |
270 ec_sync_config_t *sync_config; |
271 const ec_sync_t *sync; |
271 const ec_sync_t *sync; |
272 |
272 |
273 if (!sc->slave) |
273 if (!sc->slave) |
274 return; |
274 return; |
275 |
275 |
276 for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) { |
276 for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) { |
277 sync_config = &sc->sync_configs[sync_index]; |
277 sync_config = &sc->sync_configs[sync_index]; |
278 if ((sync = ec_slave_get_sync(sc->slave, sync_index))) { |
278 if ((sync = ec_slave_get_sync(sc->slave, sync_index))) { |
279 sync_config->dir = ec_sync_default_direction(sync); |
279 sync_config->dir = ec_sync_default_direction(sync); |
280 if (sync_config->dir == EC_DIR_INVALID) |
280 if (sync_config->dir == EC_DIR_INVALID) |
469 |
469 |
470 int ecrt_slave_config_sync_manager(ec_slave_config_t *sc, uint8_t sync_index, |
470 int ecrt_slave_config_sync_manager(ec_slave_config_t *sc, uint8_t sync_index, |
471 ec_direction_t dir, ec_watchdog_mode_t watchdog_mode) |
471 ec_direction_t dir, ec_watchdog_mode_t watchdog_mode) |
472 { |
472 { |
473 ec_sync_config_t *sync_config; |
473 ec_sync_config_t *sync_config; |
474 |
474 |
475 EC_CONFIG_DBG(sc, 1, "ecrt_slave_config_sync_manager(sc = 0x%p," |
475 EC_CONFIG_DBG(sc, 1, "ecrt_slave_config_sync_manager(sc = 0x%p," |
476 " sync_index = %u, dir = %i, watchdog_mode = %i)\n", |
476 " sync_index = %u, dir = %i, watchdog_mode = %i)\n", |
477 sc, sync_index, dir, watchdog_mode); |
477 sc, sync_index, dir, watchdog_mode); |
478 |
478 |
479 if (sync_index >= EC_MAX_SYNC_MANAGERS) { |
479 if (sync_index >= EC_MAX_SYNC_MANAGERS) { |
560 { |
560 { |
561 uint8_t sync_index; |
561 uint8_t sync_index; |
562 ec_pdo_t *pdo = NULL; |
562 ec_pdo_t *pdo = NULL; |
563 ec_pdo_entry_t *entry; |
563 ec_pdo_entry_t *entry; |
564 int retval = 0; |
564 int retval = 0; |
565 |
565 |
566 EC_CONFIG_DBG(sc, 1, "%s(sc = 0x%p, " |
566 EC_CONFIG_DBG(sc, 1, "%s(sc = 0x%p, " |
567 "pdo_index = 0x%04X, entry_index = 0x%04X, " |
567 "pdo_index = 0x%04X, entry_index = 0x%04X, " |
568 "entry_subindex = 0x%02X, entry_bit_length = %u)\n", |
568 "entry_subindex = 0x%02X, entry_bit_length = %u)\n", |
569 __func__, sc, pdo_index, entry_index, entry_subindex, |
569 __func__, sc, pdo_index, entry_index, entry_subindex, |
570 entry_bit_length); |
570 entry_bit_length); |
581 up(&sc->master->master_sem); |
581 up(&sc->master->master_sem); |
582 if (IS_ERR(entry)) |
582 if (IS_ERR(entry)) |
583 retval = PTR_ERR(entry); |
583 retval = PTR_ERR(entry); |
584 } else { |
584 } else { |
585 EC_CONFIG_ERR(sc, "PDO 0x%04X is not assigned.\n", pdo_index); |
585 EC_CONFIG_ERR(sc, "PDO 0x%04X is not assigned.\n", pdo_index); |
586 retval = -ENOENT; |
586 retval = -ENOENT; |
587 } |
587 } |
588 |
588 |
589 return retval; |
589 return retval; |
590 } |
590 } |
591 |
591 |
594 void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc, |
594 void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc, |
595 uint16_t pdo_index) |
595 uint16_t pdo_index) |
596 { |
596 { |
597 uint8_t sync_index; |
597 uint8_t sync_index; |
598 ec_pdo_t *pdo = NULL; |
598 ec_pdo_t *pdo = NULL; |
599 |
599 |
600 EC_CONFIG_DBG(sc, 1, "%s(sc = 0x%p, pdo_index = 0x%04X)\n", |
600 EC_CONFIG_DBG(sc, 1, "%s(sc = 0x%p, pdo_index = 0x%04X)\n", |
601 __func__, sc, pdo_index); |
601 __func__, sc, pdo_index); |
602 |
602 |
603 for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) |
603 for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) |
604 if ((pdo = ec_pdo_list_find_pdo( |
604 if ((pdo = ec_pdo_list_find_pdo( |
785 if (ret < 0) { |
785 if (ret < 0) { |
786 ec_sdo_request_clear(req); |
786 ec_sdo_request_clear(req); |
787 kfree(req); |
787 kfree(req); |
788 return ret; |
788 return ret; |
789 } |
789 } |
790 |
790 |
791 down(&sc->master->master_sem); |
791 down(&sc->master->master_sem); |
792 list_add_tail(&req->list, &sc->sdo_configs); |
792 list_add_tail(&req->list, &sc->sdo_configs); |
793 up(&sc->master->master_sem); |
793 up(&sc->master->master_sem); |
794 return 0; |
794 return 0; |
795 } |
795 } |
870 if (ret < 0) { |
870 if (ret < 0) { |
871 ec_sdo_request_clear(req); |
871 ec_sdo_request_clear(req); |
872 kfree(req); |
872 kfree(req); |
873 return ret; |
873 return ret; |
874 } |
874 } |
875 |
875 |
876 down(&sc->master->master_sem); |
876 down(&sc->master->master_sem); |
877 list_add_tail(&req->list, &sc->sdo_configs); |
877 list_add_tail(&req->list, &sc->sdo_configs); |
878 up(&sc->master->master_sem); |
878 up(&sc->master->master_sem); |
879 return 0; |
879 return 0; |
880 } |
880 } |
911 } |
911 } |
912 |
912 |
913 // prepare data for optional writing |
913 // prepare data for optional writing |
914 memset(req->data, 0x00, size); |
914 memset(req->data, 0x00, size); |
915 req->data_size = size; |
915 req->data_size = size; |
916 |
916 |
917 down(&sc->master->master_sem); |
917 down(&sc->master->master_sem); |
918 list_add_tail(&req->list, &sc->sdo_requests); |
918 list_add_tail(&req->list, &sc->sdo_requests); |
919 up(&sc->master->master_sem); |
919 up(&sc->master->master_sem); |
920 |
920 |
921 return req; |
921 return req; |
922 } |
922 } |
923 |
923 |
924 /*****************************************************************************/ |
924 /*****************************************************************************/ |
925 |
925 |
926 ec_sdo_request_t *ecrt_slave_config_create_sdo_request( |
926 ec_sdo_request_t *ecrt_slave_config_create_sdo_request( |
958 |
958 |
959 down(&sc->master->master_sem); |
959 down(&sc->master->master_sem); |
960 list_add_tail(&voe->list, &sc->voe_handlers); |
960 list_add_tail(&voe->list, &sc->voe_handlers); |
961 up(&sc->master->master_sem); |
961 up(&sc->master->master_sem); |
962 |
962 |
963 return voe; |
963 return voe; |
964 } |
964 } |
965 |
965 |
966 /*****************************************************************************/ |
966 /*****************************************************************************/ |
967 |
967 |
968 ec_voe_handler_t *ecrt_slave_config_create_voe_handler( |
968 ec_voe_handler_t *ecrt_slave_config_create_voe_handler( |
990 } |
990 } |
991 } |
991 } |
992 |
992 |
993 /*****************************************************************************/ |
993 /*****************************************************************************/ |
994 |
994 |
995 int ecrt_slave_config_idn(ec_slave_config_t *sc, uint8_t drive_no, |
995 int ecrt_slave_config_idn(ec_slave_config_t *sc, uint8_t drive_no, |
996 uint16_t idn, ec_al_state_t state, const uint8_t *data, |
996 uint16_t idn, ec_al_state_t state, const uint8_t *data, |
997 size_t size) |
997 size_t size) |
998 { |
998 { |
999 ec_slave_t *slave = sc->slave; |
999 ec_slave_t *slave = sc->slave; |
1000 ec_soe_request_t *req; |
1000 ec_soe_request_t *req; |
1036 if (ret < 0) { |
1036 if (ret < 0) { |
1037 ec_soe_request_clear(req); |
1037 ec_soe_request_clear(req); |
1038 kfree(req); |
1038 kfree(req); |
1039 return ret; |
1039 return ret; |
1040 } |
1040 } |
1041 |
1041 |
1042 down(&sc->master->master_sem); |
1042 down(&sc->master->master_sem); |
1043 list_add_tail(&req->list, &sc->soe_configs); |
1043 list_add_tail(&req->list, &sc->soe_configs); |
1044 up(&sc->master->master_sem); |
1044 up(&sc->master->master_sem); |
1045 return 0; |
1045 return 0; |
1046 } |
1046 } |