master/slave.c
changeset 1186 ff481f097c97
parent 1183 d77f634ab0b5
child 1313 ed15eef57d5c
child 1685 399ef727bf62
equal deleted inserted replaced
1185:337ce4fc2383 1186:ff481f097c97
   665 
   665 
   666     return NULL;
   666     return NULL;
   667 }
   667 }
   668 
   668 
   669 /*****************************************************************************/
   669 /*****************************************************************************/
       
   670 
       
   671 /** Find name for a Pdo and its entries.
       
   672  */
       
   673 void ec_slave_find_names_for_pdo(
       
   674         ec_slave_t *slave,
       
   675         ec_pdo_t *pdo
       
   676         )
       
   677 {
       
   678     const ec_sdo_t *sdo;
       
   679     ec_pdo_entry_t *pdo_entry;
       
   680     const ec_sdo_entry_t *sdo_entry;
       
   681 
       
   682     list_for_each_entry(sdo, &slave->sdo_dictionary, list) {
       
   683         if (sdo->index == pdo->index) {
       
   684             ec_pdo_set_name(pdo, sdo->name);
       
   685         } else {
       
   686             list_for_each_entry(pdo_entry, &pdo->entries, list) {
       
   687                 if (sdo->index == pdo_entry->index) {
       
   688                     sdo_entry = ec_sdo_get_entry_const(
       
   689                             sdo, pdo_entry->subindex);
       
   690                     if (sdo_entry) {
       
   691                         ec_pdo_entry_set_name(pdo_entry,
       
   692                                 sdo_entry->description);
       
   693                     }
       
   694                 }
       
   695             }
       
   696         }
       
   697     }
       
   698 }
       
   699 
       
   700 /*****************************************************************************/
       
   701 
       
   702 /** Attach Pdo names.
       
   703  */
       
   704 void ec_slave_attach_pdo_names(
       
   705         ec_slave_t *slave
       
   706         )
       
   707 {
       
   708     unsigned int i;
       
   709     ec_sync_t *sync;
       
   710     ec_pdo_t *pdo;
       
   711     
       
   712     for (i = 0; i < slave->sii.sync_count; i++) {
       
   713         sync = slave->sii.syncs + i;
       
   714         list_for_each_entry(pdo, &sync->pdos.list, list) {
       
   715             ec_slave_find_names_for_pdo(slave, pdo);
       
   716         }
       
   717     }
       
   718 }
       
   719 
       
   720 /*****************************************************************************/