Index: soft/giet_vm/applications/transpose/main.c
===================================================================
--- soft/giet_vm/applications/transpose/main.c	(revision 432)
+++ soft/giet_vm/applications/transpose/main.c	(revision 444)
@@ -1,19 +1,28 @@
-///////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////
 // File   : main.c   (for transpose application)
 // Date   : february 2014
 // author : Alain Greiner
-//
-// This application makes a transpose for a NN*NN pixels sequence of images.
+/////////////////////////////////////////////////////////////////////////////////////////////
+// This multi-threaded application makes a transpose for a NN*NN pixels sequence of images.
+// It can run on a multi-processors, multi-clusters architecture, with one thread
+// per processor. It uses the he following hardware parameters, that must be defined 
+// in the hard_config.h file:
+// - X_SIZE       : number of clusters in a row
+// - Y_SIZE       : number of clusters in a column
+// - NB_PROCS_MAX : number of processors per cluster
+// - FBUF_X_SIZE  : number of pixels per line in frame buffer
+// - FBUF_Y_SIZE  : number of lines  in frame buffer
+// 
 // The image sequence is read from a file (one byte per pixel).
 // The input and output buffers containing the image are distributed in all clusters.
 //
-// - The image size NN must be a power of 2.
+// - The image size NN must be a power of 2 and must fit the frame buffer size.
 // - The number of clusters containing processors must be a power of 2.
-// - The number of processors per cluster (NB_PROCS_MAX) must be a power of 2.
+// - The number of processors per cluster must be a power of 2.
 // - The image size NN must be larger or equal to the total number of processor.
 //
 // For each image the application makes a self test (checksum for each line).
 // The actual display on the frame buffer depends on frame buffer availability.
-///////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////
 
 #include "hard_config.h"
@@ -23,5 +32,5 @@
 
 #define NN                  128                 // image size : nlines = npixels = 128
-#define NB_IMAGES           2                   // number of images to be handled
+#define NB_IMAGES           5                   // number of images to be handled
 #define FILE_PATHNAME       "misc/images.raw"   // file pathname on disk
 #define NB_CLUSTERS         (X_SIZE * Y_SIZE)   // number of clusters
@@ -54,5 +63,5 @@
 giet_barrier_t barrier;
 
-volatile unsigned int init_ok = 1;
+volatile unsigned int init_ok = 0;
 
 //////////////////////////////////////////
@@ -86,4 +95,8 @@
     {
         // Parameters checking
+        if ( (NN != FBUF_X_SIZE) || (NN != FBUF_Y_SIZE) )
+        {
+            giet_exit("[TRANSPOSE ERROR] Frame buffer size does not fit image size");
+        }
         if ((NB_PROCS_MAX != 1) && (NB_PROCS_MAX != 2) && (NB_PROCS_MAX != 4))
         { 
@@ -149,10 +162,11 @@
             giet_shr_printf("\n[TRANSPOSE] Proc [0,0,0] open file misc/images.raw\n");
         }
-        init_ok = 0;
+        init_ok = 1;
     }
     else   // others processors wait initialisation completion
     {
-        while ( init_ok == 1 );
-        giet_shr_printf("\n[TRANSPOSE] Processor[%d,%d,%d] starts at cycle %d\n", x, y, lpid);
+        while ( init_ok == 0 );
+        giet_shr_printf("\n[TRANSPOSE] Processor[%d,%d,%d] starts at cycle %d\n", 
+                        x, y, lpid, giet_proctime() );
     }
     
@@ -247,7 +261,7 @@
             unsigned int  npt   = npixels / ntasks;   // number of pixels per task
 
-            giet_fb_sync_write( npt * task_id, 
-                                &buf_out[cluster_id][lpid*npt], 
-                                npt );
+            giet_fbf_sync_write( npt * task_id, 
+                                 &buf_out[cluster_id][lpid*npt], 
+                                 npt );
 
             if ( lpid == 0 )
