equal
deleted
inserted
replaced
413 if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information |
413 if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information |
414 (EC_READ_U8(data + 2) & 0x7F) != 0x06 || // entry descr. response |
414 (EC_READ_U8(data + 2) & 0x7F) != 0x06 || // entry descr. response |
415 EC_READ_U16(data + 6) != sdo->index || // SDO index |
415 EC_READ_U16(data + 6) != sdo->index || // SDO index |
416 EC_READ_U8(data + 8) != i) { // SDO subindex |
416 EC_READ_U8(data + 8) != i) { // SDO subindex |
417 EC_ERR("Invalid entry description response at slave %i while" |
417 EC_ERR("Invalid entry description response at slave %i while" |
418 " fetching SDO 0x%04X:%i!\n", slave->ring_position, |
418 " fetching SDO entry 0x%04X:%i!\n", slave->ring_position, |
419 sdo->index, i); |
419 sdo->index, i); |
420 ec_print_data(data, rec_size); |
420 ec_print_data(data, rec_size); |
421 return -1; |
421 return -1; |
422 } |
422 } |
423 |
423 |
432 |
432 |
433 data_size = rec_size - 16; |
433 data_size = rec_size - 16; |
434 |
434 |
435 if (!(entry = (ec_sdo_entry_t *) |
435 if (!(entry = (ec_sdo_entry_t *) |
436 kmalloc(sizeof(ec_sdo_entry_t) + data_size + 1, GFP_KERNEL))) { |
436 kmalloc(sizeof(ec_sdo_entry_t) + data_size + 1, GFP_KERNEL))) { |
437 EC_ERR("Failed to allocate entry memory!\n"); |
437 EC_ERR("Failed to allocate entry!\n"); |
438 return -1; |
438 return -1; |
439 } |
439 } |
440 |
440 |
441 entry->subindex = i; |
441 entry->subindex = i; |
442 entry->data_type = EC_READ_U16(data + 10); |
442 entry->data_type = EC_READ_U16(data + 10); |
443 entry->bit_length = EC_READ_U16(data + 12); |
443 entry->bit_length = EC_READ_U16(data + 12); |
444 if (!data_size) { |
444 |
445 entry->name = NULL; |
445 // memory for name string appended to entry |
446 } |
446 entry->name = (uint8_t *) entry + sizeof(ec_sdo_entry_t); |
447 else { |
447 |
448 entry->name = (uint8_t *) entry + sizeof(ec_sdo_entry_t); |
448 memcpy(entry->name, data + 16, data_size); |
449 memcpy(entry->name, data + 16, data_size); |
449 entry->name[data_size] = 0; |
450 entry->name[data_size] = 0; |
|
451 } |
|
452 |
450 |
453 list_add_tail(&entry->list, &sdo->entries); |
451 list_add_tail(&entry->list, &sdo->entries); |
454 } |
452 } |
455 |
453 |
456 return 0; |
454 return 0; |