master/slave.c
changeset 320 71d559ec66d7
parent 315 119f967aead8
child 325 7833cf70c4f2
equal deleted inserted replaced
319:88f2e8c4face 320:71d559ec66d7
  1506                                         /**< sync manager */
  1506                                         /**< sync manager */
  1507                                         )
  1507                                         )
  1508 {
  1508 {
  1509     ec_eeprom_pdo_t *pdo;
  1509     ec_eeprom_pdo_t *pdo;
  1510     ec_eeprom_pdo_entry_t *pdo_entry;
  1510     ec_eeprom_pdo_entry_t *pdo_entry;
  1511     uint16_t size;
  1511     unsigned int bit_size;
  1512 
  1512 
  1513     if (sync->length) return sync->length;
  1513     if (sync->length) return sync->length;
  1514 
  1514 
  1515     size = 0;
  1515     bit_size = 0;
  1516     list_for_each_entry(pdo, &slave->eeprom_pdos, list) {
  1516     list_for_each_entry(pdo, &slave->eeprom_pdos, list) {
  1517         if (pdo->sync_manager != sync->index) continue;
  1517         if (pdo->sync_manager != sync->index) continue;
  1518 
  1518 
  1519         list_for_each_entry(pdo_entry, &pdo->entries, list) {
  1519         list_for_each_entry(pdo_entry, &pdo->entries, list) {
  1520             size += pdo_entry->bit_length / 8;
  1520             bit_size += pdo_entry->bit_length;
  1521         }
  1521         }
  1522     }
  1522     }
  1523 
  1523 
  1524     return size;
  1524     if (bit_size % 8) // round up to full bytes
       
  1525         return bit_size / 8 + 1;
       
  1526     else
       
  1527         return bit_size / 8;
  1525 }
  1528 }
  1526 
  1529 
  1527 /******************************************************************************
  1530 /******************************************************************************
  1528  *  Realtime interface
  1531  *  Realtime interface
  1529  *****************************************************************************/
  1532  *****************************************************************************/