Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / board-js2x / slof / serial.fs
1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2008 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
8 \ *
9 \ * Contributors:
10 \ *     IBM Corporation - initial implementation
11 \ ****************************************************************************/
12
13
14 \ Serial console.  Enabled very early.
15 \ remember last console used
16 CREATE lastser 4 allot  0 lastser l!
17
18 \ On JS21, use serial port 2.  Detect Maui by looking at the SIO version.
19 20 siocfg@ f2 = IF 2f8 ELSE 3f8 THEN
20
21 : >serial  LITERAL + ;
22 : js21?    -2f8 >serial 0= ;
23 : serial!  js21? IF 2dup 2f8 + io-c! THEN 3f8 + io-c! ;
24 : serial1@ 3f8 + io-c@ ;
25 : serial2@ 2f8 + io-c@ ;
26
27 : serial-init  0 1 serial!  0 2 serial!
28                80 3 serial! d# 115200 swap / 0 serial!  0 1 serial!
29                3 3 serial!  3 4 serial! ;
30 : serial-emit  BEGIN 5 serial1@ 20 and UNTIL  
31                js21? IF BEGIN 5 serial2@ 20 and UNTIL THEN 0 serial! ;
32 : serial1-key? 5 serial1@ 1 and 0<> ;
33 : serial2-key? 5 serial2@ 1 and 0<> ;
34 : serial1-key  serial1-key? dup IF 0 serial1@ swap 0 lastser l! THEN ;
35 : serial2-key  serial2-key? dup IF 0 serial2@ swap 1 lastser l! THEN ;
36 : serial-key   BEGIN serial1-key dup IF ELSE js21? IF drop serial2-key THEN THEN UNTIL ;
37 : serial-key?  serial1-key? js21? IF serial2-key? or THEN ;
38
39 \ : serial-key   BEGIN 5 serial2@ 1 and UNTIL  0 serial2@ ;
40 \ : serial-key?  5 serial2@  1 and 0<> ;
41
42 d# 19200 serial-init
43 ' serial-emit to emit
44 ' serial-key  to key
45 ' serial-key? to key?
46
47 ( .( SLOF)
48 \ .(  has started execution, serial console @ ) 0 >serial .