Index: soft/giet_vm/giet_drivers/mwr_driver.h
===================================================================
--- soft/giet_vm/giet_drivers/mwr_driver.h	(revision 263)
+++ soft/giet_vm/giet_drivers/mwr_driver.h	(revision 518)
@@ -4,48 +4,79 @@
 // Author   : alain greiner
 // Copyright (c) UPMC-LIP6
-///////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// The mwr_driver.c and mwr_driver.h files are part ot the GIET-VM OS.
+// This driver supports the SoCLib vci_mwmr_dma component.
+// 
+// It can exist several MWMR_DMA controlers in the architecture 
+// (one per cluster), and each controller can contain several ports. 
+// Each port defines a TO_COPROC or FROM_COPROC communication channel.
+// Each channel can be configured to run in one of three predefined modes
+// (MWMR / DMA_IRQ / DMA_NO_IRQ).
+// The MWMR_DMA controler is a private ressource, allocated to a given task.
+//
+// The virtual base address of the segment associated to the coprocessor
+// addressable registers is:
+//   SEG_MWR_BASE + cluster_xy*PERI_CLUSTER_INCREMENT
+//
+// The virtual base address of the segments associated to a channel is:
+//   SEG_MWR_BASE +
+//   cluster_xy * PERI_CLUSTER_INCREMENT +
+//   4 * CHANNEL_SPAN * (channel+1)
+//
+// The SEG_MWR_BASE virtual address mus be defined in the hard_config.h file.
+///////////////////////////////////////////////////////////////////////////////
 
 #ifndef _GIET_MWR_DRIVERS_H_
 #define _GIET_MWR_DRIVERS_H_
 
-///////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
 // MWMR controler registers offsets 
-///////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
 
-enum SoclibMwmrRegisters 
+enum MwmrDmaRegisters 
 {
-    MWMR_IOREG_MAX = 16,
-    MWMR_RESET = MWMR_IOREG_MAX,
-    MWMR_CONFIG_FIFO_WAY,
-    MWMR_CONFIG_FIFO_NO,
-    MWMR_CONFIG_STATUS,
-    MWMR_CONFIG_DEPTH,
-    MWMR_CONFIG_BUFFER_ADDR,
-    MWMR_CONFIG_RUNNING,
-    MWMR_CONFIG_WIDTH,
-    MWMR_CONFIG_DATA,
-    MWMR_CONFIG_EXT,
-    /***/
-    MWMR_SPAN,
+    CHANNEL_BUFFER_LSB   = 0,     // Data buffer paddr 32 LSB bits
+    CHANNEL_BUFFER_MSB   = 1,     // Data buffer paddr extension
+    CHANNEL_MWMR_LSB     = 2,     // MWMR descriptor paddr 32 LSB bits
+    CHANNEL_MWMR_MSB     = 3,     // MWMR descriptor paddr extension
+    CHANNEL_LOCK_LSB     = 4,     // MWMR lock paddr 32 LSB bits
+    CHANNEL_LOCK_MSB     = 5,     // MWMR lock paddr extension
+    CHANNEL_WAY          = 6,     // TO_COPROC / FROMCOPROC         (Read-only)
+    CHANNEL_MODE         = 7,     // MWMR / DMA / DMA_IRQ 
+    CHANNEL_SIZE         = 8,     // Data Buffer size (bytes)
+    CHANNEL_RUNNING      = 9,     // channel running   
+    CHANNEL_STATUS       = 10,    // channel FSM state              (Read-Only)
+    CHANNEL_INFO         = 11,    // STS | CFG | FROM | TO          (Read-Only)
+    //
+    CHANNEL_SPAN         = 16,
 };
 
-enum SoclibMwmrWay 
-{
-    MWMR_TO_COPROC,
-    MWMR_FROM_COPROC,
-};
+///////////////////////////////////////////////////////////////////////////////
+//           Low-level access functions
+///////////////////////////////////////////////////////////////////////////////
 
-///////////////////////////////////////////////////////////////////////////////////
-// MWMR controller access functions
-///////////////////////////////////////////////////////////////////////////////////
+extern void _mwr_set_channel_register( unsigned int cluster_xy,
+                                       unsigned int channel,
+                                       unsigned int index,
+                                       unsigned int value );
 
-extern unsigned int _mwr_hw_init( unsigned int           cluster_xy, 
-                                  unsigned int           port_id, 
-                                  unsigned int           from_coproc,
-                                  unsigned long long     channel_pbase);
+extern unsigned int _mwr_get_channel_register( unsigned int cluster_xy,
+                                               unsigned int channel,
+                                               unsigned int index );
 
-///////////////////////////////////////////////////////////////////////////////////
+extern void _mwr_set_coproc_register( unsigned int cluster_xy,
+                                      unsigned int index,
+                                      unsigned int value );
 
+extern unsigned int _mwr_get_coproc_register( unsigned int cluster_xy,
+                                              unsigned int index );
 
+///////////////////////////////////////////////////////////////////////////////
+//            Interrupt Service Routine
+///////////////////////////////////////////////////////////////////////////////
+
+extern void _mwr_isr( unsigned int irq_type,
+                      unsigned int irq_id,
+                      unsigned int channel ); 
 #endif
 
