On 9/26/07, Alexander Voropay <alec(a)nwpi.ru> wrote:
> <vlad(a)comsys.ro> wrote:
>
> >>> - QEMU malta emulation is not really complete, to put it mildly
> >> Out of curiosity, what parts did you miss?
> > Like, for example, the PCI stuff. So I can use the network card.
>
> PCI stuff in the QEMU/Malta works fine, but pseudo-bootrom
> does not perform PCI enumeration and leaves uninitialized PCI BARs.
>
> Linux MIPS/Malta 2.4 can not perform PCI enumeration too. The LANCE
> Ethernet driver *requres* a pre-initialized BARs. The situation even worse,
> since current Linux 2.4 can't be even built with NEW_PCI and PCI_AUTO
> options at all (due to linkage error).
>
> http://www.linux-mips.org/wiki/PCI_Subsystem
>
> There is the same PCI problem with NetBSD/evbmips and seems VxWorks/Malta.
>
> > And yes, I am aware of YAMON.
>
> AFAIK, YAMON may runs on the MIPS hardware only, and may not
> be redistribuded in the source or binary form.
>
> Anyway, YAMON binary does not work on the Qemu/Malta. The Galileo
> chip is far more complicated then Qemu emulation. It contains four DMA
> channels, four timers e.t.c. e.t.c.
>
> >> I recommend to improve the Qemu Malta emulation, and make it work with
> >> 2.4 Malta kernels. (ISTR it used to work, so it shouldn't need a lot to
> >> get there.)
> >
> > I'm sure that improving the Qemu Malta emulation is a very noble goal,
> > but for people that need a working 2.4 kernel NOW, my patch could be
> > useful. Having the QEMU target in 2.6 surely helped me.
>
> The only thing we need is a good bootrom (BIOS) for the MIPS/Malta
> (Free-YAMON ;)
Someone could port OpenBIOS or LinuxBIOS to MIPS.
Author: wmb
Date: 2007-09-20 00:22:01 +0200 (Thu, 20 Sep 2007)
New Revision: 632
Modified:
cpu/x86/pc/olpc/fw.bth
dev/olpc/dcon/dcon.fth
dev/pckbd.fth
Log:
OLPC - made it possible to control screen brightness and startup sound
volume from the keyboard.
Modified: cpu/x86/pc/olpc/fw.bth
===================================================================
--- cpu/x86/pc/olpc/fw.bth 2007-09-19 22:21:09 UTC (rev 631)
+++ cpu/x86/pc/olpc/fw.bth 2007-09-19 22:22:01 UTC (rev 632)
@@ -347,6 +347,39 @@
' olpc-power-off to power-off
[then]
+: dimmer ( -- ) screen-ih if " dimmer" screen-ih $call-method then ;
+: brighter ( -- ) screen-ih if " brighter" screen-ih $call-method then ;
+
+dev /8042/keyboard
+0 value waiting-up?
+: olpc-check-abort ( scan-code -- abort? ) \ Square pressed?
+ last-scan over to last-scan ( scan-code old-scan-code )
+ h# e0 <> if drop false exit then ( scan-code )
+
+ check-abort? 0= if drop false exit then ( scan-code )
+
+ dup h# 7f and h# 5d <> if drop false exit then ( scan-code )
+
+ h# 80 and if \ Up
+ false to waiting-up?
+ false ( abort? )
+ else
+ secure? if false else waiting-up? 0= then ( abort? )
+ true to waiting-up?
+ then
+;
+patch olpc-check-abort check-abort get-scan
+
+: handle-volume? ( scan-code -- scan-code flag )
+ dup h# 43 = if dimmer true exit then
+ dup h# 44 = if brighter true exit then
+ dup h# 57 = if softer true exit then
+ dup h# 58 = if louder true exit then
+ false
+;
+' handle-volume? to scan-handled?
+dend
+
\ Eliminate 4 second delay in install console for the case where
\ there is no keyboard. The delay is unnecessary because the screen
\ does not go blank when the device is closed.
@@ -477,14 +510,6 @@
?usb-keyboard
;
-: start-sound ( -- )
- playback-volume >r d# -9 to playback-volume
- ['] load-started behavior >r
- ['] noop to load-started
- " rom:splash" ['] $play-wav catch if 2drop then
- r> to load-started
- r> to playback-volume
-;
: go-hook-freeze
[ ' go-hook behavior compile, ]
0 " set-source" $call-screen
@@ -492,11 +517,11 @@
: freeze ( -- ) ['] go-hook-freeze to go-hook ;
: unfreeze ( -- ) ['] usb-quiet to go-hook ;
-: ?start-sound ( -- )
- game-key-mask h# 40 and 0= if start-sound then
+: ?sound ( -- )
+ game-key-mask h# 40 and 0= if sound then
;
: ?freeze ( -- )
- game-key-mask h# 10 and 0= if freeze then
+ game-key-mask h# 40 and 0= if freeze then
;
: ?games ( -- )
game-key-mask h# 20 and if
@@ -517,7 +542,8 @@
fast-boot? if
stdout off
probe-pci
- ?start-sound
+ ?sound
+ open-keyboard
?freeze
['] false to interrupt-auto-boot?
probe-usb
@@ -528,12 +554,11 @@
[then]
auto-boot
screen-ih stdout !
- open-keyboard
?usb-keyboard
else
banner
probe-pci
- ?start-sound
+ ?sound
open-keyboard
?games
?freeze
Modified: dev/olpc/dcon/dcon.fth
===================================================================
--- dev/olpc/dcon/dcon.fth 2007-09-19 22:21:09 UTC (rev 631)
+++ dev/olpc/dcon/dcon.fth 2007-09-19 22:22:01 UTC (rev 632)
@@ -117,6 +117,9 @@
: timeout! ( to -- ) 8 dcon! ; \ def: h# ffff
: scanint! ( si -- ) 9 dcon! ; \ def: h# 0000
: bright! ( level -- ) d# 10 dcon! ; \ def: h# xxxF
+: bright@ ( -- level ) d# 10 dcon@ ;
+: brighter ( -- ) bright@ 1+ h# f min bright! ;
+: dimmer ( -- ) bright@ 1- 0 max bright! ;
\ Colour swizzle, AA, no passthrough, backlight
: set-color ( color? -- )
Modified: dev/pckbd.fth
===================================================================
--- dev/pckbd.fth 2007-09-19 22:21:09 UTC (rev 631)
+++ dev/pckbd.fth 2007-09-19 22:22:01 UTC (rev 632)
@@ -386,6 +386,8 @@
init-data
kbd-reset 0= to keyboard-present?
;
+defer scan-handled?
+' false to scan-handled?
headerless
: check-abort ( scan-code -- flag ) \ Ctrl-break pressed?
check-abort? if
@@ -409,12 +411,11 @@
begin
get-data?
while ( scan-code )
- dup enque ( scan-code )
-
\ In the following code, we must be careful to unlock the
\ queue before calling user-abort, because a timer interrupt
\ can occur at any time after user-abort is executed.
- check-abort if
+ dup check-abort if ( scan-code )
+ drop
unlock user-abort
\ Wait here for long enough to ensure that an alarm timer tick
\ will happen if it is going to happen. This is the safest
@@ -430,7 +431,8 @@
\ if the alarm tick is turned off.
d# 20 ms
exit
- then
+ then ( scan-code )
+ scan-handled? if drop else enque then ( )
repeat
unlock
;
Author: wmb
Date: 2007-09-20 00:19:21 +0200 (Thu, 20 Sep 2007)
New Revision: 630
Added:
cpu/x86/pc/olpc/sound.fth
Modified:
dev/geode/ac97/ac97.fth
Log:
OLPC audio - Added persistent storage for the startup sound playback volume.
Added: cpu/x86/pc/olpc/sound.fth
===================================================================
--- cpu/x86/pc/olpc/sound.fth (rev 0)
+++ cpu/x86/pc/olpc/sound.fth 2007-09-19 22:19:21 UTC (rev 630)
@@ -0,0 +1,64 @@
+purpose: Manage startup sound, with persistent storage for its volume
+\ See license at end of file
+
+h# -9 constant default-volume
+: set-saved-volume ( volume -- ) dup h# 80 cmos! invert h# 81 cmos! ;
+
+: get-saved-volume ( -- volume )
+ h# 80 cmos@ h# 81 cmos@ ( volume check )
+ over xor h# ff <> if ( volume )
+ drop default-volume set-saved-volume
+ default-volume
+ then
+
+ dup h# 80 and if \ Sign extend
+ h# ffffff00 or
+ else
+ dup 0> if
+ drop default-volume set-saved-volume
+ default-volume
+ then
+ then
+;
+
+: +volume ( increment -- )
+ get-saved-volume + 0 min d# -50 max set-saved-volume
+ audio-ih if get-saved-volume " set-volume" $call-audio then
+;
+: softer ( -- ) -2 +volume ;
+: louder ( -- ) 2 +volume ;
+
+: sound ( -- )
+ get-saved-volume d# -50 <= if exit then
+ playback-volume >r get-saved-volume to playback-volume
+ ['] load-started behavior >r
+ ['] noop to load-started
+ " rom:splash" ['] $play-wav catch if 2drop then
+ r> to load-started
+ r> to playback-volume
+;
+
+
+\ 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
Modified: dev/geode/ac97/ac97.fth
===================================================================
--- dev/geode/ac97/ac97.fth 2007-09-19 22:17:59 UTC (rev 629)
+++ dev/geode/ac97/ac97.fth 2007-09-19 22:19:21 UTC (rev 630)
@@ -225,6 +225,7 @@
: set-volume ( db -- )
dup 0> if drop 0 then
negate 1+ 2* 3 / dup bwjoin to volume
+ volume h# 38 codec! \ headphone/surround output pin gain
;
: open-out ( -- )