master/slave.c
changeset 127 e67c80a76de4
parent 126 bbc963b9fead
child 132 63a5b40eb7da
equal deleted inserted replaced
126:bbc963b9fead 127:e67c80a76de4
   326     uint32_t value;
   326     uint32_t value;
   327     uint8_t *cat_data;
   327     uint8_t *cat_data;
   328     unsigned int i;
   328     unsigned int i;
   329 
   329 
   330     word_offset = 0x0040;
   330     word_offset = 0x0040;
   331 
       
   332     //EC_DBG("Slave %i...\n", slave->ring_position);
       
   333 
   331 
   334     if (!(cat_data = (uint8_t *) kmalloc(0x10000, GFP_KERNEL))) {
   332     if (!(cat_data = (uint8_t *) kmalloc(0x10000, GFP_KERNEL))) {
   335         EC_ERR("Failed to allocate 64k bytes for category data.\n");
   333         EC_ERR("Failed to allocate 64k bytes for category data.\n");
   336         return -1;
   334         return -1;
   337     }
   335     }
   480     ec_eeprom_sync_t *sync;
   478     ec_eeprom_sync_t *sync;
   481 
   479 
   482     sync_count = word_count / 4; // Sync-Manager-Strunktur ist 4 Worte lang
   480     sync_count = word_count / 4; // Sync-Manager-Strunktur ist 4 Worte lang
   483 
   481 
   484     for (i = 0; i < sync_count; i++, data += 8) {
   482     for (i = 0; i < sync_count; i++, data += 8) {
   485         if (!(sync = (ec_eeprom_sync_t *) kmalloc(sizeof(ec_eeprom_sync_t),
   483         if (!(sync = (ec_eeprom_sync_t *)
   486                                                   GFP_KERNEL))) {
   484               kmalloc(sizeof(ec_eeprom_sync_t), GFP_KERNEL))) {
   487             EC_ERR("Failed to allocate Sync-Manager memory.\n");
   485             EC_ERR("Failed to allocate Sync-Manager memory.\n");
   488             return -1;
   486             return -1;
   489         }
   487         }
   490 
   488 
   491         sync->index = i;
   489         sync->index = i;
   515     ec_eeprom_pdo_t *pdo;
   513     ec_eeprom_pdo_t *pdo;
   516     ec_eeprom_pdo_entry_t *entry;
   514     ec_eeprom_pdo_entry_t *entry;
   517     unsigned int entry_count, i;
   515     unsigned int entry_count, i;
   518 
   516 
   519     while (word_count >= 4) {
   517     while (word_count >= 4) {
   520         if (!(pdo = (ec_eeprom_pdo_t *) kmalloc(sizeof(ec_eeprom_pdo_t),
   518         if (!(pdo = (ec_eeprom_pdo_t *)
   521                                                 GFP_KERNEL))) {
   519               kmalloc(sizeof(ec_eeprom_pdo_t), GFP_KERNEL))) {
   522             EC_ERR("Failed to allocate PDO memory.\n");
   520             EC_ERR("Failed to allocate PDO memory.\n");
   523             return -1;
   521             return -1;
   524         }
   522         }
   525 
   523 
   526         INIT_LIST_HEAD(&pdo->entries);
   524         INIT_LIST_HEAD(&pdo->entries);