equal
deleted
inserted
replaced
1 /****************************************************************************** |
1 /****************************************************************************** |
2 * |
2 * |
3 * $Id: master.c,v afb40fd6018e 2011/09/16 12:10:23 fp $ |
3 * $Id$ |
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 * |
1314 */ |
1314 */ |
1315 static int ec_master_idle_thread(void *priv_data) |
1315 static int ec_master_idle_thread(void *priv_data) |
1316 { |
1316 { |
1317 ec_master_t *master = (ec_master_t *) priv_data; |
1317 ec_master_t *master = (ec_master_t *) priv_data; |
1318 ec_slave_t *slave = NULL; |
1318 ec_slave_t *slave = NULL; |
|
1319 #ifdef EC_USE_HRTIMER |
1319 size_t sent_bytes; |
1320 size_t sent_bytes; |
|
1321 #endif |
1320 |
1322 |
1321 // send interval in IDLE phase |
1323 // send interval in IDLE phase |
1322 ec_master_set_send_interval(master, 1000000 / HZ); |
1324 ec_master_set_send_interval(master, 1000000 / HZ); |
1323 |
1325 |
1324 EC_MASTER_DBG(master, 1, "Idle thread running with send interval = %u us," |
1326 EC_MASTER_DBG(master, 1, "Idle thread running with send interval = %u us," |
1353 ec_mutex_unlock(&master->master_mutex); |
1355 ec_mutex_unlock(&master->master_mutex); |
1354 |
1356 |
1355 // queue and send |
1357 // queue and send |
1356 ec_mutex_lock(&master->io_mutex); |
1358 ec_mutex_lock(&master->io_mutex); |
1357 ecrt_master_send(master); |
1359 ecrt_master_send(master); |
|
1360 #ifdef EC_USE_HRTIMER |
1358 sent_bytes = master->main_device.tx_skb[ |
1361 sent_bytes = master->main_device.tx_skb[ |
1359 master->main_device.tx_ring_index]->len; |
1362 master->main_device.tx_ring_index]->len; |
|
1363 #endif |
1360 ec_mutex_unlock(&master->io_mutex); |
1364 ec_mutex_unlock(&master->io_mutex); |
1361 |
1365 |
1362 if (ec_fsm_master_idle(&master->fsm)) { |
1366 if (ec_fsm_master_idle(&master->fsm)) { |
1363 #ifdef EC_USE_HRTIMER |
1367 #ifdef EC_USE_HRTIMER |
1364 ec_master_nanosleep(master->send_interval * 1000); |
1368 ec_master_nanosleep(master->send_interval * 1000); |