equal
deleted
inserted
replaced
226 EC_MASTER_ERR(master, "Failed to allocate FSM datagram.\n"); |
226 EC_MASTER_ERR(master, "Failed to allocate FSM datagram.\n"); |
227 goto out_clear_backup; |
227 goto out_clear_backup; |
228 } |
228 } |
229 |
229 |
230 // create state machine object |
230 // create state machine object |
|
231 ec_mbox_init(&master->fsm_mbox,&master->fsm_datagram); |
231 ec_fsm_master_init(&master->fsm, master, &master->fsm_datagram); |
232 ec_fsm_master_init(&master->fsm, master, &master->fsm_datagram); |
232 |
233 |
233 // init reference sync datagram |
234 // init reference sync datagram |
234 ec_datagram_init(&master->ref_sync_datagram); |
235 ec_datagram_init(&master->ref_sync_datagram); |
235 snprintf(master->ref_sync_datagram.name, EC_DATAGRAM_NAME_SIZE, "refsync"); |
236 snprintf(master->ref_sync_datagram.name, EC_DATAGRAM_NAME_SIZE, "refsync"); |
327 #else |
328 #else |
328 class_device_unregister(master->class_device); |
329 class_device_unregister(master->class_device); |
329 #endif |
330 #endif |
330 |
331 |
331 ec_cdev_clear(&master->cdev); |
332 ec_cdev_clear(&master->cdev); |
332 |
333 |
333 #ifdef EC_EOE |
334 #ifdef EC_EOE |
334 ec_master_clear_eoe_handlers(master); |
335 ec_master_clear_eoe_handlers(master); |
335 #endif |
336 #endif |
336 ec_master_clear_domains(master); |
337 ec_master_clear_domains(master); |
337 ec_master_clear_slave_configs(master); |
338 ec_master_clear_slave_configs(master); |
339 |
340 |
340 ec_datagram_clear(&master->sync_mon_datagram); |
341 ec_datagram_clear(&master->sync_mon_datagram); |
341 ec_datagram_clear(&master->sync_datagram); |
342 ec_datagram_clear(&master->sync_datagram); |
342 ec_datagram_clear(&master->ref_sync_datagram); |
343 ec_datagram_clear(&master->ref_sync_datagram); |
343 ec_fsm_master_clear(&master->fsm); |
344 ec_fsm_master_clear(&master->fsm); |
|
345 ec_mbox_clear(&master->fsm_mbox); |
344 ec_datagram_clear(&master->fsm_datagram); |
346 ec_datagram_clear(&master->fsm_datagram); |
345 ec_device_clear(&master->backup_device); |
347 ec_device_clear(&master->backup_device); |
346 ec_device_clear(&master->main_device); |
348 ec_device_clear(&master->main_device); |
347 } |
349 } |
348 |
350 |
1277 |
1279 |
1278 // execute master & slave state machines |
1280 // execute master & slave state machines |
1279 if (ec_mutex_lock_interruptible(&master->master_mutex)) |
1281 if (ec_mutex_lock_interruptible(&master->master_mutex)) |
1280 break; |
1282 break; |
1281 if (ec_fsm_master_exec(&master->fsm)) { |
1283 if (ec_fsm_master_exec(&master->fsm)) { |
1282 ec_master_queue_fsm_datagram(master, &master->fsm_datagram); |
1284 ec_master_mbox_queue_datagrams(master, &master->fsm_mbox); |
1283 } |
1285 } |
1284 for (slave = master->slaves; |
1286 for (slave = master->slaves; |
1285 slave < master->slaves + master->slave_count; |
1287 slave < master->slaves + master->slave_count; |
1286 slave++) { |
1288 slave++) { |
1287 ec_fsm_slave_exec(&slave->fsm); // may queue datagram in fsm queue |
1289 ec_fsm_slave_exec(&slave->fsm); // may queue datagram in fsm queue |
1341 |
1343 |
1342 // execute master & slave state machines |
1344 // execute master & slave state machines |
1343 if (ec_mutex_lock_interruptible(&master->master_mutex)) |
1345 if (ec_mutex_lock_interruptible(&master->master_mutex)) |
1344 break; |
1346 break; |
1345 if (ec_fsm_master_exec(&master->fsm)) |
1347 if (ec_fsm_master_exec(&master->fsm)) |
1346 ec_master_queue_fsm_datagram(master, &master->fsm_datagram); |
1348 ec_master_mbox_queue_datagrams(master, &master->fsm_mbox); |
1347 for (slave = master->slaves; |
1349 for (slave = master->slaves; |
1348 slave < master->slaves + master->slave_count; |
1350 slave < master->slaves + master->slave_count; |
1349 slave++) { |
1351 slave++) { |
1350 ec_fsm_slave_exec(&slave->fsm); // may queue datagram in fsm queue |
1352 ec_fsm_slave_exec(&slave->fsm); // may queue datagram in fsm queue |
1351 } |
1353 } |