Adjusted examples to 1.2.0 interface changes.
authorFlorian Pose <fp@igh-essen.com>
Tue, 02 Jan 2007 13:25:26 +0000
changeset 509 87baea61d0c7
parent 508 11fb47492456
child 510 0d0c6fe0e3b2
Adjusted examples to 1.2.0 interface changes.
examples/mini/mini.c
examples/msr/msr_sample.c
examples/rtai/rtai_sample.c
--- a/examples/mini/mini.c	Tue Jan 02 13:15:02 2007 +0000
+++ b/examples/mini/mini.c	Tue Jan 02 13:25:26 2007 +0000
@@ -88,6 +88,7 @@
 #endif
 
     // send
+    ecrt_domain_queue(domain1);
     ecrt_master_run(master);
     ecrt_master_send(master);
 
@@ -131,7 +132,7 @@
 
     printk(KERN_INFO "=== Starting Minimal EtherCAT environment... ===\n");
 
-    if ((master = ecrt_request_master(0)) == NULL) {
+    if (!(master = ecrt_request_master(0))) {
         printk(KERN_ERR "Requesting master 0 failed!\n");
         goto out_return;
     }
@@ -139,8 +140,7 @@
     ecrt_master_callbacks(master, request_lock, release_lock, NULL);
 
     printk(KERN_INFO "Registering domain...\n");
-    if (!(domain1 = ecrt_master_create_domain(master)))
-    {
+    if (!(domain1 = ecrt_master_create_domain(master))) {
         printk(KERN_ERR "Domain creation failed!\n");
         goto out_release_master;
     }
@@ -180,8 +180,6 @@
         goto out_release_master;
     }
 
-    ecrt_master_prepare(master);
-
     printk("Starting cyclic sample thread.\n");
     init_timer(&timer);
     timer.function = run;
@@ -220,4 +218,3 @@
 module_exit(cleanup_mini_module);
 
 /*****************************************************************************/
-
--- a/examples/msr/msr_sample.c	Tue Jan 02 13:15:02 2007 +0000
+++ b/examples/msr/msr_sample.c	Tue Jan 02 13:25:26 2007 +0000
@@ -88,6 +88,7 @@
     EC_WRITE_S16(r_ana_out, k_ana_out / 10.0 * 0x7FFF);
 
     // Send
+    ecrt_domain_queue(domain1);
     ecrt_master_run(master);
     ecrt_master_send(master);
 
@@ -175,8 +176,6 @@
         goto out_release_master;
     }
 
-    ecrt_master_prepare(master);
-
     printk("Starting cyclic sample thread...\n");
     ticks = start_rt_timer(nano2count(TIMERTICKS));
     if (rt_task_init(&task, msr_run, 0, 2000, 0, 1, NULL)) {
@@ -195,7 +194,6 @@
     rt_task_delete(&task);
  out_stop_timer:
     stop_rt_timer();
-    ecrt_master_deactivate(master);
  out_release_master:
     ecrt_release_master(master);
  out_msr_cleanup:
--- a/examples/rtai/rtai_sample.c	Tue Jan 02 13:15:02 2007 +0000
+++ b/examples/rtai/rtai_sample.c	Tue Jan 02 13:25:26 2007 +0000
@@ -95,6 +95,7 @@
         // process data
         //k_pos = EC_READ_U32(r_ssi_input);
 
+        ecrt_domain_queue(domain1);
         ecrt_master_run(master);
         ecrt_master_send(master);
 
@@ -139,7 +140,6 @@
         goto out_return;
     }
 
-
     ecrt_master_callbacks(master, request_lock, release_lock, NULL);
 
     printk(KERN_INFO "Registering domain...\n");
@@ -160,8 +160,6 @@
         goto out_release_master;
     }
 
-    ecrt_master_prepare(master);
-
     printk("Starting cyclic sample thread...\n");
     requested_ticks = nano2count(TIMERTICKS);
     tick_period = start_rt_timer(requested_ticks);
@@ -186,7 +184,6 @@
     rt_task_delete(&task);
  out_stop_timer:
     stop_rt_timer();
-    ecrt_master_deactivate(master);
  out_release_master:
     ecrt_release_master(master);
  out_return: