Index: trunk/hal/tsar_mips32/drivers/soclib_bdv.c
===================================================================
--- trunk/hal/tsar_mips32/drivers/soclib_bdv.c	(revision 622)
+++ trunk/hal/tsar_mips32/drivers/soclib_bdv.c	(revision 626)
@@ -58,5 +58,5 @@
 void __attribute__ ((noinline)) soclib_bdv_cmd( xptr_t th_xp )
 {
-    uint32_t   cmd_type;    // IOC_READ / IOC_WRITE / IOC_SYNC_READ
+    uint32_t   cmd_type;    // IOC_READ / IOC_WRITE / IOC_SYNC_READ / IOC_SYNC_WRITE 
     uint32_t   lba;
     uint32_t   count;
@@ -86,15 +86,8 @@
     ioc_xp   = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) );
 
-#if DEBUG_HAL_IOC_RX
-if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE ) )
-printk("\n[%s] thread[%x,%x] enters for client thread[%x,%x] / RX / cycle %d\n",
-__FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid, cycle );
-#endif
-
-#if DEBUG_HAL_IOC_TX
-if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) )
-printk("\n[%s] thread[%x,%x] enters for client thread[%x,%x] / TX / cycle %d\n",
-__FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid, cycle );
-#endif
+    // decode command
+    if     ( (cmd_type == IOC_READ)  || (cmd_type == IOC_SYNC_READ)  ) op = BDV_OP_READ;
+    else if( (cmd_type == IOC_WRITE) || (cmd_type == IOC_SYNC_WRITE) ) op = BDV_OP_WRITE;
+    else     assert( false , "illegal command" );
 
     // get IOC device cluster and local pointer
@@ -110,4 +103,18 @@
     uint32_t   buf_lsb = (uint32_t)(buf_xp);
     uint32_t   buf_msb = (uint32_t)(buf_xp>>32);
+
+#if DEBUG_HAL_IOC_RX 
+if( DEBUG_HAL_IOC_RX < cycle )
+printk("\n[%s] thread[%x,%x] enters / client[%x,%x] / cmd %d / lba %x / buf(%x,%x) / cycle %d\n",
+__FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid,
+cmd_type, lba, buf_msb, buf_lsb, cycle );
+#endif
+
+#if DEBUG_HAL_IOC_TX
+if( DEBUG_HAL_IOC_TX < cycle )
+printk("\n[%s] thread[%x,%x] enters / client[%x,%x] / cmd %d / lba %x / buf(%x,%x) / cycle %d\n",
+__FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid,
+cmd_type, lba, buf_msb, buf_lsb, cycle );
+#endif
 
     // select operation
@@ -143,11 +150,25 @@
             {
                 hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 );
+
+#if DEBUG_HAL_IOC_RX
+cycle = (uint32_t)hal_get_cycles();
+if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type == IOC_SYNC_READ) )
+printk("\n[%s] thread[%x,%x] exit after SYNC_READ for client thread[%x,%x] / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
+#endif
+
+#if DEBUG_HAL_IOC_TX
+cycle = (uint32_t)hal_get_cycles();
+if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_SYNC_WRITE) )
+printk("\n[%s] thread[%x,%x] exit after SYNC_WRITE for client thread[%x,%x] / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
+#endif
                 break;
             }
-            else if( status == BDV_BUSY )   // non completed
+            else if( status == BDV_BUSY )      // non completed
             {
                 continue;
             }
-            else                            // error reported
+            else                               // error reported
             {
                 hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 );
@@ -170,5 +191,5 @@
 #if DEBUG_HAL_IOC_RX 
 if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE ) )
-printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching RX transfer\n",
+printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching READ transfer\n",
 __FUNCTION__ , this->process->pid, this->trdid );
 #endif
@@ -176,5 +197,5 @@
 #if DEBUG_HAL_IOC_TX
 if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) )
-printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching TX transfer\n",
+printk("\n[%s] thread[%x,%x] blocks & deschedules after lauching WRITE transfer\n",
 __FUNCTION__ , this->process->pid, this->trdid );
 #endif
@@ -184,10 +205,9 @@
         // exit critical section
         hal_restore_irq( save_sr );
-    }
     
 #if DEBUG_HAL_IOC_RX
 cycle = (uint32_t)hal_get_cycles();
 if( (DEBUG_HAL_IOC_RX < cycle) && (cmd_type != IOC_WRITE) )
-printk("\n[%s] thread[%x,%x] exit after RX for client thread[%x,%x] / cycle %d\n",
+printk("\n[%s] thread[%x,%x] exit after READ for client thread[%x,%x] / cycle %d\n",
 __FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
 #endif
@@ -196,7 +216,9 @@
 cycle = (uint32_t)hal_get_cycles();
 if( (DEBUG_HAL_IOC_TX < cycle) && (cmd_type == IOC_WRITE) )
-printk("\n[%s] thread[%x,%x] exit after TX for client thread[%x,%x] / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
-#endif
+printk("\n[%s] thread[%x,%x] exit after WRITE for client thread[%x,%x] / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle );
+#endif
+
+    }
 
 } // end soclib_bdv_cmd()
@@ -263,5 +285,5 @@
     else
     {
-        assert( false , "IOC_SYNC_READ should not use IRQ" );
+        assert( false , "illegal command %d", cmd_type );
     } 
 
