574 data += 8; |
574 data += 8; |
575 } |
575 } |
576 |
576 |
577 // if sync manager index is positive, the PDO is mapped by default |
577 // if sync manager index is positive, the PDO is mapped by default |
578 if (pdo->sync_index >= 0) { |
578 if (pdo->sync_index >= 0) { |
|
579 ec_sync_t *sync; |
579 ec_pdo_t *mapped_pdo; |
580 ec_pdo_t *mapped_pdo; |
580 |
581 |
581 if (pdo->sync_index >= slave->sii_sync_count) { |
582 if (pdo->sync_index >= slave->sii_sync_count) { |
582 EC_ERR("Invalid SM index %i for PDO 0x%04X in slave %u.", |
583 EC_ERR("Invalid SM index %i for PDO 0x%04X in slave %u.", |
583 pdo->sync_index, pdo->index, slave->ring_position); |
584 pdo->sync_index, pdo->index, slave->ring_position); |
584 return -1; |
585 return -1; |
585 } |
586 } |
|
587 sync = &slave->sii_syncs[pdo->sync_index]; |
586 |
588 |
587 if (!(mapped_pdo = kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) { |
589 if (!(mapped_pdo = kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) { |
588 EC_ERR("Failed to allocate PDO memory.\n"); |
590 EC_ERR("Failed to allocate PDO memory.\n"); |
589 return -1; |
591 return -1; |
590 } |
592 } |
808 " SM%u: addr 0x%04X, size %i, control 0x%02X, %s\n", |
810 " SM%u: addr 0x%04X, size %i, control 0x%02X, %s\n", |
809 sync->index, sync->physical_start_address, |
811 sync->index, sync->physical_start_address, |
810 ec_sync_size(sync), sync->control_register, |
812 ec_sync_size(sync), sync->control_register, |
811 sync->enable ? "enable" : "disable"); |
813 sync->enable ? "enable" : "disable"); |
812 |
814 |
813 if (list_empty(&sync->pdos)) |
815 if (list_empty(&sync->pdos)) { |
814 off += sprintf(buffer + off, " No PDOs mapped.\n"); |
816 off += sprintf(buffer + off, " No PDOs mapped.\n"); |
|
817 } else if (sync->mapping_source != EC_SYNC_MAPPING_NONE) { |
|
818 off += sprintf(buffer + off, " PDO mapping information from %s.\n", |
|
819 sync->mapping_source == EC_SYNC_MAPPING_SII ? "SII" : "CoE"); |
|
820 } |
815 |
821 |
816 list_for_each_entry(pdo, &sync->pdos, list) { |
822 list_for_each_entry(pdo, &sync->pdos, list) { |
817 off += sprintf(buffer + off, " %s 0x%04X \"%s\"\n", |
823 off += sprintf(buffer + off, " %s 0x%04X \"%s\"\n", |
818 pdo->type == EC_RX_PDO ? "RxPdo" : "TxPdo", |
824 pdo->type == EC_RX_PDO ? "RxPdo" : "TxPdo", |
819 pdo->index, pdo->name ? pdo->name : "???"); |
825 pdo->index, pdo->name ? pdo->name : "???"); |
828 } |
834 } |
829 } |
835 } |
830 |
836 |
831 // type-cast to avoid warnings on some compilers |
837 // type-cast to avoid warnings on some compilers |
832 if (!list_empty((struct list_head *) &slave->sii_pdos)) |
838 if (!list_empty((struct list_head *) &slave->sii_pdos)) |
833 off += sprintf(buffer + off, "\nAvailable PDOs:\n"); |
839 off += sprintf(buffer + off, "\nAvailable PDOs from SII:\n"); |
834 |
840 |
835 list_for_each_entry(pdo, &slave->sii_pdos, list) { |
841 list_for_each_entry(pdo, &slave->sii_pdos, list) { |
836 off += sprintf(buffer + off, " %s 0x%04X \"%s\"", |
842 off += sprintf(buffer + off, " %s 0x%04X \"%s\"", |
837 pdo->type == EC_RX_PDO ? "RxPdo" : "TxPdo", |
843 pdo->type == EC_RX_PDO ? "RxPdo" : "TxPdo", |
838 pdo->index, pdo->name ? pdo->name : "???"); |
844 pdo->index, pdo->name ? pdo->name : "???"); |