examples/mini/mini.c
changeset 2060 8b67602f5161
parent 2024 96e2ae6cce95
child 2089 adbf7900b848
--- a/examples/mini/mini.c	Wed Mar 23 08:06:58 2011 +0100
+++ b/examples/mini/mini.c	Wed Apr 13 22:06:28 2011 +0200
@@ -346,10 +346,9 @@
     EC_WRITE_U8(domain1_pd + off_dig_out, blink ? 0x06 : 0x09);
 
     // send process data
-    down(&master_sem);
     ecrt_domain_queue(domain1);
+    up(&master_sem);
     ecrt_master_send(master);
-    up(&master_sem);
 
     // restart timer
     timer.expires += HZ / FREQUENCY;
@@ -358,21 +357,17 @@
 
 /*****************************************************************************/
 
-void send_callback(void *cb_data)
+void request_lock_callback(void *cb_data)
 {
     ec_master_t *m = (ec_master_t *) cb_data;
     down(&master_sem);
-    ecrt_master_send_ext(m);
-    up(&master_sem);
-}
-
-/*****************************************************************************/
-
-void receive_callback(void *cb_data)
+}
+
+/*****************************************************************************/
+
+void release_lock_callback(void *cb_data)
 {
     ec_master_t *m = (ec_master_t *) cb_data;
-    down(&master_sem);
-    ecrt_master_receive(m);
     up(&master_sem);
 }
 
@@ -398,7 +393,7 @@
     }
 
     sema_init(&master_sem, 1);
-    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))) {