Index: soft/giet_vm/applications/display/main.c
===================================================================
--- soft/giet_vm/applications/display/main.c	(revision 589)
+++ soft/giet_vm/applications/display/main.c	(revision 644)
@@ -1,4 +1,4 @@
 ///////////////////////////////////////////////////////////////////////////////////////
-//  file   : main.c  (for display application)
+//  file   : main.c     (display application)
 //  date   : may 2014
 //  author : Alain Greiner
@@ -12,13 +12,16 @@
 #include <hard_config.h>     // To check Frame Buffer size
 
-#define FILENAME    "misc/lena.raw"
-#define NPIXELS     256
-#define NLINES      256
-#define NIMAGES     1                  
+#define FILENAME    "misc/images_128.raw"
+#define NPIXELS     128
+#define NLINES      128
+#define NIMAGES     10                  
 
 #define INTERACTIVE 1
 
-unsigned char buf0[NPIXELS*NLINES] __attribute__((aligned(512)));
-unsigned char buf1[NPIXELS*NLINES] __attribute__((aligned(512)));
+unsigned char buf0[NPIXELS*NLINES] __attribute__((aligned(64)));
+unsigned char buf1[NPIXELS*NLINES] __attribute__((aligned(64)));
+
+unsigned int  sts0[16]  __attribute__((aligned(64)));
+unsigned int  sts1[16]  __attribute__((aligned(64)));
 
 ////////////////////////////////////////////
@@ -29,6 +32,6 @@
     unsigned int    x;
     unsigned int    y; 
-    unsigned int    lpid;
-    giet_proc_xyp( &x, &y, &lpid );
+    unsigned int    p;
+    giet_proc_xyp( &x, &y, &p );
 
     int             fd;
@@ -46,23 +49,31 @@
     giet_tty_alloc();
 
-    giet_tty_printf("\n[DISPLAY] Processor[%d,%d,%d] starts at cycle %d\n",
-                    x, y, lpid, giet_proctime() );
+    giet_tty_printf("\n[DISPLAY] P[%d,%d,%d] starts at cycle %d\n"
+                    "  - buf0_vaddr = %x\n" 
+                    "  - buf1_vaddr = %x\n" 
+                    "  - sts0_vaddr = %x\n" 
+                    "  - sts1_vaddr = %x\n",
+                    x, y, p, giet_proctime(),
+                    buf0, buf1, sts0, sts1 );
 
     // open file
     fd = giet_fat_open( FILENAME , 0 );
 
-    giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] open file %s at cycle %d\n", 
-                    x, y, lpid, FILENAME, giet_proctime() );
+    giet_tty_printf("\n[DISPLAY] P[%d,%d,%d] open file %s at cycle %d\n", 
+                    x, y, p, FILENAME, giet_proctime() );
 
     // get a Chained Buffer DMA channel
     giet_fbf_cma_alloc();
 
+    // initialize the source and destination chbufs
+    giet_fbf_cma_init_buf( buf0 , buf1 , sts0 , sts1 );
+
     // start Chained Buffer DMA channel
-    giet_fbf_cma_start( buf0, buf1, NPIXELS*NLINES );
+    giet_fbf_cma_start( NPIXELS*NLINES );
     
     giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] starts CMA at cycle %d\n", 
-                    x, y, lpid, giet_proctime() );
+                    x, y, p, giet_proctime() );
 
-    // Main loop (on images)
+    // Main loop on images
     while ( 1 )
     {
@@ -71,5 +82,5 @@
 
         giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d at cycle %d\n", 
-                        x, y, lpid, image, giet_proctime() );
+                        x, y, p, image, giet_proctime() );
 
         // display buf0
@@ -77,7 +88,13 @@
 
         giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d at cycle %d\n", 
-                        x, y, lpid, image, giet_proctime() );
+                        x, y, p, image, giet_proctime() );
 
-        image = (image + 1) % NIMAGES;
+        image++;
+
+        if ( image == NIMAGES )
+        {
+            image = 0;
+            giet_fat_lseek( fd , 0 , 0 );
+        }
 
         if ( INTERACTIVE ) giet_tty_getc( &byte );
@@ -87,5 +104,5 @@
 
         giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d at cycle %d\n", 
-                        x, y, lpid, image, giet_proctime() );
+                        x, y, p, image, giet_proctime() );
 
         // display buf1
@@ -93,7 +110,13 @@
 
         giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d at cycle %d\n", 
-                        x, y, lpid, image, giet_proctime() );
+                        x, y, p, image, giet_proctime() );
 
-        image = (image + 1) % NIMAGES;
+        image++;
+
+        if ( image == NIMAGES )
+        {
+            image = 0;
+            giet_fat_lseek( fd , 0 , 0 );
+        }
 
         if ( INTERACTIVE ) giet_tty_getc( &byte );
