Index: /soft/giet_vm/applications/convol/main.c
===================================================================
--- /soft/giet_vm/applications/convol/main.c	(revision 443)
+++ /soft/giet_vm/applications/convol/main.c	(revision 444)
@@ -3,6 +3,21 @@
 // Date   : june 2014
 // author : Alain Greiner
+////////////////////////////////////////////////////////////////////////////////////////////
+// This multi-threaded application application implements a 2D convolution product.  
+// The convolution kernel is [201]*[35] pixels, but it can be factored in two
+// independant line and column convolution products.
+// 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 (1024 * 1024) pixels image is read from a file (2 bytes per pixel).
 //
-// The "convol" application implements a 2D convolution product.  
+// - The number of clusters containing processors must be a power of 2.
+// - The number of processors per cluster must be a power of 2.
 ////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -106,5 +121,4 @@
     unsigned int task_id     = (cluster_id * nprocs) + lpid;  // continuous task index
     unsigned int ntasks      = nclusters * nprocs;            // number of tasks
-    unsigned int npixels     = NB_PIXELS;                     // pixels per frame
     unsigned int frame_size  = FRAME_SIZE;                    // total size (bytes)
     unsigned int nblocks     = frame_size / 512;              // number of blocks per frame
@@ -126,4 +140,8 @@
      // parameters checking 
    
+    if ( (NP != FBUF_X_SIZE) || (NL != FBUF_Y_SIZE) )
+    {
+        giet_exit("[TRANSPOSE ERROR] Frame buffer size does not fit image size");
+    }
     if ((nprocs != 1) && (nprocs != 2) && (nprocs != 4))
         giet_exit( "[CONVOL ERROR] NB_PROCS_MAX must be 1, 2 or 4\n");
@@ -148,13 +166,30 @@
     if ( (x==0) && (y==0) && (lpid==0) )
     {
+        // parameters checking 
+        if ( (NP != FBUF_X_SIZE) || (NL != FBUF_Y_SIZE) )
+            giet_exit("[TRANSPOSE ERROR] Frame buffer size does not fit image size");
+        
+        if ((nprocs != 1) && (nprocs != 2) && (nprocs != 4))
+            giet_exit( "[CONVOL ERROR] NB_PROCS_MAX must be 1, 2 or 4\n");
+
+        if ((X_SIZE!=1) && (X_SIZE!=2) && (X_SIZE!=4) && (X_SIZE!=8) && (X_SIZE!=16))
+            giet_exit( "[CONVOL ERROR] X_SIZE must be 1, 2, 4, 8, 16\n");
+        
+        if ((Y_SIZE!=1) && (Y_SIZE!=2) && (Y_SIZE!=4) && (Y_SIZE!=8) && (Y_SIZE!=16))
+            giet_exit( "[CONVOL ERROR] Y_SIZE must be 1, 2, 4, 8, 16\n");
+
+        if ( NL % nclusters != 0 )
+            giet_exit( "[CONVOL ERROR] NB_CLUSTERS must be a divider of NL");
+
+        if ( NP % nclusters != 0 )
+            giet_exit( "[CONVOL ERROR] NB_CLUSTERS must be a divider of NP");
+
+    
         giet_shr_printf("\n[CONVOL] task[0,0,0] starts barrier init at cycle %d\n" 
                         "- NB_CLUSTERS     = %d\n"
-                        "- NB_LOCAL_PROCS  = %d\n" 
+                        "- NB_PROCS_MAX    = %d\n" 
                         "- NB_TASKS        = %d\n" 
-                        "- NB_PIXELS       = %x\n"           
-                        "- FRAME_SIZE      = %x\n"              
                         "- NB_BLOCKS       = %x\n",
-                        giet_proctime(), nclusters, nprocs, ntasks, 
-                        npixels, frame_size, nblocks );
+                        giet_proctime(), nclusters, nprocs, ntasks, nblocks );
 #if USE_SBT_BARRIER
         sbt_barrier_init( &barrier, ntasks );
@@ -294,7 +329,7 @@
             }
 
-            giet_fb_sync_write( NP*(l + (task_id * lines_per_task) ), 
-                                &TZ(cluster_id, line, 0), 
-                                NP);
+            giet_fbf_sync_write( NP*(l + (task_id * lines_per_task) ), 
+                                 &TZ(cluster_id, line, 0), 
+                                 NP);
         }
 
@@ -572,7 +607,7 @@
             }
 
-            giet_fb_sync_write( NP*(l + (task_id * lines_per_task) ), 
-                                &TZ(cluster_id, line, 0), 
-                                NP);
+            giet_fbf_sync_write( NP*(l + (task_id * lines_per_task) ), 
+                                 &TZ(cluster_id, line, 0), 
+                                 NP);
         }
 
Index: /soft/giet_vm/applications/display/display.ld
===================================================================
--- /soft/giet_vm/applications/display/display.ld	(revision 443)
+++ /soft/giet_vm/applications/display/display.ld	(revision 444)
@@ -3,6 +3,6 @@
 *****************************************************************************/
 
-seg_code_base      = 0x00400000;
-seg_data_base      = 0x00500000;	
+seg_code_base      = 0x10000000;
+seg_data_base      = 0x20000000;	
 
 /***************************************************************************
Index: /soft/giet_vm/applications/display/display.py
===================================================================
--- /soft/giet_vm/applications/display/display.py	(revision 444)
+++ /soft/giet_vm/applications/display/display.py	(revision 444)
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+
+from mapping import *
+
+######################################################################################
+#   file   : display.py  
+#   date   : may 2014
+#   author : Alain Greiner
+#######################################################################################
+#  This file describes the mapping of the singl-threaded "display" application 
+#  on processor[0][0][0] of a multi-clusters, multi-processors architecture.
+####################################################################################
+
+######################
+def display( mapping ):
+
+    nprocs    = mapping.nprocs
+    x_width   = mapping.x_width
+    y_width   = mapping.y_width
+
+    # define vsegs base & size
+    code_base  = 0x10000000
+    code_size  = 0x00010000     # 64 Kbytes 
+    
+    data_base  = 0x20000000
+    data_size  = 0x00010000     # 64 Kbytes 
+
+    stack_base = 0x40000000 
+    stack_size = 0x00200000     # 2 Mbytes 
+
+    heap_base  = 0x60000000 
+    heap_size  = 0x00001000     # 4 Kbytes 
+
+    # create vspace
+    vspace = mapping.addVspace( name = 'display', startname = 'disp_data' )
+    
+    # data vseg
+    mapping.addVseg( vspace, 'disp_data', data_base , data_size, 
+                     'C_WU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 
+                     binpath = 'build/display/display.elf',
+                     local = False )
+
+    # code vseg
+    mapping.addVseg( vspace, 'disp_code', code_base , code_size,
+                     'CXWU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 
+                     binpath = 'build/display/display.elf',
+                     local = False )
+
+    # stack vseg             
+    mapping.addVseg( vspace, 'disp_stack', stack_base, stack_size,
+                     'C_WU', vtype = 'BUFFER', x = 0 , y = 0 , pseg = 'RAM',
+                     local = False, big = True )
+
+    # heap vseg (unused)            
+    mapping.addVseg( vspace, 'disp_heap', heap_base, heap_size,
+                     'C_WU', vtype = 'BUFFER', x = 0 , y = 0 , pseg = 'RAM',
+                     local = False )
+
+    # task 
+    mapping.addTask( vspace, 'disp', 0, 0, 0, 0, 'disp_stack', 'disp_heap', 0 )
+
+    # extend mapping name
+    mapping.name += '_display'
+
+    return vspace  # useful for test
+            
+################################ test ######################################################
+
+if __name__ == '__main__':
+
+    vspace = display( Mapping( 'test', 2, 2, 4 ) )
+    print vspace.xml()
+
+
+# Local Variables:
+# tab-width: 4;
+# c-basic-offset: 4;
+# c-file-offsets:((innamespace . 0)(inline-open . 0));
+# indent-tabs-mode: nil;
+# End:
+#
+# vim: filetype=python:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
Index: /soft/giet_vm/applications/display/main.c
===================================================================
--- /soft/giet_vm/applications/display/main.c	(revision 443)
+++ /soft/giet_vm/applications/display/main.c	(revision 444)
@@ -1,50 +1,100 @@
-#include "stdio.h"
-#include "hard_config.h"
+ ///////////////////////////////////////////////////////////////////////////////
+//  file   : main.c  (for display application)
+//  date   : may 2014
+//  author : Alain Greiner
+///////////////////////////////////////////////////////////////////////////////////////
+//  This file describes the single thread "display" application.
+//  It uses the external chained buffer DMA to display a stream
+//  of images on the frame buffer.  
+///////////////////////////////////////////////////////////////////////////////////////
 
-#define NBLOCKS 32   // (128 * 128) / 512
+#include <stdio.h>
+#include <hard_config.h>
 
-unsigned char buf[128*128] __attribute__((aligned(512)));
+#define FILENAME    "misc/images.raw"
+#define NPIXELS     128
+#define NLINES      128
+#define NIMAGES     10                    
+#define NBLOCKS     (NPIXELS*NLINES/512)   // number of blocks per image
 
+
+unsigned char buf0[NPIXELS*NLINES] __attribute__((aligned(512)));
+unsigned char buf1[NPIXELS*NLINES] __attribute__((aligned(512)));
+
+////////////////////////////////////////////
 __attribute__((constructor)) void main()
-{  
+////////////////////////////////////////////
+{
+    // get processor identifiers
+    unsigned int    x;
+    unsigned int    y; 
+    unsigned int    lpid;
+    giet_proc_xyp( &x, &y, &lpid );
+
     int             fd;
-    int             blocks;
-    unsigned int    ko;
-    unsigned int    blocks_to_skip = 8*NBLOCKS;
+    unsigned int    image = 0;
 
-    unsigned int    procid     = giet_procid();
-    unsigned int    cluster_xy = procid/NB_PROCS_MAX;
-    unsigned int    lpid       = procid%NB_PROCS_MAX;
-    unsigned int    x          = cluster_xy >> Y_WIDTH;
-    unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
-
-    giet_tty_printf( "*** Starting task display on processor[%d,%d,%d] at cycle %d\n\n", 
-                      x, y, lpid, giet_proctime() );
-
-    ///////////////////////////////////////////
-    fd = giet_fat_open( "misc/images.raw", 0 );
-    if ( fd < 0 ) giet_exit("echec giet_fat_open for misc/images.raw");
-
-    giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 
-                    giet_proctime() );
-
-    /////////////////////////////////////////
-    while ( blocks_to_skip < (10 * NBLOCKS) )
+    // parameters checking
+    if ( (NPIXELS != FBUF_X_SIZE) || (NLINES != FBUF_Y_SIZE) )
     {
-        // lecture image sur le disque
-        giet_fat_read( fd, buf, NBLOCKS, blocks_to_skip );
-        
-        giet_tty_printf("\ngiet_fat_read for image %d completed at cycle %d \n", 
-                        (blocks_to_skip>>5), giet_proctime());
-
-        // transfert vers le frame buffer  
-        giet_fb_sync_write( 0, buf, 128 * 128 );
-
-        giet_tty_printf("\ndisplay completed for image %d at cycle %d \n", 
-                        (blocks_to_skip>>5), giet_proctime());
-
-        blocks_to_skip = blocks_to_skip + NBLOCKS;
+        giet_exit("[DISPLAY ERROR] Frame buffer size does not fit image size");
     }
 
-    giet_exit("completed");
+    giet_shr_printf("\n[DISPLAY] Processor[%d,%d,%d] starts at cycle %d\n",
+                    x, y, lpid, giet_proctime() );
+
+    // open file
+    fd = giet_fat_open( FILENAME , 0 );
+    if ( fd < 0 ) 
+    {
+        giet_exit("echec giet_fat_open for misc/images.raw");
+    }
+    else
+    {
+        giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] open file %s at cycle %d\n", 
+                    x, y, lpid, FILENAME, giet_proctime() );
+    }
+
+    // get a Chained Buffer DMA channel
+    giet_fbf_cma_alloc();
+
+    // start Chained Buffer DMA channel
+    giet_fbf_cma_start( buf0, buf1, NPIXELS*NLINES );
+    
+    giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] starts CMA at cycle %d\n", 
+                    x, y, lpid, giet_proctime() );
+
+    // Main loop (on images)
+    while ( image < NIMAGES )
+    {
+        giet_fat_read( fd, buf0, NBLOCKS, image*NBLOCKS );
+
+        giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d to buf0 at cycle %d\n", 
+                        x, y, lpid, image, giet_proctime() );
+
+        giet_fbf_cma_display( 0 );
+
+        giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d from buf0 at cycle %d\n", 
+                        x, y, lpid, image, giet_proctime() );
+
+        image++;
+
+        giet_fat_read( fd, buf1, NBLOCKS, image*NBLOCKS );
+
+        giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d to buf1 at cycle %d\n", 
+                        x, y, lpid, image, giet_proctime() );
+
+        giet_fbf_cma_display( 1 );
+
+        giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d from buf1 at cycle %d\n", 
+                        x, y, lpid, image, giet_proctime() );
+
+
+        image++;
+    }
+
+    // stop Chained buffer DMA channel
+    giet_fbf_cma_stop();
+
+    giet_exit("display completed");
 }
Index: ft/giet_vm/applications/display/main_cma.c
===================================================================
--- /soft/giet_vm/applications/display/main_cma.c	(revision 443)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#include "stdio.h"
-#include "hard_config.h"
-
-#define NBLOCKS 32
-
-unsigned char buf0[128*128] __attribute__((aligned(512)));
-unsigned char buf1[128*128] __attribute__((aligned(512)));
-
-__attribute__((constructor)) void main(void)
-{
-    // get processor identifiers
-    unsigned int    x;
-    unsigned int    y; 
-    unsigned int    lpid;
-    giet_proc_xyp( &x, &y, &lpid );
-
-    int             fd;
-    unsigned int    blocks_to_skip = 0;
-
-    giet_tty_printf( "*** Starting task display on processor[%d,%d,%d] at cycle %d\n\n", 
-                      x, y, lpid, giet_proctime() );
-
-    fd = giet_fat_open( "misc/images.raw", 0 );
-    if ( fd < 0 ) giet_exit("echec giet_fat_open for misc/images.raw");
-
-    giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 
-                    giet_proctime() );
-
-    giet_fb_cma_init( buf0, buf1, 128*128 );
-
-    giet_tty_printf("\ngiet_cma_init completed at cycle %d\n", 
-                        giet_proctime() );
- 
-    while ( blocks_to_skip < 10 * NBLOCKS )
-    {
-        giet_fat_read( fd, buf0, NBLOCKS, blocks_to_skip );
-
-        giet_tty_printf("\ngiet_fat_read to buf0 completed at cycle = %d\n",
-                            giet_proctime() );
-
-        giet_fb_cma_write( 0 );
-
-        giet_tty_printf("giet_cma_write for buf0 completed at cycle = %d\n",
-                            giet_proctime() );
-
-        blocks_to_skip = blocks_to_skip + NBLOCKS;
-
-        giet_fat_read( fd, buf1, NBLOCKS, blocks_to_skip );
-
-        giet_tty_printf("giet_fat_read to buf1 completed at cycle = %d\n",
-                            giet_proctime() );
-
-        giet_fb_cma_write( 1 );
-        
-        giet_tty_printf("giet_cma_write for buf1 completed at cycle = %d\n",
-                            giet_proctime() );
-
-        blocks_to_skip = blocks_to_skip + NBLOCKS;
-    }
-
-    giet_fb_cma_stop();
-
-    giet_exit("display completed");
-}
Index: /soft/giet_vm/applications/gameoflife/main.c
===================================================================
--- /soft/giet_vm/applications/gameoflife/main.c	(revision 443)
+++ /soft/giet_vm/applications/gameoflife/main.c	(revision 444)
@@ -106,5 +106,5 @@
    }
 
-   giet_fb_sync_write( base_line * WIDTH , 
+   giet_fbf_sync_write( base_line * WIDTH , 
                        &world[NEW][base_line][0], 
                        nb_line * WIDTH);
Index: /soft/giet_vm/applications/transpose/main.c
===================================================================
--- /soft/giet_vm/applications/transpose/main.c	(revision 443)
+++ /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 )
Index: /soft/giet_vm/applications/transpose/transpose.py
===================================================================
--- /soft/giet_vm/applications/transpose/transpose.py	(revision 443)
+++ /soft/giet_vm/applications/transpose/transpose.py	(revision 444)
@@ -25,5 +25,5 @@
     x_size    = mapping.x_size
     y_size    = mapping.y_size
-    nprocs = mapping.nprocs
+    nprocs    = mapping.nprocs
     x_width   = mapping.x_width
     y_width   = mapping.y_width
