Changeset 3049
- Timestamp:
- Jul 11, 2012 3:50:11 AM (11 months ago)
- Files:
-
- 7 added
- 31 edited
-
cpu/arm/mmp2/dramrecal.fth (modified) (2 diffs)
-
cpu/arm/mmp2/sspspi.fth (modified) (1 diff)
-
cpu/arm/olpc/1.75/compass.fth (modified) (1 diff)
-
cpu/arm/olpc/1.75/config-a1.fth (added)
-
cpu/arm/olpc/1.75/config.fth (modified) (2 diffs)
-
cpu/arm/olpc/1.75/fw.bth (modified) (1 diff)
-
cpu/arm/olpc/1.75/gamekey-a1.fth (added)
-
cpu/arm/olpc/1.75/lcdcfg.fth (modified) (1 diff)
-
cpu/arm/olpc/1.75/leds.fth (modified) (1 diff)
-
cpu/arm/olpc/1.75/olpc.bth (modified) (1 diff)
-
cpu/arm/olpc/1.75/usb.fth (modified) (2 diffs)
-
cpu/arm/olpc/3.0/config.fth (modified) (1 diff)
-
cpu/arm/olpc/3.0/fw.bth (modified) (1 diff)
-
cpu/arm/olpc/3.0/lcdcfg.fth (modified) (2 diffs)
-
cpu/arm/olpc/3.0/leds.fth (modified) (2 diffs)
-
cpu/arm/olpc/3.0/olpc.bth (modified) (1 diff)
-
cpu/arm/olpc/3.0/switches.fth (modified) (1 diff)
-
cpu/arm/olpc/3.0/usb.fth (modified) (4 diffs)
-
cpu/arm/olpc/addrs.fth (modified) (1 diff)
-
cpu/arm/olpc/boardrev.fth (modified) (1 diff)
-
cpu/arm/olpc/build-fw.fth (modified) (22 diffs)
-
cpu/arm/olpc/emmc.fth (modified) (1 diff)
-
cpu/arm/olpc/gpio-gamekeys.fth (added)
-
cpu/arm/olpc/keypad-gamekeys.fth (added)
-
cpu/arm/olpc/lcd.fth (modified) (2 diffs)
-
cpu/arm/olpc/prefw.fth (modified) (2 diffs)
-
cpu/arm/olpc/probemem.fth (modified) (1 diff)
-
cpu/arm/olpc/rtc.fth (modified) (1 diff)
-
cpu/arm/olpc/save-fw.fth (added)
-
cpu/arm/olpc/sdhci.fth (modified) (1 diff)
-
cpu/arm/olpc/sound.fth (modified) (2 diffs)
-
cpu/arm/olpc/test-tweaks.fth (added)
-
cpu/arm/olpc/usb.fth (added)
-
cpu/x86/pc/olpc/sound.fth (modified) (1 diff)
-
dev/olpc/dcon/mmp2dcon.fth (modified) (5 diffs)
-
dev/olpc/kb3700/spicmd.fth (modified) (2 diffs)
-
dev/olpc/mmp2camera/platform.fth (modified) (2 diffs)
-
dev/olpc/spiflash/spiui.fth (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cpu/arm/mmp2/dramrecal.fth
r2992 r3049 648 648 : setup-key-wakeup ( -- ) 649 649 d# 24 d# 15 do h# b0 i af! loop \ Wake SoC on game keys 650 h# 220 d# 71 af! \ Wake SoC on KBD CLK falling edge 651 h# 221 d# 160 af! \ Wake SoC on TPD CLK falling edge 650 [ifdef] soc-kbd-clk-gpio# 651 h# 220 soc-kbd-clk-gpio# af! \ Wake SoC on KBD CLK falling edge 652 h# 221 soc-tpd-clk-gpio# af! \ Wake SoC on TPD CLK falling edge 653 [then] 652 654 h# 4 h# 4c +mpmu io-set \ Pin edge (GPIO per datasheet) wakes SoC 653 655 ['] disable-int40 d# 40 interrupt-handler! … … 750 752 ; 751 753 752 : keyboard-power-on ( -- ) d# 148 gpio-clr ; 753 : keyboard-power-off ( -- ) d# 148 gpio-set ; 754 : wlan-power-on ( -- ) d# 34 gpio-set ; 755 : wlan-power-off ( -- ) d# 34 gpio-clr h# 040 d# 34 af! h# 040 d# 57 af! h# 040 d# 58 af! ; 756 : wlan-stay-on ( -- ) h# 140 d# 34 af! h# 140 d# 57 af! h# 140 d# 58 af! ; 754 [ifdef] soc-en-kbd-pwr-gpio# 755 : keyboard-power-on ( -- ) soc-en-kbd-pwr-gpio# gpio-clr ; 756 : keyboard-power-off ( -- ) soc-en-kbd-pwr-gpio# gpio-set ; 757 [else] 758 : keyboard-power-on ( -- ) ; 759 : keyboard-power-off ( -- ) ; 760 [then] 761 : wlan-power-on ( -- ) en-wlan-pwr-gpio# gpio-set ; 762 : wlan-power-off ( -- ) en-wlan-pwr-gpio# gpio-clr h# 040 en-wlan-pwr-gpio# af! h# 040 wlan-pd-gpio# af! h# 040 wlan-reset-gpio# af! ; 763 : wlan-stay-on ( -- ) h# 140 en-wlan-pwr-gpio# af! h# 140 wlan-pd-gpio# af! h# 140 wlan-reset-gpio# af! ; 757 764 758 765 0 value sleep-mask -
cpu/arm/mmp2/sspspi.fth
r2400 r3049 21 21 0 ssp-sscr1 io! 22 22 h# 87 ssp-sscr0 io! 23 d# 46gpio-set24 d# 46gpio-dir-out25 h# c0 d# 46af!23 spi-flash-cs-gpio# gpio-set 24 spi-flash-cs-gpio# gpio-dir-out 25 h# c0 spi-flash-cs-gpio# af! 26 26 ; 27 : ssp-spi-cs-on ( -- ) d# 46gpio-clr ;28 : ssp-spi-cs-off ( -- ) d# 46gpio-set ;27 : ssp-spi-cs-on ( -- ) spi-flash-cs-gpio# gpio-clr ; 28 : ssp-spi-cs-off ( -- ) spi-flash-cs-gpio# gpio-set ; 29 29 30 30 code ssp-spi-out-in ( bo -- bi ) -
cpu/arm/olpc/1.75/compass.fth
r2406 r3049 3 3 4 4 : set-compass-slave ( -- ) 5 4to smb-clock-gpio#6 5to smb-data-gpio#5 compass-scl-gpio# to smb-clock-gpio# 6 compass-sda-gpio# to smb-data-gpio# 7 7 h# 3c to smb-slave 8 8 smb-data-gpio# gpio-dir-out -
cpu/arm/olpc/1.75/config.fth
r2726 r3049 1 \ create cl2-a12 1 create debug-startup 3 2 create olpc … … 6 5 create use-null-nvram 7 6 create use-elf 7 create has-sp-kbd 8 create has-dcon 8 9 9 10 fload ${BP}/cpu/arm/mmp2/hwaddrs.fth 10 11 fload ${BP}/cpu/arm/olpc/addrs.fth 11 12 12 create machine-signature ," CL2" 13 [ifdef] use-flash-nvram 14 h# d.0000 constant nvram-offset 15 [then] 16 17 h# e.0000 constant mfg-data-offset \ Offset to manufacturing data area in SPI FLASH 18 h# f.0000 constant mfg-data-end-offset \ Offset to end of manufacturing data area in SPI FLASH 19 h# f.ffd8 constant crc-offset 20 21 h# 10.0000 constant /rom \ Total size of SPI FLASH 22 23 : signature$ " CL2" ; 24 : model$ " olpc,XO-1.75" ; 25 : compatible$ " olpc,xo-1.75" ; 26 27 d# 9999 constant machine-type \ Backwards compatibility with non-device-tree kernel 28 29 char 4 constant expected-ec-version 30 h# 8000 value /ec-flash 31 32 h# 10000 constant l2-#sets 33 34 d# 108 constant cam-scl-gpio# 35 d# 109 constant cam-sda-gpio# 36 37 d# 102 constant cam-rst-gpio# 38 d# 150 constant cam-pwr-gpio# 39 40 d# 46 constant spi-flash-cs-gpio# 41 42 d# 155 constant ec-spi-cmd-gpio# 43 d# 125 constant ec-spi-ack-gpio# 44 45 d# 161 constant dcon-scl-gpio# 46 d# 110 constant dcon-sda-gpio# 47 48 d# 124 constant dcon-irq-gpio# 49 d# 142 constant dcon-load-gpio# 50 51 d# 34 constant en-wlan-pwr-gpio# 52 d# 57 constant wlan-pd-gpio# 53 d# 58 constant wlan-reset-gpio# 54 55 d# 146 constant usb-hub-reset-gpio# 56 57 d# 149 constant emmc-rst-gpio# 58 59 d# 73 constant sec-trg-gpio# 60 61 d# 53 constant rtc-scl-gpio# 62 d# 54 constant rtc-sda-gpio# 63 64 d# 104 constant ec-edi-cs-gpio# 65 d# 105 constant ec-edi-mosi-gpio# 66 d# 106 constant ec-edi-clk-gpio# 67 68 \ d# 56 constant boot-dev-sel-gpio# \ revision-dependent, determined at run time 69 70 d# 129 constant lid-switch-gpio# 71 d# 128 constant ebook-mode-gpio# 72 73 d# 143 constant mic-ac/dc-gpio# 74 d# 8 constant audio-reset-gpio# 75 d# 97 constant hp-plug-gpio# 76 77 d# 10 constant led-storage-gpio# 78 d# 11 constant vid2-gpio# 79 80 d# 160 constant soc-tpd-clk-gpio# 81 d# 107 constant soc-tpd-dat-gpio# 82 83 d# 71 constant soc-kbd-clk-gpio# 84 d# 72 constant soc-kbd-dat-gpio# 85 d# 148 constant soc-en-kbd-pwr-gpio# 86 87 d# 144 constant cam-pwrdn-gpio# 88 89 d# 4 constant compass-scl-gpio# 90 d# 5 constant compass-sda-gpio# 91 92 d# 15 constant rotate-gpio# -
cpu/arm/olpc/1.75/fw.bth
r2726 r3049 9 9 10 10 fload ${BP}/cpu/arm/olpc/build-fw.fth 11 12 \ The internal SD card shares the host controller circuitry with 13 \ the internal eMMC, so you can only use one at a time. A GPIO 14 \ chooses which one to use. The intended usage is to "repair" 15 \ boards with a broken eMMC chip by inserting a microSD and grounding 16 \ the GPIO. 17 18 : clx-touch? ( -- ) board-revision h# 3a18 >= ; 19 : boot-dev-sel-gpio# ( -- n ) clx-touch? if 2 else d# 56 then ; 20 21 fload ${BP}/cpu/arm/olpc/emmc.fth 22 23 \ Device node for internal microSD 24 dev /sd 25 new-device 26 1 encode-int " reg" property 27 fload ${BP}/dev/mmc/sdhci/sdmmc.fth 28 fload ${BP}/dev/mmc/sdhci/selftest.fth 29 " external" " slot-name" string-property 30 finish-device 31 device-end 32 33 devalias int /sd/disk@3 34 devalias ext /sd/disk@1 35 36 fload ${BP}/cpu/arm/olpc/1.75/lcdcfg.fth 37 fload ${BP}/cpu/arm/olpc/1.75/usb.fth 38 fload ${BP}/cpu/arm/olpc/rm3150-touchscreen.fth 39 fload ${BP}/cpu/arm/olpc/1.75/compass.fth 40 fload ${BP}/cpu/arm/olpc/1.75/switches.fth 41 fload ${BP}/cpu/arm/olpc/1.75/leds.fth 42 fload ${BP}/cpu/arm/olpc/1.75/testinstructions.fth 43 fload ${BP}/cpu/arm/olpc/gpio-gamekeys.fth 44 fload ${BP}/cpu/arm/olpc/test-tweaks.fth 45 46 fload ${BP}/cpu/arm/olpc/save-fw.fth -
cpu/arm/olpc/1.75/lcdcfg.fth
r2015 r3049 1 h# 40001102 value clkdiv \ Display Clock 1 / 2 -> 56.93 MHz 2 h# 00000700 value pmua-disp-clk-sel \ PLL1 / 7 -> 113.86 MHz 1 dev /display 3 2 4 d# 8 value hsync \ Sync width 5 d# 1200 value hdisp \ Display width 6 d# 1256 value htotal \ Display + FP + Sync + BP 7 d# 24 value hbp \ Back porch 8 9 d# 3 value vsync \ Sync width 10 d# 900 value vdisp \ Display width 11 d# 912 value vtotal \ Display + FP + Sync + BP 12 d# 5 value vbp \ Back porch 13 14 : hfp ( -- n ) htotal hdisp - hsync - hbp - ; \ 24 15 : vfp ( -- n ) vtotal vdisp - vsync - vbp - ; \ 4 16 17 0 [if] 18 3 constant #lanes 19 3 constant bytes/pixel 20 d# 24 constant bpp 21 [else] 22 2 constant #lanes 23 2 constant bytes/pixel 24 d# 16 constant bpp 3 [ifdef] has-dcon 4 fload ${BP}/dev/olpc/dcon/mmp2dcon.fth \ DCON control 25 5 [then] 26 6 27 : >bytes ( pixels -- chunks ) bytes/pixel * ; 28 : >chunks ( pixels -- chunks ) >bytes #lanes / ; 29 30 alias width hdisp 31 alias height vdisp 32 alias depth bpp 33 width >bytes constant /scanline 7 device-end -
cpu/arm/olpc/1.75/leds.fth
r2682 r3049 8 8 : close ( -- ) ; 9 9 10 : hdd-led-off ( -- ) led-storage-gpio# gpio-clr ; 11 : hdd-led-on ( -- ) led-storage-gpio# gpio-set ; 12 : hdd-led-toggle ( -- ) led-storage-gpio# gpio-pin@ if hdd-led-off else hdd-led-on then ; 13 10 14 : selftest ( -- ) 11 ." Flashing LEDs" cr15 ." Flashing LEDs" cr 12 16 13 17 d# 10 0 do ols-led-on d# 200 ms ols-led-off d# 200 ms loop -
cpu/arm/olpc/1.75/olpc.bth
r3047 r3049 163 163 h# 10 buffer: signature 164 164 signature h# 10 blank 165 machine-signature count signatureswap move165 signature$ signature swap move 166 166 " ${FW_VERSION}" expand$ signature 6 + swap move 167 167 " ${FW_PREFIX}${FW_MAJOR}" expand$ signature d# 13 + swap move -
cpu/arm/olpc/1.75/usb.fth
r3023 r3049 2 2 \ See license at end of file 3 3 4 0 0 " d4208000" " /" begin-package \ USB Host Controller 5 h# 200 constant /regs 6 my-address my-space /regs reg 7 : my-map-in ( len -- adr ) 8 my-space swap " map-in" $call-parent h# 100 + ( adr ) 9 ; 10 : my-map-out ( adr len -- ) swap h# 100 - swap " map-out" $call-parent ; 11 " /pmua" encode-phandle 5 encode-int encode+ " clocks" property 12 d# 44 " interrupts" integer-property 13 14 false constant has-dbgp-regs? 15 false constant needs-dummy-qh? 16 : grab-controller ( config-adr -- error? ) drop false ; 17 fload ${BP}/dev/usb2/hcd/ehci/loadpkg.fth 18 \ false to delay? \ No need for a polling delay on this platform 19 : otg-set-host-mode 3 h# a8 ehci-reg! ; \ Force host mode 20 ' otg-set-host-mode to set-host-mode 21 4 dev /usb@d4208000 22 5 \ Port 1 on the hub is connected to unused pins on the WLAN connector, 23 6 \ so testing it is confusing … … 26 9 \ Port 4 is right lower 27 10 " 3,4,2" " usb-hub-test-list" string-property 28 : sleep ( -- ) true to first-open? ; 29 : wake ( -- ) ; 30 end-package 11 device-end 31 12 32 \ Turn on USB power after a delay, to ensure that USB devices are reset correctly on boot 33 : usb-power-on ( -- ) ; \ The EC controls the USB power 34 : reset-usb-hub ( -- ) d# 146 gpio-clr d# 10 ms d# 146 gpio-set ; 35 36 : init-usb ( -- ) 37 h# 9 h# 5c pmua! \ Enable clock to USB block 38 reset-usb-hub 39 init-usb-phy 13 : (reset-usb-hub) ( -- ) 14 usb-hub-reset-gpio# gpio-clr d# 10 ms usb-hub-reset-gpio# gpio-set 40 15 ; 41 42 stand-init: Init USB Phy 43 \ usb-power-on \ The EC now controls the USB power 44 init-usb 45 ; 46 47 d# 350 config-int usb-delay \ Milliseconds to wait before probing hub ports 16 ' (reset-usb-hub) to reset-usb-hub 48 17 49 18 devalias u /usb/disk 50 51 \ Like $show-devs, but ignores pagination keystrokes52 : $nopage-show-devs ( nodename$ -- )53 ['] exit? behavior >r ['] false to exit?54 $show-devs55 r> to exit?56 ;57 58 \ Restrict selftest to external USB ports 1,2,359 \ dev / 3 " usb-test-ports" integer-property dend60 61 : (probe-usb2) ( -- )62 " device_type" get-property if exit then63 [ifdef] use-usb-debug-port64 \ I haven't figured out how to turn on the EHCI cleanly65 \ when the Debug Port is running66 dbgp-off67 [then]68 get-encoded-string " ehci" $= if69 pwd$ open-dev ?dup if close-dev then70 then71 ;72 : (show-usb2) ( -- )73 " device_type" get-property if exit then74 get-encoded-string " ehci" $= if75 pwd$ $nopage-show-devs76 then77 ;78 79 true value first-usb-probe?80 : (silent-probe-usb) ( -- ) " /" ['] (probe-usb2) scan-subtree ;81 : silent-probe-usb ( -- )82 (silent-probe-usb)83 report-disk report-net report-keyboard84 ;85 : probe-usb ( -- )86 first-usb-probe? if87 false to first-usb-probe?88 \ Initial probe to awaken the hub89 (silent-probe-usb)90 \ A little delay to let slow devices like USB scanner wake up91 d# 150 ms92 then93 silent-probe-usb94 95 ." USB devices:" cr96 " /" ['] (show-usb2) scan-subtree97 98 ;99 alias p2 probe-usb100 101 0 value usb-keyboard-ih102 103 : attach-usb-keyboard ( -- )104 " usb-keyboard" expand-alias if ( devspec$ )105 drop " /usb" comp 0= if ( )106 " usb-keyboard" open-dev to usb-keyboard-ih107 usb-keyboard-ih add-input108 exit109 then110 else ( devspec$ )111 2drop112 then113 ;114 115 : detach-usb-keyboard ( -- )116 usb-keyboard-ih if117 usb-keyboard-ih remove-input118 usb-keyboard-ih close-dev119 0 to usb-keyboard-ih120 then121 ;122 123 : ?usb-keyboard ( -- )124 attach-usb-keyboard125 ;126 127 : usb-quiet ( -- )128 detach-usb-keyboard129 " /usb" " reset-usb" execute-device-method drop130 ;131 132 : suspend-usb ( -- )133 detach-usb-keyboard134 " /usb" " sleep" execute-device-method drop135 ;136 : has-children? ( devspec$ -- flag )137 locate-device if false else child 0<> then138 ;139 : any-usb-devices? ( -- flag ) " /usb/hub" has-children? ;140 : resume-usb ( -- )141 init-usb142 " /usb" " wake" execute-device-method drop143 any-usb-devices? if144 d# 2000 ms \ USB misses devices if you probe too soon145 then146 silent-probe-usb147 attach-usb-keyboard148 ;149 150 \ Unlink every node whose phys.hi component matches port151 : port-match? ( port -- flag )152 get-unit if drop false exit then153 get-encoded-int =154 ;155 : rm-usb-children ( port -- )156 device-context? 0= if drop exit then157 also ( port )158 'child ( port prev )159 first-child begin while ( port prev )160 over port-match? if ( port prev )161 'peer link@ over link! ( port prev ) \ Disconnect162 else ( port prev )163 drop 'peer ( port prev' )164 then ( port prev )165 next-child repeat ( port prev )166 2drop ( )167 previous definitions168 ;169 170 \ LICENSE_BEGIN171 \ Copyright (c) 2010 FirmWorks172 \173 \ Permission is hereby granted, free of charge, to any person obtaining174 \ a copy of this software and associated documentation files (the175 \ "Software"), to deal in the Software without restriction, including176 \ without limitation the rights to use, copy, modify, merge, publish,177 \ distribute, sublicense, and/or sell copies of the Software, and to178 \ permit persons to whom the Software is furnished to do so, subject to179 \ the following conditions:180 \181 \ The above copyright notice and this permission notice shall be182 \ included in all copies or substantial portions of the Software.183 \184 \ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,185 \ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF186 \ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND187 \ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE188 \ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION189 \ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION190 \ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.191 \192 \ LICENSE_END -
cpu/arm/olpc/3.0/config.fth
r2727 r3049 1 1 create debug-startup 2 2 create olpc 3 create trust-ec-keyboard3 create olpc-cl3 4 4 create use-null-nvram 5 5 create use-elf 6 create olpc-cl3 6 create use-screen-kbd 7 create use-small-font 7 8 8 9 fload ${BP}/cpu/arm/mmp2/hwaddrs.fth 9 10 fload ${BP}/cpu/arm/olpc/addrs.fth 10 11 11 create machine-signature ," CL3" 12 [ifdef] use-flash-nvram 13 h# d.0000 constant nvram-offset 14 [then] 15 16 h# e.0000 constant mfg-data-offset \ Offset to manufacturing data area in SPI FLASH 17 h# f.0000 constant mfg-data-end-offset \ Offset to end of manufacturing data area in SPI FLASH 18 h# f.ffd8 constant crc-offset 19 20 h# 10.0000 constant /rom \ Total size of SPI FLASH 21 22 : signature$ " CL3" ; 23 : model$ " olpcXO-3.0" ; 24 : compatible$ " olpcxo-3.0" ; 25 26 d# 10000 constant machine-type \ Backwards compatibility with non-device-tree kernel 27 28 char 4 constant expected-ec-version 29 h# 8000 value /ec-flash 30 31 h# 10000 constant l2-#sets 32 33 d# 56 constant boot-dev-sel-gpio# 34 35 d# 4 constant cam-scl-gpio# 36 d# 5 constant cam-sda-gpio# 37 38 d# 10 constant cam-rst-gpio# 39 d# 150 constant cam-pwr-gpio# 40 d# 9 constant cam-pwrdn-gpio# 41 42 d# 46 constant spi-flash-cs-gpio# 43 44 d# 155 constant ec-spi-cmd-gpio# 45 d# 125 constant ec-spi-ack-gpio# 46 47 \ CL3 has no DCON 48 49 d# 34 constant en-wlan-pwr-gpio# 50 d# 57 constant wlan-pd-gpio# 51 d# 58 constant wlan-reset-gpio# 52 53 d# 146 constant usb-hub-reset-gpio# 54 55 d# 149 constant emmc-rst-gpio# 56 57 d# 142 constant sec-trg-gpio# 58 59 d# 53 constant rtc-scl-gpio# 60 d# 54 constant rtc-sda-gpio# 61 62 d# 104 constant ec-edi-cs-gpio# 63 d# 105 constant ec-edi-mosi-gpio# 64 d# 106 constant ec-edi-clk-gpio# 65 66 d# 143 constant mic-ac/dc-gpio# 67 d# 8 constant audio-reset-gpio# 68 d# 97 constant hp-plug-gpio# 69 d# 11 constant vid2-gpio# -
cpu/arm/olpc/3.0/fw.bth
r2727 r3049 9 9 10 10 fload ${BP}/cpu/arm/olpc/build-fw.fth 11 12 fload ${BP}/cpu/arm/olpc/emmc.fth 13 devalias int /sd/disk@3 14 15 fload ${BP}/cpu/arm/olpc/3.0/lcdcfg.fth 16 fload ${BP}/cpu/arm/olpc/3.0/usb.fth 17 fload ${BP}/cpu/arm/olpc/exc7200-touchscreen.fth 18 fload ${BP}/cpu/arm/olpc/3.0/switches.fth 19 fload ${BP}/cpu/arm/olpc/3.0/leds.fth 20 fload ${BP}/cpu/arm/olpc/3.0/testinstructions.fth 21 fload ${BP}/cpu/arm/olpc/test-tweaks.fth 22 23 fload ${BP}/cpu/arm/olpc/save-fw.fth -
cpu/arm/olpc/3.0/lcdcfg.fth
r2757 r3049 1 h# 40001102 value clkdiv \ Display Clock 1 / 2 -> 56.93 MHz 2 h# 00000700 value pmua-disp-clk-sel \ PLL1 / 7 -> 113.86 MHz 1 dev /display 3 2 4 d# 8 value hsync \ Sync width 5 d# 1024 value hdisp \ Display width 6 d# 1344 value htotal \ Display + FP + Sync + BP 7 d# 24 value hbp \ Back porch 3 d# 1024 to hdisp \ Display width 4 d# 1344 to htotal \ Display + FP + Sync + BP 8 5 9 d# 3 value vsync \ Sync width 10 d# 768 value vdisp \ Display width 11 d# 806 value vtotal \ Display + FP + Sync + BP 12 d# 5 value vbp \ Back porch 6 d# 768 to vdisp \ Display width 7 d# 806 to vtotal \ Display + FP + Sync + BP 13 8 14 : hfp ( -- n ) htotal hdisp - hsync - hbp - ; \ 2415 : vfp ( -- n ) vtotal vdisp - vsync - vbp - ; \ 4 9 : pwm-bright! ( level -- ) d# 15 min h# 11 * h# 1a404 io! ; 10 ' pwm-bright! to bright! 16 11 17 0 [if] 18 3 constant #lanes 19 3 constant bytes/pixel 20 d# 24 constant bpp 21 [else] 22 2 constant #lanes 23 2 constant bytes/pixel 24 d# 16 constant bpp 25 [then] 12 : pwm-backlight-on ( -- ) d# 15 bright! ; 13 ' pwm-backlight-on to backlight-on 26 14 27 : >bytes ( pixels -- chunks ) bytes/pixel *;28 : >chunks ( pixels -- chunks ) >bytes #lanes / ; 15 : pwm-backlight-off ( -- ) 0 bright! ; 16 ' pwm-backlight-off to backlight-off 29 17 30 alias width hdisp31 alias height vdisp32 alias depth bpp33 width >bytes constant /scanline34 35 : bright! ( level -- ) d# 15 min h# 11 * h# 1a404 io! ;36 : backlight-on ( -- ) d# 15 bright! ;37 : backlight-off ( -- ) 0 bright! ;38 18 : setup-pwm2 ( -- ) 39 19 7 h# 1503c io! 3 h# 1503c io! \ Turn on the PWM1 clock and release reset - PWM2 depends on it … … 63 43 backlight-on 64 44 ; 65 : init-xo-display ( -- ) ; \ CForth has already turned it on 45 \ ' lcd-power-on to init-panel \ Unnecessary as CForth has already done it 66 46 67 47 : set-source ( flag -- ) drop ; \ No DCON 68 48 true constant vga? \ No DCON, hence never frozen 49 50 device-end -
cpu/arm/olpc/3.0/leds.fth
r2769 r3049 1 1 \ See license at end of file 2 purpose: Driver/selftest for OLPC XO- 1.75LEDs2 purpose: Driver/selftest for OLPC XO-3.0 LEDs 3 3 4 4 0 0 " 0" " /" begin-package … … 9 9 10 10 : selftest ( -- ) 11 ." Flashing LEDs" cr 12 13 \ d# 10 0 do ols-led-on d# 200 ms ols-led-off d# 200 ms loop 14 \ ols-led-ec-control 15 \ ols-assy-mode-on 11 ." Flashing LEDs" cr 16 12 17 13 " /wlan:quiet" test-dev " /wlan:quiet" test-dev \ Twice for longer flashing 18 19 \ ols-assy-mode-off20 14 21 15 confirm-selftest? -
cpu/arm/olpc/3.0/olpc.bth
r2735 r3049 166 166 h# 10 buffer: signature 167 167 signature h# 10 blank 168 machine-signature count signatureswap move168 signature$ signature swap move 169 169 " ${FW_VERSION}" expand$ signature 6 + swap move 170 170 " ${FW_PREFIX}${FW_MAJOR}" expand$ signature d# 13 + swap move -
cpu/arm/olpc/3.0/switches.fth
r2727 r3049 2 2 purpose: Driver/selftest for OLPC lid and ebook switches 3 3 4 \ The XO-3.0 has no switches, but we need the device node 5 \ because the suspend/resume test gets added to that node later. 4 6 0 0 " 0" " /" begin-package 5 7 " switches" device-name -
cpu/arm/olpc/3.0/usb.fth
r3048 r3049 2 2 \ See license at end of file 3 3 4 0 0 " d4208000" " /" begin-package \ USB OTG Host Controller 5 h# 200 constant /regs 6 my-address my-space /regs reg 7 : my-map-in ( len -- adr ) 8 my-space swap " map-in" $call-parent h# 100 + ( adr ) 9 ; 10 : my-map-out ( adr len -- ) swap h# 100 - swap " map-out" $call-parent ; 11 " /pmua" encode-phandle 5 encode-int encode+ " clocks" property 12 d# 44 " interrupts" integer-property 13 14 false constant has-dbgp-regs? 15 false constant needs-dummy-qh? 16 : grab-controller ( config-adr -- error? ) drop false ; 17 fload ${BP}/dev/usb2/hcd/ehci/loadpkg.fth 18 \ false to delay? \ No need for a polling delay on this platform 19 : otg-set-host-mode 3 h# a8 ehci-reg! ; \ Force host mode 20 ' otg-set-host-mode to set-host-mode 21 4 dev /usb@d4208000 22 5 \ The Marvell EHCI can handle low and full speed devices directly, 23 6 \ without needing a UHCI or OHCI companion controller 24 7 ' make-port-node to handle-ls-device 25 8 ' make-port-node to handle-fs-device 9 device-end 26 10 27 : sleep ( -- ) true to first-open? ; 28 : wake ( -- ) ; 29 end-package 11 fload ${BP}/cpu/arm/mmp2/ulpiphy.fth 30 12 31 13 0 0 " f0003000" " /" begin-package \ USB Host Controller 1 - ULPI … … 53 35 \ usb-power-on is unnecessary on initial boot, as CForth turns on the 54 36 \ USB power during its GPIO setup. 55 : usb-power-on( -- )37 : (usb-power-on) ( -- ) 56 38 d# 126 gpio-clr \ OTG 5V on 57 39 d# 127 gpio-clr \ ULPI 5V on 58 40 ; 59 : reset-usb-hub ( -- ) 41 ' (usb-power-on) to usb-power-on 42 43 : (reset-usb-hub) ( -- ) 60 44 d# 146 gpio-clr d# 10 ms d# 146 gpio-set \ Resets ULPI hub 61 45 ulpi-clock-on … … 63 47 ulpi-on 64 48 ; 65 66 : init-usb ( -- ) 67 h# 9 h# 5c pmua! \ Enable clock to USB block 68 reset-usb-hub 69 init-usb-phy 70 ; 71 72 stand-init: Init USB Phy 73 \ usb-power-on \ The USB power is turned on early, when CForth sets up GPIOs 74 init-usb 75 ; 76 77 d# 350 config-int usb-delay \ Milliseconds to wait before probing hub ports 49 ' (reset-usb-hub) to reset-usb-hub 78 50 79 51 devalias otg /usb@d4208000 \ USB OTG (micro) connector … … 81 53 devalias o /usb@d4208000/disk \ Disk on USB OTG (micro) connector 82 54 devalias u /usb@f0003000/disk \ Disk on USB-A connector 83 84 \ Like $show-devs, but ignores pagination keystrokes85 : $nopage-show-devs ( nodename$ -- )86 ['] exit? behavior >r ['] false to exit?87 $show-devs88 r> to exit?89 ;90 91 \ Restrict selftest to external USB ports 1,2,392 \ dev / 3 " usb-test-ports" integer-property dend93 94 : (probe-usb2) ( -- )95 " device_type" get-property if exit then96 [ifdef] use-usb-debug-port97 \ I haven't figured out how to turn on the EHCI cleanly98 \ when the Debug Port is running99 dbgp-off100 [then]101 get-encoded-string " ehci" $= if102 pwd$ open-dev ?dup if close-dev then103 then104 ;105 : (show-usb2) ( -- )106 " device_type" get-property if exit then107 get-encoded-string " ehci" $= if108 pwd$ $nopage-show-devs109 then110 ;111 112 true value first-usb-probe?113 : (silent-probe-usb) ( -- ) " /" ['] (probe-usb2) scan-subtree ;114 : silent-probe-usb ( -- )115 (silent-probe-usb)116 report-disk report-net report-keyboard117 ;118 : probe-usb ( -- )119 first-usb-probe? if120 false to first-usb-probe?121 \ Initial probe to awaken the hub122 (silent-probe-usb)123 \ A little delay to let slow devices like USB scanner wake up124 d# 150 ms125 then126 silent-probe-usb127 128 ." USB devices:" cr129 " /" ['] (show-usb2) scan-subtree130 131 ;132 alias p2 probe-usb133 134 0 value usb-keyboard-ih135 0 value otg-keyboard-ih136 137 : attach-usb-keyboard ( -- )138 " usb-keyboard" expand-alias if ( devspec$ )139 drop " /usb" comp 0= if ( )140 " usb-keyboard" open-dev to usb-keyboard-ih141 usb-keyboard-ih add-input142 then143 else ( devspec$ )144 2drop145 then146 147 " otg/keyboard" expand-alias if ( devspec$ )148 open-dev to otg-keyboard-ih149 otg-keyboard-ih add-input150 else151 2drop152 then153 ;154 155 : detach-usb-keyboard ( -- )156 usb-keyboard-ih if157 usb-keyboard-ih remove-input158 usb-keyboard-ih close-dev159 0 to usb-keyboard-ih160 then161 ;162 163 : ?usb-keyboard ( -- )164 attach-usb-keyboard165 ;166 167 : usb-quiet ( -- )168 detach-usb-keyboard169 " /usb@f0003000" " reset-usb" execute-device-method drop170 " /usb@d4208000" " reset-usb" execute-device-method drop171 ;172 173 : suspend-usb ( -- )174 detach-usb-keyboard175 " /usb" " sleep" execute-device-method drop176 ;177 : has-children? ( devspec$ -- flag )178 locate-device if false else child 0<> then179 ;180 : any-usb-devices? ( -- flag ) " /usb/hub" has-children? ;181 : resume-usb ( -- )182 init-usb183 " /usb" " wake" execute-device-method drop184 any-usb-devices? if185 d# 2000 ms \ USB misses devices if you probe too soon186 then187 silent-probe-usb188 attach-usb-keyboard189 ;190 191 \ Unlink every node whose phys.hi component matches port192 : port-match? ( port -- flag )193 get-unit if drop false exit then194 get-encoded-int =195 ;196 : rm-usb-children ( port -- )197 device-context? 0= if drop exit then198 also ( port )199 'child ( port prev )200 first-child begin while ( port prev )201 over port-match? if ( port prev )202 'peer link@ over link! ( port prev ) \ Disconnect203 else ( port prev )204 drop 'peer ( port prev' )205 then ( port prev )206 next-child repeat ( port prev )207 2drop ( )208 previous definitions209 ;210 211 \ LICENSE_BEGIN212 \ Copyright (c) 2010 FirmWorks213 \214 \ Permission is hereby granted, free of charge, to any person obtaining215 \ a copy of this software and associated documentation files (the216 \ "Software"), to deal in the Software without restriction, including217 \ without limitation the rights to use, copy, modify, merge, publish,218 \ distribute, sublicense, and/or sell copies of the Software, and to219 \ permit persons to whom the Software is furnished to do so, subject to220 \ the following conditions:221 \222 \ The above copyright notice and this permission notice shall be223 \ included in all copies or substantial portions of the Software.224 \225 \ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,226 \ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF227 \ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND228 \ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE229 \ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION230 \ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION231 \ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.232 \233 \ LICENSE_END -
cpu/arm/olpc/addrs.fth
r2733 r3049 45 45 h# 20000 constant dropin-offset \ Offset to dropin driver area in SPI FLASH 46 46 47 [ifdef] use-flash-nvram48 h# d.0000 constant nvram-offset49 [then]50 51 h# e.0000 constant mfg-data-offset \ Offset to manufacturing data area in SPI FLASH52 h# f.0000 constant mfg-data-end-offset \ Offset to end of manufacturing data area in SPI FLASH53 h# f.ffd8 constant crc-offset54 55 h# 10.0000 constant /rom \ Total size of SPI FLASH56 57 47 \ SRAM usage 58 48 -
cpu/arm/olpc/boardrev.fth
r2726 r3049 5 5 6 6 \ Constructs a string like "B4" or "preB4" or "postB4" 7 : model- name$ ( -- model$ )7 : model-version$ ( -- model$ ) 8 8 board-revision h# 10 /mod ( minor major ) 9 9 swap dup 8 = if ( major minor ) -
cpu/arm/olpc/build-fw.fth
r3041 r3049 8 8 \ ' noop is include-hook 9 9 10 : init-stuff 11 acgr-clocks-on 12 init-timers 13 init-twsi 14 ; 15 warning @ warning off 16 : stand-init-io 17 stand-init-io 18 init-stuff 19 ; 20 warning ! 21 22 dev / 23 model$ model 24 " OLPC" encode-string " architecture" property 25 \ The clock frequency of the root bus may be irrelevant, since the bus is internal to the SOC 26 \ d# 1,000,000,000 " clock-frequency" integer-property 27 device-end 28 10 29 fload ${BP}/cpu/arm/olpc/fbnums.fth 11 30 fload ${BP}/cpu/arm/olpc/fbmsg.fth … … 80 99 decode-int nip nip d# 1000000 / 81 100 ; 82 83 84 fload ${BP}/cpu/arm/mmp2/pmua.fth85 fload ${BP}/cpu/arm/mmp2/apbc.fth86 fload ${BP}/cpu/arm/mmp2/irq.fth87 fload ${BP}/cpu/arm/mmp2/timer.fth88 fload ${BP}/cpu/arm/mmp2/twsi.fth89 fload ${BP}/cpu/arm/mmp2/mfpr.fth90 fload ${BP}/cpu/arm/mmp2/gpio.fth91 92 : init-stuff93 acgr-clocks-on94 init-timers95 init-twsi96 ;97 warning @ warning off98 : stand-init-io99 stand-init-io100 init-stuff101 ;102 warning !103 101 104 102 fload ${BP}/cpu/arm/mmp2/watchdog.fth \ reset-all using watchdog timer … … 183 181 false constant tethered? \ We only support reprogramming our own FLASH 184 182 185 [ifdef] olpc-cl3186 : hdd-led-off ( -- ) ;187 : hdd-led-on ( -- ) ;188 : hdd-led-toggle ( -- ) ;189 [else]190 : hdd-led-off ( -- ) d# 10 gpio-clr ;191 : hdd-led-on ( -- ) d# 10 gpio-set ;192 : hdd-led-toggle ( -- ) d# 10 gpio-pin@ if hdd-led-off else hdd-led-on then ;193 [then]194 195 183 fload ${BP}/cpu/arm/olpc/bbedi.fth 196 184 fload ${BP}/cpu/arm/olpc/edi.fth … … 198 186 load-base constant flash-buf 199 187 200 201 [ifdef] cl2-a1202 h# 10000 value /ec-flash203 char 3 value expected-ec-version204 [else]205 h# 8000 value /ec-flash206 : clx-touch? ( -- ) board-revision h# 3a18 >= ;207 \+ olpc-cl2 char 4 value expected-ec-version208 \+ olpc-cl3 char 5 value expected-ec-version209 [then]210 211 [ifndef] cl2-a1212 [then]213 188 fload ${BP}/cpu/arm/olpc/ecflash.fth 214 189 … … 251 226 end-package 252 227 253 0 0 " d420b000" " /" begin-package 254 " display" name 255 my-address my-space h# 1000 reg 256 257 " /pmua" encode-phandle 1 encode-int encode+ " clocks" property 258 d# 41 " interrupts" integer-property 259 260 [ifdef] olpc-cl3261 fload ${BP}/cpu/arm/olpc/3.0/lcdcfg.fth 262 [else] 263 fload ${BP}/cpu/arm/olpc/1.75/lcdcfg.fth 228 fload ${BP}/cpu/arm/olpc/lcd.fth 229 fload ${BP}/cpu/arm/olpc/sdhci.fth 230 231 devalias net /wlan 232 233 fload ${BP}/dev/olpc/kb3700/spicmd.fth \ EC SPI Command Protocol 234 235 [ifdef] has-sp-kbd 236 fload ${BP}/cpu/arm/olpc/spcmd.fth \ Security Processor communication protocol 237 devalias keyboard /ap-sp/keyboard 238 devalias mouse /ap-sp/mouse 264 239 [then] 265 240 266 fload ${BP}/cpu/arm/olpc/lcd.fth 267 [ifndef] olpc-cl3 268 fload ${BP}/dev/olpc/dcon/mmp2dcon.fth \ DCON control 269 [then] 270 defer convert-color ' noop to convert-color 271 defer pixel* 272 defer pixel+ 273 defer pixel! 274 275 : color! ( r g b index -- ) 4drop ; 276 : color@ ( index -- r g b ) drop 0 0 0 ; 277 278 fload ${BP}/dev/video/common/rectangle16.fth \ Rectangular graphics 279 280 depth d# 24 = [if] 281 code 3a+ ( adr n -- n' ) 282 pop r0,sp 283 inc tos,#3 284 add tos,tos,r0 285 c; 286 code rgb888! ( n adr -- ) 287 pop r0,sp 288 strb r0,[tos] 289 mov r0,r0,lsr #8 290 strb r0,[tos,#1] 291 mov r0,r0,lsr #8 292 strb r0,[tos,#2] 293 pop tos,sp 294 c; 295 ' 3* to pixel* 296 ' 3a+ to pixel+ 297 ' rgb888! to pixel! 298 ' noop to convert-color 299 [else] 300 ' /w* to pixel* 301 ' wa+ to pixel+ 302 ' w! to pixel! 303 ' argb>565-pixel to convert-color 304 [then] 305 306 : display-on 307 init-xo-display \ Turns on DCON etc 308 frame-buffer-adr hdisp vdisp * >bytes h# ffffffff lfill 309 init-lcd 310 ; 311 : map-frame-buffer ( -- ) 312 \ We use fb-mem-va directly instead of calling map-in on the physical address 313 \ because the physical address changes with the total memory size. The early 314 \ assembly language startup code establishes the mapping. 315 fb-mem-va to frame-buffer-adr 316 ; 317 " display" device-type 318 " ISO8859-1" encode-string " character-set" property 319 0 0 encode-bytes " iso6429-1983-colors" property 320 321 \ Used as temporary storage for images by $get-image 322 : graphmem ( -- adr ) dimensions * pixel* fb-mem-va + ; 323 324 : display-install ( -- ) 325 map-frame-buffer 326 display-on 327 default-font set-font 328 width height ( width height ) 329 over char-width / over char-height / ( width height rows cols ) 330 /scanline depth fb-install ( ) 331 ; 332 333 : display-remove ( -- ) ; 334 : display-selftest ( -- failed? ) false ; 335 336 ' display-install is-install 337 ' display-remove is-remove 338 ' display-selftest is-selftest 339 end-package 340 341 devalias screen /display 342 343 [ifdef] olpc-cl3 344 create cp881-16 " ${BP}/ofw/termemu/cp881-16.obf" $file, 345 ' cp881-16 to romfont 346 [else] 347 devalias keyboard /keyboard 348 349 create 15x30pc " ${BP}/ofw/termemu/15x30pc.psf" $file, 350 ' 15x30pc to romfont 351 [then] 352 353 fload ${BP}/cpu/arm/olpc/sdhci.fth 354 355 [ifndef] cl2-a1 356 : boot-dev-gpio# ( -- n ) clx-touch? if 2 else d# 56 then ; 357 fload ${BP}/cpu/arm/olpc/emmc.fth 358 [then] 359 360 devalias int /sd/disk@3 361 devalias ext /sd/disk@1 362 devalias net /wlan \ XXX should report-net in case of USB Ethernet 363 364 fload ${BP}/dev/olpc/kb3700/spicmd.fth \ EC SPI Command Protocol 365 366 \- olpc-cl3 fload ${BP}/cpu/arm/olpc/spcmd.fth \ Security Processor communication protocol 367 368 : wlan-reset ( -- ) d# 58 gpio-clr d# 20 ms d# 58 gpio-set ; 241 : wlan-reset ( -- ) wlan-reset-gpio# gpio-clr d# 20 ms wlan-reset-gpio# gpio-set ; 242 243 fload ${BP}/ofw/core/fdt.fth 244 fload ${BP}/cpu/arm/linux.fth 369 245 370 246 \ Create the alias unless it already exists … … 412 288 413 289 fload ${BP}/cpu/arm/marvell/utmiphy.fth 414 415 fload ${BP}/ofw/core/fdt.fth 416 fload ${BP}/cpu/arm/linux.fth 417 418 \+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/usb.fth 419 \+ olpc-cl3 fload ${BP}/cpu/arm/mmp2/ulpiphy.fth 420 \+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/usb.fth 421 \+ olpc-cl4 fload ${BP}/cpu/arm/olpc/cl4/usb.fth 290 fload ${BP}/cpu/arm/olpc/usb.fth 422 291 423 292 fload ${BP}/dev/olpc/mmp2camera/loadpkg.fth … … 438 307 stand-init 439 308 root-device 440 model- name$ 2dup model ( name$ )309 model-version$ 2dup model ( name$ ) 441 310 " OLPC " encode-bytes 2swap encode-string encode+ " banner-name" property 442 311 board-revision " board-revision-int" integer-property 443 \+ olpc-cl2 " olpc,xo-1.75" " compatible" string-property 444 \+ olpc-cl3 " olpc,xo-3.0" " compatible" string-property 445 \+ olpc-cl4 " olpc,xo-cl4" " compatible" string-property 312 compatible$ " compatible" string-property 446 313 447 314 \ The "1-" removes the null byte … … 494 361 ' olpc-mapped-limit to mapped-limit 495 362 496 \+ olpc-cl2 d# 9999 to arm-linux-machine-type \ XO-1.75 497 \+ olpc-cl3 d# 10000 to arm-linux-machine-type \ XO-3 363 machine-type to arm-linux-machine-type 498 364 499 365 \ Add a tag describing the linear frame buffer … … 543 409 \ true to stand-init-debug? 544 410 545 : sec-trg ( -- ) d# 73gpio-set ; \ rising edge latches SPI_WP# low546 : sec-trg? ( -- bit ) d# 73gpio-pin@ ;411 : sec-trg ( -- ) sec-trg-gpio# gpio-set ; \ rising edge latches SPI_WP# low 412 : sec-trg? ( -- bit ) sec-trg-gpio# gpio-pin@ ; 547 413 548 414 alias ec-indexed-io-off sec-trg … … 568 434 ; 569 435 570 [ifdef] olpc-cl3 571 false value rotate-button? 572 [else] 573 : rotate-button? ( -- flag ) d# 15 gpio-pin@ 0= ; 574 [then] 436 defer rotate-button? ' false to rotate-button? 575 437 576 438 warning @ warning off … … 633 495 fload ${BP}/cpu/arm/olpc/banner.fth 634 496 635 \- olpc-cl3 devalias keyboard /ap-sp/keyboard636 \- olpc-cl3 devalias mouse /ap-sp/mouse637 638 497 : console-start ( -- ) 639 498 install-mux-io … … 688 547 code halt ( -- ) wfi c; 689 548 690 \+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/switches.fth \ Lid and ebook switches691 \+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/switches.fth \ Switches692 \+ olpc-cl4 fload ${BP}/cpu/arm/olpc/cl4/switches.fth \ Lid and ebook switches693 694 549 fload ${BP}/cpu/arm/mmp2/rtc.fth \ Internal RTC, used for wakeups 695 550 696 \+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/leds.fth \ LEDs697 \+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/leds.fth \ LEDs698 \+ olpc-cl4 fload ${BP}/cpu/arm/olpc/cl4/leds.fth \ LEDs699 700 551 fload ${BP}/cpu/x86/pc/olpc/via/factory.fth \ Manufacturing tools 701 552 702 553 fload ${BP}/cpu/arm/olpc/accelerometer.fth 703 704 [ifndef] olpc-cl3705 fload ${BP}/cpu/arm/olpc/1.75/compass.fth706 [then]707 708 \ Suppress long memory test at final test stage709 dev /memory710 0 value old-diag-switch?711 : not-final-test? ( -- flag )712 final-test? if false exit then713 smt-test? if false exit then714 old-diag-switch?715 ;716 warning @ warning off717 : selftest ( -- error? )718 diag-switch? to old-diag-switch?719 not-final-test? to diag-switch?720 selftest721 old-diag-switch? to diag-switch?722 ;723 warning !724 device-end725 726 \ Add suspend resume test except in final727 dev /switches728 warning @ warning off729 : selftest ( -- error? )730 final-test? 0= if731 s3-selftest if true exit then732 then733 selftest734 ;735 warning !736 device-end737 554 738 555 \ When reprogramming this machine's SPI FLASH, rebooting the EC is unnecessary … … 750 567 end-package 751 568 752 \ it seems to be difficult to get SoC wakeups from the keypad controller,753 \ so we set them up as gpio, instead.754 [ifdef] use_mmp2_keypad_control755 fload ${BP}/cpu/arm/mmp2/keypad.fth756 [ifdef] notdef \ CForth turns on the keypad; resetting it makes it not work757 stand-init: keypad758 keypad-on759 8 keypad-direct-mode760 ;761 [then]762 : keypad-bit ( n keypad out-mask key-mask -- n' keypad )763 third invert and if ( n keypad out-mask )764 rot or swap ( n' keypad )765 else ( n keypad out-mask )766 drop ( n keypad )767 then ( n' keypad )768 ;769 [then]770 771 569 fload ${BP}/cpu/x86/pc/olpc/gamekeynames.fth 772 570 773 [ifdef] cl2-a1 774 : game-key@ ( -- n ) 775 0 ( n ) 776 d# 16 gpio-pin@ 0= if h# 80 or then \ O 777 d# 17 gpio-pin@ 0= if h# 02 or then \ Check 778 d# 18 gpio-pin@ 0= if h# 100 or then \ X 779 d# 19 gpio-pin@ 0= if h# 01 or then \ Square 780 d# 20 gpio-pin@ 0= if h# 40 or then \ Rotate 781 ; 782 [then] 783 784 [ifdef] olpc-cl3 785 : game-key@ ( -- n ) 786 0 787 ; 788 [then] 789 790 [ifndef] game-key@ 791 [ifdef] use_mmp2_keypad_control 792 : game-key@ ( -- n ) 793 0 ( n ) 794 d# 15 gpio-pin@ 0= if button-rotate or then ( n ) 795 scan-keypad ( n keypad ) 796 button-o h# 01 keypad-bit ( n' keypad ) 797 button-check h# 02 keypad-bit ( n' keypad ) 798 button-x h# 04 keypad-bit ( n' keypad ) 799 button-square h# 08 keypad-bit ( n' keypad ) 800 rocker-up h# 10 keypad-bit ( n' keypad ) 801 rocker-right h# 20 keypad-bit ( n' keypad ) 802 rocker-down h# 40 keypad-bit ( n' keypad ) 803 rocker-left h# 80 keypad-bit ( n' keypad ) 804 drop ( n ) 805 ; 806 [else] 807 : game-key@ ( -- n ) 808 0 ( n ) 809 d# 15 gpio-pin@ 0= if button-rotate or then 810 d# 16 gpio-pin@ 0= if button-o or then 811 d# 17 gpio-pin@ 0= if button-check or then 812 d# 18 gpio-pin@ 0= if button-x or then 813 d# 19 gpio-pin@ 0= if button-square or then 814 d# 20 gpio-pin@ 0= if rocker-up or then 815 d# 21 gpio-pin@ 0= if rocker-right or then 816 d# 22 gpio-pin@ 0= if rocker-down or then 817 d# 23 gpio-pin@ 0= if rocker-left or then 818 ; 819 [then] 820 821 [then] 571 defer game-key@ ' 0 to game-key@ \ Implementation will be loaded later 822 572 823 573 fload ${BP}/cpu/x86/pc/olpc/gamekeys.fth … … 827 577 fload ${BP}/cpu/x86/pc/olpc/disptest.fth 828 578 829 [if ndef] olpc-cl3579 [ifdef] has-sp-kbd 830 580 dev /ap-sp/keyboard 831 581 fload ${BP}/dev/olpc/keyboard/selftest.fth \ Keyboard diagnostic … … 842 592 fload ${BP}/cpu/x86/pc/olpc/via/copynand.fth 843 593 844 \+ olpc-cl2 fload ${BP}/cpu/arm/olpc/rm3150-touchscreen.fth \ Touchscreen driver and diagnostic 845 \+ olpc-cl3 fload ${BP}/cpu/arm/olpc/exc7200-touchscreen.fth \ Touchscreen driver and diagnostic 846 \+ olpc-cl3 fload ${BP}/dev/softkeyboard.fth \ On-screen keyboard 847 \+ olpc-cl4 fload ${BP}/cpu/arm/olpc/nn-touchscreen.fth \ Touchscreen driver and diagnostic 594 \- use-screen-kbd devalias keyboard /keyboard 595 \+ use-screen-kbd fload ${BP}/dev/softkeyboard.fth \ On-screen keyboard 596 848 597 fload ${BP}/cpu/arm/olpc/roller.fth \ Accelerometer test 849 598 … … 1000 749 ; 1001 750 1002 [ifdef] olpc-cl3751 [ifdef] use-screen-kbd 1003 752 0 value screen-kbd-ih 1004 753 : open-screen-keyboard ( -- ) … … 1046 795 1047 796 fload ${BP}/cpu/arm/olpc/testitems.fth 1048 \+ olpc-cl2 fload ${BP}/cpu/arm/olpc/1.75/testinstructions.fth1049 \+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/testinstructions.fth1050 \+ olpc-cl4 fload ${BP}/cpu/arm/olpc/cl4/testinstructions.fth1051 797 1052 798 : startup ( -- ) … … 1081 827 then 1082 828 then 1083 \+ olpc-cl3open-hotspot829 \+ use-screen-kbd open-hotspot 1084 830 1085 831 install-alarm … … 1089 835 1090 836 ['] false to interrupt-auto-boot? 1091 \+ olpc-cl3?text-on837 \+ use-screen-kbd ?text-on 1092 838 [ifdef] probe-usb 1093 839 factory-test? if d# 1000 ms then \ Extra USB probe delay in the factory … … 1100 846 interpreter-init 1101 847 1102 \+ olpc-cl3?text-on848 \+ use-screen-kbd ?text-on 1103 849 ?diags 1104 850 ?fs-update … … 1108 854 ['] (interrupt-auto-boot?) to interrupt-auto-boot? 1109 855 1110 \+ olpc-cl3?text-on856 \+ use-screen-kbd ?text-on 1111 857 ?usb-keyboard 1112 858 1113 859 auto-banner? if banner then 1114 860 1115 \+ olpc-cl3?text-on861 \+ use-screen-kbd ?text-on 1116 862 auto-boot 1117 \+ olpc-cl3close-hotspot1118 1119 \+ olpc-cl3open-screen-keyboard banner863 \+ use-screen-kbd close-hotspot 864 865 \+ use-screen-kbd open-screen-keyboard banner 1120 866 1121 867 frozen? text-on? 0= and ( no-banner? ) … … 1149 895 " devalias fsdisk //null" evaluate 1150 896 ; 1151 1152 tag-file @ fclose tag-file off1153 my-self [if]1154 ." WARNING: my-self is not 0" cr1155 bye1156 [then]1157 1158 .( --- Saving fw.dic ...)1159 " fw.dic" $save-forth cr1160 1161 fload ${BP}/cpu/arm/mmp2/rawboot.fth1162 1163 .( --- Saving fw.img --- ) cr " fw.img" $save-rom1164 897 1165 898 \ LICENSE_BEGIN -
cpu/arm/olpc/emmc.fth
r3032 r3049 40 40 h# 18c2 d# 168 af! \ eMMC_D1 41 41 42 d# 149gpio-set \ Release eMMC_RST#42 emmc-rst-gpio# gpio-set \ Release eMMC_RST# 43 43 44 d# 34gpio-set \ This is for the case where the eMMC power is rewired to the WLAN44 en-wlan-pwr-gpio# gpio-set \ This is for the case where the eMMC power is rewired to the WLAN 45 45 ; 46 \ Says COMM - is RST#47 \ Says RESET - is CMD48 46 49 47 stand-init: 50 boot-dev- gpio# gpio-pin@ if48 boot-dev-sel-gpio# gpio-pin@ if 51 49 select-emmc 52 50 else -
cpu/arm/olpc/lcd.fth
r2818 r3049 1 purpose: Display driver for OLPC ARM/MMP platforms 2 \ See license at end of file 3 4 0 0 " d420b000" " /" begin-package 5 " display" name 6 my-address my-space h# 1000 reg 7 8 " /pmua" encode-phandle 1 encode-int encode+ " clocks" property 9 d# 41 " interrupts" integer-property 10 11 h# 40001102 value clkdiv \ Display Clock 1 / 2 -> 56.93 MHz 12 h# 00000700 value pmua-disp-clk-sel \ PLL1 / 7 -> 113.86 MHz 13 14 d# 8 value hsync \ Sync width 15 d# 1200 value hdisp \ Display width 16 d# 1256 value htotal \ Display + FP + Sync + BP 17 d# 24 value hbp \ Back porch 18 19 d# 3 value vsync \ Sync width 20 d# 900 value vdisp \ Display width 21 d# 912 value vtotal \ Display + FP + Sync + BP 22 d# 5 value vbp \ Back porch 23 24 : hfp ( -- n ) htotal hdisp - hsync - hbp - ; \ 24 25 : vfp ( -- n ) vtotal vdisp - vsync - vbp - ; \ 4 26 27 2 value #lanes 28 2 value bytes/pixel 29 d# 16 value bpp 30 31 0 [if] \ 24bpp parameters 32 3 to #lanes 33 3 to bytes/pixel 34 d# 24 to bpp 35 [then] 36 37 : >bytes ( pixels -- chunks ) bytes/pixel * ; 38 : >chunks ( pixels -- chunks ) >bytes #lanes / ; 39 40 alias width hdisp 41 alias height vdisp 42 alias depth bpp 43 width >bytes constant /scanline 44 45 \ \+ olpc-cl3 fload ${BP}/cpu/arm/olpc/3.0/lcdcfg.fth 1 46 2 47 : lcd@ ( offset -- l ) lcd-pa + io@ ; … … 228 273 cursor /cursor 0 cursor-sram-write 229 274 ; 275 276 defer convert-color ' noop to convert-color 277 defer pixel* 278 defer pixel+ 279 defer pixel! 280 281 : color! ( r g b index -- ) 4drop ; 282 : color@ ( index -- r g b ) drop 0 0 0 ; 283 284 fload ${BP}/dev/video/common/rectangle16.fth \ Rectangular graphics 285 286 depth d# 24 = [if] 287 code 3a+ ( adr n -- n' ) 288 pop r0,sp 289 inc tos,#3 290 add tos,tos,r0 291 c; 292 code rgb888! ( n adr -- ) 293 pop r0,sp 294 strb r0,[tos] 295 mov r0,r0,lsr #8 296 strb r0,[tos,#1] 297 mov r0,r0,lsr #8 298 strb r0,[tos,#2] 299 pop tos,sp 300 c; 301 ' 3* to pixel* 302 ' 3a+ to pixel+ 303 ' rgb888! to pixel! 304 ' noop to convert-color 305 [else] 306 ' /w* to pixel* 307 ' wa+ to pixel+ 308 ' w! to pixel! 309 ' argb>565-pixel to convert-color 310 [then] 311 312 defer init-panel ' noop to init-panel 313 defer bright! ' drop to bright! 314 defer backlight-off ' noop to backlight-off 315 defer backlight-on ' noop to backlight-on 316 317 : display-on 318 init-panel \ Turns on DCON etc 319 frame-buffer-adr hdisp vdisp * >bytes h# ffffffff lfill 320 init-lcd 321 ; 322 : map-frame-buffer ( -- ) 323 \ We use fb-mem-va directly instead of calling map-in on the physical address 324 \ because the physical address changes with the total memory size. The early 325 \ assembly language startup code establishes the mapping. 326 fb-mem-va to frame-buffer-adr 327 ; 328 " display" device-type 329 " ISO8859-1" encode-string " character-set" property 330 0 0 encode-bytes " iso6429-1983-colors" property 331 332 \ Used as temporary storage for images by $get-image 333 : graphmem ( -- adr ) dimensions * pixel* fb-mem-va + ; 334 335 : display-install ( -- ) 336 map-frame-buffer 337 display-on 338 default-font set-font 339 width height ( width height ) 340 over char-width / over char-height / ( width height rows cols ) 341 /scanline depth fb-install ( ) 342 ; 343 344 : display-remove ( -- ) ; 345 : display-selftest ( -- failed? ) false ; 346 347 ' display-install is-install 348 ' display-remove is-remove 349 ' display-selftest is-selftest 350 end-package 351 352 devalias screen /display 353 354 [ifdef] use-small-font 355 create cp881-16 " ${BP}/ofw/termemu/cp881-16.obf" $file, 356 ' cp881-16 to romfont 357 [else] 358 create 15x30pc " ${BP}/ofw/termemu/15x30pc.psf" $file, 359 ' 15x30pc to romfont 360 [then] 361 362 \ LICENSE_BEGIN 363 \ Copyright (c) 2010 FirmWorks 364 \ 365 \ Permission is hereby granted, free of charge, to any person obtaining 366 \ a copy of this software and associated documentation files (the 367 \ "Software"), to deal in the Software without restriction, including 368 \ without limitation the rights to use, copy, modify, merge, publish, 369 \ distribute, sublicense, and/or sell copies of the Software, and to 370 \ permit persons to whom the Software is furnished to do so, subject to 371 \ the following conditions: 372 \ 373 \ The above copyright notice and this permission notice shall be 374 \ included in all copies or substantial portions of the Software. 375 \ 376 \ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 377 \ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 378 \ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 379 \ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 380 \ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 381 \ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 382 \ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 383 \ 384 \ LICENSE_END -
cpu/arm/olpc/prefw.fth
r3021 r3049 43 43 fload ${BP}/ofw/core/availpm.fth \ Available memory list 44 44 45 dev /46 " olpc,XO-1.75" model47 " OLPC" encode-string " architecture" property48 \ The clock frequency of the root bus may be irrelevant, since the bus is internal to the SOC49 \ d# 1,000,000,000 " clock-frequency" integer-property50 device-end51 52 45 : (cpu-arch ( -- adr len ) 53 46 " architecture" root-phandle get-package-property drop … … 230 223 \ fload ${BP}/ofw/gui/insticon.fth 231 224 225 \ Marvell MMP low-level stuff 226 fload ${BP}/cpu/arm/mmp2/pmua.fth 227 fload ${BP}/cpu/arm/mmp2/apbc.fth 228 fload ${BP}/cpu/arm/mmp2/irq.fth 229 fload ${BP}/cpu/arm/mmp2/timer.fth 230 fload ${BP}/cpu/arm/mmp2/twsi.fth 231 fload ${BP}/cpu/arm/mmp2/mfpr.fth 232 fload ${BP}/cpu/arm/mmp2/gpio.fth 233 232 234 \ Uninstall the diag menu from the general user interface vector 233 235 \ so exiting from emacs doesn't invoke the diag menu. -
cpu/arm/olpc/probemem.fth
r2726 r3049 57 57 h# 20 +loop \ h# 20 is L1 line size 58 58 59 h# 10000 0 do \ Loop over sets - h# 10000 is L2 #sets59 l2-#sets 0 do \ Loop over sets 60 60 0 0 do \ Loop over ways 61 61 i j + 2+ clean&flush-d$-entry-way \ Operate on L2 cache (2+) -
cpu/arm/olpc/rtc.fth
r3023 r3049 16 16 [ifdef] cl2-a1 17 17 : set-address ( -- ) 18 d# 97to smb-clock-gpio#19 d# 98to smb-data-gpio#18 rtc-scl-gpio# to smb-clock-gpio# 19 rtc-sda-gpio# to smb-data-gpio# 20 20 h# d0 to smb-slave 21 21 ; -
cpu/arm/olpc/sdhci.fth
r3040 r3049 18 18 : gpio-power-on ( -- ) 19 19 sdhci-card-power-on 20 \ The CL3 version below actually works for CL2 >= B1 21 \+ olpc-cl2 d# 36 slot - gpio-set 22 \+ olpc-cl3 slot 2 = if d# 34 gpio-set then 20 slot 2 = if en-wlan-pwr-gpio# gpio-set then 23 21 ; 24 22 ' gpio-power-on to card-power-on 25 23 26 24 : gpio-power-off ( -- ) 27 \+ olpc-cl2 d# 36 slot - gpio-clr 28 \+ olpc-cl3 slot 2 = if d# 34 gpio-clr then 25 slot 2 = if en-wlan-pwr-gpio# gpio-clr then 29 26 sdhci-card-power-off 30 27 ; 31 28 ' gpio-power-off to card-power-off 32 33 \+ olpc-cl2 new-device34 \+ olpc-cl2 1 encode-int " reg" property35 \+ olpc-cl2 fload ${BP}/dev/mmc/sdhci/sdmmc.fth36 \+ olpc-cl2 fload ${BP}/dev/mmc/sdhci/selftest.fth37 \+ olpc-cl2 " external" " slot-name" string-property38 \+ olpc-cl2 finish-device39 29 40 30 new-device -
cpu/arm/olpc/sound.fth
r3023 r3049 228 228 229 229 \ Reset is unconnected on current boards 230 \ : audio-reset ( -- ) 8gpio-clr ;231 \ : audio-unreset ( -- ) 8gpio-set ;230 \ : audio-reset ( -- ) audio-reset-gpio# gpio-clr ; 231 \ : audio-unreset ( -- ) audio-reset-gpio# gpio-set ; 232 232 : codec@ ( reg# -- w ) choose-smbus 1 2 twsi-get swap bwjoin ; 233 233 : codec! ( w reg# -- ) choose-smbus >r wbsplit r> 3 twsi-out ; … … 441 441 : watch-dc ( bias? -- ) 442 442 to mic-bias? 443 d# 143gpio-set \ DC input mode443 mic-ac/dc-gpio# gpio-set \ DC input mode 444 444 h# 0400 h# 40 codec-clr 445 445 open-in -
cpu/x86/pc/olpc/sound.fth
r2753 r3049 55 55 ; 56 56 57 [ifndef] olpc-cl357 [ifndef] use-screen-kbd 58 58 dev /keyboard 59 59 0 value waiting-up? -
dev/olpc/dcon/mmp2dcon.fth
r2726 r3049 52 52 53 53 : set-dcon-slave ( -- ) 54 [ifdef] cl2-a1 55 d# 162 to smb-clock-gpio# 56 d# 163 to smb-data-gpio# 57 [else] 58 d# 161 to smb-clock-gpio# 59 d# 110 to smb-data-gpio# 60 [then] 54 dcon-scl-gpio# to smb-clock-gpio# 55 dcon-sda-gpio# to smb-data-gpio# 56 61 57 h# 1a to smb-slave 62 58 ; … … 67 63 : dcon! ( word reg# -- ) set-dcon-slave smb-word! ; 68 64 69 [ifdef] cl2-a1 70 : dcon-load ( -- ) d# 151 gpio-set ; 71 : dcon-unload ( -- ) d# 151 gpio-clr ; 72 [else] 73 : dcon-load ( -- ) d# 142 gpio-set ; 74 : dcon-unload ( -- ) d# 142 gpio-clr ; 75 [then] 65 : dcon-load ( -- ) dcon-load-gpio# gpio-set ; 66 : dcon-unload ( -- ) dcon-load-gpio# gpio-clr ; 67 76 68 \ : dcon-blnk? ( -- flag ) ; \ Not hooked up 77 : dcon-stat@ ( -- n ) h# 019100 io@ 4 rshift 3 and ; 78 : setup-dcon-irq ( -- ) d # 124dup gpio-set-fer gpio-clr-edge ;79 : dcon-irq? ( -- flag ) d # 124gpio-edge@ ;69 : dcon-stat@ ( -- n ) h# 019100 io@ 4 rshift 3 and ; \ GPIO 100..101 70 : setup-dcon-irq ( -- ) dcon-irq-gpio# dup gpio-set-fer gpio-clr-edge ; 71 : dcon-irq? ( -- flag ) dcon-irq-gpio# gpio-edge@ ; 80 72 81 73 \ DCONSTAT values: 0 SCANINT 1 SCANINT_DCON 2 DISPLAYLOAD 3 MISSED … … 152 144 : timeout! ( to -- ) 8 dcon! ; \ def: h# ffff 153 145 : scanint! ( si -- ) 9 dcon! ; \ def: h# 0000 154 : bright! ( level -- ) d# 10 dcon! ; \ def: h# xxxF 146 : dcon-bright! ( level -- ) d# 10 dcon! ; \ def: h# xxxF 147 ' dcon-bright! to bright! 155 148 : bright@ ( -- level ) d# 10 dcon@ ; 156 149 : brighter ( -- ) bright@ 1+ h# f min bright! ; 157 150 : dimmer ( -- ) bright@ 1- 0 max bright! ; 158 151 159 : backlight-off ( -- ) mode@ 8 invert and mode! ; 160 : backlight-on ( -- ) mode@ 8 or mode! ; 152 : dcon-backlight-off ( -- ) mode@ 8 invert and mode! ; 153 ' dcon-backlight-off to backlight-off 154 : dcon-backlight-on ( -- ) mode@ 8 or mode! ; 155 ' dcon-backlight-on to backlight-on 161 156 162 157 \ Color swizzle, AA, no passthrough, backlight … … 220 215 : maybe-set-cmos ( -- ) ; 221 216 222 : init- xo-display( -- )217 : init-dcon ( -- ) 223 218 smb-init 224 219 … … 227 222 \ dcon-enable leaves mode set to 69 - 40:antialias, 20:swizzle, 8:backlight on, 1:passthru off 228 223 ; 224 ' init-dcon to init-panel 225 229 226 : dcon-power-on ( -- ) 1 h# 26 ec-cmd-b! ; 230 227 : dcon-power-off ( -- ) 0 h# 26 ec-cmd-b! ; -
dev/olpc/kb3700/spicmd.fth
r3023 r3049 43 43 : decode-unit ( adr len -- phys ) push-hex $number if 0 then pop-base ; 44 44 45 d# 155 constant cmd-gpio#46 d# 125 constant ack-gpio#47 48 45 \ Channel#(port#) Meaning 49 46 \ 0 Invalid … … 162 159 \ Set the direction on the ACK and CMD GPIOs 163 160 : init-gpios ( -- ) 164 cmd-gpio# gpio-dir-out165 ack-gpio# gpio-dir-out166 ; 167 : clr-cmd ( -- ) cmd-gpio# gpio-clr ;168 : set-cmd ( -- ) cmd-gpio# gpio-set ;169 : clr-ack ( -- ) ack-gpio# gpio-clr ;170 : set-ack ( -- ) ack-gpio# gpio-set ;161 ec-spi-cmd-gpio# gpio-dir-out 162 ec-spi-ack-gpio# gpio-dir-out 163 ; 164 : clr-cmd ( -- ) ec-spi-cmd-gpio# gpio-clr ; 165 : set-cmd ( -- ) ec-spi-cmd-gpio# gpio-set ; 166 : clr-ack ( -- ) ec-spi-ack-gpio# gpio-clr ; 167 : set-ack ( -- ) ec-spi-ack-gpio# gpio-set ; 171 168 : fast-ack ( -- ) set-ack clr-ack debug? if ." ACK " cr then ; 172 169 : slow-ack ( -- ) d# 10 ms set-ack d# 10 ms clr-ack ; -
dev/olpc/mmp2camera/platform.fth
r2880 r3049 8 8 : camera-smb-setup ( -- ) 9 9 1 to smb-dly-us 10 \+ olpc-cl2 d# 108 to smb-clock-gpio# 11 \+ olpc-cl2 d# 109 to smb-data-gpio# 12 \+ olpc-cl3 d# 4 to smb-clock-gpio# 13 \+ olpc-cl3 d# 5 to smb-data-gpio# 10 cam-scl-gpio# to smb-clock-gpio# 11 cam-sda-gpio# to smb-data-gpio# 14 12 camera-smb-slave to smb-slave 15 13 ; … … 19 17 20 18 : reset-sensor ( -- ) 21 \+ olpc-cl3 d# 10 gpio-clr 1 ms d# 10 gpio-set 22 \+ olpc-cl2 d# 102 gpio-clr 1 ms d# 102 gpio-set 19 cam-rst-gpio# gpio-clr 1 ms cam-rst-gpio# gpio-set 23 20 ; 24 21 25 [ifdef] cl2-a126 : sensor-power-on ( -- ) d# 145 gpio-set ;27 : sensor-power-off ( -- ) d# 145 gpio-clr ;28 [else]29 22 : sensor-power-on ( -- ) 30 d# 150 gpio-set 31 \+ olpc-cl2 d# 144 gpio-clr 32 \+ olpc-cl3 d# 9 gpio-clr 23 cam-pwr-gpio# gpio-set 24 cam-pwrdn-gpio# gpio-clr 33 25 ; 34 : sensor-power-off ( -- ) ( d# 144 gpio-set ) d# 150 gpio-clr ; \ Leave low for Linux 26 : sensor-power-off ( -- ) 27 ( cam-pwrdn-gpio# gpio-set ) \ Leave low for Linux 28 cam-pwr-gpio# gpio-clr 29 ; 35 30 [then] 36 31 -
dev/olpc/spiflash/spiui.fth
r2705 r3049 75 75 ." Got firmware version: " 76 76 flash-buf h# f.ffc0 + dup h# 10 type cr ( adr ) 77 machine-signature countcomp abort" Wrong machine signature"77 signature$ comp abort" Wrong machine signature" 78 78 79 79 ?crc … … 291 291 dup /flash <> abort" Wrong image length" ( adr len ) 292 292 2dup + h# 40 - ( adr len signature-adr ) 293 machine-signature countcomp abort" Wrong machine signature"293 signature$ comp abort" Wrong machine signature" 294 294 ( adr len signature-adr ) 295 295 ." Firmware: " h# 10 type ( adr len )
Note: See TracChangeset
for help on using the changeset viewer.
