Changeset 3623
 Timestamp:
 Mar 25, 2013, 11:36:14 PM (2 years ago)
 Files:

 1 added
 6 edited
Legend:
 Unmodified
 Added
 Removed

cpu/arm/olpc/buildfw.fth
r3585 r3623 741 741 742 742 fload ${BP}/cpu/arm/saverom.fth \ Save the dictionary for standalone startup 743 744 fload ${BP}/forth/lib/lfsr.fth 745 0 value lfsrstate 746 : initaudionoise (  ) 747 randomlong to lfsrstate 748 \ Use a polynomial with a 32bit period 749 lfsrpolynomials d# 32 na+ @ to lfsrpoly 750 ; 751 : audionoise (  n ) lfsrstate lfsrstep dup to lfsrstate ; 743 752 744 753 fload ${BP}/dev/hdaudio/noiseburst.fth \ audiotest support package 
cpu/arm/olpc/sound.fth
r3532 r3623 183 183 false 184 184 ; 185 \ This is a grotesque workaround for a hardware problem. The audio 186 \ subsystem (SSPA + ADMA) works reasonably reliably right after the 187 \ audio island is powered on, but subsequent tries tend to get 188 \ confused about which channel is which, and possibly about the 189 \ initial SSPA FIFO contents. Resetting between test phases makes 190 \ the test work more reliably. Attempts to get help from the vendor, 191 \ over a long period of time, were unsuccessful. 192 : resetaudio (  ) audioclockoff d# 50 ms audioclockon drop ; 185 193 186 194 : resetrx (  ) h# 8000.0002 h# 0c sspa! ; 
cpu/x86/pc/olpc/via/fw.bth
r3618 r3623 480 480 481 481 fload ${BP}/cpu/x86/pc/olpc/via/padlock.fth \ Via security engine 482 alias initaudionoise noop 483 alias audionoise randomlong 482 484 fload ${BP}/dev/hdaudio/noiseburst.fth \ audiotest support package 483 485 
dev/hdaudio/noiseburst.fth
r3424 r3623 621 621 622 622 : preparesignal (  outadr, len inadr,len ) 623 initaudionoise 624 \ Doing the noise 16 bits at a time does a better job 625 \ of decorrelating the channels compared to storing 626 \ a 32bit "random" number 623 627 [ifdef] debuganalyzer? 624 628 debuganalyzer? if 625 629 pb /pb d# 1000 d# 48000 make2tones 626 630 else 627 pb /pb bounds do randomlong i l! /l+loop631 pb /pb bounds do audionoise i w! /w +loop 628 632 then 629 633 [else] 630 pb /pb bounds do randomlong i l! /l+loop634 pb /pb bounds do audionoise i w! /w +loop 631 635 [then] 632 636 pb /pb stereowmean 
dev/hdaudio/test.fth
r3450 r3623 228 228 analysisparameters " setanalysisparameters" $callanalyzer 229 229 acoustictest 230 [ifdef] resetaudio resetaudio [then] 230 231 loopbacktest 231 232 ; 
forth/lib/lfsr.fth
r2377 r3623 2 2 purpose: Linear feedback shift register code and related memory tests 3 3 4 0 value lfsrstate5 6 4 0 value lfsrpoly 7 : lfsrstep ( state  state' )8 dup 2/ swap 1 and if lfsrpoly xor then9 ;10 5 11 6 [ifdef] armassembler … … 18 13 then 19 14 c; 20 code lfsrfill ( adr seed polynomial  adr' )21 \ tos:polynomial22 ldmia sp!,{r0,r1} \ r0:seed r1:adr23 mov r2,r0 \ r2:lfsr24 begin25 str r2,[r1],#426 movs r2,r2,lsr #127 eorcs r2,r2,tos28 cmp r2,r029 = until30 mov tos,r131 c;32 code randomfill ( adr len data index polynomial  )33 ldmia sp!,{r1,r2,r3,r4} \ tos:poly r1:index r2:data r3:len r4:adr34 35 movs r3,r3,lsr #2 \ Convert to longword count36 nxteq37 38 sub r0,r3,#1 \ r0:remaining count39 40 \ r3:addresslfsr r4:datalfsr r5:datapoly41 set r5,#0x80200003 \ 32bit polynomial42 43 begin44 \ Compute new data value with an LFSR step45 movs r2,r2,lsr #146 eorcs r2,r2,r547 48 \ Compute new address index, discarding values >= len49 begin50 movs r1,r1,lsr #151 eorcs r1,r1,tos52 cmp r1,r353 u< until54 55 \ Write the "random" value to the "random" address (adr[index])56 str r2,[r4,r1,lsl #2]57 58 decs r0,#159 0= until60 61 pop tos,sp62 c;63 code randomcheck ( adr len data index remain polynomial  false  adr len data index remain true )64 ldmia sp!,{r0,r1,r2,r3,r4} \ tos:poly r0:remain r1:index r2:data r3:len r4:adr65 66 cmp r0,#067 moveq tos,#0 \ Return false68 nxteq69 70 mov r7,r3,lsr #2 \ Convert to longword count71 72 set r5,#0x80200003 \ 32bit polynomial73 74 begin75 \ Compute new data value with an LFSR step76 movs r2,r2,lsr #177 eorcs r2,r2,r578 79 \ Compute new address index, discarding values >= len80 begin81 movs r1,r1,lsr #182 eorcs r1,r1,tos83 cmp r1,r784 u< until85 86 \ Read the value at the "random" address (adr[index])87 ldr r6,[r4,r1,lsl #2]88 89 \ Compare it to the calculated value90 cmp r6,r291 92 decne r0,#193 stmnedb sp!,{r0,r1,r2,r3,r4} \ Push results94 mvnne tos,#0 \ True on top of stack95 nxtne96 97 decs r0,#198 0= until99 100 mov tos,#0101 c;102 [then]103 15 0 [if] \ This is for testing the period of various polynomials 104 16 code lfsrperiod ( polynomial  period ) … … 128 40 c; 129 41 [then] 42 [ifndef] lfsrstep 43 : lfsrstep ( state  state' ) 44 dup 2/ swap 1 and if lfsrpoly xor then 45 ; 46 [then] 130 47 131 48 0 [if] … … 147 64 \ The values come from the Wikipedia article for Linear Feedback Shift Register and from 148 65 \ http://www.xilinx.com/support/documentation/application_notes/xapp052.pdf 149 create polynomials \ #bits period 66 create lfsrpolynomials 67 \ #bits period 150 68 h# 0 , \ 0 0 151 69 h# 1 , \ 1 1 … … 182 100 h# 80200003 , \ 32 ffffffff 183 101 184 : rounduplog2 ( n  log2 )185 dup log2 ( n log2 )186 tuck 1 swap lshift ( log2 n 2^log2 )187 >  ( log2' )188 ;189 190 defer .lfsrmemerror191 : (.lfsrmemerror) ( adr len data index remain  adr len data index remain )192 pushhex193 ." Error at address " 4 pick 2 pick la+ dup 8 u.r ( adr len data index remain erradr )194 ."  expected " 3 pick 8 u.r ( adr len data index remain erradr )195 ." got " l@ 8 u.r cr196 popbase197 ;198 ' (.lfsrmemerror) to .lfsrmemerror199 : randomtest ( adr len  )200 dup /l <= if 2drop exit then ( adr len #bits )201 dup /l / rounduplog2 ( adr len #bits )202 polynomials swap la+ l@ ( adr len polynomial )203 204 3dup 1 1 rot randomfill ( adr len polynomial )205 206 >r ( adr len r: polynomial )207 1 1 third /l / 1 ( adr len data index remain r: polynomial )208 begin ( adr len data index remain r: polynomial )209 r@ randomcheck ( false  adr len data index remain true r: polynomial )210 while ( adr len data index remain r: polynomial )211 .lfsrmemerror ( adr len data index remain r: polynomial )212 repeat ( r: polynomial )213 r> drop214 ;215 216 102 \ LICENSE_BEGIN 217 103 \ Copyright (c) 2010 FirmWorks
Note: See TracChangeset
for help on using the changeset viewer.