Changes between Version 3 and Version 4 of Component/Vci Multi Tty
- Timestamp:
- May 9, 2007, 2:46:35 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Component/Vci Multi Tty
v3 v4 4 4 5 5 This 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. 6 independant terminals. The number of emulated 7 terminals is defined by the arguments in the constructor (one name per terminal). 8 Name list MUST be terminated by NULL. 9 11 10 Each 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. 11 For each terminal, a specific IRQ is activated when a character entered at the 12 keyboard is available in a buffer. IRQ is kept low as long as the buffer is not empty. 13 16 14 This hardware component cheks for segmentation violation, and can be used 17 15 as a default target. 18 16 17 This component uses a [wiki:Component/TtyWrapper TtyWrapper] per terminal in order to 18 abstract different simulator's ttys. 19 20 = Memory region layout = 21 22 The terminal index ''i'' is defined by the ADDRESS![12:4] bits. 23 19 24 Each TTY controller contains 3 memory mapped registers: 20 25 21 * '''TTY_DISPLAY''': ADDRESS![3:0] = 0x026 * `TTY_WRITE`: ADDRESS![3:0] = 0x0 22 27 This 8 bits pseudo-register is write only. 23 28 Any write request will interpret the 8 LSB bits of the WDATA field 24 29 as an ASCII character, and this character will be displayed on the addressed terminal. 25 30 26 * '''TTY_KEY_STS''': ADDRESS![3:0] = 0x431 * `TTY_STATUS`: ADDRESS![3:0] = 0x4 27 32 This Boolean status register is read-only. 28 33 A read request returns the zero value if there is no pending character. 29 34 It returns a non zero value if there is a pending character in the keyboard buffer. 30 35 31 * '''TTY_KEY_BUF''': ADDRESS![3:0] = 0x836 * `TTY_READ`: ADDRESS![3:0] = 0x8 32 37 This 8 bits register contains one single ASCII character. 33 38 This register is read-only. A read request returns the ACSII character 34 39 in the 8 LSB bits of the RDATA field, and reset the status register 40 41 = Component usage = 42 43 For extensibility issues, you should access your terminal using globally-defined offsets. 44 45 You should include file source:trunk/soclib/include/soclib/tty.h from your software, it 46 defines `TTY_WRITE`, `TTY_STATUS`, `TTY_READ` and `TTY_SPAN`. 47 48 A putc/getc implementation could be: 49 {{{ 50 #include "soclib/tty.h" 51 52 static const volatile void* tty_address = 0xc0000000; 53 54 static 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 60 static 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) 35 68 36 69 = !VciMultiTty CABA Implementation = … … 44 77 45 78 == Constructor parameters == 79 46 80 {{{ 47 81 VciMultiTty( … … 53 87 }}} 54 88 89 Example instanciation: 90 {{{ 91 VciMultiTty tty("tty_comp", IntTab(2,3), mapping_table, "term0", "term1", "term2", NULL); 92 }}} 93 55 94 == Ports == 56 95 … … 58 97 * sc_in<bool> '''p_clk''' : Global system clock 59 98 * 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.