Index: soft/giet_vm/giet_libs/mwmr_channel.h
===================================================================
--- soft/giet_vm/giet_libs/mwmr_channel.h	(revision 520)
+++ soft/giet_vm/giet_libs/mwmr_channel.h	(revision 521)
@@ -32,17 +32,16 @@
 ///////////////////////////////////////////////////////////////////////////////////
 //  MWMR channel structure
-// The data buffer size is defined to obtain sizeof(mwmr_channel_t) = 4096 bytes.
-// The actual buffer size cannot be larger than 4072 bytes (1018 words).
 ///////////////////////////////////////////////////////////////////////////////////
 
 typedef struct mwmr_channel_s 
 {
-    user_lock_t    lock;       // exclusive access lock
-    unsigned int   ptr;        // index of the first valid data word
-    unsigned int   ptw;        // index of the first empty slot 
-    unsigned int   sts;        // number of words available
-    unsigned int   depth;      // max number of words in the channel
-    unsigned int   width;      // number of words in an item      
-    unsigned int*  data;       // circular buffer base address
+    user_lock_t    lock;         // exclusive access lock
+    unsigned int   sts;          // number of words available
+    unsigned int   ptr;          // index of the first valid data word
+    unsigned int   ptw;          // index of the first empty slot 
+    unsigned int   depth;        // max number of words in the channel
+    unsigned int   width;        // number of words in an item      
+    unsigned int*  data;         // circular buffer base address
+    unsigned int   padding[10];  // for 64 bytes alignment
 } mwmr_channel_t;
 
Index: soft/giet_vm/giet_libs/stdio.c
===================================================================
--- soft/giet_vm/giet_libs/stdio.c	(revision 520)
+++ soft/giet_vm/giet_libs/stdio.c	(revision 521)
@@ -1,8 +1,8 @@
-//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
 // File     : stdio.c         
 // Date     : 01/04/2010
 // Author   : alain greiner & Joel Porquet
 // Copyright (c) UPMC-LIP6
-///////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
 
 #include <stdarg.h>
@@ -10,7 +10,7 @@
 #include <giet_config.h>
 
-////////////////////////////////////////////////////////////////////////////////////
-/////////////////////  MIPS32     related system calls /////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+/////////////////////  MIPS32     related system calls ///////////////////////
+//////////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////
@@ -48,7 +48,7 @@
 }
 
-//////////////////////////////////////////////////////////////////////////////////
-///////////////////// Task context  system calls /////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+///////////////////// Task context  system calls /////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////
@@ -74,12 +74,110 @@
 
 
-////////////////////////////////////////////////////////////////////////////////////
-/////////////////////  TTY device related system calls /////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+///////////////////// Coprocessors  system calls  ////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////
+void giet_coproc_alloc( unsigned int   coproc_type,
+                        unsigned int*  coproc_info,
+                        unsigned int*  cluster_xy )
+{
+    if ( sys_call( SYSCALL_COPROC_ALLOC,
+                   coproc_type,
+                   (unsigned int)coproc_info,
+                   (unsigned int)cluster_xy,
+                   0 ) )  
+        giet_exit("error in giet_coproc_alloc()");
+}
+
+///////////////////////////////////////////////////
+void giet_coproc_release( unsigned int cluster_xy )
+{
+    if ( sys_call( SYSCALL_COPROC_RELEASE,
+                   cluster_xy,
+                   0, 0, 0 ) )  
+        giet_exit("error in giet_coproc_release()");
+}
+
+//////////////////////////////////////////////////////////////////
+void giet_coproc_channel_init( unsigned int            cluster_xy,
+                               unsigned int            channel,
+                               giet_coproc_channel_t*  desc )
+{
+    if ( sys_call( SYSCALL_COPROC_CHANNEL_INIT,
+                   cluster_xy,
+                   channel,
+                   (unsigned int)desc,
+                   0 ) ) 
+        giet_exit("error in giet_coproc_channel_init");
+}
+
+////////////////////////////////////////////////////////////
+void giet_coproc_channel_start( unsigned int     cluster_xy,
+                                unsigned int     channel )
+{
+    if ( sys_call( SYSCALL_COPROC_CHANNEL_START,
+                   cluster_xy,
+                   channel,
+                   0, 0 ) ) 
+        giet_exit("error in giet_coproc_channel_start");
+}
+
+///////////////////////////////////////////////////////////
+void giet_coproc_channel_stop( unsigned int     cluster_xy,
+                               unsigned int     channel )
+{
+    if ( sys_call( SYSCALL_COPROC_CHANNEL_STOP,
+                   cluster_xy,
+                   channel,
+                   0, 0 ) ) 
+        giet_exit("error in giet_coproc_channel_stop");
+}
+
+/////////////////////////////////////////////////////////
+void giet_coproc_completed( unsigned int     cluster_xy )
+{
+    if ( sys_call( SYSCALL_COPROC_COMPLETED,
+                   cluster_xy,
+                   0, 0, 0 ) ) 
+        giet_exit("error in giet_coproc_completed");
+}
+
+///////////////////////////////////////////////////////////
+void giet_coproc_register_set( unsigned int     cluster_xy,
+                               unsigned int     index,
+                               unsigned int     value )
+{
+    if ( sys_call( SYSCALL_COPROC_REGISTER_SET,
+                   cluster_xy,
+                   index,
+                   value,
+                   0 ) ) 
+        giet_exit("error in giet_coproc_register_set");
+}
+
+///////////////////////////////////////////////////////////
+void giet_coproc_register_get( unsigned int     cluster_xy,
+                               unsigned int     index,
+                               unsigned int*    value )
+{
+    if ( sys_call( SYSCALL_COPROC_REGISTER_SET,
+                   cluster_xy,
+                   index,
+                   (unsigned int)value,
+                   0 ) ) 
+        giet_exit("error in giet_coproc_register_get");
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+/////////////////////  TTY device related system calls ///////////////////////
+//////////////////////////////////////////////////////////////////////////////
 
 /////////////////////
 void giet_tty_alloc()
 {
-    sys_call( SYSCALL_TTY_ALLOC, 0, 0 ,0 ,0 );
+    if ( sys_call( SYSCALL_TTY_ALLOC,
+                   0, 0, 0, 0 ) )  giet_exit("error in giet_tty_alloc()");
 }
 
Index: soft/giet_vm/giet_libs/stdio.h
===================================================================
--- soft/giet_vm/giet_libs/stdio.h	(revision 520)
+++ soft/giet_vm/giet_libs/stdio.h	(revision 521)
@@ -1,12 +1,12 @@
-//////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
 // File     : stdio.h         
 // Date     : 01/04/2010
 // Author   : alain greiner & Joel Porquet
 // Copyright (c) UPMC-LIP6
-///////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
 // The stdio.c and stdio.h files are part of the GIET_VM nano-kernel.
 // This library contains all user-level functions that contain a system call
 // to access protected or shared ressources.
-///////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
 
 #ifndef _STDIO_H
@@ -16,84 +16,84 @@
 // the _syscall_vector defined in file sys_handler.c
 
-#define SYSCALL_PROC_XYP          0x00
-#define SYSCALL_PROC_TIME         0x01
-#define SYSCALL_TTY_WRITE         0x02
-#define SYSCALL_TTY_READ          0x03
-#define SYSCALL_TTY_ALLOC         0x04
-#define SYSCALL_TTY_GET_LOCK      0x05
-#define SYSCALL_TTY_RELEASE_LOCK  0x06
-#define SYSCALL_HEAP_INFO         0x07
-#define SYSCALL_LOCAL_TASK_ID     0x08
-#define SYSCALL_GLOBAL_TASK_ID    0x09
-#define SYSCALL_FBF_CMA_ALLOC     0x0A
-#define SYSCALL_FBF_CMA_START     0x0B
-#define SYSCALL_FBF_CMA_DISPLAY   0x0C
-#define SYSCALL_FBF_CMA_STOP      0x0D
-#define SYSCALL_EXIT              0x0E
-#define SYSCALL_PROCS_NUMBER      0x0F
-
-#define SYSCALL_FBF_SYNC_WRITE    0x10
-#define SYSCALL_FBF_SYNC_READ     0x11
-#define SYSCALL_THREAD_ID         0x12
-//                                0x13
-#define SYSCALL_TIM_ALLOC         0x14
-#define SYSCALL_TIM_START         0x15
-#define SYSCALL_TIM_STOP          0x16
-//                                0x17
-//                                0x18
-#define SYSCALL_CTX_SWITCH        0x19
-#define SYSCALL_VOBJ_GET_VBASE    0x1A
-#define SYSCALL_VOBJ_GET_LENGTH   0x1B
-#define SYSCALL_GET_XY            0x1C
-//                                0x1D
-//                                0x1E
-//                                0x1F
-
-#define SYSCALL_FAT_OPEN          0x20
-#define SYSCALL_FAT_READ          0x21
-#define SYSCALL_FAT_WRITE         0x22
-#define SYSCALL_FAT_LSEEK         0x23
-#define SYSCALL_FAT_FSTAT         0x24
-#define SYSCALL_FAT_CLOSE         0x25
-//                                0x26
-//                                0x27
-//                                0x28
-//                                0x29
-//                                0x2A
-//                                0x2B
-//                                0x2C
-//                                0x2D
-//                                0x2E
-//                                0x2F
-
-#define SYSCALL_NIC_ALLOC         0x30
-#define SYSCALL_NIC_START         0x31
-#define SYSCALL_NIC_MOVE          0x32
-#define SYSCALL_NIC_STOP          0x33
-#define SYSCALL_NIC_STATS         0x34
-#define SYSCALL_NIC_CLEAR         0x35
-//                                0x36
-//                                0x37
-//                                0x38
-//                                0x39
-//                                0x3A
-//                                0x3B
-//                                0x3C
-//                                0x3D
-//                                0x3E
-//                                0x3F
-
-//////////////////////////////////////////////////////////////////////////////////
+#define SYSCALL_PROC_XYP             0x00
+#define SYSCALL_PROC_TIME            0x01
+#define SYSCALL_TTY_WRITE            0x02
+#define SYSCALL_TTY_READ             0x03
+#define SYSCALL_TTY_ALLOC            0x04
+#define SYSCALL_TTY_GET_LOCK         0x05
+#define SYSCALL_TTY_RELEASE_LOCK     0x06
+#define SYSCALL_HEAP_INFO            0x07
+#define SYSCALL_LOCAL_TASK_ID        0x08
+#define SYSCALL_GLOBAL_TASK_ID       0x09
+#define SYSCALL_FBF_CMA_ALLOC        0x0A
+#define SYSCALL_FBF_CMA_START        0x0B
+#define SYSCALL_FBF_CMA_DISPLAY      0x0C
+#define SYSCALL_FBF_CMA_STOP         0x0D
+#define SYSCALL_EXIT                 0x0E
+#define SYSCALL_PROCS_NUMBER         0x0F
+
+#define SYSCALL_FBF_SYNC_WRITE       0x10
+#define SYSCALL_FBF_SYNC_READ        0x11
+#define SYSCALL_THREAD_ID            0x12
+//                                   0x13
+#define SYSCALL_TIM_ALLOC            0x14
+#define SYSCALL_TIM_START            0x15
+#define SYSCALL_TIM_STOP             0x16
+//                                   0x17
+//                                   0x18
+#define SYSCALL_CTX_SWITCH           0x19
+#define SYSCALL_VOBJ_GET_VBASE       0x1A
+#define SYSCALL_VOBJ_GET_LENGTH      0x1B
+#define SYSCALL_GET_XY               0x1C
+//                                   0x1D
+//                                   0x1E
+//                                   0x1F
+
+#define SYSCALL_FAT_OPEN             0x20
+#define SYSCALL_FAT_READ             0x21
+#define SYSCALL_FAT_WRITE            0x22
+#define SYSCALL_FAT_LSEEK            0x23
+#define SYSCALL_FAT_FSTAT            0x24
+#define SYSCALL_FAT_CLOSE            0x25
+//                                   0x26
+//                                   0x27
+//                                   0x28
+//                                   0x29
+//                                   0x2A
+//                                   0x2B
+//                                   0x2C
+//                                   0x2D
+//                                   0x2E
+//                                   0x2F
+
+#define SYSCALL_NIC_ALLOC            0x30
+#define SYSCALL_NIC_START            0x31
+#define SYSCALL_NIC_MOVE             0x32
+#define SYSCALL_NIC_STOP             0x33
+#define SYSCALL_NIC_STATS            0x34
+#define SYSCALL_NIC_CLEAR            0x35
+//                                   0x36
+//                                   0x37
+#define SYSCALL_COPROC_REGISTER_GET  0x38
+#define SYSCALL_COPROC_REGISTER_SET  0x39
+#define SYSCALL_COPROC_RELEASE       0x3A
+#define SYSCALL_COPROC_COMPLETED     0x3B
+#define SYSCALL_COPROC_ALLOC         0x3C
+#define SYSCALL_COPROC_CHANNEL_INIT  0x3D
+#define SYSCALL_COPROC_CHANNEL_START 0x3E
+#define SYSCALL_COPROC_CHANNEL_STOP  0x3F
+
+////////////////////////////////////////////////////////////////////////////
 // NULL pointer definition
-//////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
 
 #define NULL (void *)0
 
-//////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
 // This generic C function is used to implement all system calls.
 // It writes the system call arguments in the proper registers,
 // and tells GCC what has been modified by system call execution.
 // Returns -1 to signal an error.
-//////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
 static inline int sys_call( int call_no,
                             int arg_0, 
@@ -141,5 +141,4 @@
 //////////////////////////////////////////////////////////////////////////
 
-//////////////////////////////////////////////////////////////////////////
 extern void giet_proc_xyp( unsigned int* cluster_x,
                            unsigned int* cluster_y,
@@ -159,4 +158,45 @@
 
 extern unsigned int giet_thread_id(); 
+
+//////////////////////////////////////////////////////////////////////////
+//             Coprocessors related system calls 
+//////////////////////////////////////////////////////////////////////////
+
+// this structure is used by the giet_coproc_channel_init() 
+// system call to specify the communication channel parameters. 
+typedef struct giet_coproc_channel
+{
+    unsigned int  channel_mode;    // MWMR / DMA_IRQ / DMA_NO_IRQ
+    unsigned int  buffer_size;     // memory buffer size
+    unsigned int  buffer_vaddr;    // memory buffer virtual address
+    unsigned int  mwmr_vaddr;      // MWMR descriptor virtual address
+    unsigned int  lock_vaddr;      // lock for MWMR virtual address
+} giet_coproc_channel_t;
+
+extern void giet_coproc_alloc( unsigned int   coproc_type,
+                               unsigned int*  coproc_info,
+                               unsigned int*  cluster_xy );
+
+extern void giet_coproc_release( unsigned int cluster_xy );
+
+extern void giet_coproc_channel_init( unsigned int            cluster_xy,
+                                      unsigned int            channel,
+                                      giet_coproc_channel_t*  desc );
+
+extern void giet_coproc_channel_start( unsigned int    cluster_xy,
+                                       unsigned int    channel );
+
+extern void giet_coproc_channel_stop ( unsigned int    cluster_xy,
+                                       unsigned int    channel );
+
+extern void giet_coproc_completed( unsigned int cluster_xy );
+
+extern void giet_coproc_register_set( unsigned int     cluster_xy,
+                                      unsigned int     reg_index,
+                                      unsigned int     value );
+
+extern void giet_coproc_register_get( unsigned int     cluster_xy,
+                                      unsigned int     reg_index,
+                                      unsigned int*    buffer );
 
 //////////////////////////////////////////////////////////////////////////
