Author: wmb Date: Fri Mar 5 07:55:23 2010 New Revision: 1762 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1762
Log: OLPC trac 10053 - XO-1.5 - Flaky audio selftest. Fixed buffer overflow with debugging routine for plotting impulse response. Doesn't affect normal testing.
Modified: cpu/x86/pc/olpc/plot.fth dev/hdaudio/noiseburst.fth dev/hdaudio/test.fth
Modified: cpu/x86/pc/olpc/plot.fth ============================================================================== --- cpu/x86/pc/olpc/plot.fth Fri Mar 5 05:55:13 2010 (r1761) +++ cpu/x86/pc/olpc/plot.fth Fri Mar 5 07:55:23 2010 (r1762) @@ -38,9 +38,9 @@ fill-rectangle ; : waveform-start ( -- ) 0 wave0 moveto ; -: draw-wave ( adr ) - 0 swap ( last adr ) - screen-width 0 do ( last adr ) +: draw-wave ( adr #samples -- ) + 0 -rot ( last adr #samples ) + 0 do ( last adr ) tuck <w@ ( adr last this-unscaled ) wave-scale >>a ( adr last this ) tuck swap - ( adr this distance ) @@ -49,7 +49,8 @@ loop ( last adr ) 2drop ; -: waveform ( adr -- ) clear-waveform waveform-start draw-wave ; +: waveform ( adr -- ) clear-waveform waveform-start screen-width draw-wave ; +: wave ( adr #samples -- ) clear-waveform waveform-start draw-wave ; : vgrid ( width height interval -- ) rot 0 ?do ( height interval ) i plot0 nip moveto ( height interval ) @@ -67,7 +68,7 @@ dend
\ : $call-screen ( ? name$ -- ? ) stdout @ $call-method ; -: wave ( adr -- ) " waveform" $call-screen ; +: wave ( adr #samples -- ) " wave" $call-screen ; : clear-plot ( width height -- ) " clear-plot" $call-screen ; : lineplot ( xt xmin xmax xscale ymin ymax -- ) " plot" $call-screen ; : vgrid ( width height interval -- ) " vgrid" $call-screen ;
Modified: dev/hdaudio/noiseburst.fth ============================================================================== --- dev/hdaudio/noiseburst.fth Fri Mar 5 05:55:13 2010 (r1761) +++ dev/hdaudio/noiseburst.fth Fri Mar 5 07:55:23 2010 (r1762) @@ -383,11 +383,12 @@ d# 70 < ;
-d# 1024 /w* buffer: impulse-response +d# 1200 constant #impulse-response +#impulse-response /w* buffer: impulse-response
: calc-sm-impulse ( offset -- adr ) \ offset is 0 for left or 2 for right pb + rb #samples ( adr1 adr2 #samples ) - d# 1200 0 do + #impulse-response 0 do 3dup swap i wa+ swap stereo-mono-covar ( adr1 adr2 #samples d.covar ) d# 50000000 m/mod nip ( adr1 adr2 #samples n.covar ) impulse-response i wa+ w! ( adr1 adr2 #samples ) @@ -397,7 +398,7 @@ ; : calc-stereo-impulse ( offset -- adr ) \ offset is 0 for left or 2 for right dup pb + swap rb + #samples ( adr1 adr2 #samples ) - d# 1200 0 do + #impulse-response 0 do 3dup swap i wa+ swap stereo-covar ( adr1 adr2 #samples d.covar ) d# 50000000 m/mod nip ( adr1 adr2 #samples n.covar ) impulse-response i wa+ w! ( adr1 adr2 #samples )
Modified: dev/hdaudio/test.fth ============================================================================== --- dev/hdaudio/test.fth Fri Mar 5 05:55:13 2010 (r1761) +++ dev/hdaudio/test.fth Fri Mar 5 07:55:23 2010 (r1762) @@ -101,6 +101,7 @@ ; false value plot? \ Set to true to plot the impulse response, for debugging : plot-impulse ( adr -- ) + d# 600 ( adr #samples ) " 0 set-fg h# ffff set-bg single-drawing clear-drawing wave" evaluate key ascii d = if debug-me then ;