master/slave.c
changeset 139 998215ab9b92
parent 138 7e743a61a991
child 140 b09658e50d6f
equal deleted inserted replaced
138:7e743a61a991 139:998215ab9b92
    76     ec_eeprom_string_t *string, *next_str;
    76     ec_eeprom_string_t *string, *next_str;
    77     ec_eeprom_sync_t *sync, *next_sync;
    77     ec_eeprom_sync_t *sync, *next_sync;
    78     ec_eeprom_pdo_t *pdo, *next_pdo;
    78     ec_eeprom_pdo_t *pdo, *next_pdo;
    79     ec_eeprom_pdo_entry_t *entry, *next_ent;
    79     ec_eeprom_pdo_entry_t *entry, *next_ent;
    80     ec_sdo_t *sdo, *next_sdo;
    80     ec_sdo_t *sdo, *next_sdo;
       
    81     ec_sdo_entry_t *en, *next_en;
    81 
    82 
    82     // Alle Strings freigeben
    83     // Alle Strings freigeben
    83     list_for_each_entry_safe(string, next_str, &slave->eeprom_strings, list) {
    84     list_for_each_entry_safe(string, next_str, &slave->eeprom_strings, list) {
    84         list_del(&string->list);
    85         list_del(&string->list);
    85         kfree(string);
    86         kfree(string);
   112 
   113 
   113     // Alle SDOs freigeben
   114     // Alle SDOs freigeben
   114     list_for_each_entry_safe(sdo, next_sdo, &slave->sdo_dictionary, list) {
   115     list_for_each_entry_safe(sdo, next_sdo, &slave->sdo_dictionary, list) {
   115         list_del(&sdo->list);
   116         list_del(&sdo->list);
   116         if (sdo->name) kfree(sdo->name);
   117         if (sdo->name) kfree(sdo->name);
       
   118         // Alle Entries freigeben
       
   119         list_for_each_entry_safe(en, next_en, &sdo->entries, list) {
       
   120             list_del(&en->list);
       
   121             kfree(en);
       
   122         }
   117         kfree(sdo);
   123         kfree(sdo);
   118     }
   124     }
   119 }
   125 }
   120 
   126 
   121 /*****************************************************************************/
   127 /*****************************************************************************/
   851 
   857 
   852 void ec_slave_print(const ec_slave_t *slave /**< EtherCAT-Slave */)
   858 void ec_slave_print(const ec_slave_t *slave /**< EtherCAT-Slave */)
   853 {
   859 {
   854     ec_eeprom_sync_t *sync;
   860     ec_eeprom_sync_t *sync;
   855     ec_eeprom_pdo_t *pdo;
   861     ec_eeprom_pdo_t *pdo;
   856     ec_eeprom_pdo_entry_t *entry;
   862     ec_eeprom_pdo_entry_t *pdo_entry;
   857     ec_sdo_t *sdo;
   863     ec_sdo_t *sdo;
       
   864     ec_sdo_entry_t *sdo_entry;
   858     int first;
   865     int first;
   859 
   866 
   860     EC_INFO("x-- EtherCAT slave information ---------------\n");
   867     EC_INFO("x-- EtherCAT slave information ---------------\n");
   861 
   868 
   862     if (slave->type) {
   869     if (slave->type) {
   948         EC_INFO("|   %s \"%s\" (0x%04X), -> Sync-Manager %i\n",
   955         EC_INFO("|   %s \"%s\" (0x%04X), -> Sync-Manager %i\n",
   949                 pdo->type == EC_RX_PDO ? "RXPDO" : "TXPDO",
   956                 pdo->type == EC_RX_PDO ? "RXPDO" : "TXPDO",
   950                 pdo->name ? pdo->name : "???",
   957                 pdo->name ? pdo->name : "???",
   951                 pdo->index, pdo->sync_manager);
   958                 pdo->index, pdo->sync_manager);
   952 
   959 
   953         list_for_each_entry(entry, &pdo->entries, list) {
   960         list_for_each_entry(pdo_entry, &pdo->entries, list) {
   954             EC_INFO("|     \"%s\" 0x%04X:%X, %i Bit\n",
   961             EC_INFO("|     \"%s\" 0x%04X:%X, %i Bit\n",
   955                     entry->name ? entry->name : "???",
   962                     pdo_entry->name ? pdo_entry->name : "???",
   956                     entry->index, entry->subindex, entry->bit_length);
   963                     pdo_entry->index, pdo_entry->subindex,
       
   964                     pdo_entry->bit_length);
   957         }
   965         }
   958     }
   966     }
   959 
   967 
   960     if (!list_empty(&slave->sdo_dictionary)) {
   968     if (!list_empty(&slave->sdo_dictionary)) {
   961         EC_INFO("|   SDO-Dictionary:\n");
   969         EC_INFO("|   SDO-Dictionary:\n");
   962         list_for_each_entry(sdo, &slave->sdo_dictionary, list) {
   970         list_for_each_entry(sdo, &slave->sdo_dictionary, list) {
   963             EC_INFO("|     0x%04X: \"%s\"\n", sdo->index,
   971             EC_INFO("|     0x%04X \"%s\"\n", sdo->index,
   964                     sdo->name ? sdo->name : "");
   972                     sdo->name ? sdo->name : "");
   965             EC_INFO("|       Type 0x%04X, subindices: %i, features: 0x%02X\n",
   973             EC_INFO("|       Type 0x%04X, features: 0x%02X\n",
   966                     sdo->type, sdo->max_subindex, sdo->features);
   974                     sdo->type, sdo->features);
       
   975             list_for_each_entry(sdo_entry, &sdo->entries, list) {
       
   976                 EC_INFO("|       0x%04X:%i \"%s\", type 0x%04X, %i bits\n",
       
   977                         sdo->index, sdo_entry->subindex,
       
   978                         sdo_entry->name ? sdo_entry->name : "",
       
   979                         sdo_entry->data_type, sdo_entry->bit_length);
       
   980             }
   967         }
   981         }
   968     }
   982     }
   969 
   983 
   970     EC_INFO("x---------------------------------------------\n");
   984     EC_INFO("x---------------------------------------------\n");
   971 }
   985 }