master/slave.c
changeset 835 23fd8b510803
parent 834 0791aac03180
child 836 860a5bacea6a
equal deleted inserted replaced
834:0791aac03180 835:23fd8b510803
   138     slave->sii.rx_mailbox_offset = 0;
   138     slave->sii.rx_mailbox_offset = 0;
   139     slave->sii.rx_mailbox_size = 0;
   139     slave->sii.rx_mailbox_size = 0;
   140     slave->sii.tx_mailbox_offset = 0;
   140     slave->sii.tx_mailbox_offset = 0;
   141     slave->sii.tx_mailbox_size = 0;
   141     slave->sii.tx_mailbox_size = 0;
   142     slave->sii.mailbox_protocols = 0;
   142     slave->sii.mailbox_protocols = 0;
       
   143 
       
   144     slave->sii.strings = NULL;
       
   145     slave->sii.string_count = 0;
       
   146 
       
   147     slave->sii.has_general = 0;
   143     slave->sii.group = NULL;
   148     slave->sii.group = NULL;
   144     slave->sii.image = NULL;
   149     slave->sii.image = NULL;
   145     slave->sii.order = NULL;
   150     slave->sii.order = NULL;
   146     slave->sii.name = NULL;
   151     slave->sii.name = NULL;
       
   152     memset(&slave->sii.coe_details, 0x00, sizeof(ec_sii_coe_details_t));
   147     slave->sii.current_on_ebus = 0;
   153     slave->sii.current_on_ebus = 0;
   148 
   154 
   149     slave->sii.strings = NULL;
       
   150     slave->sii.string_count = 0;
       
   151     slave->sii.syncs = NULL;
   155     slave->sii.syncs = NULL;
   152     slave->sii.sync_count = 0;
   156     slave->sii.sync_count = 0;
       
   157 
   153     INIT_LIST_HEAD(&slave->sii.pdos);
   158     INIT_LIST_HEAD(&slave->sii.pdos);
       
   159 
   154     INIT_LIST_HEAD(&slave->sdo_dictionary);
   160     INIT_LIST_HEAD(&slave->sdo_dictionary);
   155 
   161 
   156     slave->sdo_dictionary_fetched = 0;
   162     slave->sdo_dictionary_fetched = 0;
   157     slave->jiffies_preop = 0;
   163     slave->jiffies_preop = 0;
   158 
   164 
   432 
   438 
   433     for (i = 0; i < 4; i++)
   439     for (i = 0; i < 4; i++)
   434         slave->sii.physical_layer[i] =
   440         slave->sii.physical_layer[i] =
   435             (data[4] & (0x03 << (i * 2))) >> (i * 2);
   441             (data[4] & (0x03 << (i * 2))) >> (i * 2);
   436 
   442 
       
   443     memcpy(&slave->sii.coe_details, data + 5, 1);
   437     slave->sii.current_on_ebus = EC_READ_S16(data + 0x0C);
   444     slave->sii.current_on_ebus = EC_READ_S16(data + 0x0C);
   438 
   445     slave->sii.has_general = 1;
   439     return 0;
   446     return 0;
   440 }
   447 }
   441 
   448 
   442 /*****************************************************************************/
   449 /*****************************************************************************/
   443 
   450 
   699             buf += sprintf(buf, "VoE");
   706             buf += sprintf(buf, "VoE");
   700         }
   707         }
   701         buf += sprintf(buf, "\n\n");
   708         buf += sprintf(buf, "\n\n");
   702     }
   709     }
   703 
   710 
   704     buf += sprintf(buf, "Current consumption: %i mA\n\n",
   711     if (slave->sii.has_general) {
   705             slave->sii.current_on_ebus);
       
   706 
       
   707     if (slave->sii.group || slave->sii.image || slave->sii.order
       
   708             || slave->sii.name) {
       
   709         buf += sprintf(buf, "General:\n");
   712         buf += sprintf(buf, "General:\n");
   710 
   713 
   711         if (slave->sii.group)
   714         if (slave->sii.group)
   712             buf += sprintf(buf, "  Group: %s\n", slave->sii.group);
   715             buf += sprintf(buf, "  Group: %s\n", slave->sii.group);
   713         if (slave->sii.image)
   716         if (slave->sii.image)
   715         if (slave->sii.order)
   718         if (slave->sii.order)
   716             buf += sprintf(buf, "  Order number: %s\n",
   719             buf += sprintf(buf, "  Order number: %s\n",
   717                     slave->sii.order);
   720                     slave->sii.order);
   718         if (slave->sii.name)
   721         if (slave->sii.name)
   719             buf += sprintf(buf, "  Name: %s\n", slave->sii.name);
   722             buf += sprintf(buf, "  Name: %s\n", slave->sii.name);
   720         buf += sprintf(buf, "\n");
   723         if (slave->sii.mailbox_protocols & EC_MBOX_COE) {
       
   724             buf += sprintf(buf, "  CoE details:\n");
       
   725             buf += sprintf(buf, "    Enable Sdo: %s\n",
       
   726                     slave->sii.coe_details.enable_sdo ? "yes" : "no");
       
   727             buf += sprintf(buf, "    Enable Sdo Info: %s\n",
       
   728                     slave->sii.coe_details.enable_sdo_info ? "yes" : "no");
       
   729             buf += sprintf(buf, "    Enable Pdo Assign: %s\n",
       
   730                     slave->sii.coe_details.enable_pdo_assign ? "yes" : "no");
       
   731             buf += sprintf(buf, "    Enable Pdo Configuration: %s\n",
       
   732                     slave->sii.coe_details.enable_pdo_configuration ?
       
   733                     "yes" : "no");
       
   734             buf += sprintf(buf, "    Enable Upload at startup: %s\n",
       
   735                     slave->sii.coe_details.enable_upload_at_startup ?
       
   736                     "yes" : "no");
       
   737             buf += sprintf(buf, "    Enable Sdo complete access: %s\n",
       
   738                     slave->sii.coe_details.enable_sdo_complete_access
       
   739                     ? "yes" : "no");
       
   740         }
       
   741 
       
   742         buf += sprintf(buf, "  Current consumption: %i mA\n\n",
       
   743                 slave->sii.current_on_ebus);
   721     }
   744     }
   722 
   745 
   723     if (slave->sii.sync_count) {
   746     if (slave->sii.sync_count) {
   724         buf += sprintf(buf, "Sync managers / Pdo mapping:\n");
   747         buf += sprintf(buf, "Sync managers / Pdo mapping:\n");
   725 
   748