Index: soft/giet_vm/applications/coproc/main.c
===================================================================
--- soft/giet_vm/applications/coproc/main.c	(revision 533)
+++ soft/giet_vm/applications/coproc/main.c	(revision 555)
@@ -1,8 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////////////
+//  file   : main.c  (for coproc application)
+//  date   : avril 2015
+//  author : Alain Greiner
+///////////////////////////////////////////////////////////////////////////////////////
+//  This file describes the single thread "coproc" application.
+//  It uses the embedded GCD (Greater Common Divider) coprocessor to make
+//  the GCD computation between two vectors of 32 bits integers.
+//  The vectors size is defined by the VECTOR_SIZE parameter.
+///////////////////////////////////////////////////////////////////////////////////////
+
+
 #include "stdio.h"
 #include "mapping_info.h"   // for coprocessors types an modes
 
-#define  VECTOR_SIZE  32   
+#define  VECTOR_SIZE 128   
 
-#define VERBOSE  1
+#define  DMA_MODE    MODE_DMA_IRQ
+
+#define VERBOSE      1
 
 // Memory buffers for coprocessor
@@ -32,11 +46,8 @@
     }
 
-    // request a GCD coprocessor
     unsigned int coproc_info;
-    unsigned int cluster_xy;
 
-    giet_coproc_alloc( MWR_SUBTYPE_GCD,
-                       &coproc_info,
-                       &cluster_xy );
+    /////////////////////// request a GCD coprocessor
+    giet_coproc_alloc( MWR_SUBTYPE_GCD, &coproc_info );
 
     // check coprocessor ports
@@ -45,5 +56,4 @@
     unsigned int nb_config      = (coproc_info>>16) & 0xFF;
     unsigned int nb_status      = (coproc_info>>24) & 0xFF;
-
     giet_assert( ((nb_to_coproc   == 2) &&
                   (nb_from_coproc == 1) &&
@@ -52,55 +62,45 @@
                   "wrong GCD coprocessor interface" );
 
-    if ( VERBOSE )
-    giet_shr_printf("\n*** get GCD coprocessor at cycle %d\n",
-                    giet_proctime() );
+if ( VERBOSE )
+giet_shr_printf("\n*** get GCD coprocessor at cycle %d\n", giet_proctime() );
 
-    // initializes communication channels
-    giet_coproc_channel_t desc;
+    //////////////////////// initializes channel for OPA
+    giet_coproc_channel_t opa_desc;
+    opa_desc.channel_mode = DMA_MODE;
+    opa_desc.buffer_size  = VECTOR_SIZE<<2;
+    opa_desc.buffer_vaddr = (unsigned int)opa;
+    giet_coproc_channel_init( 0 , &opa_desc );
+    
+    //////////////////////// initializes channel for OPB
+    giet_coproc_channel_t opb_desc;
+    opb_desc.channel_mode = DMA_MODE;
+    opb_desc.buffer_size  = VECTOR_SIZE<<2;
+    opb_desc.buffer_vaddr = (unsigned int)opb;
+    giet_coproc_channel_init( 1 , &opb_desc );
+    
+    //////////////////////// initializes channel for RES
+    giet_coproc_channel_t res_desc;
+    res_desc.channel_mode = DMA_MODE;
+    res_desc.buffer_size  = VECTOR_SIZE<<2;
+    res_desc.buffer_vaddr = (unsigned int)res;
+    giet_coproc_channel_init( 2 , &res_desc );
+    
+if ( VERBOSE )
+giet_shr_printf("\n*** channels initialized at cycle %d\n", giet_proctime() );
 
-    desc.channel_mode = MODE_DMA_NO_IRQ;
-    desc.buffer_size  = VECTOR_SIZE<<2;
-    desc.buffer_vaddr = (unsigned int)opa;
+    /////////////////////// starts communication channels
+    giet_coproc_run( 0 );
 
-    giet_coproc_channel_init( cluster_xy , 0 , &desc );
-    
-    desc.channel_mode = MODE_DMA_NO_IRQ;
-    desc.buffer_size  = VECTOR_SIZE<<2;
-    desc.buffer_vaddr = (unsigned int)opb;
+if ( VERBOSE )
+giet_shr_printf("\n*** start GCD coprocessor at cycle %d\n", giet_proctime() );
 
-    giet_coproc_channel_init( cluster_xy , 1 , &desc );
-    
-    desc.channel_mode = MODE_DMA_IRQ;
-    desc.buffer_size  = VECTOR_SIZE<<2;
-    desc.buffer_vaddr = (unsigned int)res;
+    /////////////////////// wait coprocessor completion
+    if ( DMA_MODE == MODE_DMA_NO_IRQ )
+    {
+        giet_coproc_completed( );
+    }
 
-    giet_coproc_channel_init( cluster_xy , 2 , &desc );
-    
-    if ( VERBOSE )
-    giet_shr_printf("\n*** initialise coomunication channels at cycle %d\n",
-                    giet_proctime() );
-
-    // starts communication channels
-    giet_coproc_channel_start( cluster_xy , 0 );
-    giet_coproc_channel_start( cluster_xy , 1 );
-    giet_coproc_channel_start( cluster_xy , 2 );
-
-    if ( VERBOSE )
-    giet_shr_printf("\n*** start communication channels at cycle %d\n",
-                    giet_proctime() );
-
-    // starts GCD coprocessor
-    giet_coproc_register_set( cluster_xy , 0 , 1 );
-
-    if ( VERBOSE )
-    giet_shr_printf("\n*** start GCD coprocessor at cycle %d\n",
-                    giet_proctime() );
-
-    // wait coprocessor completion
-    giet_coproc_completed( cluster_xy );
-
-    if ( VERBOSE )
-    giet_shr_printf("\n*** GCD computation completed at cycle %d\n",
-                    giet_proctime() );
+if ( VERBOSE )
+giet_shr_printf("\n*** GCD computation completed at cycle %d\n", giet_proctime() );
 
     // display result
@@ -111,4 +111,7 @@
     }
 
+    ////////////////////// release GCD coprocessor
+    giet_coproc_release( 0 );
+
     giet_exit("completed");
 
