equal
deleted
inserted
replaced
1225 } |
1225 } |
1226 #endif |
1226 #endif |
1227 |
1227 |
1228 /*****************************************************************************/ |
1228 /*****************************************************************************/ |
1229 |
1229 |
1230 /** |
|
1231 Prepares synchronous IO. |
|
1232 Queues all domain datagrams and sends them. Then waits a certain time, so |
|
1233 that ecrt_master_receive() can be called securely. |
|
1234 */ |
|
1235 |
|
1236 void ec_master_prepare(ec_master_t *master /**< EtherCAT master */) |
|
1237 { |
|
1238 ec_domain_t *domain; |
|
1239 cycles_t cycles_start, cycles_end, cycles_timeout; |
|
1240 |
|
1241 // queue datagrams of all domains |
|
1242 list_for_each_entry(domain, &master->domains, list) |
|
1243 ecrt_domain_queue(domain); |
|
1244 |
|
1245 ecrt_master_send(master); |
|
1246 |
|
1247 cycles_start = get_cycles(); |
|
1248 cycles_timeout = (cycles_t) EC_IO_TIMEOUT /* us */ * (cpu_khz / 1000); |
|
1249 |
|
1250 // active waiting |
|
1251 while (1) { |
|
1252 udelay(100); |
|
1253 cycles_end = get_cycles(); |
|
1254 if (cycles_end - cycles_start >= cycles_timeout) break; |
|
1255 } |
|
1256 } |
|
1257 |
|
1258 /*****************************************************************************/ |
|
1259 |
|
1260 /** Detaches the slave configurations from the slaves. |
1230 /** Detaches the slave configurations from the slaves. |
1261 */ |
1231 */ |
1262 void ec_master_detach_slave_configs( |
1232 void ec_master_detach_slave_configs( |
1263 ec_master_t *master /**< EtherCAT master. */ |
1233 ec_master_t *master /**< EtherCAT master. */ |
1264 ) |
1234 ) |
1351 // restart EoE process and master thread with new locking |
1321 // restart EoE process and master thread with new locking |
1352 #ifdef EC_EOE |
1322 #ifdef EC_EOE |
1353 ec_master_eoe_stop(master); |
1323 ec_master_eoe_stop(master); |
1354 #endif |
1324 #endif |
1355 ec_master_thread_stop(master); |
1325 ec_master_thread_stop(master); |
1356 |
|
1357 ec_master_prepare(master); // prepare asynchronous IO |
|
1358 |
1326 |
1359 if (master->debug_level) |
1327 if (master->debug_level) |
1360 EC_DBG("FSM datagram is %x.\n", (unsigned int) &master->fsm_datagram); |
1328 EC_DBG("FSM datagram is %x.\n", (unsigned int) &master->fsm_datagram); |
1361 |
1329 |
1362 master->injection_seq_fsm = 0; |
1330 master->injection_seq_fsm = 0; |