master/fsm_slave_scan.c
changeset 1909 ea3eb4c74c1b
parent 1822 74e6ac2369f4
child 1921 d9cf40facbc4
equal deleted inserted replaced
1908:666ad3a50f9f 1909:ea3eb4c74c1b
   607 
   607 
   608     ec_slave_clear_sync_managers(slave);
   608     ec_slave_clear_sync_managers(slave);
   609 
   609 
   610     slave->sii.alias =
   610     slave->sii.alias =
   611         EC_READ_U16(slave->sii_words + 0x0004);
   611         EC_READ_U16(slave->sii_words + 0x0004);
       
   612     slave->effective_alias = slave->sii.alias;
   612     slave->sii.vendor_id =
   613     slave->sii.vendor_id =
   613         EC_READ_U32(slave->sii_words + 0x0008);
   614         EC_READ_U32(slave->sii_words + 0x0008);
   614     slave->sii.product_code =
   615     slave->sii.product_code =
   615         EC_READ_U32(slave->sii_words + 0x000A);
   616         EC_READ_U32(slave->sii_words + 0x000A);
   616     slave->sii.revision_number =
   617     slave->sii.revision_number =
   736         )
   737         )
   737 {
   738 {
   738     ec_datagram_t *datagram = fsm->datagram;
   739     ec_datagram_t *datagram = fsm->datagram;
   739     ec_slave_t *slave = fsm->slave;
   740     ec_slave_t *slave = fsm->slave;
   740 
   741 
   741     // read alias from register 0x0012
   742     // read alias from register
   742     if (slave->master->debug_level)
   743     if (slave->master->debug_level)
   743          EC_DBG("Reading alias from register 0x0012 of slave %u.\n",
   744          EC_DBG("Reading alias from register of slave %u.\n",
   744                  slave->ring_position);
   745                  slave->ring_position);
   745     ec_datagram_fprd(datagram, slave->station_address, 0x0012, 2);
   746     ec_datagram_fprd(datagram, slave->station_address, 0x0012, 2);
   746     ec_datagram_zero(datagram);
   747     ec_datagram_zero(datagram);
   747     fsm->retries = EC_FSM_RETRIES;
   748     fsm->retries = EC_FSM_RETRIES;
   748     fsm->state = ec_fsm_slave_scan_state_regalias;
   749     fsm->state = ec_fsm_slave_scan_state_regalias;
   773 
   774 
   774     if (datagram->working_counter != 1) {
   775     if (datagram->working_counter != 1) {
   775         EC_WARN("Failed to read reg alias of slave %u.\n",
   776         EC_WARN("Failed to read reg alias of slave %u.\n",
   776         fsm->slave->ring_position);
   777         fsm->slave->ring_position);
   777     } else {
   778     } else {
   778         slave->sii.alias = EC_READ_U16(datagram->data);
   779         slave->effective_alias = EC_READ_U16(datagram->data);
   779         if (slave->master->debug_level)
   780         if (slave->master->debug_level)
   780             EC_DBG("Alias of slave %u is %u.\n",
   781             EC_DBG("Read alias %u from register of slave %u.\n",
   781         slave->ring_position,slave->sii.alias);
   782                     slave->effective_alias, slave->ring_position);
   782     }
   783     }
   783     if (slave->sii.mailbox_protocols & EC_MBOX_COE) {
   784     if (slave->sii.mailbox_protocols & EC_MBOX_COE) {
   784         ec_fsm_slave_scan_enter_preop(fsm);
   785         ec_fsm_slave_scan_enter_preop(fsm);
   785     } else {
   786     } else {
   786         fsm->state = ec_fsm_slave_scan_state_end;
   787         fsm->state = ec_fsm_slave_scan_state_end;