Index: soft/giet_vm/giet_kernel/sys_handler.h
===================================================================
--- soft/giet_vm/giet_kernel/sys_handler.h	(revision 714)
+++ soft/giet_vm/giet_kernel/sys_handler.h	(revision 725)
@@ -51,5 +51,5 @@
 #define SYSCALL_NO_CHANNEL_AVAILABLE             (-18)
 #define SYSCALL_CHANNEL_NON_ALLOCATED            (-19)
-#define SYSCALL_ILLEGAL_XY_ARGUMENTS             (-20)
+#define SYSCALL_ILLEGAL_ARGUMENT                 (-20)
 #define SYSCALL_OUT_OF_KERNEL_HEAP_MEMORY        (-21)
 #define SYSCALL_ADDRESS_NON_ALIGNED              (-22)
@@ -64,30 +64,18 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-// This structure is used by the CMA component to store the status of the
-// frame buffer (full or empty). The useful information is contained in the
-// "status" integer (1 for full and 0 for empty).
-// This structure must be aligned on a cache line (64 bytes) to simplify 
-// the software L2/L3 cache coherence when the IO bridge is used. 
-///////////////////////////////////////////////////////////////////////////////
-
-typedef struct buffer_status_s
-{
-    unsigned int status;
-    unsigned int padding[15];
-} buffer_status_t;
-
-///////////////////////////////////////////////////////////////////////////////
-// This structure is used by the CMA component to move a stream 
-// of images from two user buffers to the frame buffer in kernel space.
+// This structure is used by the CMA component to move a stream of images 
+// from a set of user buffers to the frame buffer in kernel space.
 // It contains two chbuf arrays:
-// - The SRC chbuf contains two buffers (buf0 & buf1), in user space.
-// - The DST cbuf contains one single buffer (fbf), that is the frame buffer.
+// - The SRC chbuf contains <nbufs> buffer descriptors, in user space,
+//   that can be distributed (one buffer per cluster) or not.
+// - The DST cbuf contains one single buffer, that is the frame buffer.
 // Each buffer is described with a 64 bits buffer descriptor:
-// - the 26 LSB bits contain bits[6:31] of the buffer physical address
-// - the 26 following bits contain bits[6:31] of the physical address where the
-//   buffer status is located
-// - the 12 MSB bits contain the common address extension of the buffer and its
-//   status
-// The length field define the buffer size (bytes)
+// - the 26 LSB bits contain bits[31:6] of the status physical address.
+// - the 26 following bits contain bits[31:6] of the buffer physical address.
+// - the 12 MSB bits contain the common address extension.
+// The actual number of user buffers cannot be larger than 256 (at most
+// one user buffer per cluster for a 16*16 mesh).
+// NB: The user buffers are mapped in user space, but the chbuf descriptor
+// contained in this structure is a protected kernel variable.
 // This structure must be 64 bytes aligned.
 ///////////////////////////////////////////////////////////////////////////////
@@ -95,9 +83,7 @@
 typedef struct fbf_chbuf_s
 {
-    unsigned long long  buf0_desc;     // first user buffer descriptor 
-    unsigned long long  buf1_desc;     // second user buffer descriptor
-    unsigned long long  fbf_desc;      // frame buffer descriptor 
-    unsigned int        length;        // buffer length (bytes)
-    unsigned int        padding[9];    // padding for 64 bytes alignment
+    unsigned long long  fbf_desc;                    // frame buffer descriptor 
+    unsigned long long  usr_desc[256];               // user chbuf descriptor 
+    unsigned int        nbufs;                       // number of user buffers
 } fbf_chbuf_t;   
 
@@ -110,18 +96,17 @@
 // The actual number of buffers used in the chbuf is defined by (xmax * ymax).
 // Each buffer is described with a 64 bits buffer descriptor:
-// - the 26 LSB bits contain bits[6:31] of the buffer physical address
-// - the 26 following bits contain bits[6:31] of the physical address where the
-//   buffer status is located
-// - the 12 MSB bits contain the common address extension of the buffer and its
-//   status
+// - the 26 LSB bits contain bits[31:6] of the status physical address.
+// - the 26 following bits contain bits[31:6] of the buffer physical address.
+// - the 12 MSB bits contain the common address extension.
+// The <xmax> and <ymax> fields define the actual mesh size.
 // This structure must be 64 bytes aligned.
 ///////////////////////////////////////////////////////////////////////////////
 
-typedef struct ker_chbuf_s
+typedef struct nic_chbuf_s
 {
-    unsigned long long   buf_desc[X_SIZE*Y_SIZE]; // kernel chbuf descriptor
+    unsigned long long   buf_desc[X_SIZE*Y_SIZE];     // kernel chbuf descriptor
     unsigned int         xmax;                        // nb clusters in a row
     unsigned int         ymax;                        // nb clusters in a column
-} ker_chbuf_t;
+} nic_chbuf_t;
 
 
@@ -236,23 +221,24 @@
 
 extern int _sys_fbf_sync_write( unsigned int offset,
-                         void*        buffer,
-                         unsigned int length );
+                                void*        buffer,
+                                unsigned int length );
 
 extern int _sys_fbf_sync_read(  unsigned int offset,
-                         void*        buffer,
-                         unsigned int length );
-
-extern int _sys_fbf_cma_alloc();
+                                void*        buffer,
+                                unsigned int length );
+
+extern int _sys_fbf_cma_alloc( unsigned int nbufs );
 
 extern int _sys_fbf_cma_release();
 
-extern int _sys_fbf_cma_init_buf(void*        buf0_vbase, 
-                                 void*        buf1_vbase, 
-                                 void*        sts0_vaddr,
-                                 void*        sts1_vaddr );
-
-extern int _sys_fbf_cma_start( unsigned int length );
-
-extern int _sys_fbf_cma_display( unsigned int buffer_index );
+extern int _sys_fbf_cma_init_buf( unsigned int index, 
+                                  void*        buf_vaddr, 
+                                  void*        sts_vaddr );
+
+extern int _sys_fbf_cma_start();
+
+extern int _sys_fbf_cma_display( unsigned int index );
+
+extern int _sys_fbf_cma_check( unsigned int index );
 
 extern int _sys_fbf_cma_stop();
@@ -265,27 +251,27 @@
 
 extern int _sys_proc_xyp( unsigned int* x,
-                   unsigned int* y,
-                   unsigned int* p );
+                          unsigned int* y,
+                          unsigned int* p );
 
 extern int _sys_procs_number( unsigned int* x_size,
-                       unsigned int* y_size, 
-                       unsigned int* nprocs );
+                              unsigned int* y_size, 
+                              unsigned int* nprocs );
 
 extern int _sys_vseg_get_vbase( char*         vspace_name,
-                         char*         vseg_name,
-                         unsigned int* vbase );
+                                char*         vseg_name,
+                                unsigned int* vbase );
 
 extern int _sys_vseg_get_length( char*         vspace_name, 
-                          char*         vseg_name,
-                          unsigned int* length );
+                                 char*         vseg_name,
+                                 unsigned int* length );
 
 extern int _sys_xy_from_ptr( void*          ptr,
-                      unsigned int*  x,
-                      unsigned int*  y );
+                             unsigned int*  x,
+                             unsigned int*  y );
 
 extern int _sys_heap_info( unsigned int* vaddr, 
-                    unsigned int* length,
-                    unsigned int  x,
-                    unsigned int  y ); 
+                           unsigned int* length,
+                           unsigned int  x,
+                           unsigned int  y ); 
 
 #endif
