1 \ briq specific initialization code
3 \ Copyright (C) 2004 Greg Watson
5 \ This program is free software; you can redistribute it and/or
6 \ modify it under the terms of the GNU General Public License
7 \ as published by the Free Software Foundation
11 \ -------------------------------------------------------------------------
13 \ -------------------------------------------------------------------------
15 : make-openable ( path )
18 \ install trivial open and close methods
19 dup active-package! is-open
25 : preopen ( chosen-str node-path )
28 " /chosen" find-device
30 encode-int 2swap property
36 \ preopen device nodes (and store the ihandles under /chosen)
38 " rtc" " /pci/isa/rtc" preopen
39 " memory" " /memory" preopen
40 " mmu" " /cpu@0" preopen
41 " stdout" " /packages/terminal-emulator" preopen
42 " stdin" " keyboard" preopen
47 \ -------------------------------------------------------------------------
49 \ -------------------------------------------------------------------------
51 \ add decode-address methods
52 : (make-decodable) ( phandle -- )
54 dup " #address-cells" rot get-package-property 0= if
56 over " decode-unit" rot find-method if 2drop else
57 ( save phandle ncells )
61 1 of ['] parse-hex " decode-unit" is-xt-func endof
63 " bus-range" active-package get-package-property 0= if
65 ['] encode-unit-pci " encode-unit" is-xt-func
66 " decode-unit" is-func-begin
68 ['] decode-unit-pci-bus ,
78 : init-briq-tree ( -- )
92 \ use the tty interface if available
93 : activate-tty-interface
94 " /packages/terminal-emulator" find-dev if drop
95 " /packages/terminal-emulator" " input-device" $setenv
96 " /packages/terminal-emulator" " output-device" $setenv
102 ; CONSOLE-IN-initializer
105 \ -------------------------------------------------------------------------
107 \ -------------------------------------------------------------------------
110 " /chosen" find-device
111 stdin @ encode-int " stdin" property
112 stdout @ encode-int " stdout" property
113 " /pci/isa/interrupt-controller" find-dev if encode-int " interrupt-controller" property then