master/slave_config.c
changeset 2151 4751747d4e6d
parent 2103 8c63d804ead9
child 2402 1a450b095f3b
equal deleted inserted replaced
2150:5144a4bc6184 2151:4751747d4e6d
     1 /******************************************************************************
     1 /******************************************************************************
     2  *
     2  *
     3  *  $Id$
     3  *  $Id: slave_config.c,v 8c63d804ead9 2011/08/11 18:44:18 fp $
     4  *
     4  *
     5  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
     5  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
     6  *
     6  *
     7  *  This file is part of the IgH EtherCAT Master.
     7  *  This file is part of the IgH EtherCAT Master.
     8  *
     8  *
   232         EC_CONFIG_DBG(sc, 1, "Failed to attach configuration. Slave %u"
   232         EC_CONFIG_DBG(sc, 1, "Failed to attach configuration. Slave %u"
   233                 " already has a configuration!\n", slave->ring_position);
   233                 " already has a configuration!\n", slave->ring_position);
   234         return -EEXIST;
   234         return -EEXIST;
   235     }
   235     }
   236 
   236 
   237     if (slave->sii.vendor_id != sc->vendor_id
   237     if (
   238             || slave->sii.product_code != sc->product_code) {
   238 #ifdef EC_IDENT_WILDCARDS
   239         EC_CONFIG_DBG(sc, 1, "Slave %u has an invalid type (0x%08X/0x%08X)"
   239             sc->vendor_id != 0xffffffff &&
   240                 " for configuration (0x%08X/0x%08X).\n",
   240 #endif
   241                 slave->ring_position, slave->sii.vendor_id,
   241             slave->sii.vendor_id != sc->vendor_id
   242                 slave->sii.product_code, sc->vendor_id, sc->product_code);
   242        ) {
       
   243         EC_CONFIG_DBG(sc, 1, "Slave %u has no matching vendor ID (0x%08X)"
       
   244                 " for configuration (0x%08X).\n",
       
   245                 slave->ring_position, slave->sii.vendor_id, sc->vendor_id);
       
   246         return -EINVAL;
       
   247     }
       
   248 
       
   249     if (
       
   250 #ifdef EC_IDENT_WILDCARDS
       
   251             sc->product_code != 0xffffffff &&
       
   252 #endif
       
   253             slave->sii.product_code != sc->product_code
       
   254        ) {
       
   255         EC_CONFIG_DBG(sc, 1, "Slave %u has no matching product code (0x%08X)"
       
   256                 " for configuration (0x%08X).\n",
       
   257                 slave->ring_position, slave->sii.product_code,
       
   258                 sc->product_code);
   243         return -EINVAL;
   259         return -EINVAL;
   244     }
   260     }
   245 
   261 
   246     // attach slave
   262     // attach slave
   247     slave->config = sc;
   263     slave->config = sc;