Changeset 2630
- Timestamp:
- Oct 22, 2011 5:40:03 AM (19 months ago)
- Location:
- cpu/arm/olpc/1.75
- Files:
-
- 2 edited
-
alc5631.fth (modified) (3 diffs)
-
sound.fth (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cpu/arm/olpc/1.75/alc5631.fth
r2598 r2630 31 31 \ In our system, SPKVDD is 5V and AVDD is 3.3V, so we need a gain ratio <= 1.51 . 32 32 \ The value 3 gives a ratio of 1.44, and value 4 gives a ratio of 1.56 . We use 3. 33 h# 3e00 h# 40 codec! \ Speaker Amp Ratio GAIN is 1.44x, no HPFs33 h# 3e00 h# 40 codec! \ Speaker Amp Ratio GAIN is 1.44x, HPF on ADC and DAC 34 34 35 35 h# 0000 h# 42 codec! \ Use MCLK, not PLL … … 43 43 : mic-bias-on ( -- ) h# 000c h# 3b codec-set ; 44 44 45 : mic1-high-bias ( -- ) h# 80 h# 22 codec-clr mic-bias-on; \ 0.90*AVDD, e.g. 3V with AVDD=3.3V46 : mic1-low-bias ( -- ) h# 80 h# 22 codec-set mic-bias-on; \ 0.75*AVDD, e.g. 2.5V with AVDD=3.3V47 : mic2-high-bias ( -- ) h# 08 h# 22 codec-clr mic-bias-on; \ 0.90*AVDD, e.g. 3V with AVDD=3.3V48 : mic2-low-bias ( -- ) h# 08 h# 22 codec-set mic-bias-on; \ 0.75*AVDD, e.g. 2.5V with AVDD=3.3V45 : mic1-high-bias ( -- ) h# 80 h# 22 codec-clr ; \ 0.90*AVDD, e.g. 3V with AVDD=3.3V 46 : mic1-low-bias ( -- ) h# 80 h# 22 codec-set ; \ 0.75*AVDD, e.g. 2.5V with AVDD=3.3V 47 : mic2-high-bias ( -- ) h# 08 h# 22 codec-clr ; \ 0.90*AVDD, e.g. 3V with AVDD=3.3V 48 : mic2-low-bias ( -- ) h# 08 h# 22 codec-set ; \ 0.75*AVDD, e.g. 2.5V with AVDD=3.3V 49 49 50 50 : depop! ( value -- ) h# 54 codec! ; … … 202 202 : adc-stereo-reversed ( -- ) h# c000 adc-source ; \ L->R, R->L (channels swapped) 203 203 204 true value mic-bias? 204 205 : open-in-specific ( -- ) 205 h# 000c h# 3b codec-set\ Power on MIC1/2 bias206 mic-bias? if mic-bias-on else mic-bias-off then \ Power on MIC1/2 bias 206 207 adc-stereo 207 208 h# 0c00 h# 3b codec-set \ Power on RECMIXLR -
cpu/arm/olpc/1.75/sound.fth
r2598 r2630 401 401 402 402 0 value mono? 403 : stereo false to mono? ; 404 : mono true to mono? ; 405 406 : average-channel ( adr -- n ) 407 0 swap /audio-buf bounds do ( accum ) 408 i <w@ + ( accum' ) 409 /l +loop ( accum ) 410 /audio-buf /l / / ( average ) 411 ; 412 : average-in ( -- ) 413 my-in-desc 2 la+ l@ ( adr ) 414 (cr push-decimal ( adr ) 415 dup average-channel ( adr average ) 416 6 .r space ( adr ) 417 wa1+ average-channel ( average ) 418 6 .r ( ) 419 pop-base ( ) 420 my-in-desc 3 la+ l@ to my-in-desc 421 ; 422 : audio-watch ( -- ) 423 setup-sspa-rx ( ) 424 make-in-ring ( ) 425 start-in-ring ( ) 426 master-rx ( ) 427 begin ( ) 428 wait-in ( ) 429 average-in ( ) 430 key? until ( ) 431 disable-sspa-rx ( ) 432 stop-in-ring ( ) 433 reset-rx ( ) 434 ; 435 : watch-dc ( bias? -- ) 436 to mic-bias? 437 d# 143 gpio-set \ DC input mode 438 h# 0400 h# 40 codec-clr 439 open-in 440 stereo 0 set-adc-gain 0 set-mic-gain 441 \ High bias gets us closer to the top of the digital range - but bias can 442 \ be turned off completely with "false to mic-bias?" 443 mic1-high-bias mic2-high-bias 444 audio-watch 445 close-in 446 ; 447 403 448 0 value in-adr0 404 449 0 value in-len0 … … 504 549 set-adc-gain 505 550 ; 506 507 : stereo false to mono? ;508 : mono true to mono? ;509 551 510 552 : init-codec ( -- ) … … 570 612 571 613 end-package 614 615 : (watch-dc) ( bias? -- ) 616 " /audio" open-dev >r ( bias? r: ihandle ) 617 " watch-dc" r@ $call-method ( r: ihandle ) 618 r> close-dev ( ) 619 ; 620 : watch-dc-biased ( -- ) true (watch-dc) ; 621 : watch-dc-unbiased ( -- ) false (watch-dc) ; 622 572 623 573 624 \ LICENSE_BEGIN
Note: See TracChangeset
for help on using the changeset viewer.
