Changeset 2226


Ignore:
Timestamp:
May 26, 2011, 1:56:39 AM (4 years ago)
Author:
wmb
Message:

OLPC trac #10896 - Implement persistent volume control for XO-1.75 (in the process, I moved the relevant code, which was duplicated between XO-1 and XO-1.5, into a common file that is used by all versions).

Location:
cpu
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/olpc/1.75/fw.bth

    r2225 r2226  
    232232;
    233233code halt  ( -- )  wfi   c;
     234
     235: dimmer  ( -- )  screen-ih  if  " dimmer" screen-ih $call-method  then  ;
     236: brighter  ( -- )  screen-ih  if  " brighter" screen-ih $call-method  then  ;
     237
    234238fload ${BP}/cpu/x86/pc/olpc/sound.fth
    235239fload ${BP}/cpu/x86/pc/olpc/guardrtc.fth
  • cpu/arm/olpc/1.75/sound.fth

    r2103 r2226  
    1 0 0  " d42a0c00"  " /" begin-package
     10 0  " d42a0800"  " /" begin-package
    22" audio" name
    3 my-space h# 40 reg
    4 
    5 h# d42a.0c00 constant sspa-base
    6 h# d42a.0800 constant adma-base
     3my-space h# 800 reg
     4
     50 value sspa-base  \ E.g. h# d42a.0c00
     60 value adma-base  \ E.g. h# d42a.0800
    77: sspa!  ( n offset -- )  sspa-base + l!  ;  \ Write a register in SSPA1
    88: sspa@  ( offset -- n )  sspa-base + l@  ;  \ Read a register in SSPA1
     
    171171;
    172172
     173[ifdef] cl2-a1
     174: choose-smbus  ( -- )  h# 30 1 set-twsi-target  ;
     175[else]
     176: choose-smbus  ( -- )  h# 34 1 set-twsi-target  ;
     177[then]
     178
    173179\ Reset is unconnected on current boards
    174180\ : audio-reset  ( -- )  8 gpio-clr  ;
    175181\ : audio-unreset  ( -- )  8 gpio-set  ;
    176 : codec@  ( reg# -- w )  1 2 twsi-get  swap bwjoin  ;
    177 : codec!  ( w reg# -- )  >r wbsplit r> 3 twsi-write  ;
     182: codec@  ( reg# -- w )  choose-smbus  1 2 twsi-get  swap bwjoin  ;
     183: codec!  ( w reg# -- )  choose-smbus  >r wbsplit r> 3 twsi-write  ;
    178184: codec-i@  ( index# -- w )  h# 6a codec!  h# 6c codec@  ;
    179185: codec-i!  ( w index# -- )  h# 6a codec!  h# 6c codec!  ;
     
    347353
    348354[ifdef] cl2-a1
    349 : init-smbus  ( -- )  h# 30 1 set-twsi-target  ;
    350 
    351355fload ${BP}/cpu/arm/olpc/1.75/alc5624.fth  \ Realtek ALC5624 CODEC
    352356[else]
    353 : init-smbus  ( -- )  h# 34 1 set-twsi-target  ;
    354 
    355357: headphones-inserted?  ( -- flag )  d# 97 gpio-pin@  ;
    356358: microphone-inserted?  ( -- flag )  d# 96 gpio-pin@  ;
     
    379381
    380382: init-codec  ( -- )
    381    init-smbus
    382383   codec-on
    383384   set-default-gains
     
    3863870 value open-count
    387388: open  ( -- flag )
    388    open-count 0=  if  audio-clock-on  init-codec  then
     389   open-count 0=  if
     390      my-space h# 800 " map-in" $call-parent to adma-base
     391      adma-base h# 400 + to sspa-base
     392      audio-clock-on  init-codec
     393   then
    389394   open-count 1+ to open-count
    390395   true
     
    393398   open-count 1 =  if
    394399      uninstall-playback-alarm  codec-off  ( audio-clock-off )
     400      adma-base h# 800 " map-out" $call-parent
     401      0 to adma-base  0 to sspa-base
    395402   then
    396403   open-count 1- 0 max to open-count
  • cpu/x86/pc/olpc/fw.bth

    r2196 r2226  
    360360fload ${BP}/cpu/x86/pc/olpc/biosresume.fth
    361361
     362: dimmer  ( -- )  screen-ih  if  " dimmer" screen-ih $call-method  then  ;
     363: brighter  ( -- )  screen-ih  if  " brighter" screen-ih $call-method  then  ;
     364
    362365fload ${BP}/cpu/x86/pc/olpc/setwp.fth
    363366fload ${BP}/cpu/x86/pc/olpc/sound.fth
     
    388391\needs ramdisk  " " d# 128 config-string ramdisk
    389392" "   ' boot-file      set-config-string-default   \ Let the boot script set the cmdline
    390 
    391 : dimmer  ( -- )  screen-ih  if  " dimmer" screen-ih $call-method  then  ;
    392 : brighter  ( -- )  screen-ih  if  " brighter" screen-ih $call-method  then  ;
    393 
    394 dev /8042/keyboard
    395 0 value waiting-up?
    396 : olpc-check-abort  ( scan-code -- abort? )  \ Square pressed?
    397    last-scan   over to last-scan  ( scan-code old-scan-code )
    398    h# e0 <>  if  drop false exit  then          ( scan-code )
    399 
    400    check-abort?  0=  if  drop false exit  then  ( scan-code )
    401 
    402    dup h# 7f and  h# 5d <>  if  drop false exit then  ( scan-code )
    403 
    404    h# 80 and  if   \ Up
    405       false to waiting-up?
    406       false                             ( abort? )
    407    else
    408       secure?  if  false  else  waiting-up?  0=  then   ( abort? )
    409       true to waiting-up?
    410    then
    411 ;
    412 patch olpc-check-abort check-abort get-scan
    413 
    414 : handle-volume?  ( scan-code -- scan-code flag )
    415    dup h# 43 =  if  dimmer    true exit  then
    416    dup h# 44 =  if  brighter  true exit  then
    417    dup h# 57 =  if  softer    true exit  then
    418    dup h# 58 =  if  louder    true exit  then
    419    false
    420 ;
    421 ' handle-volume?  to scan-handled?
    422 dend
    423393
    424394\ Eliminate 4 second delay in install console for the case where
  • cpu/x86/pc/olpc/sound.fth

    r2072 r2226  
    5555;
    5656
     57dev /keyboard
     580 value waiting-up?
     59: olpc-check-abort  ( scan-code -- abort? )  \ Square pressed?
     60   last-scan   over to last-scan  ( scan-code old-scan-code )
     61   h# e0 <>  if  drop false exit  then          ( scan-code )
     62
     63   check-abort?  0=  if  drop false exit  then  ( scan-code )
     64
     65   dup h# 7f and  h# 5d <>  if  drop false exit then  ( scan-code )
     66
     67   h# 80 and  if   \ Up
     68      false to waiting-up?
     69      false                             ( abort? )
     70   else
     71      secure?  if  false  else  waiting-up?  0=  then   ( abort? )
     72      true to waiting-up?
     73   then
     74;
     75patch olpc-check-abort check-abort get-scan
     76
     77: handle-volume?  ( scan-code -- scan-code flag )
     78   dup h# 43 =  if  dimmer    true exit  then
     79   dup h# 44 =  if  brighter  true exit  then
     80   dup h# 57 =  if  softer    true exit  then
     81   dup h# 58 =  if  louder    true exit  then
     82   false
     83;
     84' handle-volume?  to scan-handled?
     85dend
     86
    5787\ LICENSE_BEGIN
    5888\ Copyright (c) 2006 FirmWorks
  • cpu/x86/pc/olpc/via/fw.bth

    r2196 r2226  
    404404[then]
    405405
     406: dimmer  ( -- )  screen-ih  if  " dimmer" screen-ih $call-method  then  ;
     407: brighter  ( -- )  screen-ih  if  " brighter" screen-ih $call-method  then  ;
     408
    406409fload ${BP}/cpu/x86/firfilter.fth
    407410fload ${BP}/cpu/x86/pc/olpc/sound.fth
     
    422425\needs ramdisk  " " d# 128 config-string ramdisk
    423426" "   ' boot-file      set-config-string-default   \ Let the boot script set the cmdline
    424 
    425 : dimmer  ( -- )  screen-ih  if  " dimmer" screen-ih $call-method  then  ;
    426 : brighter  ( -- )  screen-ih  if  " brighter" screen-ih $call-method  then  ;
    427 
    428 dev /8042/keyboard
    429 0 value waiting-up?
    430 : olpc-check-abort  ( scan-code -- abort? )  \ Square pressed?
    431    last-scan   over to last-scan  ( scan-code old-scan-code )
    432    h# e0 <>  if  drop false exit  then          ( scan-code )
    433 
    434    check-abort?  0=  if  drop false exit  then  ( scan-code )
    435 
    436    dup h# 7f and  h# 5d <>  if  drop false exit then  ( scan-code )
    437 
    438    h# 80 and  if   \ Up
    439       false to waiting-up?
    440       false                             ( abort? )
    441    else
    442       secure?  if  false  else  waiting-up?  0=  then   ( abort? )
    443       true to waiting-up?
    444    then
    445 ;
    446 patch olpc-check-abort check-abort get-scan
    447 
    448 : handle-volume?  ( scan-code -- scan-code flag )
    449    dup h# 43 =  if  dimmer    true exit  then
    450    dup h# 44 =  if  brighter  true exit  then
    451    dup h# 57 =  if  softer    true exit  then
    452    dup h# 58 =  if  louder    true exit  then
    453    false
    454 ;
    455 ' handle-volume?  to scan-handled?
    456 dend
    457427
    458428\ Eliminate 4 second delay in install console for the case where
Note: See TracChangeset for help on using the changeset viewer.