--- a/examples/dc_rtai/dc_rtai_sample.c Fri May 13 15:33:16 2011 +0200
+++ b/examples/dc_rtai/dc_rtai_sample.c Fri May 13 15:34:20 2011 +0200
@@ -229,8 +229,8 @@
}
ecrt_master_sync_slave_clocks(master);
ecrt_domain_queue(domain1);
+ rt_sem_signal(&master_sem);
ecrt_master_send(master);
- rt_sem_signal(&master_sem);
rt_task_wait_period();
}
@@ -238,30 +238,18 @@
/*****************************************************************************/
-void send_callback(void *cb_data)
+void request_lock_callback(void *cb_data)
{
ec_master_t *m = (ec_master_t *) cb_data;
-
- // too close to the next real time cycle: deny access...
- if (get_cycles() - t_last_cycle <= t_critical) {
- rt_sem_wait(&master_sem);
- ecrt_master_send_ext(m);
- rt_sem_signal(&master_sem);
- }
-}
-
-/*****************************************************************************/
-
-void receive_callback(void *cb_data)
+ rt_sem_wait(&master_sem);
+}
+
+/*****************************************************************************/
+
+void release_lock_callback(void *cb_data)
{
ec_master_t *m = (ec_master_t *) cb_data;
-
- // too close to the next real time cycle: deny access...
- if (get_cycles() - t_last_cycle <= t_critical) {
- rt_sem_wait(&master_sem);
- ecrt_master_receive(m);
- rt_sem_signal(&master_sem);
- }
+ rt_sem_signal(&master_sem);
}
/*****************************************************************************/
@@ -285,7 +273,7 @@
goto out_return;
}
- ecrt_master_callbacks(master, send_callback, receive_callback, master);
+ ecrt_master_callbacks(master, request_lock_callback, release_lock_callback, master);
printk(KERN_INFO PFX "Registering domain...\n");
if (!(domain1 = ecrt_master_create_domain(master))) {