Index: soft/giet_vm/giet_drivers/bdv_driver.h
===================================================================
--- soft/giet_vm/giet_drivers/bdv_driver.h	(revision 496)
+++ soft/giet_vm/giet_drivers/bdv_driver.h	(revision 529)
@@ -10,35 +10,17 @@
 // a single channel, block oriented, external storage contrÃŽler.
 //
-// The _bdv_read() and _bdv_write() functions are always blocking.
-// They can be called in 3 modes:
+// The _bdv_access() function supports both read and write access to block device,
+// and implement two operating modes:
 //
-// - In BOOT mode, these functions use a polling policy on the BDV STATUS 
+// - in "synchronous" mode, it uses a polling policy on the BDV STATUS 
 //   register to detect transfer completion, as interrupts are not activated. 
 //   This mode is used by the boot code to load the map.bin file into memory
 //   (before MMU activation), or to load the .elf files (after MMU activation). 
-//
-// - In KERNEL mode, these functions use a descheduling strategy:
-//   The ISR executed when transfer completes should restart the calling task.
-//   There is no checking of user access right to the memory buffer. 
-//   This mode must be used, for an "open" system call.
-//
-// - In USER mode, these functions use a descheduling strategy:
-//   The ISR executed when transfer completes should restart the calling task, 
-//   The user access right to the memory buffer must be checked.
-//   This mode must be used for a "read/write" system call.
-//
+// - In "descheduling" mode, ir uses a descheduling + IRQ policy.
+//   The ISR executed when transfer completes should restart the calling task,
+//   as the calling task global index has been saved in the _bdv_gtid variable.
+//   
 // As the BDV component can be used by several programs running in parallel,
-// the _bdv_lock variable guaranties exclusive access to the device.  The
-// _bdv_read() and _bdv_write() functions use atomic LL/SC to get the lock.
-//
-// Finally, the memory buffer must fulfill the following conditions:
-// - The buffer must be word aligned, 
-// - The buffer must be mapped in user space for an user access, 
-// - The buffer must be writable in case of (to_mem) access,
-// - The total number of physical pages occupied by the user buffer cannot
-//   be larger than 512 pages if the IOMMU is activated,
-// - All physical pages occupied by the user buffer must be contiguous
-//   if the IOMMU is not activated.
-// An error code is returned if these conditions are not verified.
+// the _bdv_lock variable guaranties exclusive access to the device.
 //
 // The SEG_IOC_BASE address must be defined in the hard_config.h file.
@@ -86,10 +68,12 @@
 
 ///////////////////////////////////////////////////////////////////////////////
-// BDV global variables
+//           Global variables
 ///////////////////////////////////////////////////////////////////////////////
 
 extern spin_lock_t  _bdv_lock;
+
+extern unsigned int _bdv_gtid;
+
 extern unsigned int _bdv_status;
-extern unsigned int _bdv_gtid;
 
 ///////////////////////////////////////////////////////////////////////////////////
@@ -104,38 +88,17 @@
 
 ///////////////////////////////////////////////////////////////////////////////////
-// Transfer data from the block device to a memory buffer. 
-// - mode     : BOOT / KERNEL / USER
+// Transfer data to/from the block device from/to a memory buffer. 
+// - use_irq  : descheduling + IRQ if non zero / polling if zero
+// - to_mem   : from external storage to memory when non 0.
 // - lba      : first block index on the block device
-// - buffer   : base address of the memory buffer (must be word aligned)
-// - count    : number of blocks to be transfered.
-// Returns 0 if success, > 0 if error.
-////////////////////////////////////////////////////////////////////////////////////
-extern unsigned int _bdv_read(  unsigned int       mode,
-                                unsigned int       lba, 
-                                unsigned long long buffer,
-                                unsigned int       count );
-
-///////////////////////////////////////////////////////////////////////////////////
-// Transfer data from a memory buffer to the block device. 
-// - mode     : BOOT / KERNEL / USER
-// - lba      : first block index on the block device
-// - buffer   : base address of the memory buffer (must be word aligned)
+// - buffer   : pbase address of the memory buffer (must be word aligned)
 // - count    : number of blocks to be transfered.
 // Returns 0 if success, > 0 if error.
 ///////////////////////////////////////////////////////////////////////////////////
-extern unsigned int _bdv_write( unsigned int       mode,
-                                unsigned int       lba, 
-                                unsigned long long buffer, 
-                                unsigned int       count );
-
-///////////////////////////////////////////////////////////////////////////////////
-// Returns device status.
-///////////////////////////////////////////////////////////////////////////////////
-extern unsigned int _bdv_get_status();
-
-///////////////////////////////////////////////////////////////////////////////////
-// Returns block size.
-///////////////////////////////////////////////////////////////////////////////////
-extern unsigned int _bdv_get_block_size();
+extern unsigned int _bdv_access( unsigned int       use_irq,
+                                 unsigned int       to_mem,
+                                 unsigned int       lba, 
+                                 unsigned long long buffer,
+                                 unsigned int       count );
 
 ///////////////////////////////////////////////////////////////////////////////////
