Changes between Version 3 and Version 4 of Component/Vci Multi Tty


Ignore:
Timestamp:
May 9, 2007, 2:46:35 PM (17 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Component/Vci Multi Tty

    v3 v4  
    44
    55This VCI target is a TTY terminal controller. This hardware component controls
    6 up to 256 terminals, emulated as XTERM windows. The number of emulated
    7 terminals is defined by the arguments in the constructor.
    8 The constructor creates as many UNIX XTERM processes as the number N of emulated terminals.
    9 It creates N PTY pseudo-terminals (one for each XTERM process), to support the bidirectional
    10 communication between the TTY controller process and the XTERM processes.
     6independant terminals. The number of emulated
     7terminals is defined by the arguments in the constructor (one name per terminal).
     8Name list MUST be terminated by NULL.
     9
    1110Each terminal is acting both as a character display, and a keyboard interface.
    12 For each terminal, a specific IRQ is activated when a character is entered at the keyboard.
    13 The terminal index i is defined by the ADDRESS![12:4] bits.
    14 The address space segment allocated to this component must be aligned
    15 on a 4K bytes boundary.
     11For each terminal, a specific IRQ is activated when a character entered at the
     12keyboard is available in a buffer. IRQ is kept low as long as the buffer is not empty.
     13
    1614This hardware component cheks for segmentation violation, and can be used
    1715as a default target.
    1816
     17This component uses a [wiki:Component/TtyWrapper TtyWrapper] per terminal in order to
     18abstract different simulator's ttys.
     19
     20= Memory region layout =
     21
     22The terminal index ''i'' is defined by the ADDRESS![12:4] bits.
     23
    1924Each TTY controller contains 3 memory mapped registers:
    2025
    21  * '''TTY_DISPLAY'''     : ADDRESS![3:0] = 0x0
     26 * `TTY_WRITE`: ADDRESS![3:0] = 0x0
    2227This 8 bits pseudo-register is write only.
    2328Any write request will interpret the 8 LSB bits of the WDATA field
    2429as an ASCII character, and this character will be displayed on the addressed terminal.
    2530
    26  * '''TTY_KEY_STS''' : ADDRESS![3:0] = 0x4
     31 * `TTY_STATUS`: ADDRESS![3:0] = 0x4
    2732This Boolean status register is read-only.
    2833A read request returns the zero value if there is no pending character.
    2934It returns a non zero value if there is a pending character in the keyboard buffer.
    3035
    31  * '''TTY_KEY_BUF'''    : ADDRESS![3:0] = 0x8
     36 * `TTY_READ`: ADDRESS![3:0] = 0x8
    3237This 8 bits register contains one single ASCII character.
    3338This register is read-only. A read request returns the ACSII character
    3439in the 8 LSB bits of the RDATA field, and reset the status register
     40
     41= Component usage =
     42
     43For extensibility issues, you should access your terminal using globally-defined offsets.
     44
     45You should include file source:trunk/soclib/include/soclib/tty.h from your software, it
     46defines `TTY_WRITE`, `TTY_STATUS`, `TTY_READ` and `TTY_SPAN`.
     47
     48A putc/getc implementation could be:
     49{{{
     50#include "soclib/tty.h"
     51
     52static const volatile void* tty_address = 0xc0000000;
     53
     54static inline void putc(const size_t term_no, const char x)
     55{
     56    volatile int *tty = ((int*)tty_address) + term_no*TTY_SPAN;
     57    tty[TTY_WRITE] = x;
     58}
     59
     60static inline char getc(const size_t term_no)
     61{
     62    volatile int *tty = ((int*)tty_address) + term_no*TTY_SPAN;
     63    return tty[TTY_READ];
     64}
     65}}}
     66
     67(add -I/path/to/soclib/include to your compilation command-line)
    3568
    3669= !VciMultiTty CABA  Implementation =
     
    4477
    4578== Constructor parameters ==
     79
    4680{{{
    4781VciMultiTty(
     
    5387}}}
    5488
     89Example instanciation:
     90{{{
     91VciMultiTty tty("tty_comp", IntTab(2,3), mapping_table, "term0", "term1", "term2", NULL);
     92}}}
     93
    5594== Ports ==
    5695
     
    5897 * sc_in<bool> '''p_clk''' : Global system clock
    5998 * soclib::common::!VciiTarget<vci_param> '''p_vci''' : The VCI port
    60  * sc_out<bool> '''*p_irq''' : Pointer on the interrupt ports array.
     99 * sc_out<bool> '''p_irq[]''' : Interrupt ports array.