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
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
14 \ Serial console. Enabled very early.
15 \ remember last console used
16 CREATE lastser 4 allot 0 lastser l!
18 \ On JS21, use serial port 2. Detect Maui by looking at the SIO version.
19 20 siocfg@ f2 = IF 2f8 ELSE 3f8 THEN
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@ ;
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 ;
39 \ : serial-key BEGIN 5 serial2@ 1 and UNTIL 0 serial2@ ;
40 \ : serial-key? 5 serial2@ 1 and 0<> ;
48 \ .( has started execution, serial console @ ) 0 >serial .