Index: trunk/kernel/devices/dev_txt.c
===================================================================
--- trunk/kernel/devices/dev_txt.c	(revision 626)
+++ trunk/kernel/devices/dev_txt.c	(revision 637)
@@ -95,5 +95,5 @@
     {
         // select a core to execute the server thread
-        lid_t lid = cluster_select_local_core();
+        lid_t lid = cluster_select_local_core( local_cxy );
 
         // The unique IRQ from cluster 00's MTTY must be bound to a RX chdev
@@ -131,5 +131,5 @@
         thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
     }
-}
+}  // end dev_txt_init()
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -166,5 +166,6 @@
     // return I/O operation status from calling thread descriptor
     return this->txt_cmd.error;
-}
+
+}  // end dev_txt_access()
 
 /////////////////////////////////////////
@@ -173,4 +174,5 @@
                        uint32_t   count )
 {
+    error_t error;
 
 #if (DEBUG_SYS_WRITE & 1)
@@ -182,20 +184,16 @@
 uint32_t   cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_DEV_TXT_TX < cycle )
-printk("\n[%s] thread[%x,%x] enters / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, cycle );
-#endif
-
-    // get extended pointer on TXT[0] chdev
+printk("\n[%s] thread[%x,%x] enters for <%s> / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, buffer, cycle );
+#endif
+
+    // If we use MTTY (vci_multi_tty), we do a synchronous write on TXT[0]
+    // If we use TTY  (vci_tty_tsar), we do a standard asynchronous write
+    // TODO this is not very clean ... [AG]
+
+    // get pointers on chdev
     xptr_t dev_xp = chdev_dir.txt_tx[0];
-
-    assert( (dev_xp != XPTR_NULL) , __FUNCTION__ ,
-    "undefined TXT0 chdev descriptor" );
-
-    // get TXTO chdev cluster and local pointer
-    cxy_t    dev_cxy  = GET_CXY( dev_xp );
-    chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
-
-    // If we use MTTYs (vci_multi_tty), we perform only sync writes
-    // Otherwise, we use vci_tty_tsar so we can use async writes
+    cxy_t     dev_cxy = GET_CXY( dev_xp );
+    chdev_t * dev_ptr = GET_PTR( dev_xp );
 
     if( dev_ptr->impl == IMPL_TXT_MTY )
@@ -211,13 +209,19 @@
         args.channel = channel;
 
-        // call driver function
+        // call directly the driver function
         aux( &args );
 
-        return 0;
-    }
-
+        error = 0;
+    }
     else
     {
-        return dev_txt_access( TXT_WRITE , channel , buffer , count );
+        // register command in chdev queue for an asynchronous access
+        error = dev_txt_access( TXT_WRITE , channel , buffer , count );
+
+        if( error )
+        {
+            printk("\n[ERROR] in %s : cannot write string %s / cycle %d\n",
+            __FUNCTION__, buffer, (uint32_t)hal_get_cycles() );
+        }
     }
 
@@ -225,5 +229,5 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_DEV_TXT_TX < cycle )
-printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
+printk("\n[%s] thread[%x,%x] exit /  cycle %d\n",
 __FUNCTION__, this->process->pid, this->trdid, cycle );
 #endif
@@ -233,5 +237,7 @@
 #endif
 
-}
+    return error;
+
+}  // end dev_txt_write()
 
 /////////////////////////////////////////
@@ -239,4 +245,5 @@
                       char     * buffer )
 {
+    error_t error;
 
 #if (DEBUG_SYS_READ & 1)
@@ -252,11 +259,18 @@
 #endif
 
-    return dev_txt_access( TXT_READ , channel , buffer , 1 );
+    // register command in chdev queue for an asynchronous access
+    error = dev_txt_access( TXT_READ , channel , buffer , 1 );
+
+    if( error )
+    {
+        printk("\n[ERROR] in %s : cannot get character / cycle %d\n",
+        __FUNCTION__, (uint32_t)hal_get_cycles() );
+    }
 
 #if DEBUG_DEV_TXT_RX
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_DEV_TXT_RX < cycle )
-printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, cycle );
+printk("\n[%s] thread[%x,%x] get character <%c> / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, *buffer, cycle );
 #endif
 
@@ -265,5 +279,7 @@
 #endif
 
-}
+    return error;
+
+}  // end dev_txt_read()
 
 ////////////////////////////////////////////////
