Index: trunk/hal/tsar_mips32/drivers/soclib_tty.h
===================================================================
--- trunk/hal/tsar_mips32/drivers/soclib_tty.h	(revision 424)
+++ trunk/hal/tsar_mips32/drivers/soclib_tty.h	(revision 435)
@@ -28,5 +28,5 @@
 
 /****************************************************************************************
- * This driver supports the soclib_multi_tty component.
+ * This driver supports the vci_tty_tsar component.
  * It implements the generic TXT device API:
  * - transfer one single character from TTY to command "buffer" if to_mem is non-zero.
@@ -62,7 +62,9 @@
 
 /****************************************************************************************
- * This function implements the TXT_READ & TXT_WRITE commands registered in the client
- * thread descriptor (in the txt_cmd field), identified by the <xp_thread> argument.
- * Depending on the command type, it only unmasks the relevant TTY_RX / TTY_TX IRQ,
+ * This function implements both the TXT_READ & TXT_WRITE commands registered in the
+ * client thread descriptor (in the txt_cmd field), even if ALMOS-MKH defines two
+ * different chdevs (and consequently two diffeerent server threads) for the RX and TX
+ * directions. The client thread is identified by the <thread_xp> argument.
+ * Depending on the command type, it unmasks the relevant TTY_RX / TTY_TX IRQ,
  * and blocks the TXT device server thread on the THREAD_BLOCKED_DEV_ISR, as the data
  * transfer is done by the ISR.
@@ -83,14 +85,39 @@
 
 /****************************************************************************************
- * This ISR is executed to handle both the TTY_TX_IRQ and the TTY_RX_IRQ.
- * - the TTY_RX_IRQ is activated as soon as the TTY_STATUS_RX_FULL bit is set in the
- *   TTY status register, indicating a character registered in the TTY_READ register.
+ * This ISR is executed to handle both the TTY_TX_IRQ and the TTY_RX_IRQ, even if
+ *   The RX_IRQ is activated as soon as the TTY_STATUS_RX_FULL bit is 1 in the
+ *   TTY_STATUS register, when the TTY_RX_IRQ_ENABLE is non zero, indicating that
+ *   the TTY_READ buffer is full and can be read.
+ *   The TX_IRQ is activated as soon as the TTY_STATUS_TX_FULL bit is 0 in the
+ *   TTY_STATUS register, when the TTY_TX_IRQ_ENABLE is non zero, indicating that
+ *   the TTY_WRITE buffer is empty, and can be written.
+ * WARNING : In ALMOS-MKH, the RX_IRQ is always enabled to catch the control signals,
+ * but the TX_IRQ is dynamically enabled by the TXT_WRITE command, and disabled when
+ * the command is completed.
  *
- *   . if it exist a TXT_READ command registered in the command queue, and thit copies the
+ * 1) The ISR first read the TTY_STATUS to get the current state of the TTY_READ and
+ *   the TTY_WRITE buffers.
+ *
+ * 2) It try to read the first command registered in the server thread queue associated 
+ *    to the TTY channel
+ *
+ * 2) The ISR handles the RX when the TTY_READ buffer is full :
+ *   . it read the available character from the TTY_READ buffer, and this
+ *     acknowledges the RX_IRQ.
+ *   . if it is a control character ( ^C / ^D / ^Z ) it translate it to the proper
+ *     signal and execute the relevant sigaction for the foreground process.
+ *   . if it is a normal character, it try to get the first command registered in the 
+ *     server thread queue. If it is a TXT_READ, it returns this character to the 
+ *     command buffer in the client thread.
+ * 
+ * 3) The ISR handles the TX when the TTY_WRITE buffer is empty and a TXT_WRITE
+ *   . it try to get it copies the
  *     character to the command buffer, acknowledges the TTY_RX_IRQ, and unblock the 
  *     associated server thread.
      
- *   . the control characters are directly handled by the txt ^C / ^D /  and the this IRQ ca
- * 
+ *   . the control characters ^C / ^D / ^Z  are directly handled by the ISR and
+ *     translated to the foreground process.
+
+ * - the 
  the TXT_READ and TXT_WRITE commands.
  * It gets the command arguments from the first client thread in the TXT chdev queue:
