Author: wmb
Date: Wed Aug 17 03:47:50 2011
New Revision: 2463
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2463
Log:
OLPC XO-1.75 - Enable/disable DCON freezing based on presence of DCON RAM (in turn based on board ID). If RAM is absent, the /display/dcon device node now has a "no-freeze" property.
Modified:
dev/olpc/dcon/mmp2dcon.fth
Modified: dev/olpc/dcon/mmp2dcon.fth
==============================================================================
--- dev/olpc/dcon/mmp2dcon.fth Tue Aug 16 03:06:53 2011 (r2462)
+++ dev/olpc/dcon/mmp2dcon.fth Wed Aug 17 03:47:50 2011 (r2463)
@@ -1,11 +1,28 @@
\ See license at end of file
\ " dcon" device-name
+also forth definitions
+: has-dcon-ram? ( -- flag )
+ board-revision h# 1b18 = if true exit then
+ board-revision h# 1b48 >= if true exit then
+ false
+;
+previous definitions
+
new-device
" dcon" device-name
" olpc,xo1-dcon" +compatible
+" olpc,xo1.75-dcon" +compatible
finish-device
+stand-init:
+ has-dcon-ram? 0= if
+ " /dcon? find-device
+ 0 0 " no-freeze" property
+ device-end
+ then
+;
+
\ DCON internal registers, accessed via I2C
\ 0 constant DCON_ID
\ 1 constant DCON_MODE
@@ -103,14 +120,16 @@
d# 25 ms \ Ensure that that DCON sees the DCONLOAD high
\ display-on
else
- begin ( )
- dcon-unload \ Put the DCON in self-refresh mode
- lock[ wait-dcon-mode ]unlock ( retry? )
-\ display-off ( retry? )
- while ( )
- \ We got a false ack from the DCON so start over from LOAD state
- dcon-load d# 25 ms ( )
- repeat ( )
+ has-dcon-ram? if
+ begin ( )
+ dcon-unload \ Put the DCON in self-refresh mode
+ lock[ wait-dcon-mode ]unlock ( retry? )
+ \ display-off ( retry? )
+ while ( )
+ \ We got a false ack from the DCON so start over from LOAD state
+ dcon-load d# 25 ms ( )
+ repeat ( )
+ then
then
;
Author: wmb
Date: Sat Aug 13 02:51:41 2011
New Revision: 2460
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2460
Log:
Alex - Added interface to the EC and its internal access to battery, AC, CPU temperature, and fan.
Added:
cpu/x86/pc/alex/ec.fth
dev/acpiec.fth
Modified:
cpu/x86/pc/alex/devices.fth
Modified: cpu/x86/pc/alex/devices.fth
==============================================================================
--- cpu/x86/pc/alex/devices.fth Thu Aug 11 03:35:51 2011 (r2459)
+++ cpu/x86/pc/alex/devices.fth Sat Aug 13 02:51:41 2011 (r2460)
@@ -192,6 +192,9 @@
fload ${BP}/cpu/x86/pc/reset.fth \ reset-all
+fload ${BP}/dev/acpiec.fth \ Access to ACPI EC internal variables
+fload ${BP}/cpu/x86/pc/alex/ec.fth \ Battery, AC, CPU temperature, Fan controls
+
: ?enough-power ; \ Implement based on AC presence and battery status
fload ${BP}/cpu/x86/pc/alex/spiui.fth \ User interface for SPI FLASH programming
Added: cpu/x86/pc/alex/ec.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/x86/pc/alex/ec.fth Sat Aug 13 02:51:41 2011 (r2460)
@@ -0,0 +1,68 @@
+\ See license at end of file
+purpose: Access to platform functions controlled by the Embedded Controller
+
+[ifdef] notdef
+\ The following is an alternative interface to EC internals. It seems to
+\ accomplish the same thing as the standard port 66/62 ACPI interface.
+: ec-i@ ( index -- b ) h# a00 pc! h# a01 pc@ ;
+: ec-i! ( b index -- ) h# a00 pc! h# a01 pc! ;
+: ec-rdy? ( -- flag ) h# 82 ec-i@ 0= ;
+: wait-ec-rdy ( -- )
+ h# 800 0 do ec-rdy? if unloop exit then d# 10 us loop
+ true abort" EC timeout"
+;
+: ec-cmd ( cmd -- ) wait-ec-rdy h# 82 ec-i! wait-ec-rdy ;
+: ec-cmd-data ( data cmd -- ) wait-ec-rdy swap h# 84 ec-i! h# 82 ec-i! wait-ec-rdy ;
+
+: ec-b@ ( adr -- b ) h# 88 ec-cmd-data h# 84 ec-i@ ;
+: ec-b! ( b adr -- ) h# 84 ec-i! h# 85 ec-i! h# 89 h# 82 ec-i! ;
+
+: ec-w@ ( adr -- b ) dup ec-b@ swap 1+ ec-b@ bwjoin ;
+: ec-w! ( w adr -- b ) >r wbsplit r@ 1+ ec-b! r> ec-b! ;
+[then]
+
+\ Alex has one fan, but it appears that the EC supports up to 5 fans.
+\ Alex's fan goes on if you turn on either of EC fans 0,1, or 2
+: fan-on? ( -- flag ) h# ca ec-b@ 7 and 0<> ;
+: fan-on ( -- ) h# 81 h# ca ec-b! ;
+: fan-off ( -- ) h# 80 h# ca ec-b! ;
+
+: battery-remaining-capacity ( -- w ) h# a2 ec-w@ ;
+: battery-present-rate ( -- w ) h# a4 ec-w@ ;
+: battery-present-voltage ( -- w ) h# a6 ec-w@ ;
+
+: battery-design-capacity ( -- w ) h# b0 ec-w@ ;
+: battery-last-charge ( -- w ) h# b2 ec-w@ ;
+: battery-design-voltage ( -- w ) h# b4 ec-w@ ;
+: battery-design-full ( -- w ) h# b6 ec-w@ ;
+
+: cpu-temperature ( -- degrees-c ) h# c0 ec-b@ ;
+
+: battery-state ( -- b ) h# 84 ec-b@ ; \ 0:discharging 1:charging 2:critical
+: lid-open? ( -- flag ) h# 83 ec-b@ 1 and 0<> ;
+: ac? ( -- flag ) h# 80 ec-b@ 4 and 0<> ;
+: battery? ( -- flag ) h# 80 ec-b@ 1 and 0<> ;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: dev/acpiec.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/acpiec.fth Sat Aug 13 02:51:41 2011 (r2460)
@@ -0,0 +1,48 @@
+\ See license at end of file
+purpose: Interface to ACPI Embedded Controller internal variables
+
+: ec-obf? ( -- flag ) h# 66 pc@ 1 and 0<> ;
+: ec-ibf? ( -- flag ) h# 66 pc@ 2 and 0<> ;
+: wait-ibf0
+ h# 800 0 do ec-ibf? 0= if unloop exit then d# 10 us loop
+ true abort" EC timeout"
+;
+: wait-obf ( -- )
+ h# 800 0 do ec-obf? if unloop exit then d# 10 us loop
+ true abort" EC timeout"
+;
+: ec-cmd ( cmd -- ) wait-ibf0 h# 66 pc! ;
+: ec-data! ( data -- ) wait-ibf0 h# 62 pc! ;
+: ec-data@ ( data -- ) wait-obf h# 62 pc@ ;
+: ec-cmd-data ( data cmd -- ) ec-cmd ec-data! ;
+: ec-sci@ ( -- b ) h# 84 ec-cmd ec-data@ ;
+
+: ec-b@ ( adr -- b ) h# 80 ec-cmd-data ec-data@ ;
+: ec-b! ( b adr -- ) h# 81 ec-cmd-data ec-data! ;
+
+: ec-w@ ( adr -- b ) dup ec-b@ swap 1+ ec-b@ bwjoin ;
+: ec-w! ( b adr -- ) >r wbsplit r@ 1+ ec-b! r> ec-b! ;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Author: wmb
Date: Thu Aug 11 03:35:51 2011
New Revision: 2459
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2459
Log:
DRAM recalibration - added explanatory comments.
Modified:
cpu/arm/mmp2/dramrecal.fth
Modified: cpu/arm/mmp2/dramrecal.fth
==============================================================================
--- cpu/arm/mmp2/dramrecal.fth Thu Aug 11 02:46:27 2011 (r2458)
+++ cpu/arm/mmp2/dramrecal.fth Thu Aug 11 03:35:51 2011 (r2459)
@@ -1,6 +1,15 @@
\ See license at end of file
purpose: Recalibrate DDR3 DRAM
+\ DDR3 DRAM requires periodic recalibration to cope with parameter drift from
+\ temperature variation. The recalibration below affects both the DLL and
+\ the "ZQ" driver strength.
+
+\ DDR3 recalibration will cause the display to glitch if done during display DMA.
+\ The glitch can be avoided by doing the recal just after display frame done.
+\ For example (from inside the screen driver):
+\ : wait-frame-done 0 1c4 lcd! begin 1c4 lcd@ cc00.0000 tuck and = until ;
+
\ This code must be executed from SRAM because it touches the DRAM memory controller
label ddr-recal ( r0: memctrl-va -- )
mov r1, #0x80000000 \ PHY Sync Enable (WO) - Synchronize dclk2x and dclk in the PHY
Author: wmb
Date: Thu Aug 11 02:46:27 2011
New Revision: 2458
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2458
Log:
OLPC XO-1.75 - Added DRAM recalibration.
Added:
cpu/arm/mmp2/dramrecal.fth
Modified:
cpu/arm/olpc/1.75/devices.fth
Added: cpu/arm/mmp2/dramrecal.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/mmp2/dramrecal.fth Thu Aug 11 02:46:27 2011 (r2458)
@@ -0,0 +1,98 @@
+\ See license at end of file
+purpose: Recalibrate DDR3 DRAM
+
+\ This code must be executed from SRAM because it touches the DRAM memory controller
+label ddr-recal ( r0: memctrl-va -- )
+ mov r1, #0x80000000 \ PHY Sync Enable (WO) - Synchronize dclk2x and dclk in the PHY
+ str r1, [r0, #0x240] \ PHY_CTRL14
+
+ \ The value "f" for the reset timer is in units of 256 (memory clock?) cycles, thus
+ \ the timer is set to 256*15
+ ldr r1, [r0, #0x230]
+ orr r1, r1, #0xf0000000 \ DLL Reset timer
+ str r1, [r0, #0x230] \ PHY_CTRL13
+
+ \ Block all Memory Controller accesses until the DLL Reset timer expires
+ mov r1, #0x20000000 \ PHY DLL Reset (WO)
+ str r1, [r0, #0x240] \ PHY_CTRL14
+
+ mov r1, #0x40000000 \ DLL Update enable
+ str r1, [r0, #0x240] \ PHY_CTRL14
+
+ mov r1, #0x80 \ Exit self-refresh
+ str r1, [r0, #0x120] \ USER_INITIATED_COMMAND0
+
+ ldr r1, [r0, #0x80] \ SDRAM_CTRL1
+ orr r1, r1, #0x40 \ DLL_RESET
+ str r1, [r0, #0x80] \ SDRAM_CTRL1
+
+ mov r1, #0x01000000 \ Chip select 0
+ orr r1, r1, #0x00000100 \ Initiate Mode Register Set
+ str r1, [r0, #0x120] \ USER_INITIATED_COMMAND0
+
+ mov r1, #0x01000000 \ Chip select 0
+ orr r1, r1, #0x00001000 \ Initiate ZQ calibration long
+ str r1, [r0, #0x120] \ USER_INITIATED_COMMAND0
+
+ \ ZQ calibration long takes 512 memory clock cycles after a reset
+ \ At 400 MHz, that's a little more than 2 us. We spin here to
+ \ ensure that the recal is complete before we touch the DRAM again.
+ mov r1, #0x100000 \ 512K spins, takes about 2.6 us
+ begin
+ decs r1, #1
+ 0= until
+
+ mov r1, #0x0 \ Normal operation (unblock data requests)
+ str r1, [r0, #0x7e0] \ SDRAM_CTRL14
+
+ mov pc,lr
+end-code
+here ddr-recal - constant /ddr-recal
+
+h# d000.0000 constant memctrl-pa
+h# d000.0000 constant memctrl-va
+h# d100.0000 constant sram-pa
+h# d100.0000 constant sram-va
+sram-va h# 2.0000 + constant 'ddr-recal
+
+: ddr-recal-to-sram ( -- )
+ memctrl-pa h# c02 or memctrl-va map-section \ Map the memory controller
+ sram-pa h# c0e or sram-va map-section \ Make the code cacheable
+ ddr-recal 'ddr-recal /ddr-recal move
+;
+
+stand-init: Setup DDR3 recalibration
+ ddr-recal-to-sram
+;
+
+\ Call this from OFW to perform a recalibration
+code do-recal ( -- )
+ set r0,`memctrl-va #` \ Memory controller virtual address
+ set r1,`'ddr-recal #` \ Address of ddr-recal routine in SRAM
+ mov lr,pc
+ mov pc,r1
+c;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Modified: cpu/arm/olpc/1.75/devices.fth
==============================================================================
--- cpu/arm/olpc/1.75/devices.fth Wed Aug 10 02:57:09 2011 (r2457)
+++ cpu/arm/olpc/1.75/devices.fth Thu Aug 11 02:46:27 2011 (r2458)
@@ -390,6 +390,8 @@
fload ${BP}/cpu/arm/mmp2/thermal.fth
+fload ${BP}/cpu/arm/mmp2/dramrecal.fth
+
\ LICENSE_BEGIN
\ Copyright (c) 2010 FirmWorks
\
Author: wmb
Date: Wed Aug 10 01:54:30 2011
New Revision: 2456
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2456
Log:
Alex - turn off serial output.
Added:
dev/null2.fth
dev/nulluart.fth
Modified:
cpu/x86/pc/alex/config.fth
cpu/x86/pc/alex/devices.fth
cpu/x86/pc/alex/fw.bth
cpu/x86/pc/alex/usb.fth
Modified: cpu/x86/pc/alex/config.fth
==============================================================================
--- cpu/x86/pc/alex/config.fth Wed Aug 10 01:13:17 2011 (r2455)
+++ cpu/x86/pc/alex/config.fth Wed Aug 10 01:54:30 2011 (r2456)
@@ -5,12 +5,12 @@
create coreboot-loaded
create coreboot-qemu
-create debug-startup
+\ create debug-startup
create use-timestamp-counter
create use-tsc-timing
-create serial-console
+\ create serial-console
\ In virtual mode, OFW runs with the MMU on. The advantages are
\ that OFW can automatically locate itself out of the way, at the
Modified: cpu/x86/pc/alex/devices.fth
==============================================================================
--- cpu/x86/pc/alex/devices.fth Wed Aug 10 01:13:17 2011 (r2455)
+++ cpu/x86/pc/alex/devices.fth Wed Aug 10 01:54:30 2011 (r2456)
@@ -81,16 +81,18 @@
fload ${BP}/cpu/x86/pc/isatick.fth \ Use ISA timer as the alarm tick timer
fload ${BP}/cpu/x86/pc/olpc/timertest.fth \ Selftest for PIT timer
+fload ${BP}/dev/pci/isaall.fth
+devalias mouse /isa/8042/mouse
+
+fload ${BP}/cpu/x86/pc/tsccal1.fth
+
[ifdef] resident-packages
support-package: 16550
fload ${BP}/dev/16550pkg/16550.fth \ Serial port support package
end-support-package
[then]
-fload ${BP}/dev/pci/isaall.fth
-devalias mouse /isa/8042/mouse
-
-fload ${BP}/cpu/x86/pc/tsccal1.fth
+fload ${BP}/dev/null2.fth
0 0 hex mem-uart-base (u.) " /" begin-package
4 encode-int 0 encode-int encode+ " interrupts" property
@@ -99,7 +101,13 @@
fload ${BP}/dev/16550pkg/isa-int.fth
end-package
devalias com1 /serial:115200
-: com1 ( -- adr len ) " com1" ; ' com1 to fallback-device
+: com1 ( -- adr len ) " com1" ;
+[ifdef] serial-console
+' com1 to fallback-device
+[else]
+: devnull ( -- adr len ) " /null" ;
+' devnull to fallback-device
+[then]
0 0 " i70" " /isa" begin-package \ Real-time clock node
fload ${BP}/dev/ds1385r.fth
@@ -166,8 +174,13 @@
;
fload ${BP}/cpu/x86/inoutstr.fth \ Multiple I/O port read/write
+
+[ifdef] serial-console
fload ${BP}/dev/isa/diaguart.fth \ ISA COM port driver
fload ${BP}/forth/lib/sysuart.fth \ Use UART for key and emit
+[else]
+fload ${BP}/dev/nulluart.fth \ Null UART driver
+[then]
0 value keyboard-ih
0 value screen-ih
Modified: cpu/x86/pc/alex/fw.bth
==============================================================================
--- cpu/x86/pc/alex/fw.bth Wed Aug 10 01:13:17 2011 (r2455)
+++ cpu/x86/pc/alex/fw.bth Wed Aug 10 01:54:30 2011 (r2456)
@@ -210,8 +210,8 @@
fload ${BP}/cpu/x86/pc/alex/yuv2rgb.fth \ YUV2 to RGB conversion
fload ${BP}/cpu/x86/pc/alex/vstest.fth \ Video stream test helpers
-\ false to stand-init-debug?
-true to stand-init-debug?
+false to stand-init-debug?
+\ true to stand-init-debug?
hex
stand-init-debug? [if]
@@ -244,13 +244,9 @@
: probe-all ( -- )
" probe-" do-drop-in
- ." probe-pci" cr
-\ debug-me
probe-pci
- probe-usb
- report-net
- report-disk
report-pci-fb
+ silent-probe-usb
;
\ This reduces processor use when waiting for a key. It helps
@@ -261,13 +257,15 @@
: startup ( -- )
standalone? 0= if exit then
- ." nvramrc" cr
- use-nvramrc? if nvramrc safe-evaluate then
+ use-nvramrc? if nvramrc safe-evaluate then
auto-banner? if
" Probing" ?type probe-all
install-mux-io
-\ " Install console" ?type install-console
+[ifndef] serial-console
+ fallback-in-ih remove-input
+ fallback-out-ih remove-output
+[then]
\ ?usb-keyboard
banner
then
@@ -285,6 +283,7 @@
." See "
blue-letters ." http://wiki.laptop.org/go/Forth_Lessons" black-letters
cr cr
+ ." Type menu to run diagnostics" cr
quit
;
Modified: cpu/x86/pc/alex/usb.fth
==============================================================================
--- cpu/x86/pc/alex/usb.fth Wed Aug 10 01:13:17 2011 (r2455)
+++ cpu/x86/pc/alex/usb.fth Wed Aug 10 01:54:30 2011 (r2456)
@@ -41,7 +41,13 @@
pwd$ $nopage-show-devs
then
;
+: show-usb ( -- )
+ ." USB2 devices:" cr
+ " /" ['] (show-usb2) scan-subtree
+ ." USB1 devices:" cr
+ " /" ['] (show-usb1) scan-subtree
+;
: silent-probe-usb ( -- )
" /" ['] (probe-usb2) scan-subtree
" /" ['] (probe-usb1) scan-subtree
@@ -49,12 +55,7 @@
;
: probe-usb ( -- )
silent-probe-usb
-
- ." USB2 devices:" cr
- " /" ['] (show-usb2) scan-subtree
-
- ." USB1 devices:" cr
- " /" ['] (show-usb1) scan-subtree
+ show-usb
;
alias p2 probe-usb
Added: dev/null2.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/null2.fth Wed Aug 10 01:54:30 2011 (r2456)
@@ -0,0 +1,41 @@
+\ See license at end of file
+purpose: Null I/O package - discards output, provides no input
+
+dev /
+new-device
+
+" null" device-name
+
+: open ( -- flag ) true ;
+: close ( -- ) ;
+: size ( -- ud ) 0 0 ;
+: seek ( ud -- error? ) or ; \ error if ud is not 0 0
+: write ( adr len -- actual ) nip ; \ Return actual = len
+: read ( adr len -- actual ) 2drop -2 ; \ Return -2, indicating no input
+
+finish-device
+device-end
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: dev/nulluart.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/nulluart.fth Wed Aug 10 01:54:30 2011 (r2456)
@@ -0,0 +1,47 @@
+\ See license at end of file
+purpose: Null diagnostic UART driver
+
+: inituarts ( -- ) ;
+: ukey? ( -- flag ) false ;
+: uemit? ( -- flag ) false ;
+: uemit ( char -- ) drop ;
+: ukey ( -- char ) drop ;
+: ubreak? ( -- flag ) false ;
+: clear-break ( -- ) ;
+
+: install-uart-io ( -- )
+ ['] lf-pstr is newline-pstring
+ ['] false is key?
+ ['] 0 is (key
+ ['] drop is (emit
+ ['] default-type is (type
+ ['] emit1 is emit
+ ['] type1 is type
+ ['] crlf is cr
+ ['] true is (interactive?
+ ['] cancel is light
+;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END