equal
deleted
inserted
replaced
1217 ec_domain_t *ecrt_master_create_domain(ec_master_t *master /**< master */) |
1217 ec_domain_t *ecrt_master_create_domain(ec_master_t *master /**< master */) |
1218 { |
1218 { |
1219 ec_domain_t *domain, *last_domain; |
1219 ec_domain_t *domain, *last_domain; |
1220 unsigned int index; |
1220 unsigned int index; |
1221 |
1221 |
|
1222 if (master->debug_level) |
|
1223 EC_DBG("ecrt_master_create_domain(master = 0x%x)\n", (u32) master); |
|
1224 |
1222 if (!(domain = (ec_domain_t *) kmalloc(sizeof(ec_domain_t), GFP_KERNEL))) { |
1225 if (!(domain = (ec_domain_t *) kmalloc(sizeof(ec_domain_t), GFP_KERNEL))) { |
1223 EC_ERR("Error allocating domain memory!\n"); |
1226 EC_ERR("Error allocating domain memory!\n"); |
1224 return NULL; |
1227 return NULL; |
1225 } |
1228 } |
1226 |
1229 |
1236 ec_domain_init(domain, master, index); |
1239 ec_domain_init(domain, master, index); |
1237 list_add_tail(&domain->list, &master->domains); |
1240 list_add_tail(&domain->list, &master->domains); |
1238 |
1241 |
1239 up(&master->master_sem); |
1242 up(&master->master_sem); |
1240 |
1243 |
|
1244 if (master->debug_level) |
|
1245 EC_DBG("Created domain %u.\n", domain->index); |
|
1246 |
1241 return domain; |
1247 return domain; |
1242 } |
1248 } |
1243 |
1249 |
1244 /*****************************************************************************/ |
1250 /*****************************************************************************/ |
1245 |
1251 |
1246 int ecrt_master_activate(ec_master_t *master) |
1252 int ecrt_master_activate(ec_master_t *master) |
1247 { |
1253 { |
1248 uint32_t domain_offset; |
1254 uint32_t domain_offset; |
1249 ec_domain_t *domain; |
1255 ec_domain_t *domain; |
|
1256 |
|
1257 if (master->debug_level) |
|
1258 EC_DBG("ecrt_master_activate(master = 0x%x)\n", (u32) master); |
1250 |
1259 |
1251 down(&master->master_sem); |
1260 down(&master->master_sem); |
1252 |
1261 |
1253 // finish all domains |
1262 // finish all domains |
1254 domain_offset = 0; |
1263 domain_offset = 0; |
1382 uint32_t product_code) |
1391 uint32_t product_code) |
1383 { |
1392 { |
1384 ec_slave_config_t *sc; |
1393 ec_slave_config_t *sc; |
1385 unsigned int found = 0; |
1394 unsigned int found = 0; |
1386 |
1395 |
|
1396 |
|
1397 if (master->debug_level) |
|
1398 EC_DBG("ecrt_master_slave_config(master = 0x%x, alias = %u, " |
|
1399 "position = %u, vendor_id = %u, product_code = %u)\n", |
|
1400 (u32) master, alias, position, vendor_id, product_code); |
|
1401 |
1387 list_for_each_entry(sc, &master->configs, list) { |
1402 list_for_each_entry(sc, &master->configs, list) { |
1388 if (sc->alias == alias && sc->position == position) { |
1403 if (sc->alias == alias && sc->position == position) { |
1389 found = 1; |
1404 found = 1; |
1390 break; |
1405 break; |
1391 } |
1406 } |
1430 /*****************************************************************************/ |
1445 /*****************************************************************************/ |
1431 |
1446 |
1432 void ecrt_master_callbacks(ec_master_t *master, int (*request_cb)(void *), |
1447 void ecrt_master_callbacks(ec_master_t *master, int (*request_cb)(void *), |
1433 void (*release_cb)(void *), void *cb_data) |
1448 void (*release_cb)(void *), void *cb_data) |
1434 { |
1449 { |
|
1450 if (master->debug_level) |
|
1451 EC_DBG("ecrt_master_callbacks(master = 0x%x, request_cb = 0x%x, " |
|
1452 " release_cb = 0x%x, cb_data = 0x%x)\n", (u32) master, |
|
1453 (u32) request_cb, (u32) release_cb, (u32) cb_data); |
|
1454 |
1435 master->ext_request_cb = request_cb; |
1455 master->ext_request_cb = request_cb; |
1436 master->ext_release_cb = release_cb; |
1456 master->ext_release_cb = release_cb; |
1437 master->ext_cb_data = cb_data; |
1457 master->ext_cb_data = cb_data; |
1438 } |
1458 } |
1439 |
1459 |