Index: soft/giet_vm/giet_libs/stdio.h
===================================================================
--- soft/giet_vm/giet_libs/stdio.h	(revision 501)
+++ 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 );
 
 //////////////////////////////////////////////////////////////////////////
